解决报表的问题

dep
我叫锄头 11 months ago
parent 3e3fffb8a1
commit 23d160e4a0

@ -125,6 +125,11 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer
DataTable tableB = dbHelper.ToDataTable();
DataTable newTable = GetDefault();
var dateNow = DateTime.Now;
Dictionary<int, int> dic = new Dictionary<int, int>();
Dictionary<int, DateTime> Newdic = new Dictionary<int, DateTime>();
foreach (DataRow row in tableB.Rows)
{
var dr= newTable.NewRow();
@ -135,9 +140,29 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer
dr["速度"] = row["速度"];
dr["记录时间"] = row["记录时间"];
dr["速度"] = Convert.ToSingle(row["速度"]).ToString("#0.00");
dateNow = Convert.ToDateTime(row["记录时间"].ToString());
dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"]));
newTable.Rows.Add(dr);
}
for (int i = 1; i < 11; i++)
{
var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum();
Newdic.Add(i, dateNow.AddSeconds(-miao));
}
foreach (System.Data.DataRow row in newTable.Rows)
{
var bu = Convert.ToInt32(row["步号"]);
if (Newdic.ContainsKey(bu))
{
var dt = Newdic[bu];
row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss");
}
}
clientGrid2.DataSource = newTable;
}

@ -165,12 +165,14 @@ t1.actValue as 实际重量,t1.actToler as 实际公差
$" left join ActionCode t2 on t1.actCode =t2.Code\r\n\r\n " +
$" where t2.DeviceUnitId=2 and t1.reportId ='{lR_planID}'\r\n\r\n " +
$"" +
$" order by t1.actCode";
$" order by t1.mixStep";
dbHelper.CommandText = sql.ToString();
dbHelper.CommandType = System.Data.CommandType.Text;
DataTable table2 = dbHelper.ToDataTable();
Dictionary<int, int> dic = new Dictionary<int, int>();
Dictionary<int, DateTime> Newdic = new Dictionary<int, DateTime>();
var tableNewB=new DataTable();
tableNewB.Columns.Add("批次", typeof(string));
@ -180,6 +182,7 @@ t1.actValue as 实际重量,t1.actToler as 实际公差
//tableNewB.Columns.Add("温度", typeof(string));
tableNewB.Columns.Add("速度", typeof(string));
tableNewB.Columns.Add("记录时间", typeof(string));
var dateNow = DateTime.Now;
foreach (System.Data.DataRow row in table2.Rows)
{
@ -194,10 +197,38 @@ t1.actValue as 实际重量,t1.actToler as 实际公差
dr["时间"] = ConverToTime(Convert.ToInt32(row["时间"]));
//dr["温度"] = row["温度"];
dr["速度"] = row["速度"];
dr["记录时间"] = row["记录时间"];
dateNow = Convert.ToDateTime(row["记录时间"].ToString());
tableNewB.Rows.Add(dr);
dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"]));
}
for (int i = 1; i < 8; i++)
{
var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum();
Newdic.Add(i, dateNow.AddSeconds(-miao));
}
foreach (System.Data.DataRow row in tableNewB.Rows)
{
var bu = Convert.ToInt32(row["步号"]);
if(Newdic.ContainsKey(bu))
{
var dt = Newdic[bu];
row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss");
}
}
clientGrid2.DataSource = null;
clientGrid2.DataSource = tableNewB;

@ -84,14 +84,17 @@ namespace Mesnac.Action.ChemicalWeighing.Report.WetMixer
where t2.DeviceUnitId=3 and t1.reportId = @reportId
order by t1.actCode ");
order by t1.mixStep ");
dbHelper.CommandText = sqlStr.ToString();
dbHelper.CommandType = System.Data.CommandType.Text;
dbHelper.AddParameter("@reportId", lR_planID);
DataTable table = dbHelper.ToDataTable();
var dateNow = DateTime.Now;
Dictionary<int, int> dic = new Dictionary<int, int>();
Dictionary<int, DateTime> Newdic = new Dictionary<int, DateTime>();
var tableNew=new DataTable();
var tableNew=new DataTable();
tableNew.Columns.Add("批次", typeof(string));
tableNew.Columns.Add("步号", typeof(string));
tableNew.Columns.Add("动作", typeof(string));
@ -114,7 +117,30 @@ namespace Mesnac.Action.ChemicalWeighing.Report.WetMixer
dr["温度"] = row["温度"];
dr["速度"] = row["速度"];
dr["记录时间"] = row["记录时间"];
dateNow = Convert.ToDateTime(row["记录时间"].ToString());
dic.Add(Convert.ToInt32(dr["步号"]), Convert.ToInt32(row["时间"]));
tableNew.Rows.Add(dr);
}
for (int i = 1; i < 3; i++)
{
var miao = dic.Where(x => x.Key >= i).Select(x => x.Value).Sum();
Newdic.Add(i, dateNow.AddSeconds(-miao));
}
foreach (System.Data.DataRow row in tableNew.Rows)
{
var bu = Convert.ToInt32(row["步号"]);
if (Newdic.ContainsKey(bu))
{
var dt = Newdic[bu];
row["记录时间"] = dt.ToString("yyyy-MM-dd HH:mm:ss");
}
}

@ -119,7 +119,7 @@
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCVisible">False</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">True</Property>
<Property name="Format" />

Loading…
Cancel
Save