Esempio n. 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     TaskDal taskDal = new TaskDal();
     DataTable dt = taskDal.TaskOutToDetail();
     DataTable dt2 = null;
     //if (IndexStar == 0)
     //{
     //    string strWhere = string.Format("TASK_TYPE IN ({0}) AND DETAIL.STATE IN ({1})  AND DETAIL.CRANE_NO IS NOT NULL ", "11,21,12,13,14", "0,1");
     //    dt2 = taskDal.CraneTaskIn(strWhere);
     //    strWhere = string.Format("TASK_TYPE IN ({0}) AND DETAIL.STATE IN ({1}) AND DETAIL.CRANE_NO IS NOT NULL ", "22", "0,1,2");
     //    DataTable dtout = taskDal.CraneTaskIn(strWhere);
     //    dt2.Merge(dtout);
     //}
     DataTable[] dtSend = new DataTable[2];
     dtSend[0] = dt;
     dtSend[1] = dt2;
     Context.Processes["CraneProcess"].Start();
     Context.ProcessDispatcher.WriteToProcess("CraneProcess", "StockOutRequest", dtSend);
     IndexStar++;
 }
Esempio n. 2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnStart.Enabled = false;
                this.btnStop.Enabled = true;

                TaskDal taskDal = new TaskDal();
                //��ȡ��1¥��2¥��״̬Ϊ0��δִ�еĶѶ���ij����������Ϣ=dt
                DataTable dt = taskDal.TaskOutToDetail();
                //��ȡ��1¥��2¥��״̬Ϊ1����ִ�еĶѶ���ij����������Ϣ=dt2
                DataTable dt2 = null;
                if (IndexStar == 0)
                {
                    //��ȡ�Ѷ����Ҫִ�л�����ִ�е���������
                    string strWhere = string.Format("TASK_TYPE IN ({0}) AND DETAIL.STATE IN ({1})  AND DETAIL.CRANE_NO IS NOT NULL ", "11,21,12,13,14", "0,1");
                    dt2 = taskDal.CraneTaskIn(strWhere);
                    strWhere = string.Format("TASK_TYPE IN ({0}) AND DETAIL.STATE IN ({1}) AND DETAIL.CRANE_NO IS NOT NULL ", "22", "1");
                    DataTable dtout = taskDal.CraneTaskIn(strWhere);
                    dt2.Merge(dtout);
                }
                DataTable[] dtSend = new DataTable[2];
                dtSend[0] = dt;
                dtSend[1] = dt2;
                Context.Processes["CraneProcess"].Start();
                Context.ProcessDispatcher.WriteToProcess("CraneProcess", "StockOutRequest", dtSend);
                IndexStar++;

                timer1.Enabled = true;
                timer1.Start();
                timer1.Interval = 3000000;
                timer1.Tick += new EventHandler(timer1_Tick);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
            }
        }