夜班白天统计

dep
我叫锄头 9 months ago
parent 97e842c0a7
commit 1fe2c0ff84

@ -100,11 +100,14 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
private void WhiteWork_Click(object sender, EventArgs e)
{
dt = GetDefault();
DateTime nowTime = DateTime.Now;
DateTime starttime;
DateTime endtime;
DateTime starttime=DateTime.Now;
DateTime endtime=DateTime.Now;
if (((Button)sender).Text.Contains("白"))
{
//如果大于当天8点 就展示当天的白班 否则展示上一个白班
if (nowTime >= DateTime.Now.Date.AddHours(8))
{
@ -116,9 +119,34 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
starttime = DateTime.Now.Date.AddHours(-17).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(-5).AddMinutes(30);
}
}
else
{
//如果小于当天20点 就展示当天的前一个晚班
if (nowTime <= DateTime.Now.Date.AddHours(20))
{
starttime = DateTime.Now.Date.AddHours(-5).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(7).AddMinutes(30);
}
else
{
starttime = DateTime.Now.Date.AddHours(19).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(31).AddMinutes(30);
}
}
string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss");
string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss");
startDate.Value = Convert.ToDateTime(starttime.ToString("yyyy-MM-dd"));
endDate.Value = Convert.ToDateTime(endtime.ToString("yyyy-MM-dd"));
startTime.Value = Convert.ToDateTime(starttime.ToString("HH:mm:ss"));
endTime.Value = Convert.ToDateTime(endtime.ToString("HH:mm:ss"));
FillData(statValue, endValue);
}
@ -126,6 +154,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
private void FillData(string statValue, string endValue)
{
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
list = new List<GhWuLiaoIniEntity>();

@ -89,8 +89,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
//selectButton.Click += SelectButton_Click;
//dataGridView.CellClick += MoreData_Click;
//dataGridView.CellValueChanged += MoreData_Click;
//WhiteWork.Click += WhiteWork_Click;
//NightWork.Click += NightWork_Click;
WhiteWork.Click += WhiteWork_Click;
NightWork.Click += WhiteWork_Click;
SelectButton_Click(new object(),new EventArgs());
MoreData_Click(new object(), new EventArgs());
@ -118,6 +118,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
DateTime starttime;
DateTime endtime;
if (((Button)sender).Text.Contains("白"))
{
//如果大于当天8点 就展示当天的白班 否则展示上一个白班
if (nowTime >= DateTime.Now.Date.AddHours(8))
{
@ -129,6 +131,28 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
starttime = DateTime.Now.Date.AddHours(-17).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(-5).AddMinutes(30);
}
}
else
{
//如果小于当天20点 就展示当天的前一个晚班
if (nowTime <= DateTime.Now.Date.AddHours(20))
{
starttime = DateTime.Now.Date.AddHours(-5).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(7).AddMinutes(30);
}
else
{
starttime = DateTime.Now.Date.AddHours(19).AddMinutes(30);
endtime = DateTime.Now.Date.AddHours(31).AddMinutes(30);
}
}
startDate.Value = Convert.ToDateTime(starttime.ToString("yyyy-MM-dd"));
endDate.Value = Convert.ToDateTime(endtime.ToString("yyyy-MM-dd"));
startTime.Value = Convert.ToDateTime(starttime.ToString("HH:mm:ss"));
endTime.Value = Convert.ToDateTime(endtime.ToString("HH:mm:ss"));
string statValue = starttime.ToString("yyyy-MM-dd HH:mm:ss");
string endValue = endtime.ToString("yyyy-MM-dd HH:mm:ss");

Loading…
Cancel
Save