|
|
|
@ -180,75 +180,82 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
{
|
|
|
|
|
lock (GridRefreshLocker)
|
|
|
|
|
{
|
|
|
|
|
//取出近两日的报表数据
|
|
|
|
|
List<ZxDailyReportEntity> dailyEntity = _zxDailyReportService.GetDailyReportInfos();
|
|
|
|
|
_monitorDataSources.Clear();
|
|
|
|
|
if (dailyEntity == null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int showCount = 0;
|
|
|
|
|
if (dailyEntity.Count >= 50)
|
|
|
|
|
{
|
|
|
|
|
showCount = 50;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
showCount = dailyEntity.Count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < showCount; i++)
|
|
|
|
|
{
|
|
|
|
|
_monitorDataSources.Add(new MonitorDataSource()
|
|
|
|
|
//取出近两日的报表数据
|
|
|
|
|
List<ZxDailyReportEntity> dailyEntity = _zxDailyReportService.GetDailyReportInfos();
|
|
|
|
|
_monitorDataSources.Clear();
|
|
|
|
|
if (dailyEntity == null)
|
|
|
|
|
{
|
|
|
|
|
No = i + 1,
|
|
|
|
|
VulcanizationNo = dailyEntity[i].VulcanizationNo,
|
|
|
|
|
StartTime = dailyEntity[i].StartTime.ToString("HH:mm:ss"),
|
|
|
|
|
RecipeName = dailyEntity[i].RecipeName,
|
|
|
|
|
RecipeCode = dailyEntity[i].RecipeCode,
|
|
|
|
|
SpecCode = dailyEntity[i].SpecCode,
|
|
|
|
|
DeviceNo = dailyEntity[i].DeviceNo.ToString(),
|
|
|
|
|
StandardWeight = dailyEntity[i].StandardWeight ?? 0,
|
|
|
|
|
RawTireWeight = dailyEntity[i].RawTireWeight ?? 0,
|
|
|
|
|
BaseRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].BaseEndTime),
|
|
|
|
|
MidRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].MidEndTime),
|
|
|
|
|
FaceRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].FaceEndTime),
|
|
|
|
|
RepeatWeight = dailyEntity[i].RepeatWeight ?? 0,
|
|
|
|
|
IsDone = dailyEntity[i].IsDone == 1 ? "已完成" : "未完成"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MonitorDataGridView.DataSource = null;
|
|
|
|
|
MonitorDataGridView.DataSource = _monitorDataSources;
|
|
|
|
|
MonitorDataGridView.CellFormatting += MonitorDataGridView_CellFormatting;
|
|
|
|
|
|
|
|
|
|
int daycount = dailyEntity.Count(x => x.StartTime >= DayStartTime && x.StartTime <= DayEndTine && x.IsDone == 1);
|
|
|
|
|
DayProductNumTextBox.Text = daycount.ToString();
|
|
|
|
|
int nightcount = dailyEntity.Count(x => x.StartTime >= NightStartTime && x.StartTime <= NightEndTime && x.IsDone == 1);
|
|
|
|
|
NightProductNumTextBox.Text = nightcount.ToString();
|
|
|
|
|
NowDateProductNumTextBox.Text = dailyEntity.Count(x => x.StartTime >= LastDayStartTime && x.StartTime <= LastNightEndTime).ToString();
|
|
|
|
|
|
|
|
|
|
ZxDailyReportEntity first = dailyEntity.FirstOrDefault();
|
|
|
|
|
if (first == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
RecipeCodeLabel.Text = first.RecipeCode;
|
|
|
|
|
SpecCodeLabel.Text = first.SpecCode;
|
|
|
|
|
RecipeNameLabel.Text = first.RecipeName;
|
|
|
|
|
ZxRecipeEntity recipeEntity = ZxRecipeService.Instance.GetRecipeInfosByRecipeCode(first.RecipeCode).FirstOrDefault();
|
|
|
|
|
if (recipeEntity != null)
|
|
|
|
|
{
|
|
|
|
|
//SpecNameLabel.Text = recipeEntity.RecipeName;
|
|
|
|
|
ZxRecipeParaEntity paraEntity = ZxRecipeParaService.Instance.GetRecipeParaInfoByRecipeCode(recipeEntity.RecipeCode).FirstOrDefault();
|
|
|
|
|
if (paraEntity != null)
|
|
|
|
|
{
|
|
|
|
|
RawTireWeightLabel.Text = paraEntity.TireWeight.ToString();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int showCount = 0;
|
|
|
|
|
if (dailyEntity.Count >= 50)
|
|
|
|
|
{
|
|
|
|
|
showCount = 50;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
showCount = dailyEntity.Count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < showCount; i++)
|
|
|
|
|
{
|
|
|
|
|
_monitorDataSources.Add(new MonitorDataSource()
|
|
|
|
|
{
|
|
|
|
|
No = i + 1,
|
|
|
|
|
VulcanizationNo = dailyEntity[i].VulcanizationNo ?? "",
|
|
|
|
|
StartTime = dailyEntity[i].StartTime.ToString("HH:mm:ss"),
|
|
|
|
|
RecipeName = dailyEntity[i].RecipeName ?? "",
|
|
|
|
|
RecipeCode = dailyEntity[i].RecipeCode ?? "",
|
|
|
|
|
SpecCode = dailyEntity[i].SpecCode ?? "",
|
|
|
|
|
DeviceNo = (dailyEntity[i].DeviceNo ?? 0).ToString(),
|
|
|
|
|
StandardWeight = dailyEntity[i].StandardWeight ?? 0,
|
|
|
|
|
RawTireWeight = dailyEntity[i].RawTireWeight ?? 0,
|
|
|
|
|
BaseRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].BaseEndTime),
|
|
|
|
|
MidRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].MidEndTime),
|
|
|
|
|
FaceRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].FaceEndTime),
|
|
|
|
|
RepeatWeight = dailyEntity[i].RepeatWeight ?? 0,
|
|
|
|
|
IsDone = dailyEntity[i].IsDone == 1 ? "已完成" : "未完成"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MonitorDataGridView.DataSource = null;
|
|
|
|
|
MonitorDataGridView.DataSource = _monitorDataSources;
|
|
|
|
|
MonitorDataGridView.CellFormatting += MonitorDataGridView_CellFormatting;
|
|
|
|
|
|
|
|
|
|
int daycount = dailyEntity.Count(x => x.StartTime >= DayStartTime && x.StartTime <= DayEndTine && x.IsDone == 1);
|
|
|
|
|
DayProductNumTextBox.Text = daycount.ToString();
|
|
|
|
|
int nightcount = dailyEntity.Count(x => x.StartTime >= NightStartTime && x.StartTime <= NightEndTime && x.IsDone == 1);
|
|
|
|
|
NightProductNumTextBox.Text = nightcount.ToString();
|
|
|
|
|
NowDateProductNumTextBox.Text = dailyEntity.Count(x => x.StartTime >= LastDayStartTime && x.StartTime <= LastNightEndTime).ToString();
|
|
|
|
|
|
|
|
|
|
ZxDailyReportEntity first = dailyEntity.FirstOrDefault();
|
|
|
|
|
if (first == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
RecipeCodeLabel.Text = first.RecipeCode;
|
|
|
|
|
SpecCodeLabel.Text = first.SpecCode;
|
|
|
|
|
RecipeNameLabel.Text = first.RecipeName;
|
|
|
|
|
ZxRecipeEntity recipeEntity = ZxRecipeService.Instance.GetRecipeInfosByRecipeCode(first.RecipeCode).FirstOrDefault();
|
|
|
|
|
if (recipeEntity != null)
|
|
|
|
|
{
|
|
|
|
|
//SpecNameLabel.Text = recipeEntity.RecipeName;
|
|
|
|
|
ZxRecipeParaEntity paraEntity = ZxRecipeParaService.Instance.GetRecipeParaInfoByRecipeCode(recipeEntity.RecipeCode).FirstOrDefault();
|
|
|
|
|
if (paraEntity != null)
|
|
|
|
|
{
|
|
|
|
|
RawTireWeightLabel.Text = paraEntity.TireWeight.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
RgvNoLabel.Text = first.DeviceNo.ToString();
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
RgvNoLabel.Text = first.DeviceNo.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -260,20 +267,31 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
private void MonitorDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// 确保是针对 "IsDone" 列的操作
|
|
|
|
|
if (MonitorDataGridView.Columns[e.ColumnIndex].Name == "IsDone" && e.RowIndex >= 0)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var cell = MonitorDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
|
|
|
|
string status = cell.Value?.ToString();
|
|
|
|
|
if (MonitorDataGridView.Columns[e.ColumnIndex].Name == "IsDone" && e.RowIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
var cell = MonitorDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
|
|
|
|
|
string status = cell.Value?.ToString();
|
|
|
|
|
|
|
|
|
|
if (status == "已完成")
|
|
|
|
|
{
|
|
|
|
|
cell.Style.BackColor = Color.LightGreen; // 绿色
|
|
|
|
|
}
|
|
|
|
|
else if (status == "未完成")
|
|
|
|
|
{
|
|
|
|
|
cell.Style.BackColor = Color.Yellow; // 黄色
|
|
|
|
|
if (status == "已完成")
|
|
|
|
|
{
|
|
|
|
|
cell.Style.BackColor = Color.LightGreen; // 绿色
|
|
|
|
|
}
|
|
|
|
|
else if (status == "未完成")
|
|
|
|
|
{
|
|
|
|
|
cell.Style.BackColor = Color.Yellow; // 黄色
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cell.Style.BackColor = Color.Transparent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -289,5 +307,14 @@ namespace HighWayIot.Winform.UserControlPages
|
|
|
|
|
MoveText.Text = form.OutValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MonitorDataGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lock (GridRefreshLocker)
|
|
|
|
|
{
|
|
|
|
|
MonitorDataGridView.DataSource = null;
|
|
|
|
|
MonitorDataGridView.DataSource = _monitorDataSources;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|