private bool 是否能组合(专家任务 x, 车辆 y, int 后续作业计划) { if (后续作业计划 < 1) { return(true); } return(false); }
public static void 车辆_车主驾驶员_对应(object sender, SelectedDataValueChangedEventArgs e) { if (e.DataControlName == "车辆编号") { IDisplayManager dm = sender as IDisplayManager; IDataControl dc = e.Container as IDataControl; if (dc != null) { if (dc.SelectedDataValue != null) { 车辆 cl = EntityBufferCollection.Instance.Get <车辆>(dc.SelectedDataValue); if (cl != null) { if (dm.DataControls["车主编号"] != null && dm.DataControls["车主编号"].SelectedDataValue == null) { dm.DataControls["车主编号"].SelectedDataValue = cl.车主编号; } if (dm.DataControls["承运人编号"] != null && dm.DataControls["承运人编号"].SelectedDataValue == null) { dm.DataControls["承运人编号"].SelectedDataValue = cl.车主编号; } if (dm.DataControls["驾驶员编号"] != null && dm.DataControls["驾驶员编号"].SelectedDataValue == null) { dm.DataControls["驾驶员编号"].SelectedDataValue = cl.默认驾驶员编号; } } } } else { Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell; if (cell.Value != null) { 车辆 cl = EntityBufferCollection.Instance.Get <车辆>(cell.Value); if (cl != null) { if (cell.ParentRow.Cells["车主编号"] != null && cell.ParentRow.Cells["车主编号"].Value == null) { cell.ParentRow.Cells["车主编号"].Value = cl.车主编号; } if (cell.ParentRow.Cells["承运人编号"] != null && cell.ParentRow.Cells["承运人编号"].Value == null) { cell.ParentRow.Cells["承运人编号"].Value = cl.车主编号; } if (cell.ParentRow.Cells["驾驶员编号"] != null && cell.ParentRow.Cells["驾驶员编号"].Value == null) { cell.ParentRow.Cells["驾驶员编号"].Value = cl.默认驾驶员编号; } } } } } }
public 车辆详细信息(车辆 cl) { System.Diagnostics.Debug.Assert(cl != null, "车辆详细信息车辆不能为空"); InitializeComponent(); m_cl = cl; m_dm = AssociateDataControlsInDisplayManager(new Control[] { pnl车辆忠诚度, pnl车牌号, pnl车型, pnl车主联系方式, pnl核定载重, pnl驾驶员联系方式, pnl是否监管车, pnl所属车队, pnl车主, pnl驾驶员 }, "实时监控_车辆作业_车辆详细信息"); }
void 转关箱预排车_DoubleClick(object sender, EventArgs e) { Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell; if (srcCell == null) { return; } if (srcCell.ParentColumn.FieldName == "后续作业计划") { 车辆 cl = srcCell.ParentRow.Tag as 车辆; if (cl != null) { new 单车后续作业计划(cl).ShowDialog(); } } else if (srcCell.ParentColumn.FieldName == "提单号") { new 进口箱批量任务确认((string)srcCell.Value).ShowDialog(); } }
public static void 油费金额计算(object sender, EventArgs e) { decimal count = 0; if (sender is Xceed.Grid.DataCell) { Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; if (cell.ReadOnly || !((string)row.Cells["费用项编号"].Value == "204" || (string)row.Cells["费用项编号"].Value == "205") || row.Cells["车辆编号"].Value == null) { return; } if (row.Cells["升数"] != null && row.Cells["升数"].Value != null) { count = (decimal)row.Cells["升数"].Value; } else if (row.Cells["数量"] != null && row.Cells["数量"].Value != null) { count = (decimal)row.Cells["数量"].Value; } else { return; } //ArchiveSeeForm form = cell.GridControl.FindForm() as ArchiveSeeForm; 车辆 cl = null; //if ((form.DisplayManager.CurrentItem) is 业务费用) //{ // cl = (form.DisplayManager.CurrentItem as 业务费用).车辆; //} //else if ((form.DisplayManager.CurrentItem) is 非业务车辆费用) //{ // cl = (form.DisplayManager.CurrentItem as 非业务车辆费用).车辆; //} //else //{ // throw new InvalidOperationException("实体不属于业务费用或非业务车辆费用!"); //} using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆>()) { cl = rep.Get <车辆>(new Guid(row.Cells["车辆编号"].Value.ToString())); } if (cl != null) { switch (cl.车辆类别) { case 车辆类别.自有车: case 车辆类别.代管车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { if (cbyj.HasValue) { cell.CellEditorControl.Text = (cbyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置成本油价!"); } } else { if (jsyyj.HasValue) { cell.CellEditorControl.Text = (jsyyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置驾驶员油价!"); } } break; case 车辆类别.挂靠车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "车主") { if ((string)row.Cells["费用项编号"].Value == "204") //油费 { if (czyj.HasValue) { cell.CellEditorControl.Text = (czyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置车主油价!"); } } else //定耗油 { if (czyj.HasValue && jsyyj.HasValue) { cell.CellEditorControl.Text = ((czyj - jsyyj) * count).ToString(); } else { throw new ArgumentException("数据库中必须配置车主油价、驾驶员油价!!"); } } } else { throw new ArgumentException("费用归属不规范!"); } break; case 车辆类别.外协车: break; default: throw new ArgumentException("车辆类别不规范!"); } } } else if (sender is Xceed.Grid.InsertionCell) { Xceed.Grid.InsertionCell cell = sender as Xceed.Grid.InsertionCell; Xceed.Grid.InsertionRow row = cell.ParentRow as Xceed.Grid.InsertionRow; if (cell.ReadOnly || !((string)row.Cells["费用项编号"].Value == "204" || (string)row.Cells["费用项编号"].Value == "205") || row.Cells["车辆编号"].Value == null) { return; } if (row.Cells["升数"] != null && row.Cells["升数"].Value != null) { count = (decimal)row.Cells["升数"].Value; } else if (row.Cells["数量"] != null && row.Cells["数量"].Value != null) { count = (decimal)row.Cells["数量"].Value; } else { return; } //ArchiveSeeForm form = cell.GridControl.FindForm() as ArchiveSeeForm; 车辆 cl = null; //if ((form.DisplayManager.CurrentItem) is 业务费用) //{ // cl = (form.DisplayManager.CurrentItem as 业务费用).车辆; //} //else if ((form.DisplayManager.CurrentItem) is 非业务车辆费用) //{ // cl = (form.DisplayManager.CurrentItem as 非业务车辆费用).车辆; //} //else //{ // throw new InvalidOperationException("实体不属于业务费用或非业务车辆费用!"); //} using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆>()) { cl = rep.Get <车辆>(new Guid(row.Cells["车辆编号"].Value.ToString())); } if (cl != null) { switch (cl.车辆类别) { case 车辆类别.自有车: case 车辆类别.代管车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(jsyyj), count).ToString(); } break; case 车辆类别.挂靠车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "车主") { if ((string)row.Cells["费用项编号"].Value == "204") //油费 { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(czyj), count).ToString(); } else //定耗油 { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(czyj) - Convert.ToDecimal(jsyyj), count).ToString(); } } else { throw new ArgumentException("费用归属不规范!"); } break; case 车辆类别.外协车: break; default: throw new ArgumentException("车辆类别不规范!"); } } } }
void 车队调度静态任务下达_DoubleClick(object sender, EventArgs e) { Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell; if (srcCell == null) { return; } srcCell.ParentRow.EndEdit(); if (srcCell.GridControl == m_待命车辆_单车单任务Grid) { if (srcCell.ParentColumn.FieldName == "移出") { if (srcCell.ParentRow.Cells["作业号"].Value != null) { Xceed.Grid.Cell srcCell2 = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell; //srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow); srcCell2.ParentGrid.DataRows.Remove(srcCell2.ParentRow as Xceed.Grid.DataRow); srcCell.ParentRow.Cells["作业号"].Value = null; srcCell.ParentRow.Cells["作业号"].Tag = null; srcCell.ParentRow.Cells["中心新任务号"].Value = null; srcCell.ParentRow.Cells["中心新任务号"].Tag = null; } } else if (srcCell.ParentColumn.FieldName == "确认") { if (srcCell.ParentRow.Cells["作业号"].Value != null) { return; } Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells["中心新任务号"].Tag as Xceed.Grid.Cell; if (destCell == null) { return; } 车辆 cl = srcCell.ParentRow.Tag as 车辆; 专家任务 zjrw = destCell.ParentRow.Tag as 专家任务; 车辆作业 clzy = m_clzyDao.生成车辆作业(cl, zjrw, (string)srcCell.ParentRow.Cells["作业备注"].Value); srcCell.ParentRow.Cells["作业号"].Value = clzy.作业号; srcCell.ParentRow.Cells["作业号"].Tag = clzy; srcCell.ParentRow.Cells["中心新任务号"].ForeColor = 专家调度一级静态优化.优化DisableColor; m_待命车辆_单车单任务Grid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow); srcCell.ParentRow.Cells["作业号"].Value = clzy.作业号; } else if (srcCell.ParentColumn.FieldName == "撤销") { if (srcCell.ParentRow.Cells["作业号"].Value != null) { //m_clzyDao.撤销车辆作业(srcCell.ParentRow.Cells["作业号"].Tag as 车辆作业); //srcCell.ParentRow.Cells["作业号"].Value = null; //srcCell.ParentRow.Cells["作业号"].Tag = null; return; } if (srcCell.ParentRow.Cells["中心新任务号"].Value != null) { if (srcCell.ParentRow.Cells["中心新任务号"].Tag == null) { return; } (srcCell.ParentRow.Cells["中心新任务号"].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor(); srcCell.ParentRow.Cells["中心新任务号"].Value = null; srcCell.ParentRow.Cells["中心新任务号"].Tag = null; } } } if (srcCell.ParentColumn.FieldName == "后续作业计划") { 车辆 cl = srcCell.ParentRow.Tag as 车辆; if (cl != null) { new 单车后续作业计划(cl).ShowDialog(); } } else if (srcCell.ParentColumn.FieldName == "车牌号") { new 车辆详细信息(srcCell.ParentRow.Tag as 车辆).ShowDialog(); } }
void 车队调度静态任务下达_DoubleClick(object sender, EventArgs e) { Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell; if (srcCell == null) { return; } srcCell.ParentRow.EndEdit(); if (srcCell.GridControl == m_待命车辆_单车多任务Grid) { if (srcCell.ParentColumn.FieldName == "确认") { for (int i = 1; i <= m_multiTaskCnt; ++i) { string si = i.ToString(); if (srcCell.ParentRow.Cells["中心新任务号" + si].Value != null) { Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells["中心新任务号" + si].Tag as Xceed.Grid.Cell; if (destCell == null) { continue; } if (srcCell.ParentRow.Cells["作业号" + si].Value != null) { continue; } 车辆 cl = srcCell.ParentRow.Tag as 车辆; 专家任务 zjrw = destCell.ParentRow.Tag as 专家任务; 车辆作业 clzy = m_clzyDao.生成车辆作业(cl, zjrw, (string)srcCell.ParentRow.Cells["作业备注"].Value); srcCell.ParentRow.Cells["作业号" + si].Value = clzy.作业号; srcCell.ParentRow.Cells["作业号" + si].Tag = clzy; srcCell.ParentRow.Cells["作业号Any"].Value = clzy.作业号; srcCell.ParentRow.Cells["作业号Any"].Tag = clzy; srcCell.ParentRow.Cells["中心新任务号" + si].ForeColor = 专家调度一级静态优化.优化DisableColor; } } m_待命车辆_单车多任务Grid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow); } else if (srcCell.ParentColumn.FieldName == "撤销") { if (srcCell.ParentRow.Cells["作业号Any"].Value != null) { return; } for (int i = 1; i <= m_multiTaskCnt; ++i) { string si = i.ToString(); if (srcCell.ParentRow.Cells["中心新任务号" + si].Value != null) { if (srcCell.ParentRow.Cells["中心新任务号" + si].Tag == null) { continue; } (srcCell.ParentRow.Cells["中心新任务号" + si].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor(); srcCell.ParentRow.Cells["中心新任务号" + si].Value = null; srcCell.ParentRow.Cells["中心新任务号" + si].Tag = null; } } } } if (srcCell.ParentColumn.FieldName == "后续作业计划") { 车辆 cl = srcCell.ParentRow.Tag as 车辆; if (cl != null) { new 单车后续作业计划(cl).ShowDialog(); } } else if (srcCell.ParentColumn.FieldName == "车牌号") { new 车辆详细信息(srcCell.ParentRow.Tag as 车辆).ShowDialog(); } }
public 单车后续作业计划(车辆 cl) { InitializeComponent(); m_cl = cl; }