diff --git a/shangjian/XGL.Data/DBService/DBService.cs b/shangjian/XGL.Data/DBService/DBService.cs index 646f48c..77723c0 100644 --- a/shangjian/XGL.Data/DBService/DBService.cs +++ b/shangjian/XGL.Data/DBService/DBService.cs @@ -2621,6 +2621,29 @@ left join basedata_nodesetting c on a.CurrNodeId=c.id return null; ; } + public static DataTable getShiftTime() + { + + StringBuilder strSql = new StringBuilder(); + strSql.Append("SELECT t.Shift_Code,t.Shift_Desc,t.Shift_Start_Time,Shift_End_Time from base_shifts_t t where del_flag=0"); + DataSet ds = Utils.netClientDBHelper.getDataSet(strSql.ToString()); + List list = new List(); + if (ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; ; + } + public static bool ModShiftTime(string Code,string beginTime,string endTime, string Code1, string beginTime1, string endTime1) + { + List sqlList = new List(); + string sql=@"update base_shifts_t set Shift_Start_Time='"+ beginTime + "', Shift_End_Time='"+ endTime + "' where del_flag = 0 and Shift_Code = '"+ Code + "'"; + string sql1 = @"update base_shifts_t set Shift_Start_Time='" + beginTime1 + "', Shift_End_Time='" + endTime1 + "' where del_flag = 0 and Shift_Code = '" + Code1 + "'"; + sqlList.Add(sql); sqlList.Add(sql1); + bool result = Utils.netClientDBHelper.executeBatchSql(sqlList); + return result; + } + /// /// 是否存在该小车记录 /// @@ -3373,5 +3396,7 @@ left join basedata_plcsetting f on a.PlcId5=f.Id // return list; // } + + } } diff --git a/shangjian/XGL/Views/.xaml.cs b/shangjian/XGL/Views/.xaml.cs new file mode 100644 index 0000000..d6b92ac --- /dev/null +++ b/shangjian/XGL/Views/.xaml.cs @@ -0,0 +1,143 @@ +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 +{ + /// + /// FormClassesTime.xaml 的交互逻辑 + /// + 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 listMin = new List(); + public void GetMin() + { + listMin = new List(); + 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 listHour = new List(); + public void GetHour() + { + listHour = new List(); + 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(); + } + } +} diff --git a/shangjian/XGL/Views/FormClassesTime.xaml b/shangjian/XGL/Views/FormClassesTime.xaml new file mode 100644 index 0000000..d1ba2fc --- /dev/null +++ b/shangjian/XGL/Views/FormClassesTime.xaml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +