public bool SendMachineCycleData(MachineCycleData data) { if (data == null) { return(false); } string jsonString = data.Serializer(); InsertSendQueue("MA/addMachineCycleData", jsonString); return(true); }
public bool ReadMachineCycleData() { foreach (KeyValuePair <int, SimMachine> d in _dicSimMachine) { int machineID = d.Key; SimMachine simMachine = d.Value; if (simMachine.IsCycleCompleted == true) { MachineCycleData cycleData = new MachineCycleData(); // Fill cycle data and add to dictionary cycleData.JobID = simMachine.CycleJobID; cycleData.JobType = simMachine.CycleJobType; cycleData.MachineID = simMachine.CycleMachineID; cycleData.TotalStartTime = simMachine.CycleTotalStartTime; cycleData.TotalEndTime = simMachine.CycleTotalEndTime; cycleData.DrivingInfo = new List <MachineCycleDrivingInfo>(); cycleData.DrivingInfo.Add(simMachine.CycleFirstDrivingInfo); cycleData.DrivingInfo.Add(simMachine.CycleSecondDrivingInfo); cycleData.UpperDrivingInfo = new List <MachineCycleUpperDrivingInfo>(); cycleData.UpperDrivingInfo.Add(simMachine.CycleUpperDrivingInfo); cycleData.HoistingInfo = new List <MachineCycleHoistingInfo>(); cycleData.HoistingInfo.Add(simMachine.CycleFirstHoistingInfo); cycleData.HoistingInfo.Add(simMachine.CycleSecondHoistingInfo); cycleData.ForkInfo = new List <MachineCycleForkInfo>(); cycleData.ForkInfo.Add(simMachine.CycleForkInfo); cycleData.LaserDistanceMeterTotalUsedTime = simMachine.CycleLaserDistanceMeterTotalUsedTime; cycleData.OpticalRepeaterTotalUsedTime = simMachine.CycleOpticalRepeaterTotalUsedTime; cycleData.Weight = simMachine.CycleWeight; cycleData.InventoryCount = simMachine.CycleInventoryCount; if (_dicMachineCycleData.ContainsKey(machineID) == true) { _dicMachineCycleData[machineID] = cycleData; } simMachine.IsCycleCompleted = false; } else { _dicMachineCycleData[machineID] = null; } } return(true); }
private void CycleWatcher() { UIHelper.LogInfo(string.Format("Cycle Data를 {0}주기로 체크", _cycleCheckInterval)); int count = 0; int checkCount = _cycleCheckInterval / 100; while (!_shouldStop) { if (count < checkCount) { // Wait Thread.Sleep(100); count++; continue; } count = 0; // Check cycle complete flag if (_machineInterface.IsCompleteCycle() == true) { if (_machineInterface.ReadMachineCycleData() == false) { UIHelper.UpdateDBCommStatus(false); continue; } UIHelper.UpdateDBCommStatus(true); // Collect Data from DB foreach (MachineInfo mInfo in _listMachineInfo) { MachineCycleData cycleData = _machineInterface.GetMachineCycleData(mInfo.ID); _serverComm.SendMachineCycleData(cycleData); } } } UIHelper.LogInfo("Cycle Data 수집 종료"); }