diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 50d06df..1f42857 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -654,6 +654,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties { } } + /// + /// 查找类似 Editing historical crafts is prohibited 的本地化字符串。 + /// + public static string EHCIP { + get { + return ResourceManager.GetString("EHCIP", resourceCulture); + } + } + /// /// 查找类似 End of program 的本地化字符串。 /// @@ -717,6 +726,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties { } } + /// + /// 查找类似 Editing non-pending work order is prohibited 的本地化字符串。 + /// + public static string ENWOIP { + get { + return ResourceManager.GetString("ENWOIP", resourceCulture); + } + } + /// /// 查找类似 Simulation 的本地化字符串。 /// diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx index f559a3a..c65153a 100644 --- a/Properties/Resources.en-US.resx +++ b/Properties/Resources.en-US.resx @@ -942,4 +942,10 @@ Does Not Exist + + Editing historical crafts is prohibited + + + Editing non-pending work order is prohibited + \ No newline at end of file diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 80461b7..c3f4c29 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -942,4 +942,10 @@ Does Not Exist + + Editing historical crafts is prohibited + + + Editing non-pending work order is prohibited + \ No newline at end of file diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx index 1b79e23..2356fbf 100644 --- a/Properties/Resources.zh-CN.resx +++ b/Properties/Resources.zh-CN.resx @@ -942,4 +942,10 @@ 不存在 + + 禁止编辑历史工艺 + + + 禁止编辑非等待中的工单 + \ No newline at end of file diff --git a/View/ProductionPlanningView.xaml.cs b/View/ProductionPlanningView.xaml.cs index 207fe3a..4da26ee 100644 --- a/View/ProductionPlanningView.xaml.cs +++ b/View/ProductionPlanningView.xaml.cs @@ -83,9 +83,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View private ObservableCollection ganttTaskContextMenuItems = new ObservableCollection(); public void GanttChartNEW() - { - string iiii = "select * from WorkOrder where StartTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss") - + "'or EndTime>'" + DateTime.Parse(Sdatepicker.Text).ToString("yyyy/MM/dd HH:mm:ss") + "'Order by StartTime"; + { SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 WorkOrder = SQLiteHelpers.ExecuteDataSet( @@ -149,10 +147,30 @@ namespace SunlightCentralizedControlManagement_SCCM_.View } private void EditClicked(GanttTask ganttTask) { - Picture.Content = null; - Picture.Width = 600; - Picture.Content = new ProductionPlanningEdit(ganttTask.ID, true); - } + SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 + SQLiteHelpers.Open(); //打开数据库 + DataTable WorkOrder_dt = SQLiteHelpers.ExecuteDataSet( + "select * from WorkOrder where WorkOrder='" + ganttTask.ID + "'Order by StartTime", null).Tables[0]; //读取表写入缓存 + SQLiteHelpers.Close(); + + if (DateTime.Now > DateTime.Parse(WorkOrder_dt.Select().First().Field("EndTime").ToString())) + { + MessageBox.Show(Properties.Resources.EHCIP);//禁止编辑历史工艺 + } + else + { + if (WorkOrder_dt.Select().First().Field("State").ToString() == "101") + { + Picture.Content = null; + Picture.Width = 600; + Picture.Content = new ProductionPlanningEdit(ganttTask.ID, true); + } + else + { + MessageBox.Show(Properties.Resources.ENWOIP);//禁止编辑非等待中的工单 + } + } + }//编辑 private void DeleteClicked(GanttTask ganttTask)//删除 { if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + ganttTask.Name, "Delete ",