• 20180519001


    DataSet6 = DataSet1.Copy();

    DataRow[] dr = DataSet6.Tables[0].Select(" 完工状态 = '完工异常' ");

    DataTable dt1 = DataSet6.Tables[0].Clone();

    for (int i = 0; i < dr.Length; i++)
    {
    dt1.ImportRow((DataRow)dr[i]);

    //this.Text = i.ToString();
    }

    // Group by
    DataTable dtResult = dt1.Clone();
    DataTable dtName = dt1.DefaultView.ToTable(true, "委外发票号", "委外订单号", "存货编码", "工艺名称", "订单数量", "出库数量", "未交数量", "CT不良数", "原币含税单价",
    "原币价税合计", "累计开票金额", "币种");
    for (int i = 0; i < dtName.Rows.Count; i++)
    {
    DataRow[] rows = dt1.Select(" 委外发票号 ='" + dtName.Rows[i]["委外发票号"].ToString()
    + "' and 委外订单号='" + dtName.Rows[i]["委外订单号"].ToString()
    + "' and 存货编码='" + dtName.Rows[i]["存货编码"].ToString()
    + "' and 工艺名称='" + dtName.Rows[i]["工艺名称"].ToString() + "' ");
    //temp用来存储筛选出来的数据
    DataTable temp = dtResult.Clone();
    foreach (DataRow row in rows)
    {
    temp.Rows.Add(row.ItemArray);
    }

    DataRow dr2 = dtResult.NewRow();
    dr2["委外发票号"] = dtName.Rows[i]["委外发票号"].ToString();
    dr2["委外订单号"] = dtName.Rows[i]["委外订单号"].ToString();
    dr2["存货编码"] = dtName.Rows[i]["存货编码"].ToString();
    dr2["工艺名称"] = dtName.Rows[i]["工艺名称"].ToString();
    dr2["订单数量"] = dtName.Rows[i]["订单数量"].ToString();
    dr2["出库数量"] = dtName.Rows[i]["出库数量"].ToString();
    dr2["未交数量"] = dtName.Rows[i]["未交数量"].ToString();
    dr2["CT不良数"] = dtName.Rows[i]["长腾不良数"].ToString();
    dr2["原币含税单价"] = dtName.Rows[i]["原币含税单价"].ToString();
    dr2["原币价税合计"] = dtName.Rows[i]["原币价税合计"].ToString();
    dr2["累计开票金额"] = dtName.Rows[i]["累计开票金额"].ToString();

    dr2["币种"] = dtName.Rows[i]["币种"].ToString();

    dr2["入库数量"] = temp.Compute("sum(入库数量)", "");
    dtResult.Rows.Add(dr2);
    }


    //
    DataSet9 = new DataSet();
    DataSet9.Tables.Add(dtResult);

  • 相关阅读:
    PAT查找题---1032 挖掘机技术哪家强 (20分)
    PAT查找题---1028 人口普查 (20分)
    PAT查找题---1004 成绩排名 (20分)
    01_1JAVA简介
    01考试简介
    shell时间变量拼接问题
    如何将oracle查询的结果传输给变量
    生产环境邮件问题总结
    mutt+msmtp做linux邮件客户端
    linux配置邮件客户端
  • 原文地址:https://www.cnblogs.com/hutie1980/p/9059911.html
Copyright © 2020-2023  润新知