private void wbt_DoubleClick(object sender, EventArgs e) { if (!ClsBLL.IsPower("分单")) { return; } DoubleClickButton bt = (DoubleClickButton)((Control)sender); frmServiceItem fsi = new frmServiceItem(int.Parse(bt.Name)); if (fsi.ShowDialog() == DialogResult.OK) { 刷新ToolStripMenuItem_Click(null, null); } }
private void 分单ToolStripMenuItem_Click(object sender, EventArgs e) { if (CureentCt == null) { return; } DoubleClickButton bt = (DoubleClickButton)CureentCt; int recordid = int.Parse(bt.Name); frmServiceItem fsi = new frmServiceItem(recordid); if (fsi.ShowDialog() == DialogResult.OK) { 刷新ToolStripMenuItem_Click(null, null); } }
private void wbt_MouseUp(object sender, MouseEventArgs e) { if (!ClsBLL.IsPower("派工")) { MessageBox.Show("你没有权限派工!"); ((Control)sender).Top = PcStartTop; ((Control)sender).Left = PcStartLeft; return; } if (IsMove) { decimal top = decimal.Parse(Convert.ToString(((Control)sender).Top - dataGridView1.ColumnHeadersHeight)); decimal height = decimal.Parse(dataGridView1.Rows[0].Height.ToString()); Rowindex = int.Parse(decimal.Round(top / height, 0).ToString()); int left = ((Control)sender).Left; int startleft = dataGridView1.Columns[0].Width + dataGridView1.Columns[1].Width; Colindex = (left - startleft) / dataGridView1.Columns[2].Width; Colindex = Colindex + 2; if (top == 0 || left < dataGridView1.Columns[0].Width) { ((Control)sender).Top = PcStartTop; ((Control)sender).Left = PcStartLeft; return; } if (Rowindex == -1) { Rowindex = 0; } ((Control)sender).Top = Rowindex * dataGridView1.Rows[0].Height + dataGridView1.ColumnHeadersHeight; ((Control)sender).Left = (Colindex - 2) * dataGridView1.Columns[2].Width + startleft; try { if (Rowindex > -1) { if (((Control)sender).Name != string.Empty) { string sqlstring = string.Empty; DoubleClickButton bt = (DoubleClickButton)((Control)sender); //记录ID int recordid = int.Parse(bt.Name); string[] strinfo = bt.ImageKey.Split(new Char[] { ',' }); if (strinfo[1] == "延时到明天") { //延时到明天的单,第二天派工时确认追加工时,预计完成时间是当前时间加上追加工时 if (ClsBLL.GetFendanNum(recordid) > 1) { //如果有两张同时延时到明天的单,则进入分单界面。 frmServiceItem fsi = new frmServiceItem(recordid); if (fsi.ShowDialog() == DialogResult.OK) { 刷新ToolStripMenuItem_Click(null, null); } else { ((Control)sender).Top = PcStartTop; ((Control)sender).Left = PcStartLeft; return; } } else { frmAddHour2Day frmaddhour = new frmAddHour2Day(recordid); if (frmaddhour.ShowDialog() == DialogResult.OK) { ClsBLL.AddMsg(recordid, "车牌号码:" + strinfo[2] + ",派工给" + ClsBLL.GetWorker(recordid)); 刷新ToolStripMenuItem_Click(null, null); } else { ((Control)sender).Top = PcStartTop; ((Control)sender).Left = PcStartLeft; return; } } } else { //维修工时 decimal servicehours = ClsBLL.GetServiceHour(recordid); //维修工人 string serviceworker = dataGridView1.Rows[Rowindex].Cells[1].Value.ToString(); DateTime DtPlanComplete = DateTime.Now.AddMinutes(double.Parse(Convert.ToString(servicehours * 60))); sqlstring = "Update Booking Set AssignTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "', StartServiceTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "',PlanCompleteTime='" + DtPlanComplete + "', Worker='" + serviceworker + "',State='维修进行中' where ID=" + recordid; if (SQLDbHelper.ExecuteSql(sqlstring) > 0) { ClsBLL.AddMsg(recordid, "车牌号码:" + strinfo[2] + ",派工给" + serviceworker); ClsBLL.ServicePauseStart(recordid); 刷新ToolStripMenuItem_Click(null, null); } } } } } catch (Exception Err) { MessageBox.Show(Err.Message); } } IsMove = false; }