@ -102,20 +102,91 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer
dbHelper . AddParameter ( "@reportId" , lR_planID ) ;
DataTable table = dbHelper . ToDataTable ( ) ;
foreach ( DataRow row in table . Rows )
{
row [ "实际重量" ] = Convert . ToSingle ( row [ "实际重量" ] ) . ToString ( "#0.00" ) ;
row [ "实际公差" ] = Convert . ToSingle ( row [ "实际公差" ] ) . ToString ( "#0.00" ) ;
}
clientGrid . DataSource = table ;
dbHelper . ClearParameter ( ) ;
string sql = $"select t1.mixBatch as 批次,t1.mixStep as 步号,t2.ActionName as 动作,t1.mixTime as 时间,t1.mixTemp as 温度,t1.mixSpeed as 速度 from Report_DryMixer_Detail t1\r\nleft join ActionCode t2 on t2.Code=t1.actCode\r\nwhere t2.DeviceUnitId=1 and t1.reportId='{lR_planID}' order by actCode" ;
string sql = $"select t1.actCode, t1.mixBatch as 批次,t1.mixStep as 步号," +
$"t2.ActionName as 动作,t1.mixTime as 时间,t1.mixTemp as 温度," +
$"t1.mixSpeed as 速度 from Report_DryMixer_Detail t1\r\nleft join ActionCode t2 on t2.Code=t1.actCode\r\nwhere t2.DeviceUnitId=1 and t1.reportId='{lR_planID}' order by actCode" ;
dbHelper . CommandText = sql . ToString ( ) ;
dbHelper . CommandType = System . Data . CommandType . Text ;
DataTable tableB = dbHelper . ToDataTable ( ) ;
DataTable newTable = GetDefault ( ) ;
foreach ( DataRow row in tableB . Rows )
{
var dr = newTable . NewRow ( ) ;
dr [ "批次" ] = row [ "批次" ] ;
dr [ "步号" ] = row [ "步号" ] ;
dr [ "动作" ] = DryStepConvert ( Convert . ToInt32 ( row [ "actCode" ] ) ) ;
dr [ "时间" ] = ConverToTime ( Convert . ToInt32 ( row [ "时间" ] ) ) ;
dr [ "速度" ] = row [ "速度" ] ;
dr [ "记录时间" ] = row [ "记录时间" ] ;
dr [ "速度" ] = Convert . ToSingle ( row [ "速度" ] ) . ToString ( "#0.00" ) ;
newTable . Rows . Add ( dr ) ;
}
clientGrid2 . DataSource = newTable ;
}
}
string ConverToTime ( int duration )
{
TimeSpan ts = new TimeSpan ( 0 , 0 , Convert . ToInt32 ( duration ) ) ;
string str = "" ;
if ( ts . Hours > 0 )
{
str = ts . Hours . ToString ( ) + "小时 " + ts . Minutes . ToString ( ) + "分钟 " + ts . Seconds + "秒" ;
}
if ( ts . Hours = = 0 & & ts . Minutes > 0 )
{
str = ts . Minutes . ToString ( ) + "分钟 " + ts . Seconds + "秒" ;
}
if ( ts . Hours = = 0 & & ts . Minutes = = 0 )
{
str = ts . Seconds + "秒" ;
}
return str ;
}
clientGrid2 . DataSource = tableB ;
private DataTable GetDefault ( )
{
var tableNewB = new DataTable ( ) ;
tableNewB . Columns . Add ( "批次" , typeof ( string ) ) ;
tableNewB . Columns . Add ( "步号" , typeof ( string ) ) ;
tableNewB . Columns . Add ( "动作" , typeof ( string ) ) ;
tableNewB . Columns . Add ( "时间" , typeof ( string ) ) ;
//tableNewB.Columns.Add("温度", typeof(string));
tableNewB . Columns . Add ( "速度" , typeof ( string ) ) ;
tableNewB . Columns . Add ( "记录时间" , typeof ( string ) ) ;
return tableNewB ;
}
private string DryStepConvert ( int code )
{
switch ( code )
{
case 1 : return "加粉料" ;
case 4 : return "搅拌" ;
case 6 : return "等待排料" ;
default : return "无" ;
}
}
}
}