|
|
|
|
|
using CentralControl.DBDAO;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
using XGL.Data.DBService;
|
|
|
|
|
|
using XGL.Models.Model.FoamingMac;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XGL.Views
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// FormClassesTime.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class FormClassesTime : Window
|
|
|
|
|
|
{
|
|
|
|
|
|
FormingMachineService formingMachineService = new FormingMachineService();
|
|
|
|
|
|
FoamingMacModel _foamingMacModel;
|
|
|
|
|
|
public FormClassesTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public FormClassesTime(FoamingMacModel foamingMac)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
_foamingMacModel = foamingMac;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//DBService ser = new DBService();
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
GetHour(); GetMin(); GetAllTime();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string beginTime = cbxhour.Text + ":" + cbxmin.Text;
|
|
|
|
|
|
string endTime = cbxhour1.Text + ":" + cbxmin1.Text;
|
|
|
|
|
|
string beginTime1 = cbxhour2.Text + ":" + cbxmin2.Text;
|
|
|
|
|
|
string endTime1 = cbxhour3.Text + ":" + cbxmin3.Text;
|
|
|
|
|
|
|
|
|
|
|
|
bool i = DBService.ModShiftTime("BC002", beginTime, endTime, "BC001", beginTime1, endTime1);
|
|
|
|
|
|
if (i)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("更新成功");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void GetTime(string beforTime, out string afterHour, out string afterMin)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int index = beforTime.IndexOf(':');
|
|
|
|
|
|
afterHour =beforTime.Substring(0, 2);
|
|
|
|
|
|
afterMin = beforTime.Substring(index+1, 2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void GetAllTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
DataTable dt= DBService.getShiftTime();
|
|
|
|
|
|
string beginHour = "";
|
|
|
|
|
|
string beginMin = "";
|
|
|
|
|
|
string endHour = "";
|
|
|
|
|
|
string endMin = "";
|
|
|
|
|
|
foreach (DataRow dr in dt.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (dr["Shift_Code"].ToString() == "BC002") //白班
|
|
|
|
|
|
{
|
|
|
|
|
|
GetTime(dr["Shift_Start_Time"].ToString(), out beginHour, out beginMin);
|
|
|
|
|
|
cbxhour.Text = beginHour;
|
|
|
|
|
|
cbxmin.Text = beginMin;
|
|
|
|
|
|
|
|
|
|
|
|
GetTime(dr["Shift_End_Time"].ToString(), out endHour, out endMin);
|
|
|
|
|
|
cbxhour1.Text = endHour;
|
|
|
|
|
|
cbxmin1.Text = endMin;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
GetTime(dr["Shift_Start_Time"].ToString(), out beginHour, out beginMin);
|
|
|
|
|
|
cbxhour2.Text = beginHour;
|
|
|
|
|
|
cbxmin2.Text = beginMin;
|
|
|
|
|
|
|
|
|
|
|
|
GetTime(dr["Shift_End_Time"].ToString(), out endHour, out endMin);
|
|
|
|
|
|
cbxhour3.Text = endHour;
|
|
|
|
|
|
cbxmin3.Text = endMin;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> listMin = new List<string>();
|
|
|
|
|
|
public void GetMin()
|
|
|
|
|
|
{
|
|
|
|
|
|
listMin = new List<string>();
|
|
|
|
|
|
for (int i = 0; i <= 60; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
string minStr = i.ToString().PadLeft(2, '0');
|
|
|
|
|
|
listMin.Add(minStr);
|
|
|
|
|
|
}
|
|
|
|
|
|
cbxmin.ItemsSource = listMin;
|
|
|
|
|
|
cbxmin1.ItemsSource = listMin;
|
|
|
|
|
|
cbxmin2.ItemsSource = listMin;
|
|
|
|
|
|
cbxmin3.ItemsSource = listMin;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> listHour = new List<string>();
|
|
|
|
|
|
public void GetHour()
|
|
|
|
|
|
{
|
|
|
|
|
|
listHour = new List<string>();
|
|
|
|
|
|
for (int i = 1; i <= 24; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
string minStr = i.ToString().PadLeft(2, '0'); ;
|
|
|
|
|
|
listHour.Add(minStr);
|
|
|
|
|
|
}
|
|
|
|
|
|
cbxhour.ItemsSource = listHour;
|
|
|
|
|
|
cbxhour1.ItemsSource = listHour;
|
|
|
|
|
|
cbxhour2.ItemsSource = listHour;
|
|
|
|
|
|
cbxhour3.ItemsSource = listHour;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void txtBarcode_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
//this.lbMsg.Content = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|