Ejemplo n.º 1
0
        /// <summary>
        /// 更新批次
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void label_freg_Click(object sender, EventArgs e)
        {
            string ret = CheckTimeRule();

            if (ret != "")
            {
                MessageBox.Show(ret);
                return;
            }
            else
            {
                foreach (Control c in panel1.Controls)
                {
                    if (c is TimeRow)
                    {
                        TimeRow tr = (TimeRow)c;
                        update.UpdateTimeRule(tr.label1.Text, tr.Start_Time.Text, tr.End_Time.Text, false);
                    }
                }
            }

            StringBuilder mrg = new StringBuilder();

            dt = sel.getDFreg().Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                checkSubRule(i);
                string[] time = dt.Rows[i][4].ToString().Split('_');
                if (time.Length > 0)
                {
                    for (int j = 0; j < time.Length; j++)
                    {
                        if (sel.getOrderID(time[j]).Tables[0].Rows.Count > 0)
                        {
                            string order = sel.getOrderID(time[j]).Tables[0].Rows[0][0].ToString();
                            codeid = dt.Rows[i][0].ToString() + (j + 1);
                            update.updateFreqRule(time[j], order, dt.Rows[i][0].ToString(), codeid);
                        }
                        else
                        {
                            mrg.Append("找不到" + time[j] + "的批次" + "\n");
                        }
                    }
                }
            }
            MessageBox.Show("更新成功");
            if (mrg.ToString() != "")
            {
                MessageBox.Show(mrg.ToString(), "请到时间规则维护");
            }
        }
Ejemplo n.º 2
0
 private void TimeRule_Load(object sender, EventArgs e)
 {
     panel1.Controls.Clear();
     dt = sel.getTimeRule().Tables[0];
     for (i = 0; i < dt.Rows.Count; i++)
     {
         TimeRow time = new TimeRow();
         time.show(dt.Rows[i]);
         time.Name   = i.ToString();
         time.Top    = 33 * i;
         time.Parent = this;
         panel1.Controls.Add(time);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加事件规则
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void label_add_Click(object sender, EventArgs e)
 {
     CheckTimeRule();
     panel1.VerticalScroll.Value = panel1.VerticalScroll.Minimum;
     if (i < 24)
     {
         DataTable dt1 = new DataTable();
         dt1 = sel.getLaterOrder().Tables[0];
         string OrderID    = "1";
         string start_time = "00:00";
         string end_time   = "23:59";
         if (dt1.Rows.Count > 0)
         {
             OrderID    = dt1.Rows[0]["NextOrderID"].ToString();
             start_time = dt1.Rows[0]["EndTime"].ToString();
         }
         if (DateTime.Compare(DateTime.Parse(end_time), DateTime.Parse(start_time)) < 0)
         {
             update.insertTimeRule(OrderID, start_time, end_time, true);
         }
         else
         {
             update.insertTimeRule(OrderID, start_time, end_time, false);
         }
         dt = sel.getTimeRule().Tables[0];
         TimeRow time = new TimeRow();
         time.show(dt.Rows[i]);
         time.Name = (i).ToString();
         time.Top  = 33 * (i);
         panel1.Controls.Add(time);
         i++;
     }
     else
     {
         MessageBox.Show("数量超出范围");
     }
 }