[BIOLEVANTE - EUROFORK]
- aggiornata gestione missioni
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.CtbAmac;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
|
||||
public class Migration_20251106114932 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.Biolevante_Biolevante)){
|
||||
CtbAmac eurofork = new CtbAmac();
|
||||
eurofork.setCodCmac("MAG-WH1")
|
||||
.setDescrizione("MAGAZZINO AUTOMATICO EUROFORK L7")
|
||||
.setCodJfas("L7")
|
||||
.setPosizione("WH1C3")
|
||||
.setFlagAttivo(true)
|
||||
.setMachineType(CtbAmac.MachineType.SILOS_MACHINE.getValue())
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
eurofork.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class MissioniMagazzinoAutomaticoService {
|
||||
|
||||
String sqlRows = "SELECT * FROM " + MtbMissioneMagAutoDet.ENTITY +
|
||||
" WHERE parent_id = " + UtilityDB.valueToString(missionId) +
|
||||
" AND completed = 0 AND skipped = 0";
|
||||
" AND completed = 0 AND skipped = 0 and (started_at is NULL OR ended_at IS NOT NULL)";
|
||||
|
||||
final List<MtbMissioneMagAutoDet> mtbMissioneMagAutoDets = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sqlRows, MtbMissioneMagAutoDet.class);
|
||||
if (mtbMissioneMagAutoDets == null) return;
|
||||
@@ -347,7 +347,7 @@ public class MissioniMagazzinoAutomaticoService {
|
||||
|
||||
String sqlRows = "SELECT top 1 * FROM " + MtbMissioneMagAutoDet.ENTITY +
|
||||
" WHERE id = " + UtilityDB.valueToString(instructionId) +
|
||||
" AND completed = 0 AND skipped = 0";
|
||||
" AND completed = 0 AND skipped = 0 and (started_at is NULL OR ended_at IS NOT NULL)";
|
||||
|
||||
MtbMissioneMagAutoDet mtbMissioneMagAutoDet = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sqlRows, MtbMissioneMagAutoDet.class);
|
||||
if (mtbMissioneMagAutoDet == null) return;
|
||||
@@ -365,7 +365,7 @@ public class MissioniMagazzinoAutomaticoService {
|
||||
|
||||
String sqlTestate = "SELECT * FROM " + MtbMissioneMagAutoDet.ENTITY + " WHERE " +
|
||||
" id IN (" + UtilityQuery.concatLongFieldsWithSeparator(requestDTO.getInstructionsList(), ",") + ") " +
|
||||
" AND completed = 0 AND skipped = 0";
|
||||
" AND completed = 0 AND skipped = 0 and (started_at is NULL OR ended_at IS NOT NULL)";
|
||||
List<MtbMissioneMagAutoDet> istruzioniToUpdate = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sqlTestate, MtbMissioneMagAutoDet.class);
|
||||
|
||||
if (UtilityList.isNullOrEmpty(istruzioniToUpdate))
|
||||
|
||||
@@ -9,10 +9,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -54,4 +51,12 @@ public class ControlloGiacenzeController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getPosizioniAreaWithOccupazione")
|
||||
public ServiceRestResponse getPosizioniAreaWithOccupazione(HttpServletRequest request,
|
||||
@RequestParam(required = false) String codMdep,
|
||||
@RequestParam(required = false) String codArea) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(controlloGiacenzeService.getPosizioniAreaWithOccupazione(multiDBTransactionManager,codMdep,codArea));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package it.integry.ems.retail.pvmRetail.dto.pvm.controllo_giacenze;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class PosizioniAreaWithOccupazioneDTO {
|
||||
|
||||
@SqlField("posizione")
|
||||
private String posizione;
|
||||
@SqlField("desc_posizione")
|
||||
private String descPosizione;
|
||||
@SqlField("cod_area")
|
||||
private String codArea;
|
||||
@SqlField("desc_area")
|
||||
private String descArea;
|
||||
@SqlField("descrizione")
|
||||
private String descrizione;
|
||||
@SqlField("num_ul")
|
||||
private Integer numUl;
|
||||
@SqlField("posti_pallet")
|
||||
private Integer postiPallet;
|
||||
@SqlField("flag_silos_liquidi")
|
||||
private boolean flagSilosLiquidi;
|
||||
@SqlField("capacita")
|
||||
private BigDecimal capacita;
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setPosizione(String posizione) {
|
||||
this.posizione = posizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescPosizione() {
|
||||
return descPosizione;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setDescPosizione(String descPosizione) {
|
||||
this.descPosizione = descPosizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodArea() {
|
||||
return codArea;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setCodArea(String codArea) {
|
||||
this.codArea = codArea;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescArea() {
|
||||
return descArea;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setDescArea(String descArea) {
|
||||
this.descArea = descArea;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumUl() {
|
||||
return numUl;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setNumUl(Integer numUl) {
|
||||
this.numUl = numUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPostiPallet() {
|
||||
return postiPallet;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setPostiPallet(Integer postiPallet) {
|
||||
this.postiPallet = postiPallet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagSilosLiquidi() {
|
||||
return flagSilosLiquidi;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setFlagSilosLiquidi(boolean flagSilosLiquidi) {
|
||||
this.flagSilosLiquidi = flagSilosLiquidi;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getCapacita() {
|
||||
return capacita;
|
||||
}
|
||||
|
||||
public PosizioniAreaWithOccupazioneDTO setCapacita(BigDecimal capacita) {
|
||||
this.capacita = capacita;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package it.integry.ems.retail.pvmRetail.service;
|
||||
|
||||
import it.integry.ems.retail.pvmRetail.dto.pvm.controllo_giacenze.ArriviDepositoDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.pvm.controllo_giacenze.MovimentiDepositoDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.pvm.controllo_giacenze.PosizioniAreaWithOccupazioneDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.pvm.controllo_giacenze.UsciteDepositoDTO;
|
||||
import it.integry.ems.service.dto.production.OrdineLavorazioneDTO;
|
||||
import it.integry.ems.service.production.ProductionOrderDataHandlerService;
|
||||
@@ -41,7 +42,6 @@ public class ControlloGiacenzeService {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
private List<ArriviDepositoDTO> getOrdiniAcquistoDeposito(Connection connection, String codMdep) throws Exception {
|
||||
String sql =
|
||||
"DECLARE @today DATE;\n" +
|
||||
@@ -89,7 +89,7 @@ public class ControlloGiacenzeService {
|
||||
response.forEach(ordine -> {
|
||||
ordine.setCategoria(MovimentiDepositoDTO.CategoriaMovimento.ARRIVI_DA_ACQUISTO)
|
||||
.setKey(ordine.getCodAnag())
|
||||
.setLabel( ordine.getRagSoc());
|
||||
.setLabel(ordine.getRagSoc());
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ public class ControlloGiacenzeService {
|
||||
" where cod_mdep = " + UtilityDB.valueToString(codMdep) + "\n" +
|
||||
" and flag_annulla = 'N'\n" +
|
||||
" and flag_sospeso = 'N'\n" +
|
||||
" "+whereCond+"\n" +
|
||||
" " + whereCond + "\n" +
|
||||
")" +
|
||||
" SELECT CONCAT(DATEDIFF(SECOND, '1970-01-01', dtb_ordr.data_ord), '_', dtb_ordr.num_ord,'_',dtb_ordr.riga_ord) AS unique_id,\n" +
|
||||
" dtb_ordt.data_ord,\n" +
|
||||
@@ -192,7 +192,6 @@ public class ControlloGiacenzeService {
|
||||
" AND NOT EXISTS (SELECT * FROM mtb_tcol WHERE mtb_tcol.cod_mart = dtb_ordr.cod_mart)\n";
|
||||
|
||||
|
||||
|
||||
List<UsciteDepositoDTO> ordiniLav = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, UsciteDepositoDTO.class);
|
||||
if (UtilityList.isNullOrEmpty(ordiniLav))
|
||||
return new ArrayList<>();
|
||||
@@ -265,4 +264,34 @@ public class ControlloGiacenzeService {
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
public List<PosizioniAreaWithOccupazioneDTO> getPosizioniAreaWithOccupazione(MultiDBTransactionManager multiDBTransactionManager, String codMdep, String codArea) throws Exception {
|
||||
String sql = "SELECT mtb_depo_posizioni.posizione,\n" +
|
||||
" CONCAT(mtb_depo_posizioni.posizione, ' - ', mtb_depo_posizioni.descrizione) AS desc_posizione,\n" +
|
||||
" mda.cod_area,\n" +
|
||||
" mda.descrizione AS desc_area,\n" +
|
||||
" mtb_depo_posizioni.descrizione as descrizione,\n" +
|
||||
" COUNT(inv.barcode_ul) AS num_ul,\n" +
|
||||
" mtb_depo_posizioni.posti_pallet,\n" +
|
||||
" flag_silos_liquidi,\n" +
|
||||
" capacita\n" +
|
||||
"FROM mtb_depo_posizioni\n" +
|
||||
" LEFT OUTER JOIN mtb_depo_area mda\n" +
|
||||
" ON mtb_depo_posizioni.cod_mdep = mda.cod_mdep AND mtb_depo_posizioni.cod_area = mda.cod_area\n" +
|
||||
" LEFT OUTER JOIN jtb_fasi jf ON mtb_depo_posizioni.posizione = jf.cod_jfas\n" +
|
||||
" LEFT OUTER JOIN mvw_sitart_udc_det_inventario inv\n" +
|
||||
" ON inv.posizione = mtb_depo_posizioni.posizione AND inv.cod_mdep = mtb_depo_posizioni.cod_mdep\n" +
|
||||
"WHERE flag_silos_liquidi = 0\n" +
|
||||
" AND jf.cod_jfas IS NULL\n" +
|
||||
"GROUP BY mtb_depo_posizioni.posizione, mtb_depo_posizioni.descrizione,\n" +
|
||||
" mda.cod_area, mda.descrizione, mtb_depo_posizioni.posti_pallet, flag_silos_liquidi, capacita\n";
|
||||
if (!UtilityString.isNullOrEmpty(codMdep)){
|
||||
sql = UtilityDB.addwhereCond(sql,"mda.cod_mdep = "+UtilityDB.valueToString(codMdep),true);
|
||||
}
|
||||
if (!UtilityString.isNullOrEmpty(codArea)){
|
||||
sql = UtilityDB.addwhereCond(sql,"mda.cod_area = "+UtilityDB.valueToString(codArea),true);
|
||||
}
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PosizioniAreaWithOccupazioneDTO.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user