public void StartRun() { rStart = DateTime.Now; ProdHistory.InitNewRun(this); nc.ResetStatus(); agent.Action((byte)(0x80 + _pack_id), "start");//0x80 is group action agent.Action(vib_addr, "start"); status = PackerStatus.RUNNING; }
public void AddNewPack(onepack o) { if (!bSimulate) { total_packs++; total_weights += o.weight; } else { total_sim_weights += o.weight; total_sim_packs++; } last_one_pack = o; packhist.Enqueue(o); if (packhist.Count > 500) { packhist.Dequeue(); } //update the speed long count = 0; DateTime lastmin = DateTime.Now; lastmin = lastmin.Subtract(new TimeSpan(0, 1, 0)); foreach (onepack op in packhist) { if (op.time < lastmin) { count = count + 1; } else { count = packhist.Count - count; break; } } speed = (UInt32)count; if (bSimulate) { return; } if (total_packs % 100 == 1) //update record for every 100 packs { ProdHistory.UpdateRecord(this); EngConfigWnd.DecreasePacker(100); } }
public App() { System.Diagnostics.Process[] pses = System.Diagnostics.Process.GetProcessesByName("ioex-cs"); if (pses.Length > 0) { // System.Diagnostics.Process.GetCurrentProcess().Kill(); // return; } if (Environment.CommandLine.IndexOf("/debug") > 0) { NodeAgent.IsDebug = true; } StringResource.SetLanguage(); //app_cfg = new XmlConfig(ProdNum.baseDir +"\\app_config.xml"); app_cfg = new SqlConfig("app"); app_cfg.LoadConfigFromFile(); curr_cfg = app_cfg.Current; agent = new NodeAgent(); packers = new List <UIPacker>(); for (int i = 0; i < Int32.Parse(curr_cfg.Element("machine_number").Value); i++) { UIPacker p = new UIPacker(i, agent); p.agent = agent; p.InitConfig(); packers.Add(p); } singlewnd = new SingleMode(Int32.Parse(curr_cfg.Element("node_number").Value)); runwnd = new RunMode(Int32.Parse(curr_cfg.Element("node_number").Value)); histwnd = new ProdHistory(); helpwnd = new Help(); kbdwnd = new kbd(); bottomwnd = new BottomWnd(); alertwnd = new AlertWnd(); alertwnd.UpdateUI(); //load alert configuration which is in app_config.xml too pwdwnd = new PwdWnd(); engwnd = new EngConfigWnd(); configwnd = new ConfigMenuWnd(); prodwnd = new ProdWnd(); prodnum = new ProdNum(); }
private void DoRelease(SubNode[] addrs, double weight) { foreach (SubNode n in addrs) { n.Action("release", false); } //todo update the display; onepack o = new onepack(); o.bucket = new byte[5]; o.bucket[1] = o.bucket[2] = o.bucket[3] = o.bucket[4] = o.bucket[0] = (byte)0; int i = 0; foreach (SubNode n in addrs) { o.bucket[i++] = (byte)n["addr"].Value; o.time = DateTime.Now; } o.weight = weight; ProdHistory.AddNewPack(o, (Application.Current as App).bSimulate); }
public void StopRun() { nc.Stop(300); agent.Stop(100); agent.Action((byte)(0x80 + _pack_id), "stop"); agent.Action(vib_addr, "stop"); Thread.Sleep(300); status = PackerStatus.IDLE; agent.Resume(); nc.Resume(); if (!bSimulate) { ProdHistory.UpdateRecord(this); ResetHistory(); } else { total_sim_packs = 0; total_sim_weights = 0; } }
public App() { System.Diagnostics.Process[] pses = System.Diagnostics.Process.GetProcessesByName("ioex-cs"); if (pses.Length > 0) { // System.Diagnostics.Process.GetCurrentProcess().Kill(); // return; } if (Environment.CommandLine.IndexOf("/debug") > 0) NodeAgent.IsDebug = true; StringResource.SetLanguage(); //app_cfg = new XmlConfig(ProdNum.baseDir +"\\app_config.xml"); app_cfg = new SqlConfig("app"); app_cfg.LoadConfigFromFile(); curr_cfg = app_cfg.Current; agent = new NodeAgent(); packers = new List<UIPacker>(); for (int i = 0; i < Int32.Parse(curr_cfg.Element("machine_number").Value); i++) { UIPacker p = new UIPacker(i, agent); p.agent = agent; p.InitConfig(); packers.Add(p); } singlewnd = new SingleMode(Int32.Parse(curr_cfg.Element("node_number").Value)); runwnd = new RunMode(Int32.Parse(curr_cfg.Element("node_number").Value)); histwnd = new ProdHistory(); helpwnd = new Help(); kbdwnd = new kbd(); bottomwnd = new BottomWnd(); alertwnd = new AlertWnd(); alertwnd.UpdateUI(); //load alert configuration which is in app_config.xml too pwdwnd = new PwdWnd(); engwnd = new EngConfigWnd(); configwnd = new ConfigMenuWnd(); prodwnd = new ProdWnd(); prodnum = new ProdNum(); }