[ROSSOGARGANO - Piano accettazione]

Gestione calibri e stampe etichette
This commit is contained in:
2024-05-29 12:31:19 +02:00
parent ebb9db1b92
commit 067c7c24fc
9 changed files with 755 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.migration._base.MigrationModelInterface;
import it.integry.ems_model.entity.JtbFasi;
public class Migration_20240527192333 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String codMsgrPom = null;
String codMsgrCarc = null;
if (isCustomer(IntegryCustomer.RossoGargano)) {
codMsgrPom = "01";
codMsgrCarc = "02";
}
createSetup("PVM","PIAN_ACC_ROSSG","COD_MSGR_POM",codMsgrPom,"Codice sottogruppo merceologico per i pomodori",null);
createSetup("PVM","PIAN_ACC_ROSSG","COD_MSGR_CARC",codMsgrCarc,"Codice sottogruppo merceologico per i carciofi",null);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,74 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20240528101717 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
String val = "N";
if (isCustomer(IntegryCustomer.RossoGargano)) {
val = "S";
createOrUpdateFunction("f_suggestCodePartitaMag", "CREATE FUNCTION [dbo].[f_suggestCodePartitaMag](@partialCode VARCHAR(1024), @codLen INT)\n" +
" RETURNS VARCHAR(20)\n" +
"AS\n" +
"BEGIN\n" +
" DECLARE @partitaMag VARCHAR(20);\n" +
" DECLARE @codMdep VARCHAR(20);\n" +
" DECLARE @dataProd DATETIME;\n" +
" DECLARE @idProduttore VARCHAR(10);\n" +
" DECLARE @idLottoLav VARCHAR(5);\n" +
" DECLARE @numOrd INT;\n" +
" DECLARE @gestione VARCHAR;\n" +
"-- Parse parametri\n" +
" SELECT @partitaMag = partita_mag, @dataProd = data_ord, @numOrd = num_ord, @gestione = gestione\n" +
" FROM DBO.parseParmSuggestPartitaMag(@partialCode);\n" +
"-- SELECT deposito da ordine (per codice produttore)\n" +
" SELECT @codMdep = cod_mdep\n" +
" FROM dtb_ordt\n" +
" WHERE data_ord = @dataProd\n" +
" AND num_ord = CAST(@numOrd AS INT)\n" +
" AND gestione = @gestione;\n" +
"-- SELECT ID produttore da setup per deposito\n" +
" SELECT @idProduttore = ISNULL(stb_gest_setup_depo.value, stb_gest_setup.value)\n" +
" FROM stb_gest_setup\n" +
" LEFT OUTER JOIN stb_gest_setup_depo ON stb_gest_setup.gest_name = stb_gest_setup_depo.gest_name AND\n" +
" stb_gest_setup.section = stb_gest_setup_depo.section AND\n" +
" stb_gest_setup.key_section = stb_gest_setup_depo.key_section\n" +
" AND stb_gest_setup_depo.cod_mdep = @codMdep\n" +
" WHERE stb_gest_setup.gest_name = 'DATI_AZIENDA'\n" +
" AND stb_gest_setup.section = 'SETUP'\n" +
" AND stb_gest_setup.key_section = 'COD_PRODUTTORE';\n" +
"-- SELECT id produzione annuo\n" +
" SELECT @idLottoLav = id_lotto_lav FROM gtb_anni_divi WHERE anno = YEAR(@dataProd)\n" +
"\n" +
" BEGIN\n" +
" SELECT @partitaMag =\n" +
" CASE\n" +
" WHEN @partitaMag IS NOT NULL THEN @partitaMag + '-' +\n" +
" CONVERT(VARCHAR(3), FORMAT(DATEPART(DAYOFYEAR, @dataProd), 'D3'))\n" +
" WHEN @idProduttore IS NOT NULL THEN\n" +
" @idProduttore + @idLottoLav + CONVERT(VARCHAR(3), FORMAT(DATEPART(DAYOFYEAR, @dataProd), 'D3'))\n" +
" ELSE\n" +
" @partitaMag + '-' + CONVERT(VARCHAR(3), FORMAT(DATEPART(DAYOFYEAR, @dataProd), 'D3'))\n" +
" END\n" +
" END\n" +
" RETURN @partitaMag;\n" +
"END");
}
createSetup("PVM","PIAN_ACC_ROSSG","NUM_DOC_AS_BARCODE",val,"Se impostata crea il barcodeUl usanto il formato yynnnnnn dove n = numero documento","SI_NO");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,30 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20240528180648 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("UPDATE azienda set progressivo_sscc = 300000000");
String value = null;
if (isCustomer(IntegryCustomer.RossoGargano))
value = "EtichettaCalibro";
createSetup("PVM","PIAN_ACC_ROSSG","REPORT_NAME_ETICH_CARC_CALIBR",value,"Report name etichette carciofi calibrati",null);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -403,7 +403,7 @@ rule "completeBarcodeUl"
no-loop
when
eval(completeRulesEnabled)
$mtbColt: MtbColt(barcodeUl == null && gestione == "L" && segno == 1 && numCollo != null && (operation == OperationType.INSERT || operation == OperationType.INSERT_OR_UPDATE) )
$mtbColt: MtbColt(barcodeUl == null && numCollo != null && (operation == OperationType.INSERT || operation == OperationType.INSERT_OR_UPDATE) )
then
String barcode = PackagesRules.completeBarcodeUl(conn, $mtbColt.getGestione(), $mtbColt.getDataCollo(), $mtbColt.getSerCollo(), $mtbColt.getNumCollo(), $mtbColt.getCodJfas());

