Browse Source

通讯修改,温控增加主泵检查

master
sc 2 months ago
parent
commit
5750ff7ce1
  1. 2
      UserClass/AsyncTcpServer.cs
  2. 359
      ViewModel/MainWindowViewModel.cs

2
UserClass/AsyncTcpServer.cs

@ -532,7 +532,7 @@ namespace DyeingComputer.UserClass
if (SYSKEY == MainWindowViewModel.SYSKEY) if (SYSKEY == MainWindowViewModel.SYSKEY)
{ {
try try
{ {
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
MainWindowViewModel.TX++; MainWindowViewModel.TX++;
} }

359
ViewModel/MainWindowViewModel.cs

@ -527,7 +527,7 @@ namespace DyeingComputer.ViewModel
Work_Numder = WorkNumder.ToString(); Work_Numder = WorkNumder.ToString();
StatusStr = Status_Str; StatusStr = Status_Str;
Program_Name = ProgramName; Program_Name = ProgramName;
if (dt_TP.Rows.Count>0) Process_step = dt_TP.Select("Step=" + RUN_STEPID).First().Field<string>("ParameterName"); if (dt_TP.Rows.Count>= RUN_STEPID+1) Process_step = dt_TP.Select("Step=" + RUN_STEPID).First().Field<string>("ParameterName");
if (set_) { set_ = false; SYS_SET(); }//设置更新 if (set_) { set_ = false; SYS_SET(); }//设置更新
if (!SETP_runtime) DIDETime++; if (!SETP_runtime) DIDETime++;
@ -783,7 +783,7 @@ namespace DyeingComputer.ViewModel
public static void USERcall(string ID, string DAT) public static void USERcall(string ID, string DAT)
{ {
if (userCall == null || !userCall.IsLoaded) if (userCall == null || !userCall.IsLoaded)
{ {
userCall = new UserCall(); userCall = new UserCall();
userCall.Topmost = true; userCall.Topmost = true;
userCall.CALL_time = S19; userCall.CALL_time = S19;
@ -814,12 +814,14 @@ namespace DyeingComputer.ViewModel
case "007": case "007":
STEP_P1 = Convert.ToDouble(P1); STEP_P1 = Convert.ToDouble(P1);
STEP_P2 = Convert.ToDouble(P2); STEP_P2 = Convert.ToDouble(P2);
STEP_TIME = 0;
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
case "008": case "008":
STEP_P1 = Convert.ToDouble(P1); STEP_P1 = Convert.ToDouble(P1);
STEP_P2 = Convert.ToDouble(P2); STEP_P2 = Convert.ToDouble(P2);
STEP_TIME = 0;
SETP_runtime = true; SETP_runtime = true;
STEP_finish = false; STEP_finish = false;
break; break;
@ -983,9 +985,8 @@ namespace DyeingComputer.ViewModel
STEP_finish = false; STEP_finish = false;
break;//PH控制 break;//PH控制
default: default:
break; break;
} }
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径 //SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
// SQLiteHelpers.Open(); //打开数据库 // SQLiteHelpers.Open(); //打开数据库
updata_RUN.Clear(); updata_RUN.Clear();
@ -1025,6 +1026,7 @@ namespace DyeingComputer.ViewModel
STEP_P4p3 = (double)arrRows[0]["Parameter4_S3"]; STEP_P4p3 = (double)arrRows[0]["Parameter4_S3"];
STEP_P5p3 = (double)arrRows[0]["Parameter5_S3"]; STEP_P5p3 = (double)arrRows[0]["Parameter5_S3"];
} }
User_Button = true;
} }
TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔 TimeSpan ts = new TimeSpan(00,00,01);//1秒间隔
@ -1035,6 +1037,11 @@ namespace DyeingComputer.ViewModel
private string TANK1, TANK2, TANK3;//料桶信息 private string TANK1, TANK2, TANK3;//料桶信息
public static string TANK1_DYELOT, TANK2_DYELOT, TANK3_DYELOT;//料单号 public static string TANK1_DYELOT, TANK2_DYELOT, TANK3_DYELOT;//料单号
private int TANK1_REDYE,TANK1_STEP, TANK2_REDYE, TANK2_STEP, TANK3_REDYE, TANK3_STEP; private int TANK1_REDYE,TANK1_STEP, TANK2_REDYE, TANK2_STEP, TANK3_REDYE, TANK3_STEP;
int TIME_H;
int TIME_M;
int TIME_S;
double TO = 0;
double T = 0;
void STEP_RUN_master() void STEP_RUN_master()
{ {
WORK_run = WORK_RUN; WORK_run = WORK_RUN;
@ -1045,154 +1052,158 @@ namespace DyeingComputer.ViewModel
switch (STEP_ID) switch (STEP_ID)
{ {
case "001": case "001":
int TIME_H; if (Selet_dtd("3011"))
int TIME_M;
int TIME_S;
double TO = 0;
double T = Selet_dtm("1010"); //实际温度
if (THL_mode == 0) //保温
{
TO = pid.PID_iterate(STEP_P1, T, ts);
TEMP_co = STEP_P1;
//if (TO < 0) TO = 0;
TIME_H = STEP_TIME / 3600;
TIME_M = (STEP_TIME - TIME_H * 3600) / 60;
TIME_S = STEP_TIME - TIME_H * 3600 - TIME_M * 60;
if (errTabler.Rows.Count == 0) Status_Str = Resources.Heat_insulating + ":" + Resources.Time + string.Format(" {0:D2}", TIME_H) + ":" + string.Format(" {0:D2}", TIME_M) + ":" + string.Format(" {0:D2}", TIME_S);
if (STEP_TIME <= 0)
{
STEP_finish = true;
}
else
{
STEP_TIME--;
}
}
else if (THL_mode == 1)//升温
{
if (STEP_P1 > TEMP_co) TEMP_co = TEMP_co + (STEP_P2 / 60);
TO = pid.PID_iterate(TEMP_co, T, ts);
if (TO < 0) TO = 0;
if (TEMP_co < T-0.5)
{
TO = 0;
pid.ResetController();
}
if (STEP_P1 < T)
{
Updata_dta("5001", 0);
Updata_dtm("1004", 0);
TO = 0;
THL_mode = 0;
TIME_M = 0;
}
else
{
TIME_M = Convert.ToInt16((STEP_P1 - T) / STEP_P2);
}
if (errTabler.Rows.Count == 0)
{
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C";
}
if ((TEMP_co - T) > 5)
{
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]", "201-1");//写入
}
else
{
ERRinf.ERRinf_d(errTabler, "201-1");//
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
}
}
else if (THL_mode == 2)//降温
{ {
if (STEP_P1 < TEMP_co) TEMP_co = TEMP_co - (STEP_P2 / 60); ERRinf.ERRinf_d(errTabler, "103");//
TO = pid.PID_iterate(TEMP_co, T, ts); T = Selet_dtm("1010"); //实际温度
if (TO > 0) TO = 0; if (THL_mode == 0) //保温
TO = Math.Abs(TO);
if (STEP_P1 > T)
{ {
Updata_dta("5002", 0); TO = pid.PID_iterate(STEP_P1, T, ts);
Updata_dtm("1005", 0); TEMP_co = STEP_P1;
TO = 0; //if (TO < 0) TO = 0;
THL_mode = 0;
TIME_M = 0; TIME_H = STEP_TIME / 3600;
} TIME_M = (STEP_TIME - TIME_H * 3600) / 60;
else TIME_S = STEP_TIME - TIME_H * 3600 - TIME_M * 60;
{ if (errTabler.Rows.Count == 0) Status_Str = Resources.Heat_insulating + ":" + Resources.Time + string.Format(" {0:D2}", TIME_H) + ":" + string.Format(" {0:D2}", TIME_M) + ":" + string.Format(" {0:D2}", TIME_S);
TIME_M = Convert.ToInt16((T - STEP_P1) / STEP_P2); if (STEP_TIME <= 0)
} {
if (errTabler.Rows.Count == 0) STEP_finish = true;
{ }
Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C"; else
} {
if ((T - TEMP_co) > 5) STEP_TIME--;
{ }
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]", "201-2");//写入
}
else
{
ERRinf.ERRinf_d(errTabler, "201-2");//
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
}
}
Updata_dtm("1004", TO);
Updata_dtm("1005", TEMP_co);
if (MT12 == 1)//输出类型0开关1模拟
{
if (THL_mode == 2)
{
Updata_dta("5002", Convert.ToInt16(TO));
Updata_dta("5001", 0);
Updata_dtd("3010", true);
Updata_dtd("3009", false);
} }
if (THL_mode == 1) else if (THL_mode == 1)//升温
{ {
Updata_dta("5001", Convert.ToInt16(TO)); if (STEP_P1 > TEMP_co) TEMP_co = TEMP_co + (STEP_P2 / 60);
Updata_dta("5002", 0); TO = pid.PID_iterate(TEMP_co, T, ts);
Updata_dtd("3009", true); if (TO < 0) TO = 0;
Updata_dtd("3010", false); if (TEMP_co < T - 0.5)
{
TO = 0;
pid.ResetController();
}
if (STEP_P1 <= T)
{
Updata_dta("5001", 0);
Updata_dtm("1004", 0);
TO = 0;
THL_mode = 0;
TIME_M = 0;
}
else
{
TIME_M = Convert.ToInt16((STEP_P1 - T) / STEP_P2);
}
if (errTabler.Rows.Count == 0)
{
Status_Str = Resources.Heats + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C";
}
if ((TEMP_co - T) > 5)
{
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Heats + Resources.LnsufficientPower + "]", "201-1");//写入
}
else
{
ERRinf.ERRinf_d(errTabler, "201-1");//
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
}
} }
if (THL_mode == 0) else if (THL_mode == 2)//降温
{ {
if (TO > 0) if (STEP_P1 < TEMP_co) TEMP_co = TEMP_co - (STEP_P2 / 60);
{ TO = pid.PID_iterate(TEMP_co, T, ts);
Updata_dta("5001", Convert.ToInt16(TO)); if (TO > 0) TO = 0;
TO = Math.Abs(TO);
if (STEP_P1 >= T)
{
Updata_dta("5002", 0); Updata_dta("5002", 0);
Updata_dtm("1005", 0);
TO = 0;
THL_mode = 0;
TIME_M = 0;
} }
else else
{
TIME_M = Convert.ToInt16((T - STEP_P1) / STEP_P2);
}
if (errTabler.Rows.Count == 0)
{
Status_Str = Resources.Cooling + ":" + Resources.Target + Resources.Temperature + string.Format(" {0:###.#}", STEP_P1) + "°C";
}
if ((T - TEMP_co) > 5)
{
ERRinf.ERRinf_w(errTabler, Status_Str + "[" + Resources.Cooling + Resources.LnsufficientPower + "]", "201-2");//写入
}
else
{
ERRinf.ERRinf_d(errTabler, "201-2");//
Status_Str = Status_Str + Resources.Expected + string.Format(" {0:D2}", TIME_M) + Resources.Min;
}
}
Updata_dtm("1004", TO);
Updata_dtm("1005", TEMP_co);
if (MT12 == 1)//输出类型0开关1模拟
{
if (THL_mode == 2)
{ {
Updata_dta("5002", Convert.ToInt16(TO)); Updata_dta("5002", Convert.ToInt16(TO));
Updata_dta("5001", 0); Updata_dta("5001", 0);
Updata_dtd("3010", true);
Updata_dtd("3009", false);
}
if (THL_mode == 1)
{
Updata_dta("5001", Convert.ToInt16(TO));
Updata_dta("5002", 0);
Updata_dtd("3009", true);
Updata_dtd("3010", false);
}
if (THL_mode == 0)
{
if (TO > 0)
{
Updata_dta("5001", Convert.ToInt16(TO));
Updata_dta("5002", 0);
}
else
{
Updata_dta("5002", Convert.ToInt16(TO));
Updata_dta("5001", 0);
}
} }
} }
} else
else
{
if (temp_time10s <= 0) { temp_time10s = 10; } else { temp_time10s--; }
if (THL_mode == 2)
{ {
if ((temp_time10s <= Convert.ToInt16(TO)/100)) if (temp_time10s <= 0) { temp_time10s = 10; } else { temp_time10s--; }
{ Updata_dtd("3010", true); } if (THL_mode == 2)
else { Updata_dtd("3010", false); }//降温 {
if ((temp_time10s <= Convert.ToInt16(TO) / 100))
{ Updata_dtd("3010", true); }
else { Updata_dtd("3010", false); }//降温
}
else
{
if (temp_time10s == 1) temp_time10s = 2;
if ((temp_time10s <= Convert.ToInt16(TO) / 100))
{ Updata_dtd("3009", true); }
else { Updata_dtd("3009", false); }//升温
}
} }
else if (STEP_finish)
{ {
if (temp_time10s == 1) temp_time10s = 2; Updata_dtm("1004", 0);
if ((temp_time10s <= Convert.ToInt16(TO)/100)) Updata_dtd("3009", false);
{ Updata_dtd("3009", true); } Updata_dtd("3010", false);
else { Updata_dtd("3009", false); }//升温 Updata_dta("5001", 0);
Updata_dta("5002", 0);
} }
} }
if (STEP_finish) else
{ {
Updata_dtm("1004", 0); ERRinf.ERRinf_w(errTabler, Resources.PumpStops , "");//写入
Updata_dtd("3009", false);
Updata_dtd("3010", false);
Updata_dta("5001", 0);
Updata_dta("5002", 0);
} }
break;//功能模块001温度控制 break;//功能模块001温度控制
case "007": case "007":
@ -1367,7 +1378,7 @@ namespace DyeingComputer.ViewModel
"[" + STEP_P4 + "]" + ":" + Resources.Drainage + "3"; "[" + STEP_P4 + "]" + ":" + Resources.Drainage + "3";
} }
if (Selet_dtm("1015") <= STEP_P2) //排水状态完成 if (Selet_dtm("1015") <= MT43) //排水状态完成
{ {
if (STEP_TIME <= 0)//排水延时 if (STEP_TIME <= 0)//排水延时
{ {
@ -1387,7 +1398,7 @@ namespace DyeingComputer.ViewModel
} }
} }
} }
if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Properties.Resources.WaterLevel + ")"; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Washing + "(" + Properties.Resources.WaterLevel + ")";
} }
else { STEP_finish = true; } else { STEP_finish = true; }
break;//批次水位水洗 break;//批次水位水洗
@ -1508,7 +1519,6 @@ 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;
@ -1517,6 +1527,7 @@ namespace DyeingComputer.ViewModel
} }
else else
{ {
USERcall("035", Resources.ClothIntake);
Alert_yellow = true; Alert_yellow = true;
if (STEP_TIME <= 0) if (STEP_TIME <= 0)
{ {
@ -1531,7 +1542,6 @@ 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;
@ -1540,6 +1550,7 @@ namespace DyeingComputer.ViewModel
} }
else else
{ {
USERcall("036", Resources.OutTheCloth);
Alert_yellow = true; Alert_yellow = true;
if (STEP_TIME <= 0) if (STEP_TIME <= 0)
{ {
@ -1554,7 +1565,6 @@ 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;
@ -1563,6 +1573,7 @@ namespace DyeingComputer.ViewModel
} }
else else
{ {
USERcall("039", Resources.CallWorkers);
Alert_yellow = true; Alert_yellow = true;
if (STEP_TIME <= 0) if (STEP_TIME <= 0)
{ {
@ -1576,14 +1587,7 @@ 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;
@ -1592,6 +1596,14 @@ namespace DyeingComputer.ViewModel
} }
else else
{ {
if (sampling == null || !sampling.IsLoaded)
{
sampling = new Sampling();
sampling.Topmost = true;
sampling.CALL_time = S20;
sampling.Show();
}//取样提示
Alert_yellow = true; Alert_yellow = true;
if (STEP_TIME <= 0) if (STEP_TIME <= 0)
{ {
@ -1606,11 +1618,16 @@ namespace DyeingComputer.ViewModel
if (errTabler.Rows.Count == 0) Status_Str = Resources.Sampling; if (errTabler.Rows.Count == 0) Status_Str = Resources.Sampling;
break;//取样 break;//取样
case "041": case "041":
STEP_finish = true; STEP_RUN_slave_stop();
Updata_dtm("1004", 0);
Updata_dtm("1005", Selet_dtm("1010"));
for (int i = 1; i < 128; i++)
{
Updata_dtd((3000 + i).ToString(), false);
}
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;
@ -1619,6 +1636,7 @@ namespace DyeingComputer.ViewModel
} }
else else
{ {
USERcall("035", Resources.Await);
Alert_yellow = true; Alert_yellow = true;
STEP_TIME--; STEP_TIME--;
if (STEP_TIME <= 0) if (STEP_TIME <= 0)
@ -2155,6 +2173,8 @@ namespace DyeingComputer.ViewModel
{ {
if (STEP_finish) if (STEP_finish)
{ {
STEP_finish = false;
UserCall_OK = false;
RUN_STEPID = dt_TP.Select("RUN ='1'").First().Field<int>("Step") +1; RUN_STEPID = dt_TP.Select("RUN ='1'").First().Field<int>("Step") +1;
DataRow[] arrRows = dt_TP.Select("STEP ='" + RUN_STEPID + "'"); DataRow[] arrRows = dt_TP.Select("STEP ='" + RUN_STEPID + "'");
string T_ID = arrRows[0]["StepID"].ToString(); string T_ID = arrRows[0]["StepID"].ToString();
@ -2418,7 +2438,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString();
TANK1_STEP = Convert.ToInt16(STEP_P3p1); TANK1_STEP = Convert.ToInt16(STEP_P3p1);
FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p1), TANK1_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫 FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p1), TANK1_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution;
} //药缸1 } //药缸1
else if (STEP_P1p1 == 2) else if (STEP_P1p1 == 2)
{ {
@ -2431,7 +2451,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString();
TANK2_STEP = Convert.ToInt16(STEP_P3p1); TANK2_STEP = Convert.ToInt16(STEP_P3p1);
FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p1), TANK2_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫 FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p1), TANK2_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution;
}//药缸2 }//药缸2
else if (STEP_P1p1 == 3) else if (STEP_P1p1 == 3)
{ {
@ -2444,7 +2464,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString();
TANK3_STEP = Convert.ToInt16(STEP_P3p1); TANK3_STEP = Convert.ToInt16(STEP_P3p1);
FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p1), TANK3_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫 FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p1), TANK3_STEP, Convert.ToInt16(STEP_P2p1));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution;
}//药缸3 }//药缸3
//STEP_finish = true; //STEP_finish = true;
break;//呼叫输送 break;//呼叫输送
@ -2674,7 +2694,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString();
TANK1_STEP = Convert.ToInt16(STEP_P3p2); TANK1_STEP = Convert.ToInt16(STEP_P3p2);
FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p2), TANK1_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫 FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p2), TANK1_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution;
} //药缸1 } //药缸1
else if (STEP_P1p2 == 2) else if (STEP_P1p2 == 2)
{ {
@ -2687,7 +2707,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString();
TANK2_STEP = Convert.ToInt16(STEP_P3p2); TANK2_STEP = Convert.ToInt16(STEP_P3p2);
FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p2), TANK2_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫 FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p2), TANK2_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution;
}//药缸2 }//药缸2
else if (STEP_P1p2 == 3) else if (STEP_P1p2 == 3)
{ {
@ -2700,7 +2720,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString();
TANK3_STEP = Convert.ToInt16(STEP_P3p2); TANK3_STEP = Convert.ToInt16(STEP_P3p2);
FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p2), TANK3_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫 FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p2), TANK3_STEP, Convert.ToInt16(STEP_P2p2));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution;
}//药缸3 }//药缸3
//STEP_finish = true; //STEP_finish = true;
break;//呼叫输送 break;//呼叫输送
@ -2930,7 +2950,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK1_DYELOT)) TANK1_DYELOT = WorkNumder.ToString();
TANK1_STEP = Convert.ToInt16(STEP_P3p3); TANK1_STEP = Convert.ToInt16(STEP_P3p3);
FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p3), TANK1_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫 FeedingRecords(work_Numder, TANK1_DYELOT, Convert.ToInt16(STEP_P1p3), TANK1_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 1 :" + Resources.CallDistribution;
} //药缸1 } //药缸1
else if (STEP_P1p3 == 2) else if (STEP_P1p3 == 2)
{ {
@ -2943,7 +2963,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK2_DYELOT)) TANK2_DYELOT = WorkNumder.ToString();
TANK2_STEP = Convert.ToInt16(STEP_P3p3); TANK2_STEP = Convert.ToInt16(STEP_P3p3);
FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p3), TANK2_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫 FeedingRecords(work_Numder, TANK2_DYELOT, Convert.ToInt16(STEP_P1p3), TANK2_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 2 :" + Resources.CallDistribution;
}//药缸2 }//药缸2
else if (STEP_P1p3 == 3) else if (STEP_P1p3 == 3)
{ {
@ -2956,7 +2976,7 @@ namespace DyeingComputer.ViewModel
if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString(); if (string.IsNullOrEmpty(TANK3_DYELOT)) TANK3_DYELOT = WorkNumder.ToString();
TANK3_STEP = Convert.ToInt16(STEP_P3p3); TANK3_STEP = Convert.ToInt16(STEP_P3p3);
FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p3), TANK3_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫 FeedingRecords(work_Numder, TANK3_DYELOT, Convert.ToInt16(STEP_P1p3), TANK3_STEP, Convert.ToInt16(STEP_P2p3));//调用呼叫
if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution; // if (errTabler.Rows.Count == 0) Status_Str = Resources.Tank + " 3 :" + Resources.CallDistribution;
}//药缸3 }//药缸3
//STEP_finish = true; //STEP_finish = true;
break;//呼叫输送 break;//呼叫输送
@ -3266,7 +3286,15 @@ namespace DyeingComputer.ViewModel
private void Simulate()//模拟 private void Simulate()//模拟
{ {
double _rd = (double)_random.Next(1, 5) / 10; double _rd = (double)_random.Next(1, 5) / 10;
if (THL_mode == 1 || THL_mode == 0) if (THL_mode == 0)
{
if (Selet_dta("4001") > 16)
{
Updata_dta("4001", (int)(Selet_dta("4001") - _rd / 100));
}
Updata_dta("4001", (int)(Selet_dta("4001") + Selet_dta("5001") / 50 * _rd));
}
else if(THL_mode == 1 )
{ {
if (Selet_dta("4001") > 16) if (Selet_dta("4001") > 16)
{ {
@ -3276,11 +3304,18 @@ namespace DyeingComputer.ViewModel
} }
else if (THL_mode == 2) else if (THL_mode == 2)
{ Updata_dta("4001", (int)(Selet_dta("4001") - Selet_dta("5002") / 100*_rd)); } { Updata_dta("4001", (int)(Selet_dta("4001") - Selet_dta("5002") / 100*_rd)); }
if (Selet_dtd("3013") || Selet_dtd("3014") || Selet_dtd("3015") || Selet_dtd("3016"))
{
Updata_dta("4007", (int)(Selet_dta("4007") + _rd * 20));
}
if (Selet_dtd("3017") || Selet_dtd("3018") || Selet_dtd("3019"))
{
Updata_dta("4007", (int)(Selet_dta("4007") - _rd * 20));
}
} }
public static DataTable dt_d = new DataTable("DIO"); public static DataTable dt_d = new DataTable("DIO");

Loading…
Cancel
Save