private void btn_down_Click(object sender, EventArgs e) { decimal num = 0; try { num = Convert.ToDecimal(textBox_num.Text); if (num < 0) { MessageBox.Show("输入数值必须为非负数!"); return; } } catch (Exception) { MessageBox.Show("输入数量格式有误!"); return; } if (!Check(num, 2)) { return; } DialogResult re = MessageBox.Show("确定减少所有合流缓存上限为:" + textBox_num.Text + " ?", "数据修改", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (re == DialogResult.OK) { UnionCacheServer.datepldown(num); dataGridView1.DataSource = UnionCacheServer.GetAllData(); } }
private void btn_dispatchesize_Click(object sender, EventArgs e) { decimal num = 0; try { num = Convert.ToDecimal(txt_dispatchesize_pl.Text); } catch (Exception) { MessageBox.Show("输入数量格式有误!"); } DialogResult re = MessageBox.Show("确定修改每次缓存补烟数为:" + txt_dispatchesize_pl.Text + " ?", "数据修改", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (re == DialogResult.OK) { UnionCacheServer.up_dispatchesize(num); dataGridView1.DataSource = UnionCacheServer.GetAllData(); } }
private void btn_Search_Click(object sender, EventArgs e) { decimal mainbeltno; decimal groupnono; try { if (txt_mainbeltno.Text.Length <= 0) { mainbeltno = 0; } else { mainbeltno = Convert.ToDecimal(txt_mainbeltno.Text); } } catch (Exception) { MessageBox.Show("主皮带输入格式有误!"); return; } try { if (txt_groupnono.Text.Length <= 0) { groupnono = 0; } else { groupnono = Convert.ToDecimal(txt_groupnono.Text); } } catch (Exception) { MessageBox.Show("分拣组号输入格式有误!"); return; } dataGridView1.DataSource = UnionCacheServer.GetSearchData(mainbeltno, groupnono); }
public void binding() { dataGridView1.DataSource = UnionCacheServer.GetAllData(); }
private void btn_update_Click(object sender, EventArgs e) { InBound.Model.UnionCaChe ce = new InBound.Model.UnionCaChe(); try { ce.mainbelt = Convert.ToDecimal(txt_mainbelt.Text); ce.groupno = Convert.ToDecimal(txt_groupno.Text); ce.cachesize = Convert.ToDecimal(txt_cachesize.Text); ce.dispatchenum = Convert.ToDecimal(txt_dispatchenum.Text); ce.dispatchesize = Convert.ToDecimal(txt_dispatchesize.Text); } catch (Exception) { MessageBox.Show("信息输入格式不正确!"); return; } if (ce.cachesize > 280) { MessageBox.Show("输入的缓存量上限过大!"); return; } else if (ce.dispatchesize > ce.cachesize) { MessageBox.Show("每次订单数量超过缓存上限!"); return; } else if (ce.dispatchenum > ce.cachesize) { MessageBox.Show("空余缓存量超过缓存上限!"); return; } decimal states = 5; switch (cmb_state.SelectedItem.ToString()) { case "启用": states = 10; break; case "禁用": states = 0; break; } ce.state = states; DialogResult re = MessageBox.Show("确定修改 " + ce.mainbelt + "号主皮带上第 " + ce.groupno + "分拣组的信息?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (re == DialogResult.OK) { if (UnionCacheServer.UpdateData(ce)) { MessageBox.Show("修改成功!"); dataGridView1.DataSource = UnionCacheServer.GetAllData(); } else { MessageBox.Show("修改失败!"); } } else { return; } }