diff --git a/ConvertMoels/StatenConvert.cs b/ConvertMoels/StatenConvert.cs index edf4430..aecabed 100644 --- a/ConvertMoels/StatenConvert.cs +++ b/ConvertMoels/StatenConvert.cs @@ -21,11 +21,13 @@ namespace DyeingComputer.ConvertMoels string Staten = null; string i = value.ToString(); - if (i == "101") Staten = Properties.Resources.Ready; + if (i == "100") Staten = Properties.Resources.Ready; + else if (i == "101") Staten = Properties.Resources.Ready; else if (i == "102") Staten = Properties.Resources.Measure; else if (i == "201") Staten = Properties.Resources.Auto; else if (i == "202") Staten = Properties.Resources.LineUp; else if (i == "203") Staten = Properties.Resources.Await; + else if (i == "205") Staten = Properties.Resources.RUN; else if (i == "301") Staten = Properties.Resources.Finish; else if (i == "309") Staten = Properties.Resources.Abnormal; else if (i == "800") Staten = Properties.Resources.Notimplementation; diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 0131b0d..bd85cac 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -1095,6 +1095,15 @@ namespace DyeingComputer.Properties { } } + /// + /// 查找类似 RUN 的本地化字符串。 + /// + public static string RUN { + get { + return ResourceManager.GetString("RUN", resourceCulture); + } + } + /// /// 查找类似 RunningProcess 的本地化字符串。 /// diff --git a/Properties/Resources.en-US.resx b/Properties/Resources.en-US.resx index 95f3ed4..5e8daa4 100644 --- a/Properties/Resources.en-US.resx +++ b/Properties/Resources.en-US.resx @@ -546,4 +546,7 @@ Product Name + + RUN + \ No newline at end of file diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 19ed402..d3dc54d 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -546,4 +546,7 @@ ProductName + + RUN + \ No newline at end of file diff --git a/Properties/Resources.zh-CN.resx b/Properties/Resources.zh-CN.resx index acc1b93..8ab622a 100644 --- a/Properties/Resources.zh-CN.resx +++ b/Properties/Resources.zh-CN.resx @@ -546,4 +546,7 @@ 原料名 + + 运行 + \ No newline at end of file diff --git a/Properties/Resources.zh-TW.resx b/Properties/Resources.zh-TW.resx index 5d62983..4cf7d94 100644 --- a/Properties/Resources.zh-TW.resx +++ b/Properties/Resources.zh-TW.resx @@ -546,4 +546,7 @@ 原料名 + + 運行 + \ No newline at end of file diff --git a/View/TechnologicalProcessView.xaml b/View/TechnologicalProcessView.xaml index f9f9890..a711d5c 100644 --- a/View/TechnologicalProcessView.xaml +++ b/View/TechnologicalProcessView.xaml @@ -135,7 +135,13 @@ - + + + + + diff --git a/View/WorkOrderView.xaml b/View/WorkOrderView.xaml index 9fedc48..969f9bd 100644 --- a/View/WorkOrderView.xaml +++ b/View/WorkOrderView.xaml @@ -47,6 +47,12 @@ + + + + + + @@ -61,6 +67,12 @@ + + + + + + diff --git a/View/WorkOrderView.xaml.cs b/View/WorkOrderView.xaml.cs index 349577a..73c99ec 100644 --- a/View/WorkOrderView.xaml.cs +++ b/View/WorkOrderView.xaml.cs @@ -87,7 +87,7 @@ namespace DyeingComputer.View SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 - string sql_script = "select * from WorkOrder where EndTime > '" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "'"; + string sql_script = "select * from WorkOrder where EndTime > '" + DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'"; if (sql != null) sql.Clear(); //清空缓存 sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存 @@ -247,11 +247,12 @@ namespace DyeingComputer.View DataTable data_t = new DataTable(); int a; + /*检查并写入run信息*/ SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 int R_D = SQLiteHelpers.ExecuteDataSet( "select * from RUN", null).Tables[0].Rows.Count; //读取表写入缓存 - if (R_D > 0) + if (R_D > 0)//判断是否有运行中工艺 { SQLiteHelpers.Close(); //关闭连接 @@ -264,14 +265,13 @@ namespace DyeingComputer.View System.Windows.MessageBox.Show(Properties.Resources.refuse, "800", MessageBoxButton.OK); return; } - SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 } } updata_temp.Clear(); //使用前清缓存 - updata_temp.Add("State", 101); + updata_temp.Add("State", 205); SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null); WorkorderSteps = SQLiteHelpers.ExecuteDataSet( @@ -294,13 +294,26 @@ namespace DyeingComputer.View SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入 } - updata_temp.Clear(); //使用前清缓存 updata_temp.Add("RUN", 1); SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null); - SQLiteHelpers.Close(); //关闭连接 + /*触发启动*/ + string Numder = WorkorderSteps.Select("Step = 1").First().Field("StepID");// + double P1 = WorkorderSteps.Select("Step = 1").First().Field("Parameter1"); + double P2 = WorkorderSteps.Select("Step = 1").First().Field("Parameter2"); + double P3 = WorkorderSteps.Select("Step = 1").First().Field("Parameter3"); + double P4 = WorkorderSteps.Select("Step = 1").First().Field("Parameter4"); + double P5 = WorkorderSteps.Select("Step = 1").First().Field("Parameter5"); + MainWindowViewModel.RUN_STEPID = Convert.ToInt16(1);//插入步骤号 + MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), + Convert.ToDouble(P4), Convert.ToDouble(P5)); + MainWindowViewModel.WORK_RUN =2; + APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + + MainWindowViewModel.RUN_STEPID +";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5); + + /*选定工艺有效跳转准备 */ if (Process_id != null) //选定工艺有效跳转准备 { MainWindowViewModel.WorkNumder = WorkOrder_Numder; diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 5b41b72..b551ee7 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -237,6 +237,8 @@ namespace DyeingComputer.ViewModel SM01 = Convert.ToInt16(Selet_sys("SM01"));//FG SM02 = Convert.ToInt16(Selet_sys("SM02"));//FG SM03 = Convert.ToInt16(Selet_sys("SM03"));//FG + + SK5 = Selet_sys("SK5");// } private void ProgramgroupView_run_()////运行/暂停 { @@ -612,28 +614,24 @@ namespace DyeingComputer.ViewModel STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); TEMP_tar = STEP_P1; - double t_t = Convert.ToDouble(Selet_dtm("1010")); if (STEP_P1 > t_t) { THL_mode = 1; } else if (STEP_P1 < t_t) { THL_mode = 2; } TEMP_co = t_t; Updata_dtm("1003", STEP_P2 / 600); STEP_TIME = Convert.ToInt16(STEP_P3) * 60; - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//功能模块001温度控制开始 case "007": STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "008": STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; @@ -650,7 +648,6 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_TIME = Convert.ToInt16(MT05); //排水倒计时 - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; @@ -658,55 +655,46 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_TIME = Convert.ToInt16(MT06); //动力排水倒计时 - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "031": STEP_TIME = Convert.ToInt16(P1) * 60; - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "035": STEP_TIME = Convert.ToInt32(MU01); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "036": STEP_TIME = Convert.ToInt32(MU01); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "039": STEP_TIME = Convert.ToInt32(MU01); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "040": STEP_TIME = Convert.ToInt32(MU01); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "041": - WORK_RUN = 2; SETP_runtime = false; STEP_finish = false; break; case "049": STEP_TIME = Convert.ToInt32(MU01); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break; case "050": STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//主缸加压 @@ -720,18 +708,15 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//主泵/风机速度 case "055": STEP_TIME = 10; - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//主泵启动 case "056": - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//主泵停止 @@ -741,7 +726,6 @@ namespace DyeingComputer.ViewModel STEP_P3 = Convert.ToDouble(P3); STEP_P4 = Convert.ToDouble(P4); STEP_P5 = Convert.ToDouble(P5); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//药缸备药 @@ -749,7 +733,6 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//药缸加药 @@ -757,7 +740,6 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//呼叫输送 @@ -765,14 +747,12 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//呼叫输送 case "090": STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//快速加酸 @@ -780,7 +760,6 @@ namespace DyeingComputer.ViewModel STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); STEP_P3 = Convert.ToDouble(P3); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//PH温度控制 @@ -793,7 +772,6 @@ namespace DyeingComputer.ViewModel case "094": STEP_P1 = Convert.ToDouble(P1); STEP_P2 = Convert.ToDouble(P2); - WORK_RUN = 2; SETP_runtime = true; STEP_finish = false; break;//PH控制 @@ -1658,9 +1636,11 @@ namespace DyeingComputer.ViewModel } } - public static bool CALL_FR = false; + public static bool CALL_FR = false;//呼叫状态 + string SK5; void FeedingRecords(string WorkOrder,string Dyelot,int TANK,int STEP,int Type) //呼叫输送 { + int SQLI = 0; Dictionary dat_FR = new Dictionary(); dat_FR.Add("State", "201"); dat_FR.Add("Tank", TANK.ToString()); @@ -1669,9 +1649,18 @@ namespace DyeingComputer.ViewModel SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 SQLiteHelpers.Open(); //打开数据库 - int SQLI = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where " + - "Dyelot = '"+Dyelot+ "' AND Step = '"+STEP+ "' AND Redye ='"+SYS_REDYE+"' AND State = '101'", null).Tables[0].Rows.Count; - if(SQLI>0) SQLiteHelpers.Update("Dyelot", dat_FR, "Dyelot = '"+Dyelot+ "' AND Step = '"+STEP+ "' AND Redye ='"+SYS_REDYE+"'", null);//行更新 + + if (SK5 == "1")//是否检查原料类型 + { + SQLI = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where " + + "Dyelot = '" + Dyelot + "' AND Step = '" + STEP + "' AND Redye ='" + SYS_REDYE + "' AND State = '101' AND ProductType='" + Type + "'", null).Tables[0].Rows.Count; + } + else + { + SQLI = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where " + + "Dyelot = '" + Dyelot + "' AND Step = '" + STEP + "' AND Redye ='" + SYS_REDYE + "' AND State = '101'", null).Tables[0].Rows.Count; + } + if (SQLI > 0) SQLiteHelpers.Update("Dyelot", dat_FR, "Dyelot = '" + Dyelot + "' AND Step = '" + STEP + "' AND Redye ='" + SYS_REDYE + "'", null);//行更新 SQLiteHelpers.Close(); //关闭连接 }