private void mainTimer_Elapse(object sender, ElapsedEventArgs e) { if (!isWorking) { //initControl(); setText_Label(label4, "0"); setText_ProgressBar(progressBar1, 0); setText_Label(lblBadQty, "0"); setText_Label(lblPrdQty, "0"); setText_Label(lblInQty, "0"); setText_TextBox(textBox1, ""); setText_TextBox(textBox2, ""); setText_TextBox(textBox3, ""); setText_TextBox(textBox4, ""); AsyncEchoServer(); } else { if (!isFull) { if (isFirst) { setText_ListBox(listBox1, "--------------작업시작---------------"); service.UpdateWorkStatus(workOrderNo, "작업중"); setText_TextBox(textBox1, workOrderNo); wcService.WcStatusUpdate(ConfigurationManager.AppSettings["Wc_Code"], "RUN"); SetTimer(); isFirst = false; } } else { timer1.Stop(); timer1.Dispose(); isFull = false; isWorking = false; isFirst = true; service.UpdateWorkStatus(workOrderNo, "작업종료"); wcService.WcStatusUpdate(ConfigurationManager.AppSettings["Wc_Code"], "STOP"); setText_ListBox(listBox1, "--------------생산완료---------------"); setText_ListBox(listBox1, $"총 투입 개수 : {lblInQty.Text}/ 양품 개수 : {lblPrdQty.Text}/ 불량 개수 : {lblBadQty.Text}"); setText_ListBox(listBox1, "--------------작업종료---------------"); setText_ListBox(listBox1, " "); } } }
static void Main(string[] args) { WorkOrderService service = new WorkOrderService(); WorkCenterService wcService = new WorkCenterService(); Console.WriteLine($"--- {workCenterNo} 작동---"); SetLoad(); while (true) { if (!isWorking) { AsyncEchoServer(); } else { if (!isFull) { if (isFirst) { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("------ 작업 시작 ------"); service.UpdateWorkStatus(workOrderNo, "작업중"); wcService.WcStatusUpdate(ConfigurationManager.AppSettings["Wc_Code"], "RUN"); SetTimer(); isFirst = false; } } else { timer1.Stop(); timer1.Dispose(); isFull = false; isWorking = false; isFirst = true; service.UpdateWorkStatus(workOrderNo, "작업종료"); wcService.WcStatusUpdate(ConfigurationManager.AppSettings["Wc_Code"], "STOP"); Console.WriteLine("------ 작업 종료 ------"); } } } }