- gestione resetstep per Siemens

This commit is contained in:
Emmanuele Sassi
2023-11-28 09:56:46 +01:00
parent 113ad8bcf6
commit 19557d6e05
4 changed files with 45 additions and 18 deletions
@@ -247,6 +247,22 @@ Public Class SIEMENSSharp7Comm
Return Result = 0
End Function
Friend Sub ResetStep(bReset As Boolean)
Dim ResetStep As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList(19) ' Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STEP)
If bReset Then
ResetStep.sValue = 1
Threading.Thread.Sleep(100)
Dim nResetStepOk As Integer = 0
Dim ResetStepOk As Variable = Map.refMachCommandMessagePanelVM.MainVariablesList.FirstOrDefault(Function(x) x.sName = RESET_STEP_OK)
While nResetStepOk <> 1
RefreshAllVars()
Integer.TryParse(ResetStepOk.sValue, nResetStepOk)
Threading.Thread.Sleep(1000)
End While
End If
ResetStep.sValue = 0
End Sub
End Class
Friend Class DBBuffer
@@ -61,6 +61,10 @@ Module ConstCommVar
Public Const RESETREADED As String = "Reset_Readed"
' variabile per confermare lettura stato reset
Public Const DATATOREAD As String = "Data_ToRead"
' variabile per confermare lettura stato reset
Public Const RESET_STEP As String = "Reset_Step"
' variabile per confermare lettura stato reset
Public Const RESET_STEP_OK As String = "Reset_Step_Ok"
Public Enum OPStates
Start = 1
@@ -229,23 +229,25 @@ Public Class MyMachGroupVM
Dim bRedo As MessageBoxResult = MessageBox.Show(EgtMsg(62509), "", MessageBoxButton.YesNo, MessageBoxImage.Information)
Select Case bRedo
Case MessageBoxResult.Yes
' segno da rifare pezzi non completamente lavorati
For Each Part As PartVM In PartVMList
If Part.dtEndTime <> DateTime.MinValue Then
Part.bDO = False
Else
Part.SetDo(True)
End If
'Part.bDO = (Part.dtEndTime = DateTime.MinValue)
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
Next
' se ripresa, mostro lista feature e colonne Redo
Map.refLeftPanelVM.bRestart = True
' blocco produzione di tutti gli altri
MyMachGroupVM.UpdateProduceIsEnabledForAll()
' riabilito bottoni di comunicazione a fine invio programma
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
Return
If CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7 Then
' segno da rifare pezzi non completamente lavorati
For Each Part As PartVM In PartVMList
If Part.dtEndTime <> DateTime.MinValue Then
Part.bDO = False
Else
Part.SetDo(True)
End If
'Part.bDO = (Part.dtEndTime = DateTime.MinValue)
'Part.NotifyPropertyChanged(NameOf(Part.bRedo))
Next
' se ripresa, mostro lista feature e colonne Redo
Map.refLeftPanelVM.bRestart = True
' blocco produzione di tutti gli altri
MyMachGroupVM.UpdateProduceIsEnabledForAll()
' riabilito bottoni di comunicazione a fine invio programma
Map.refMachCommandMessagePanelVM.SetCommBtnIsEnabled(True)
Return
End If
Case MessageBoxResult.No
' annullo stati dei pezzi gia' fatti
For Each Part In PartVMList
@@ -840,7 +840,7 @@ Public Class MachManaging
SyncLock m_Lock_SendProgram
For Each MyMachGroup As MyMachGroupVM In Map.refProjectVM.SupervisorMachGroupPanelVM.MachGroupVMList
' EgtOutLog("Ciclo su name: " & MyMachGroup.Name & " id: " & MyMachGroup.Id)
If Not MyMachGroup.bSentToMachine AndAlso (MyMachGroup.dtStartTime = DateTime.MinValue OrElse
If Not MyMachGroup.bSentToMachine AndAlso (If(CurrentMachine.NCType <> NCTypes.SIEMENS_SHARP7, MyMachGroup.dtStartTime = DateTime.MinValue, True) OrElse
(Map.refSupervisorManagerVM.CurrProd.nType = BWType.WALL AndAlso MyMachGroup.bResetWhileCutting)) Then
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " è da fare")
' verifico se ricalcolo finito
@@ -848,6 +848,11 @@ Public Class MachManaging
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " pronto per essere lavorato")
' lo lancio
bSent = SendProgram(MyMachGroup.CnFilePath(), MyMachGroup.Name)
' per siemens
If CurrentMachine.NCType = NCTypes.SIEMENS_SHARP7 Then
' annullo step di ripartenza
Map.refMachManaging.Siemens_Sharp7.ResetStep(Not (MyMachGroup.dtStartTime <> DateTime.MinValue OrElse MyMachGroup.nProduction_State = ItemState.WIP))
End If
' EgtOutLog(MyMachGroup.Name & " id: " & MyMachGroup.Id & " mandato " & DateTime.Now() & " " & MyMachGroup.Name & " " & bSent.ToString())
Select Case CurrentMachine.NCType
Case NCTypes.TPA, NCTypes.SIEMENS_SHARP7