View File

@@ -0,0 +1,120 @@
package it.integry.core.report_javabean.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.integry.core.report_javabean.UtilityReportJavabean;
import it.integry.core.report_javabean.model.base.BaseReportJavabean;
import it.integry.core.report_javabean.model.base.IReportJavabean;
import it.integry.core.report_javabean.model.exception.NoPageProcessedException;
import it.integry.ems.order.dto.EtichettaCalibriFieldsDTO;
import it.integry.ems.order.dto.EtichettaCalibriParamsDTO;
import it.integry.ems.report.dto.JasperDTO;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Component
public class StampaEtichetteCarciofiCalibratiJavabean extends BaseReportJavabean implements IReportJavabean {
@PostConstruct
public void register() {
UtilityReportJavabean.registerJavabean("EtichettaCalibriRossoGargano", StampaEtichetteCarciofiCalibratiJavabean.class);
}
@Override
public byte[] process(JasperDTO jasperDTO) throws Exception {
HashMap<String, Object> paramsMap = reportProcessor.createParamsFromList(jasperDTO.getParams());
// if (paramsMap.containsKey("params")) {
// for (Object params : (ArrayList) paramsMap.get("params")) {
// ObjectMapper mapper = new ObjectMapper();
// param = mapper.convertValue(params, EtichettaCalibriParamsDTO.class);
// }
// } else {
ObjectMapper mapper = new ObjectMapper();
EtichettaCalibriParamsDTO param = mapper.convertValue(paramsMap, EtichettaCalibriParamsDTO.class);
// }
// param.setIDAttachmentLogo((String) paramsMap.get("IDAttachmentLogo"));
List<Object> javaBeans = this.run(param);
if (javaBeans != null) {
jasperDTO.setJavaBeans(javaBeans);
return reportProcessor.processReport(jasperDTO);
}
throw new NoPageProcessedException();
}
public List<Object> run(EtichettaCalibriParamsDTO dto) throws Exception {
List<Object> listEtichette = new ArrayList<>();
String sql;
EtichettaCalibriFieldsDTO baseJavaBean = new EtichettaCalibriFieldsDTO();
baseJavaBean.setBarcode_ul(dto.getBarcodeUl())
.setSscc(dto.getBarcodeUl())
.setNome_ditta(dto.getRagSoc())
.setGestione(dto.getGestione())
.setData_collo(dto.getDataCollo())
.setSer_collo(dto.getSerCollo())
.setNum_collo(dto.getNumCollo())
.setNum_doc(dto.getNumDocProvv())
.setProduttore(dto.getRagSocProduttore())
.setProdotto(dto.getDescrizione())
.setUnt_mis(dto.getUntMis())
.setLotto(dto.getPartitaMag())
.setQta(dto.getQtaCol())
.setPesomediocnf(dto.getQtaCnf())
.setNumcnf(dto.getNumCnf().intValue())
.setDataorains(new Timestamp(dto.getDataVers().getTime()))
.setRow_number(0)
.setRow_total(0)
;
if (dto.getCalibro60() > 0) {
for (int i = 0; i < dto.getCalibro60(); i++) {
EtichettaCalibriFieldsDTO javaBean = baseJavaBean.clone();
javaBean.setRow_number(i+1)
.setRow_total(dto.getCalibro60())
.setCalibro(60);
listEtichette.add(javaBean);
}
}
if (dto.getCalibro70() > 0) {
for (int i = 0; i < dto.getCalibro70(); i++) {
EtichettaCalibriFieldsDTO javaBean = baseJavaBean.clone();
javaBean.setRow_number(i+1)
.setRow_total(dto.getCalibro70())
.setCalibro(70);
listEtichette.add(javaBean);
}
}
if (dto.getCalibro80() > 0) {
for (int i = 0; i < dto.getCalibro80(); i++) {
EtichettaCalibriFieldsDTO javaBean = baseJavaBean.clone();
javaBean.setRow_number(i+1)
.setRow_total(dto.getCalibro80())
.setCalibro(80);
listEtichette.add(javaBean);
}
}
if (dto.getCalibro90() > 0) {
for (int i = 0; i < dto.getCalibro90(); i++) {
EtichettaCalibriFieldsDTO javaBean = baseJavaBean.clone();
javaBean.setRow_number(i+1)
.setRow_total(dto.getCalibro90())
.setCalibro(90);
listEtichette.add(javaBean);
}
}
return listEtichette;
}
}

