private void insertFreqRule(int subcode) { StringBuilder mrg = new StringBuilder(); string codeid; for (int i = 1; i <= subcode; i++) { codeid = textBox1.Text + i; insert.intsertFreqRule(textBox2.Text, codeid); } string[] time = textBox3.Text.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 = textBox1.Text + (j + 1); update.updateFreqRule(time[j], order, textBox1.Text, codeid); } else { mrg.Append("找不到" + time[j] + "的批次" + "\n"); } } } if (mrg.ToString() != "") { MessageBox.Show(mrg.ToString(), "请到时间规则维护"); } }
/// <summary> /// 更新批次 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void label1_Click(object sender, EventArgs e) { 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(), "请到时间规则维护"); } }
/// <summary> /// 同步更新批次 /// </summary> /// <param name="str">用法时间</param> public void FregRule(string str) { StringBuilder mrg = new StringBuilder(); // DFeg form1 = (DFeg)this.Owner; string[] time = str.Split('_'); for (int i = 0; i < time.Length - 1; i++) { if (sel.getOrderID(time[i]).Tables[0].Rows.Count > 0) { string order = sel.getOrderID(time[i]).Tables[0].Rows[0][0].ToString(); string codeid = rowDFreg.i + (i + 1); update.updateFreqRule(time[i], order, rowDFreg.i, codeid); } else { mrg.Append("找不到" + time[i] + "的批次" + "\n"); } } if (mrg.ToString() != "") { MessageBox.Show(mrg.ToString()); } else { ChangeTextVal(); // form1.refresh(); this.Close(); } }
/// <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(), "请到时间规则维护"); } }