|
|
|
|
@ -108,9 +108,76 @@ namespace XGL.Views
|
|
|
|
|
{
|
|
|
|
|
List<FoamingMacModel> orderList = new List<FoamingMacModel>();
|
|
|
|
|
|
|
|
|
|
int currHour = DateTime.Now.Hour;
|
|
|
|
|
int currMinute = DateTime.Now.Minute;
|
|
|
|
|
//modelWareHouse = new List<WorkOrder>();
|
|
|
|
|
//userDbWareHouse = new DBService();
|
|
|
|
|
int shiftId = 0;
|
|
|
|
|
DataTable shiftlist = formingMachineService.GetShiftList();
|
|
|
|
|
string endTimeRecord = "";
|
|
|
|
|
string startTimeRecord = "";
|
|
|
|
|
foreach (DataRow shift in shiftlist.Rows)
|
|
|
|
|
{
|
|
|
|
|
string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':');
|
|
|
|
|
string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':');
|
|
|
|
|
|
|
|
|
|
// 创建两个不带日期的时间点
|
|
|
|
|
TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
|
|
|
|
|
TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0);
|
|
|
|
|
// 比较当前时间点和班次开始的时间点
|
|
|
|
|
int comparisonResultStart = TimeSpan.Compare(currTime, startTime);
|
|
|
|
|
// 比较当前时间点和班次结束的时间点
|
|
|
|
|
int comparisonResultEnd = TimeSpan.Compare(currTime, endTime);
|
|
|
|
|
//if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); }
|
|
|
|
|
if (comparisonResultStart >= 0 && comparisonResultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
endTimeRecord = shift["Shift_Start_Time"].ToString();
|
|
|
|
|
startTimeRecord = shift["Shift_End_Time"].ToString();
|
|
|
|
|
shiftId = Convert.ToInt32(shift["shift_id"].ToString());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (comparisonResultStart >= 0 || comparisonResultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
endTimeRecord = shift["Shift_Start_Time"].ToString();
|
|
|
|
|
startTimeRecord = shift["Shift_End_Time"].ToString();
|
|
|
|
|
shiftId = Convert.ToInt32(shift["shift_id"].ToString());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
|
|
|
|
|
//{
|
|
|
|
|
// shiftId = shift.shiftId;
|
|
|
|
|
// break;
|
|
|
|
|
//}
|
|
|
|
|
//else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
|
|
|
|
|
//{
|
|
|
|
|
// shiftId = shift.shiftId;
|
|
|
|
|
// break;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string[] endTimeReally = endTimeRecord.Split(':');
|
|
|
|
|
string[] startTimeReally = startTimeRecord.Split(':');
|
|
|
|
|
DateTime currShiftDate = DateTime.Now.Date;
|
|
|
|
|
TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
|
|
|
|
|
TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
//计算白夜班工作日期用
|
|
|
|
|
int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew);
|
|
|
|
|
// 比较当前时间点和班次结束的时间点
|
|
|
|
|
int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew);
|
|
|
|
|
|
|
|
|
|
//夜班、
|
|
|
|
|
if (resultstart < 0 && resultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
currShiftDate = DateTime.Now.Date.AddDays(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//modelWareHouse = new List<WorkOrder>();
|
|
|
|
|
userDbWareHouse = new DBService();
|
|
|
|
|
DataTable dt = formingMachineService.GetFormingMachineInfo(deviceCode);
|
|
|
|
|
DataTable dt = formingMachineService.GetFormingMachineInfo(deviceCode, currShiftDate.ToString());
|
|
|
|
|
if (dt == null) return;
|
|
|
|
|
foreach (DataRow i in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
@ -127,6 +194,7 @@ namespace XGL.Views
|
|
|
|
|
order.process_id = i["route_code"].ToString();
|
|
|
|
|
order.attr1 = i["attr1"].ToString();
|
|
|
|
|
isbaiye= i["shift_id"].ToString();
|
|
|
|
|
order.totalCount = i["totalCount"].ToString();
|
|
|
|
|
if (isbaiye=="5")
|
|
|
|
|
{
|
|
|
|
|
order.isbai = "白班";
|
|
|
|
|
@ -152,6 +220,7 @@ namespace XGL.Views
|
|
|
|
|
{
|
|
|
|
|
this.dgWorkOrderInfo.ItemsSource = null;
|
|
|
|
|
this.dgWorkOrderInfo.ItemsSource = orderList;//dt.DefaultView;
|
|
|
|
|
dgWorkOrderInfo.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
System.Windows.Threading.DispatcherPriority.Render);
|
|
|
|
|
@ -169,9 +238,76 @@ namespace XGL.Views
|
|
|
|
|
{
|
|
|
|
|
List<FoamingMacModel> orderList = new List<FoamingMacModel>();
|
|
|
|
|
|
|
|
|
|
int currHour = DateTime.Now.Hour;
|
|
|
|
|
int currMinute = DateTime.Now.Minute;
|
|
|
|
|
//modelWareHouse = new List<WorkOrder>();
|
|
|
|
|
//userDbWareHouse = new DBService();
|
|
|
|
|
int shiftId = 0;
|
|
|
|
|
DataTable shiftlist = formingMachineService.GetShiftList();
|
|
|
|
|
string endTimeRecord = "";
|
|
|
|
|
string startTimeRecord = "";
|
|
|
|
|
foreach (DataRow shift in shiftlist.Rows)
|
|
|
|
|
{
|
|
|
|
|
string[] timeStart = shift["Shift_Start_Time"].ToString().Split(':');
|
|
|
|
|
string[] timeEnd = shift["Shift_End_Time"].ToString().Split(':');
|
|
|
|
|
|
|
|
|
|
// 创建两个不带日期的时间点
|
|
|
|
|
TimeSpan currTime = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
|
|
|
|
|
TimeSpan startTime = new TimeSpan(Convert.ToInt32(timeStart[0]), Convert.ToInt32(timeStart[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
TimeSpan endTime = new TimeSpan(Convert.ToInt32(timeEnd[0]), Convert.ToInt32(timeEnd[1]), 0);
|
|
|
|
|
// 比较当前时间点和班次开始的时间点
|
|
|
|
|
int comparisonResultStart = TimeSpan.Compare(currTime, startTime);
|
|
|
|
|
// 比较当前时间点和班次结束的时间点
|
|
|
|
|
int comparisonResultEnd = TimeSpan.Compare(currTime, endTime);
|
|
|
|
|
//if (comparisonResultStart > 0) { Console.WriteLine("time1 大于 time2"); }
|
|
|
|
|
if (comparisonResultStart >= 0 && comparisonResultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
endTimeRecord = shift["Shift_Start_Time"].ToString();
|
|
|
|
|
startTimeRecord = shift["Shift_End_Time"].ToString();
|
|
|
|
|
shiftId = Convert.ToInt32(shift["shift_id"].ToString());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (comparisonResultStart >= 0 || comparisonResultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
endTimeRecord = shift["Shift_Start_Time"].ToString();
|
|
|
|
|
startTimeRecord = shift["Shift_End_Time"].ToString();
|
|
|
|
|
shiftId = Convert.ToInt32(shift["shift_id"].ToString());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//if (Convert.ToInt32(timeStart[0]) <= currHourWithDecimal && currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
|
|
|
|
|
//{
|
|
|
|
|
// shiftId = shift.shiftId;
|
|
|
|
|
// break;
|
|
|
|
|
//}
|
|
|
|
|
//else if (currHourWithDecimal >= Convert.ToInt32(timeStart[0]) || currHourWithDecimal < Convert.ToInt32(timeEnd[0]))
|
|
|
|
|
//{
|
|
|
|
|
// shiftId = shift.shiftId;
|
|
|
|
|
// break;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string[] endTimeReally = endTimeRecord.Split(':');
|
|
|
|
|
string[] startTimeReally = startTimeRecord.Split(':');
|
|
|
|
|
DateTime currShiftDate = DateTime.Now.Date;
|
|
|
|
|
TimeSpan currTimeNew = new TimeSpan(currHour, currMinute, 0); // 获取当前小时+分钟数
|
|
|
|
|
TimeSpan startTimeNew = new TimeSpan(Convert.ToInt32(startTimeReally[0]), Convert.ToInt32(startTimeReally[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
TimeSpan endTimeNew = new TimeSpan(Convert.ToInt32(endTimeReally[0]), Convert.ToInt32(endTimeReally[1]), 0); // 表示9小时45分钟0秒
|
|
|
|
|
//计算白夜班工作日期用
|
|
|
|
|
int resultstart = TimeSpan.Compare(currTimeNew, startTimeNew);
|
|
|
|
|
// 比较当前时间点和班次结束的时间点
|
|
|
|
|
int resultEnd = TimeSpan.Compare(currTimeNew, endTimeNew);
|
|
|
|
|
|
|
|
|
|
//夜班、
|
|
|
|
|
if (resultstart < 0 && resultEnd < 0)
|
|
|
|
|
{
|
|
|
|
|
currShiftDate = DateTime.Now.Date.AddDays(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//modelWareHouse = new List<WorkOrder>();
|
|
|
|
|
userDbWareHouse = new DBService();
|
|
|
|
|
DataTable dt = formingMachineService.GetFormingMachineInfo(deviceCode);
|
|
|
|
|
DataTable dt = formingMachineService.GetFormingMachineInfo(deviceCode,currShiftDate.ToString());
|
|
|
|
|
if (dt == null) return;
|
|
|
|
|
foreach (DataRow i in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
|