private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)

{

int hand = e.RowHandle;

if (hand >= 0)

{

if (e.Column.FieldName == "OneV")

{

string obj =gridView1.GetRowCellValue(hand, "Obj").ToString();

if (obj == "高压" || obj == "低压")

{

e.Appearance.BackColor = Color.Red;

}

              }
} }

private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)

{

if (gridView1.GetDataRow(e.RowHandle) == null)

return;

if (e.Column.FieldName == "未完成数量" || e.Column.FieldName == "入库未完成数量")

{

int WeiWangChengShu = this.gridView1.GetRowCellValue(e.RowHandle, "未完成数量").ToString() == "" ? 0 : int.Parse(this.gridView1.GetRowCellValue(e.RowHandle, "未完成数量").ToString());

int RukuWeiWangChengShu = this.gridView1.GetRowCellValue(e.RowHandle, "入库未完成数量").ToString() == "" ? 0 : int.Parse(this.gridView1.GetRowCellValue(e.RowHandle, "入库未完成数量").ToString());

if (WeiWangChengShu > 0 || RukuWeiWangChengShu > 0)

{

this.gridView1.SetRowCellValue(e.RowHandle, "进度跟进", "未完成");

}

}

}

private void gridView1_ShowingEditor(object sender, CancelEventArgs e)

{

int thisIndex = this.gridView1.FocusedRowHandle;

if (thisIndex < 0)

{

return;

}

string shengChangType = this.gridView1.GetRowCellValue(thisIndex, "生产类型").ToString();

if (shengChangType != "包装")

{

if (this.gridView1.FocusedColumn.FieldName == "未完成数量" || this.gridView1.FocusedColumn.FieldName == "入库未完成数量")

{

e.Cancel = true;

}

}

}

private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)

{

if (this.gridView1.FocusedColumn == e.Column)

{

if (e.Column == this.未完成数量 || e.Column == this.入库未完成数量)

{

//String strUnitNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString();

//String strRukuUnitNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString();//入库未完成数量

int strnum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString()==""?0:int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "未完成数量").ToString());

int strRukuNum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString() == "" ? 0 :int.Parse( gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量").ToString());

//if(int.TryParse(strUnitNum,out strnum))

//{

// if (int.TryParse(strRukuUnitNum,out strRukuNum))

// {

//生产类型=‘包装‘的时候 ;输入的未完成数量/入库未完成数量 不允许大于 任务数;当生产类型<>‘包装’的时候 未完成数量/入库未完成数量 不允许编辑

if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "生产类型").ToString() == "包装")

{

int tasknum = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "任务数").ToString() == "" ? 0 : int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "任务数").ToString());

if (strnum > tasknum || strRukuNum > tasknum)

{

gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "未完成数量", "0");

gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "入库未完成数量", "0");

return;

}

}

                        if (strnum > 0 || strRukuNum>0)
{
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "进度跟进", "未完成");
}
else
{
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "进度跟进", "");
}
// }
//}
}
}
}

gridControl 中CellValueChanged,ShowingEditor,CustomDrawCell的用法的更多相关文章

  1. Spring mvc中@RequestMapping 6个基本用法

    Spring mvc中@RequestMapping 6个基本用法 spring mvc中的@RequestMapping的用法.  1)最基本的,方法级别上应用,例如: Java代码 @Reques ...

  2. Delphi中stringlist分割字符串的用法

    Delphi中stringlist分割字符串的用法 TStrings是一个抽象类,在实际开发中,是除了基本类型外,应用得最多的. 常规的用法大家都知道,现在来讨论它的一些高级的用法. 1.CommaT ...

  3. Linq中关键字的作用及用法

    Linq中关键字的作用及用法 1.All:确定序列中的所有元素是否都满足条件.如果源序列中的每个元素都通过指定谓词中的测试,或者序列为空,则为 true:否则为 false. Demo: 此示例使用 ...

  4. 标准C++中的string类的用法总结

    标准C++中的string类的用法总结 相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用.但是如果离开了MFC框架,还有 ...

  5. html中的alt和title用法区别

    html中的alt和title用法区别 首先明确一下概念,alt是html标签的属性,而title既是html标签,又是html属性.title标签这个不用多说,网页的标题就是写在<title& ...

  6. HTML中的target(_self,_blank)用法总结

    HTML中的target(_self,_blank)用法总结 最近一个项目,多次遇到target='_self', target='_blank'的用法, 再次总结一下: 1.<a>标签 ...

  7. jquery中append跟prepend的用法

    jquery中append和prepend的用法 append   是插入到元素中,并放到元素内的最后面prepend  是插入到元素中,并放到元素内的最前面例$("body"). ...

  8. js正则表达式中的问号几种用法小结

    这篇文章主要介绍了js正则表达式中的问号几种用法,比如+?,*?,{2,3}?可以停止匹配的贪婪模式,感兴趣的朋友可以参考下 在表示重复的字符后面加问号,比如+?,*?,{2,3}?可以停止匹配的贪婪 ...

  9. SQL Server 中 with tmp 临时表的用法

    SQL Server 中 with tmp 临时表的用法 ----------with临时表用法,有时候采用临时表比采用in的效率更高,避免了全表扫描. 实例中实现了查询普通题.大题.子题目的sql ...

随机推荐

  1. sharepoint:拥有完全控制权限的用户依然“拒绝访问”

    //来源 http://www.cnblogs.com/jindahao/archive/2012/04/25/2468714.html 遇到问题: 拥有完全控制权限的用户依然拒绝访问. 可能的原因: ...

  2. 拓展自定义编辑器窗口(EditorGUILayout类)

    Unity支持自行创建窗口,也支持自定义窗口布局.在Project视图中创建一个Editor文件夹,在文件夹中再创建一条脚本. 自定义窗口需要让脚本继承EditorWindow再设置MenuItem, ...

  3. LWP::UserAgent介绍1

    require LWP::UserAgent; my $ua = LWP::UserAgent->new; ); $ua->env_proxy; my $response = $ua-&g ...

  4. code style

    http://www.jianshu.com/p/0a984f999592# https://github.com/drakeet/LayoutFormatter https://github.com ...

  5. PHP来实现文件上传

    文件php <?phpif ($_FILES["file"]["error"] > 0){ echo '错误: ' . $_FILES[" ...

  6. Xcode-之项目重命名

    一.前言 在iOS开发过程中,对于以前的项目或者想改一下项目的名字,都会遇到比较麻烦的事情.直接改项目名,然而它会牵扯一大堆问题,并且不能把所有的名字都能改过来.有些文件改了项目名后,引导路径错误,导 ...

  7. 第一章 flume架构介绍

    1.flume概念介绍 1.1 常见的分布式日志收集系统                             Scribe是facebook开源的日志收集系统,在facebook内部已经得到大量的 ...

  8. 投票项目-bootstrap

    <script id="src" type="text/tmpl"> //script标签的type写成这个,浏览器会认为他不是javascript ...

  9. LINQ 查询集合总的重复项

                      select new FMDS_FarmPlotNewInfo                   {                        FarmPlo ...

  10. JS代码备忘

    function $(v) { if (typeof v === 'function') { window.onload = v; } else if (typeof v === 'string') ...