public VisMain() { InitializeComponent(); dgHaderLance.RowCount = LanceStringsCount; dgPatternLance.RowCount = LanceStringsCount; dgHaderAdditions.RowCount = MaterialsCount; dgPatternAdditions.RowCount = MaterialsCount; m_cntJobReadyList = new List<int>(); for (int i = 0; i < WeigherNum; i++) m_cntJobReadyList.Add(0); PushGate = new Client(); var o = new TestEvent(); ListenGate = new Client(new Listener()); ListenGate.Subscribe(); initTimer.Interval = 2000; initTimer.Start(); LanceHaderFill(); comJobW3Old = new comJobW3Event(); comJobW4Old = new comJobW4Event(); comJobW5Old = new comJobW5Event(); comJobW6Old = new comJobW6Event(); comJobW7Old = new comJobW7Event(); //gbW3.BackColor = Color.FromArgb(0,0,50); //gbW4.BackColor = Color.FromArgb(255,100,0); }
public void Process(comJobW6Event _event) { try { this._Module._Heat.comJobW6History.Add(_event); } catch { } }
public static int SenderWeigherLoadMaterial(List<WeigherQuant> weigherQuant) { // m_pushGate.PushEvent(new HeatSchemaStepEvent() { Step = currentStep }); //comAdditionsSchemaEvent bunkers = new comAdditionsSchemaEvent(); var jobW3Event = new comJobW3Event(); var jobW4Event = new comJobW4Event(); var jobW5Event = new comJobW5Event(); var jobW6Event = new comJobW6Event(); var jobW7Event = new comJobW7Event(); var w3HaveJob = false; var w4HaveJob = false; var w5HaveJob = false; var w6HaveJob = false; var w7HaveJob = false; // заполняем значениями, что не заполнили останется -1 - важно для правильной работы весов(только 1 материал грузим) int weigher = 0; if (weigherQuant[weigher].BunkerId == 0) // W3 RB5 (0,0) { jobW3Event.RB5Weight = weigherQuant[weigher].PortionWeight; jobW3Event.RB5Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW3Event.RB5Weight > 0) w3HaveJob = true; } if (weigherQuant[weigher].BunkerId == 1) // W3 RB6 (0,1) { jobW3Event.RB6Weight = weigherQuant[weigher].PortionWeight; jobW3Event.RB6Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW3Event.RB6Weight > 0) w3HaveJob = true; } weigher = 1; if (weigherQuant[weigher].BunkerId == 2) // W4 RB7 (1,2) { jobW4Event.RB7Weight = weigherQuant[weigher].PortionWeight; jobW4Event.RB7Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW4Event.RB7Weight > 0) w4HaveJob = true; } weigher = 2; if (weigherQuant[weigher].BunkerId == 3) // W5 RB8 (2,3) { jobW5Event.RB8Weight = weigherQuant[weigher].PortionWeight; jobW5Event.RB8Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW5Event.RB8Weight > 0) w5HaveJob = true; } weigher = 3; if (weigherQuant[weigher].BunkerId == 4) // W6 RB9 (3,4) { jobW6Event.RB9Weight = weigherQuant[weigher].PortionWeight; jobW6Event.RB9Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW6Event.RB9Weight > 0) w6HaveJob = true; } weigher = 4; if (weigherQuant[weigher].BunkerId == 5) // W7 RB10 (4,5) { jobW7Event.RB10Weight = weigherQuant[weigher].PortionWeight; jobW7Event.RB10Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW7Event.RB10Weight > 0) w7HaveJob = true; } if (weigherQuant[weigher].BunkerId == 6) // W7 RB11 (4,6) { jobW7Event.RB11Weight = weigherQuant[weigher].PortionWeight; jobW7Event.RB11Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW7Event.RB11Weight > 0) w7HaveJob = true; } if (weigherQuant[weigher].BunkerId == 7) // W7 RB12 (4,7) { jobW7Event.RB12Weight = weigherQuant[weigher].PortionWeight; jobW7Event.RB12Oxygen = weigherQuant[weigher].OxygenTreshold; if (jobW7Event.RB12Weight > 0) w7HaveJob = true; } // m_pushGate.PushEvent(bunkers); // отправляем задание for (int i = 0; i < weigherQuant.Count; i++) { var quant = weigherQuant[i]; if (quant.PortionWeight > 0) { InstantLogger.log("JOB SENDER:"); Thread.Sleep(DelayRefrashData); if (w3HaveJob) { m_pushGate.PushEvent(jobW3Event); InstantLogger.log(string.Format("PushEvent: jobW3Event ==> {0}", jobW3Event.ToString())); } if (w4HaveJob) { m_pushGate.PushEvent(jobW4Event); InstantLogger.log(string.Format("PushEvent: jobW4Event ==> {0}", jobW4Event.ToString())); } if (w5HaveJob) { m_pushGate.PushEvent(jobW5Event); InstantLogger.log(string.Format("PushEvent: jobW5Event ==> {0}", jobW5Event.ToString())); } if (w6HaveJob) { m_pushGate.PushEvent(jobW6Event); InstantLogger.log(string.Format("PushEvent: jobW6Event ==> {0}", jobW6Event.ToString())); } if (w7HaveJob) { m_pushGate.PushEvent(jobW7Event); InstantLogger.log(string.Format("PushEvent: jobW7Event ==> {0}", jobW7Event.ToString())); } Thread.Sleep(DelayRefrashData); if (w3HaveJob) { m_pushGate.PushEvent(new cntWeigher3JobReadyEvent() {Counter = m_cntWeighersJobReady[0]++}); // подтверждаем задание для весов w3 InstantLogger.log(string.Format("job for w3 ==> {0}", weigherQuant[0].ToString())); } if (w4HaveJob) { m_pushGate.PushEvent(new cntWeigher4JobReadyEvent() {Counter = m_cntWeighersJobReady[1]++}); // подтверждаем задание для весов w4 InstantLogger.log(string.Format("job for w4 ==> {0}", weigherQuant[1].ToString())); } if (w5HaveJob) { m_pushGate.PushEvent(new cntWeigher5JobReadyEvent() {Counter = m_cntWeighersJobReady[2]++}); // подтверждаем задание для весов w5 InstantLogger.log(string.Format("job for w5 ==> {0}", weigherQuant[2].ToString())); } if (w6HaveJob) { m_pushGate.PushEvent(new cntWeigher6JobReadyEvent() {Counter = m_cntWeighersJobReady[3]++}); // подтверждаем задание для весов w6 InstantLogger.log(string.Format("job for w6 ==> {0}", weigherQuant[3].ToString())); } if (w7HaveJob) { m_pushGate.PushEvent(new cntWeigher7JobReadyEvent() {Counter = m_cntWeighersJobReady[4]++}); // подтверждаем задание для весов w7 InstantLogger.log(string.Format("job for w7 ==> {0}", weigherQuant[4].ToString())); //InstantLogger.log(string.Format("job for w7 ==> {0}", jobW7Event.ToString())); } Thread.Sleep(DelayRefrashData); break; } } return 0; }