Browse Source

中控操作逻辑修复

master
sc 2 months ago
parent
commit
77288bdf85
  1. 5
      UserClass/AsyncTcpServer.cs
  2. 3
      View/TechnologicalProcessView.xaml.cs
  3. 81
      ViewModel/MainWindowViewModel.cs

5
UserClass/AsyncTcpServer.cs

@ -247,14 +247,15 @@ namespace DyeingComputer.UserClass
} }
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE") else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE")
{ {
MainWindowViewModel.errTabler.Clear();
MainWindowViewModel.WORK_RUN = 2;// MainWindowViewModel.WORK_RUN = 2;//
// //
client.SendAsync("SC821" + SYSKEY + SYSDAT); client.SendAsync("SC821" + SYSKEY + SYSDAT);
}//运行 }//运行
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP") else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP")
{ {
MainWindowViewModel.RUN_DATATABLE = MainWindowViewModel.dt_TP;//缓存表 MainWindowViewModel.RUN_STEPID = Convert.ToInt16(dat_821.GetValue("ID"));//步骤号
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(dat_821.GetValue("ID").ToString());//插入步骤号
MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")), MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")),
Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")), Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")),
Convert.ToDouble(dat_821.GetValue("P4")), Convert.ToDouble(dat_821.GetValue("P5"))); Convert.ToDouble(dat_821.GetValue("P4")), Convert.ToDouble(dat_821.GetValue("P5")));

3
View/TechnologicalProcessView.xaml.cs