View File

@@ -38,7 +38,7 @@ public class EmsEngineService {
public byte[] processReport(JasperDTO jasperDTO) throws Exception {
byte[] bytes = null;
String javabeanSourceName = this.getJavabeanSourceName(jasperDTO);
if (javabeanSourceName != null) {
if (!UtilityString.isNullOrEmpty(javabeanSourceName)) {
bytes = this.processJavabean(jasperDTO);
} else {
bytes = reportProcessor.processReport(jasperDTO);

View File

@@ -0,0 +1,207 @@
package it.integry.ems.order.dto;
import java.math.BigDecimal;
import java.util.Date;
import java.sql.Timestamp;
public class EtichettaCalibriFieldsDTO implements Cloneable {
private String nome_ditta;
private String gestione;
private Date data_collo;
private String ser_collo;
private Integer num_collo;
private Integer num_doc;
private String produttore;
private String prodotto;
private String unt_mis;
private String sscc;
private String lotto;
private BigDecimal qta;
private String barcode_ul;
private BigDecimal pesomediocnf;
private Integer numcnf;
private Timestamp dataorains;
private Integer row_number;
private Integer row_total;
private Integer calibro;
public String getNome_ditta() {
return nome_ditta;
}
public EtichettaCalibriFieldsDTO setNome_ditta(String nome_ditta) {
this.nome_ditta = nome_ditta;
return this;
}
public String getGestione() {
return gestione;
}
public EtichettaCalibriFieldsDTO setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public Date getData_collo() {
return data_collo;
}
public EtichettaCalibriFieldsDTO setData_collo(Date data_collo) {
this.data_collo = data_collo;
return this;
}
public String getSer_collo() {
return ser_collo;
}
public EtichettaCalibriFieldsDTO setSer_collo(String ser_collo) {
this.ser_collo = ser_collo;
return this;
}
public Integer getNum_collo() {
return num_collo;
}
public EtichettaCalibriFieldsDTO setNum_collo(Integer num_collo) {
this.num_collo = num_collo;
return this;
}
public Integer getNum_doc() {
return num_doc;
}
public EtichettaCalibriFieldsDTO setNum_doc(Integer num_doc) {
this.num_doc = num_doc;
return this;
}
public String getProduttore() {
return produttore;
}
public EtichettaCalibriFieldsDTO setProduttore(String produttore) {
this.produttore = produttore;
return this;
}
public String getProdotto() {
return prodotto;
}
public EtichettaCalibriFieldsDTO setProdotto(String prodotto) {
this.prodotto = prodotto;
return this;
}
public String getUnt_mis() {
return unt_mis;
}
public EtichettaCalibriFieldsDTO setUnt_mis(String unt_mis) {
this.unt_mis = unt_mis;
return this;
}
public String getSscc() {
return sscc;
}
public EtichettaCalibriFieldsDTO setSscc(String sscc) {
this.sscc = sscc;
return this;
}
public String getLotto() {
return lotto;
}
public EtichettaCalibriFieldsDTO setLotto(String lotto) {
this.lotto = lotto;
return this;
}
public BigDecimal getQta() {
return qta;
}
public EtichettaCalibriFieldsDTO setQta(BigDecimal qta) {
this.qta = qta;
return this;
}
public String getBarcode_ul() {
return barcode_ul;
}
public EtichettaCalibriFieldsDTO setBarcode_ul(String barcode_ul) {
this.barcode_ul = barcode_ul;
return this;
}
public BigDecimal getPesomediocnf() {
return pesomediocnf;
}
public EtichettaCalibriFieldsDTO setPesomediocnf(BigDecimal pesomediocnf) {
this.pesomediocnf = pesomediocnf;
return this;
}
public Integer getNumcnf() {
return numcnf;
}
public EtichettaCalibriFieldsDTO setNumcnf(Integer numcnf) {
this.numcnf = numcnf;
return this;
}
public Timestamp getDataorains() {
return dataorains;
}
public EtichettaCalibriFieldsDTO setDataorains(Timestamp dataorains) {
this.dataorains = dataorains;
return this;
}
public Integer getRow_number() {
return row_number;
}
public EtichettaCalibriFieldsDTO setRow_number(Integer row_number) {
this.row_number = row_number;
return this;
}
public Integer getRow_total() {
return row_total;
}
public EtichettaCalibriFieldsDTO setRow_total(Integer row_total) {
this.row_total = row_total;
return this;
}
public Integer getCalibro() {
return calibro;
}
public EtichettaCalibriFieldsDTO setCalibro(Integer calibro) {
this.calibro = calibro;
return this;
}
@Override
public EtichettaCalibriFieldsDTO clone() {
try {
return (EtichettaCalibriFieldsDTO) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
}
}

View File

@@ -0,0 +1,285 @@
package it.integry.ems.order.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.math.BigDecimal;
import java.util.Date;
public class EtichettaCalibriParamsDTO {
private Date dataCollo;
private String gestione;
private Integer numCollo;
private String serCollo;
private Date dataVers;
private String codJfas;
private Date dataOrd;
private Integer numOrd;
private String codMart;
private String descrizione;
private String untMis;
private String partitaMag;
private BigDecimal qtaCol;
private BigDecimal numCnf;
private BigDecimal qtaCnf;
private String codAnagProduttore;
private String ragSocProduttore;
private String ragSoc;
private Integer calibro60;
private Integer calibro70;
private Integer calibro80;
private Integer calibro90;
private String idAttachmentLogo;
private String activityId;
private String jbeansource;
private String barcodeUl;
private Integer numDocProvv;
public Date getDataCollo() {
return dataCollo;
}
public EtichettaCalibriParamsDTO setDataCollo(Date dataCollo) {
this.dataCollo = dataCollo;
return this;
}
public String getGestione() {
return gestione;
}
public EtichettaCalibriParamsDTO setGestione(String gestione) {
this.gestione = gestione;
return this;
}
public Integer getNumCollo() {
return numCollo;
}
public EtichettaCalibriParamsDTO setNumCollo(Integer numCollo) {
this.numCollo = numCollo;
return this;
}
public String getSerCollo() {
return serCollo;
}
public EtichettaCalibriParamsDTO setSerCollo(String serCollo) {
this.serCollo = serCollo;
return this;
}
public Date getDataVers() {
return dataVers;
}
public EtichettaCalibriParamsDTO setDataVers(Date dataVers) {
this.dataVers = dataVers;
return this;
}
public String getCodJfas() {
return codJfas;
}
public EtichettaCalibriParamsDTO setCodJfas(String codJfas) {
this.codJfas = codJfas;
return this;
}
public Date getDataOrd() {
return dataOrd;
}
public EtichettaCalibriParamsDTO setDataOrd(Date dataOrd) {
this.dataOrd = dataOrd;
return this;
}
public Integer getNumOrd() {
return numOrd;
}
public EtichettaCalibriParamsDTO setNumOrd(Integer numOrd) {
this.numOrd = numOrd;
return this;
}
public String getCodMart() {
return codMart;
}
public EtichettaCalibriParamsDTO setCodMart(String codMart) {
this.codMart = codMart;
return this;
}
public String getDescrizione() {
return descrizione;
}
public EtichettaCalibriParamsDTO setDescrizione(String descrizione) {
this.descrizione = descrizione;
return this;
}
public String getUntMis() {
return untMis;
}
public EtichettaCalibriParamsDTO setUntMis(String untMis) {
this.untMis = untMis;
return this;
}
public String getPartitaMag() {
return partitaMag;
}
public EtichettaCalibriParamsDTO setPartitaMag(String partitaMag) {
this.partitaMag = partitaMag;
return this;
}
public BigDecimal getQtaCol() {
return qtaCol;
}
public EtichettaCalibriParamsDTO setQtaCol(BigDecimal qtaCol) {
this.qtaCol = qtaCol;
return this;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public EtichettaCalibriParamsDTO setNumCnf(BigDecimal numCnf) {
this.numCnf = numCnf;
return this;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public EtichettaCalibriParamsDTO setQtaCnf(BigDecimal qtaCnf) {
this.qtaCnf = qtaCnf;
return this;
}
public String getCodAnagProduttore() {
return codAnagProduttore;
}
public EtichettaCalibriParamsDTO setCodAnagProduttore(String codAnagProduttore) {
this.codAnagProduttore = codAnagProduttore;
return this;
}
public String getRagSocProduttore() {
return ragSocProduttore;
}
public EtichettaCalibriParamsDTO setRagSocProduttore(String ragSocProduttore) {
this.ragSocProduttore = ragSocProduttore;
return this;
}
public Integer getCalibro60() {
return calibro60;
}
public EtichettaCalibriParamsDTO setCalibro60(Integer calibro60) {
this.calibro60 = calibro60;
return this;
}
public Integer getCalibro70() {
return calibro70;
}
public EtichettaCalibriParamsDTO setCalibro70(Integer calibro70) {
this.calibro70 = calibro70;
return this;
}
public Integer getCalibro80() {
return calibro80;
}
public EtichettaCalibriParamsDTO setCalibro80(Integer calibro80) {
this.calibro80 = calibro80;
return this;
}
public Integer getCalibro90() {
return calibro90;
}
public EtichettaCalibriParamsDTO setCalibro90(Integer calibro90) {
this.calibro90 = calibro90;
return this;
}
public String getIdAttachmentLogo() {
return idAttachmentLogo;
}
public EtichettaCalibriParamsDTO setIdAttachmentLogo(String idAttachmentLogo) {
this.idAttachmentLogo = idAttachmentLogo;
return this;
}
public String getActivityId() {
return activityId;
}
public EtichettaCalibriParamsDTO setActivityId(String activityId) {
this.activityId = activityId;
return this;
}
public String getJbeansource() {
return jbeansource;
}
public EtichettaCalibriParamsDTO setJbeansource(String jbeansource) {
this.jbeansource = jbeansource;
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
public EtichettaCalibriParamsDTO setBarcodeUl(String barcodeUl) {
this.barcodeUl = barcodeUl;
return this;
}
public Integer getNumDocProvv() {
return numDocProvv;
}
public EtichettaCalibriParamsDTO setNumDocProvv(Integer numDocProvv) {
this.numDocProvv = numDocProvv;
return this;
}
public String getRagSoc() {
return ragSoc;
}
public EtichettaCalibriParamsDTO setRagSoc(String ragSoc) {
this.ragSoc = ragSoc;
return this;
}
}

View File

@@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -198,6 +199,11 @@ public class OrtoFruttaProductionService {
.setPesoNettoKg(BigDecimal.ZERO)
.setOperation(OperationType.INSERT_OR_UPDATE);
if (setupGest.getSetupBoolean("PVM","PIAN_ACC_ROSSG","NUM_DOC_AS_BARCODE")){
SimpleDateFormat dateFormat = new SimpleDateFormat("yy");
collo.setBarcodeUl(dateFormat.format(UtilityLocalDate.localDateToDate(collo.getDataCollo())) + String.format("%06d", docLav.getNumDoc()));
}
collo.setOraInizPrep(UtilityLocalDate.localDateTimeToDate(dto.getOraInizPrep(), null));
if (!UtilityBigDecimal.isNullOrZero(dto.getQtaCol()))