select * from ActType
select * from ActList
select * from SyncState
select * from MesPODL_last
select * from MesPODL_req

select * from MachineFluxLog
select * from MachineProdData
select * from MachineSignalLog


-- test scrittura PODL: OK!
exec dbo.SyncPodlToMachine

exec dbo.GetMachineSigLog
select * from SyncState
select * from MachineSignalLog

/*
truncate table MachineFluxLog
update SyncState 
set lastidx=0
where TableName='ToMachineFluxLog'
*/

select top 2 * from MachineFluxLog order by 1 desc
select top 2 * from MachineProdData order by 1 desc
select top 10 * from MachineSignalLog order by 1 desc
select * from SyncState

exec dbo.GetMachineFluxLog
select * from MachineFluxLog

select * from syn_ERP2M
select * from syn_M2ERP_MACHINE_STATE
select * from syn_M2ERP_PRODORDERS


select top 10 * from syn_M2ERP_PRODORDERS 
where ProdOrder LIKE 'PODL000%'


select top 10 * from syn_M2ERP_PRODORDERS 
where ProdOrder LIKE '%ODL%'
order by 1 desc

EXEC GetMachineProdData
SELECT * FROM SyncState
SELECT * FROM MachineFluxLog
SELECT * FROM MachineProdData
SELECT * FROM MachineSignalLog


/*
truncate table MachineProdData
update SyncState 
set lastidx=0
where TableName='ToMachineProdData'
*/

select * from ActType



/*

drop table __MigrationHistory
drop table ActList
drop table ActType
drop table MachineEventList
drop table MachineFluxLog
drop table MachinePODL
drop table MesPODL_last
drop table MesPODL_req
drop table SyncState

drop PROCEDURE dbo.BackupDb
drop PROCEDURE dbo.ExportAll
drop PROCEDURE dbo.GetMachineEvList
drop PROCEDURE dbo.GetMachineFluxLog
drop PROCEDURE dbo.ImportAll
drop PROCEDURE dbo.ResetPodlMes
drop PROCEDURE dbo.SyncPodlToMachine

*/





select * from ERP2M

select * from M2ERP_MACHINE_STATE where ActiveProdOrder = 'ODL0003743'
select * from M2ERP_PRODORDERS

select * from M2ERP_PRODORDERS where ProdOrder = 'ODL0003743'