@ -563,8 +563,7 @@ namespace DyeingComputer.View
} }
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e) private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
{ {
int n = Convert.ToInt16(ID); DataRow dr = MainWindowViewModel.dt_TP.Select("Step='" + ID + "'").First();
DataRow dr = MainWindowViewModel.dt_TP.Rows[n - 1];
dr.BeginEdit(); dr.BeginEdit();
dr["RUN"] = 2; dr["RUN"] = 2;
dr.EndEdit(); dr.EndEdit();

81
ViewModel/MainWindowViewModel.cs

@ -77,7 +77,7 @@ namespace DyeingComputer.ViewModel
private IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini"); private IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
private PID pid = new PID(); private PID pid = new PID();
public static DataTable errTabler = new DataTable();//错误表 public static DataTable errTabler = new DataTable();//错误表
public static DataTable RUN_DATATABLE = new DataTable();//缓存工作表 // public static DataTable RUN_DATATABLE = new DataTable();//缓存工作表
public static DataTable Dyelot_dat = new DataTable();//物料表 public static DataTable Dyelot_dat = new DataTable();//物料表
public static string Dyelot; //领料单号 public static string Dyelot; //领料单号
public static int RUN_STEPID;//当前步骤 public static int RUN_STEPID;//当前步骤
@ -741,12 +741,25 @@ namespace DyeingComputer.ViewModel
private bool Alert_red = false; //警报红灯 private bool Alert_red = false; //警报红灯
public static bool Alert_bell = false; //警报铃声 public static bool Alert_bell = false; //警报铃声
static Dictionary<string, object> updata_RUN = new Dictionary<string, object>();// static Dictionary<string, object> updata_RUN = new Dictionary<string, object>();//
public static void STEP_START(string ID, double P1, double P2, double P3, double P4, double P5) //启动模块
/**提示页面信息**/
static UserCall userCall = null;
static Sampling sampling = null;
public static void USERcall(string ID, string DAT)
{
if (userCall == null || !userCall.IsLoaded)
{ {
UserCall userCall = new UserCall(); userCall = new UserCall();
userCall.Topmost = true; userCall.Topmost = true;
userCall.CALL_time= S19; userCall.CALL_time = S19;
userCall.Inf_DAT = DAT;
userCall.Show();
}
}
/**主功能**/
public static void STEP_START(string ID, double P1, double P2, double P3, double P4, double P5) //启动模块
{
STEP_ID = ID; STEP_ID = ID;
switch (ID) switch (ID)
{ {
@ -823,44 +836,30 @@ namespace DyeingComputer.ViewModel
STEP_finish = false; STEP_finish = false;
break; break;
case "035": case "035":
userCall.Inf_DAT = Resources.ClothIntake;
userCall.Show();
STEP_TIME = Convert.ToInt32(MU01); STEP_TIME = Convert.ToInt32(MU01);
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
case "036": case "036":
userCall.Inf_DAT = Resources.OutTheCloth;
userCall.Show();
STEP_TIME = Convert.ToInt32(MU01); STEP_TIME = Convert.ToInt32(MU01);
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
case "039": case "039":
userCall.Inf_DAT = Resources.CallWorkers;
userCall.Show();
STEP_TIME = Convert.ToInt32(MU01); STEP_TIME = Convert.ToInt32(MU01);
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
case "040": case "040":
Sampling sampling = new Sampling();
sampling.Topmost = true;
sampling.CALL_time = S20;
sampling.Show();
STEP_TIME = Convert.ToInt32(MU01); STEP_TIME = Convert.ToInt32(MU01);
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
case "041": case "041":
userCall.Inf_DAT = Resources.End;
userCall.Show();
SETP_runtime = false; SETP_runtime = false;
STEP_finish = false; STEP_finish = false;
break; break;
case "049": case "049":
userCall.Inf_DAT = Resources.Await;
userCall.Show();
STEP_TIME = Convert.ToInt32(MU01); STEP_TIME = Convert.ToInt32(MU01);
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
@ -960,9 +959,38 @@ namespace DyeingComputer.ViewModel
SQLiteHelpers.Update("RUN", updata_RUN, "RUN ='1'", null);//更新 SQLiteHelpers.Update("RUN", updata_RUN, "RUN ='1'", null);//更新
updata_RUN.Clear(); updata_RUN.Clear();
updata_RUN.Add("RUN", 1); updata_RUN.Add("RUN", 1);
SQLiteHelpers.Update("RUN", updata_RUN, "Step ='"+ RUN_STEPID + "'", null);//更新 SQLiteHelpers.Update("RUN", updata_RUN, "Step ='" + RUN_STEPID + "'", null);//更新
dt_TP = SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0]; dt_TP = SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0];
SQLiteHelpers.Close();//关闭数据库 SQLiteHelpers.Close();//关闭数据库
//启动副功能
STEP_RUN_slave_stop(); DataRow[] arrRows = dt_TP.Select("STEP ='" + RUN_STEPID + "'");
if (!String.IsNullOrEmpty((string)arrRows[0]["StepID_S1"]))
{
STEP_IDp1 = (string)arrRows[0]["StepID_S1"];
STEP_P1p1 = (double)arrRows[0]["Parameter1_S1"];
STEP_P2p1 = (double)arrRows[0]["Parameter2_S1"];
STEP_P3p1 = (double)arrRows[0]["Parameter3_S1"];
STEP_P4p1 = (double)arrRows[0]["Parameter4_S1"];
STEP_P5p1 = (double)arrRows[0]["Parameter5_S1"];
}
if (!String.IsNullOrEmpty((string)arrRows[0]["StepID_S2"]))
{
STEP_IDp2 = (string)arrRows[0]["StepID_S2"];
STEP_P1p2 = (double)arrRows[0]["Parameter1_S2"];
STEP_P2p2 = (double)arrRows[0]["Parameter2_S2"];
STEP_P3p2 = (double)arrRows[0]["Parameter3_S2"];
STEP_P4p2 = (double)arrRows[0]["Parameter4_S2"];
STEP_P5p2 = (double)arrRows[0]["Parameter5_S2"];
}
if (!String.IsNullOrEmpty((string)arrRows[0]["StepID_S2"]))
{
STEP_IDp3 = (string)arrRows[0]["StepID_S3"];
STEP_P1p3 = (double)arrRows[0]["Parameter1_S3"];
STEP_P2p3 = (double)arrRows[0]["Parameter2_S3"];
STEP_P3p3 = (double)arrRows[0]["Parameter3_S3"];
STEP_P4p3 = (double)arrRows[0]["Parameter4_S3"];
STEP_P5p3 = (double)arrRows[0]["Parameter5_S3"];
}
} }
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔 TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
@ -1412,6 +1440,7 @@ namespace DyeingComputer.ViewModel
} }
break;//运转时间 break;//运转时间
case "035": case "035":
USERcall("035", Resources.ClothIntake);
if (Selet_dtd("2004")|| UserCall_OK) if (Selet_dtd("2004")|| UserCall_OK)
{ {
UserCall_OK = false; UserCall_OK = false;
@ -1434,6 +1463,7 @@ namespace DyeingComputer.ViewModel
if (errTabler.Rows.Count == 0) Status_Str = Resources.ClothIntake; if (errTabler.Rows.Count == 0) Status_Str = Resources.ClothIntake;
break;//准备入布 break;//准备入布
case "036": case "036":
USERcall("036", Resources.OutTheCloth);
if (Selet_dtd("2004")|| UserCall_OK) if (Selet_dtd("2004")|| UserCall_OK)
{ {
UserCall_OK=false; UserCall_OK=false;
@ -1456,6 +1486,7 @@ namespace DyeingComputer.ViewModel
if (errTabler.Rows.Count == 0) Status_Str = Resources.OutTheCloth; if (errTabler.Rows.Count == 0) Status_Str = Resources.OutTheCloth;
break;//准备出布 break;//准备出布
case "039": case "039":
USERcall("039", Resources.CallWorkers);
if (Selet_dtd("2004")|| UserCall_OK) if (Selet_dtd("2004")|| UserCall_OK)
{ {
UserCall_OK = false; UserCall_OK = false;
@ -1478,6 +1509,13 @@ namespace DyeingComputer.ViewModel
if (errTabler.Rows.Count == 0) Status_Str = Resources.CallWorkers; if (errTabler.Rows.Count == 0) Status_Str = Resources.CallWorkers;
break;//呼叫人工 break;//呼叫人工
case "040": case "040":
if (sampling == null || !sampling.IsLoaded)
{
sampling = new Sampling();
sampling.Topmost = true;
sampling.CALL_time = S20;
sampling.Show();
}//取样提示
if (Selet_dtd("2004")|| UserCall_OK) if (Selet_dtd("2004")|| UserCall_OK)
{ {
UserCall_OK = false; UserCall_OK = false;
@ -1504,6 +1542,7 @@ namespace DyeingComputer.ViewModel
if (errTabler.Rows.Count == 0) Status_Str = Resources.End; if (errTabler.Rows.Count == 0) Status_Str = Resources.End;
break;//结束 break;//结束
case "049": case "049":
USERcall("035", Resources.Await);
if (Selet_dtd("2004")|| UserCall_OK) if (Selet_dtd("2004")|| UserCall_OK)
{ {
UserCall_OK = false; UserCall_OK = false;
@ -2126,7 +2165,7 @@ namespace DyeingComputer.ViewModel
} }
} }
/**子功能**/ /**子功能**/
void STEP_RUN_slave_stop() static void STEP_RUN_slave_stop()
{ {
STEP_IDp1 = ""; STEP_IDp1 = "";
STEP_IDp2 = ""; STEP_IDp2 = "";

Loading…
Cancel
Save