| | |
| | | { |
| | | static void Main(string[] args) { |
| | | |
| | | Settings.Init(); |
| | | // 设置控制台编码为 UTF-8 |
| | | Console.OutputEncoding = Encoding.UTF8; |
| | | |
| | |
| | | tasks.Add(GetTask(WCSCore.Dispatch)); |
| | | //自动补充母拖 |
| | | tasks.Add(GetTask(Monitor.AutoEmptyTrayOutStock)); |
| | | |
| | | // 缓存空托出库 |
| | | tasks.Add(GetTask(Monitor.BufferEmptyTrayOutStock,5000)); |
| | | Task.WaitAll(tasks.ToArray()); |
| | | } |
| | | public void Stop() { Console.WriteLine("work stopped"); } |
| | | private Task GetTask(Action action) { |
| | | private Task GetTask(Action action ,int time = 3000) { |
| | | var task = Task.Run(() => { |
| | | while (true) { |
| | | try { |
| | |
| | | catch (Exception ex) { |
| | | LogHelper.Error(ex.Message, ex); |
| | | } |
| | | Thread.Sleep(3000); |
| | | Thread.Sleep(time); |
| | | } |
| | | }); |
| | | return task; |