Exemple #1
0
        //   runEvent deleevnet;
        /// <summary>
        /// 回调函数
        /// </summary>
        /// <param name="ar"></param>
        private void CallBackMethod(IAsyncResult ar)
        {
            string      msg    = string.Empty;
            AsyncResult result = (AsyncResult)ar;
            runEvent    re     = (runEvent)result.AsyncDelegate;

            msg = re.EndInvoke(ar);
            //将值传递出去
            ErrMsg obj = (ErrMsg)ar.AsyncState;

            obj.errmsg.Add(msg);
        }
Exemple #2
0
 public void Insert_DB_Log(string StrLog)
 {
     deleevnet = new runEvent(Insert_Log);
     deleevnet.BeginInvoke(StrLog, null, null);
 }
Exemple #3
0
        public string SP_TEST_STOCKIN(List <string> ListData, string MYGROUP, string EMP, string EC, string LINE, int Total)
        {
            #region 开启多个线程来处理数据
            int x = 0;
            Dictionary <int, List <string> > diclistesn = new Dictionary <int, List <string> >();
            List <string> esndata = new List <string>();

            for (int i = 0; i < ListData.Count; i++)
            {
                esndata.Add(ListData[i]);
                x++;
                if (x >= 1)
                {
                    diclistesn.Add(i, esndata);
                    x       = 0;
                    esndata = new List <string>();
                }
                else
                {
                    if ((i + 1) == ListData.Count)
                    {
                        diclistesn.Add(i, esndata);
                    }
                }
            }
            AsyncCallback re = new AsyncCallback(CallBackMethod);
            ErrMsg        em = new ErrMsg();
            int           h  = 0;
            foreach (int it in diclistesn.Keys)
            {
                if (h == 0)
                {
                    EC = "OK";
                }
                else
                {
                    EC = "KK";
                }
                h++;
                deleevnet = new runEvent(_sp_test_stockin);
                ListIasyncresult.Add(deleevnet.BeginInvoke(diclistesn[it], MYGROUP, EMP, EC, LINE, diclistesn[it].Count, re, em));
            }
            while (true)
            {
                bool flag = true;
                foreach (IAsyncResult item in ListIasyncresult)
                {
                    flag &= item.IsCompleted;
                }
                if (flag)
                {
                    break;
                }
            }
            for (int r = 0; r < em.errmsg.Count; r++)
            {
                MessageBox.Show(em.errmsg[r]);
            }
            #endregion
            return("OK");
        }
Exemple #4
0
 public void SendLog(string StrLog)
 {
     deleevnet = new runEvent(SaveLog);
     deleevnet.BeginInvoke(StrLog, null, null);
 }
Exemple #5
0
 private void Insert_System_Log(string StrLog)
 {
     deleevnet = new runEvent(Save_DB_Log);
     deleevnet.BeginInvoke(StrLog, null, null);
 }