示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string pi_no = (sender as Button).Tag.ToString();

                PIViewModel clickPI = piList.First(pi => pi.PI_NO == pi_no);

                if (clickPI == null || !clickPI.LAMPOn)
                {
                    return;
                }

                string query = string.Format(@"update lt_pi_loc set send_yn = 'P', upd_date = getdate() where pi_no = '{0}' and send_yn = 'T'", clickPI.PI_NO);

                this.FnPILogSelect(query);

                clickPI.LAMPOn = false;
                clickPI.CNT    = "";
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }
示例#2
0
        private void threadBCU()
        {
            while (this.isRunBCUThread)
            {
                string log = string.Empty;

                try
                {
                    //BCU로 받을 데이터 확인
                    Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff - SEND 시작"));

                    //새로운 Row 검색 (N)
                    //DataTable piNewRow = BCUHelper.Instance.FnPILogSelect(0, null, "N", null, UICommon.ConfigHelper.Instance.BCUNo);      //PI에서 저장된 새로운 ROW 체크

                    //PI에서 저장된 새로운 ROW 체크
                    string strQuery = string.Format(@"SELECT pc_no, pi_no, pick_no,pi_log_data, send_yn, auto_yn FROM lt_pi_loc (nolock) 
                                                        where bcu_no = '{0}' and send_yn = 'N' 
                                                        order by  upd_date, convert(int, pi_no)", this.BCUNO);

                    DataTable piNewRow = this.FnPILogSelect(strQuery);      //PI에서 저장된 새로운 ROW 체크

                    foreach (DataRow row in piNewRow.Rows)
                    {
                        Thread.Sleep(20);


                        BCUInfo logInfo = new BCUInfo(row["pi_log_data"].ToString(), "seq_non");

                        PIViewModel onPi = piList.First(pi => pi.PI_NO == logInfo.PI_No);
                        if (onPi == null)
                        {
                            continue;
                        }

                        onPi.LAMPOn = (logInfo.PI_LampAttribute == 64) ? false : true;
                        onPi.CNT    = logInfo.Send_Data.Replace(" ", "");

                        strQuery = string.Format(@"update lt_pi_loc set send_yn = '{1}', upd_date = getdate() where pi_no ='{0}' and send_yn ='N'", logInfo.PI_No, (row["auto_yn"].ToString() == "Y") ? "Y" : "T");
                        piNewRow = this.FnPILogSelect(strQuery);      //PI에서 저장된 새로운 ROW 체크
                    }
                    //if (!string.IsNullOrEmpty(lastq))
                    //    this.WorkMessageAdd("마지막REQUEES" + lastq);
                }
                catch (Exception ex)
                {
                    if (!this.isRunBCUThread)
                    {
                        return;
                    }

                    Console.WriteLine("tmBCU_Tick - " + ex.ToString());
                }
                finally
                {
                    if (!string.IsNullOrEmpty(log.Trim()))
                    {
                        Console.WriteLine("Interface - " + log);
                    }

                    if (this.BCUThread != null)
                    {
                        this.BCUThread.Join(500);
                    }
                }
            }
        }