惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
Tenable Blog
Project Zero
Project Zero
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
S
Schneier on Security
Scott Helme
Scott Helme
S
Securelist
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
IT之家
IT之家
V
V2EX
F
Fortinet All Blogs
Simon Willison's Weblog
Simon Willison's Weblog
K
Kaspersky official blog
博客园_首页
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
Spread Privacy
Spread Privacy
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
有赞技术团队
有赞技术团队
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
S
SegmentFault 最新的问题
AWS News Blog
AWS News Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost

博客园 - 追逐苦痛

20230509001 - DataTable 导出成Excel 20230425001 - DataGridView绑定了数据之后, 再添加CheckBox列的解决方案 20230424001 - 打开文件对话框OpenFileDialog类 20200812001 - SQL openquery 传参数 ASP.net用Graphics实现的统计图(折线图、柱状图、饼图) 20190917002 - SQL 中处理交叉重复条件参考 20190917001 - 去除DataTable中重复的数据 20190410001 - 遍历控件参考 20180709001 - 委托传值 20180706001 - 动态添加 tabPage 20180519001 - DataTable Group by功能参考 20161020001 DataGridView 选中的 DataGridViewCheckBoxCell 不添加重复项 20161014006 DataGridView Combobox 数据绑定与传值 20161013001 DataGridView 数据转 DataTable 20161011001 treeView 递归 20160929001 Guid生成 20160815001 - 修改字段的长度 20160715001 - 分发与订阅 总结 20160712001 SQL server R2 更名
20161014001 DataGridView 单元格内容 自动计算
追逐苦痛 · 2016-10-14 · via 博客园 - 追逐苦痛

private void T_Form_CY_CBD_D_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (T_Form_CY_CBD_D.Rows.Count > 0 && e.RowIndex >= 0)
            {

                // 计算制造成本的公式依据:工费率/产能/直通率.
                if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "DFWorkRate" || T_Form_CY_CBD_D.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "DFCapacity" || T_Form_CY_CBD_D.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "DFFPY")
                {
                    try
                    {
                        T_Form_CY_CBD_D.Columns["DFManufacturingCost"].ReadOnly = true;

                        if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFWorkRate"].Value.ToString().Trim() == "")
                        {
                            T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFWorkRate"].Value = "1";
                        }
                        if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFCapacity"].Value.ToString().Trim() == "")
                        {
                            T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFCapacity"].Value = "1";
                        }
                        if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFFPY"].Value.ToString().Trim() == "")
                        {
                            T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFFPY"].Value = "1";
                        }

                        T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFManufacturingCost"].Value =
                        System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFWorkRate"].Value) /
                        System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFCapacity"].Value) /
                        System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFFPY"].Value);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }

                // 计算浪费成本的公式依据: (制造成本)*(1-效率)/ 效率)
                if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "DFManufacturingCost"
                    || T_Form_CY_CBD_D.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name == "DFEfficiency")
                {
                    try
                    {
                        T_Form_CY_CBD_D.Columns["DFWasteCost"].ReadOnly = true;

                        if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFManufacturingCost"].Value.ToString().Trim() == "")
                        {
                            T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFManufacturingCost"].Value = "0.00";
                        }
                        if (T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFEfficiency"].Value.ToString().Trim() == "")
                        {
                            T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFEfficiency"].Value = "1";
                        }

                        T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFWasteCost"].Value =
                        System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFManufacturingCost"].Value) *
                        (1 - System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFEfficiency"].Value)) /
                        System.Convert.ToDecimal(T_Form_CY_CBD_D.Rows[e.RowIndex].Cells["DFEfficiency"].Value);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }

                //

            }
        }