Compare commits

...
20 Commits
Author SHA1 Message Date
sc eb2828aab0 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:01 +08:00
sc 33b970eff9 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:26:00 +08:00
sc 5caf92be59 Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:46 +08:00
sc 437b8957ce Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2026-01-04 23:24:44 +08:00
sc a68fb9ae01 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:41 +08:00
sc 68b98ac7e4 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-27 22:10:39 +08:00
sc 2329ac9abc Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:33 +08:00
sc b062420be1 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-26 01:35:30 +08:00
sc a248c41163 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-25 20:18:34 +08:00
sc 2b676adbba 修正错误 2025-10-25 20:18:31 +08:00
sc 00a5cd3ec7 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:27 +08:00
sc abfcf6e36a Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 22:14:26 +08:00
sc 1df7212414 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:37 +08:00
sc 751a2b092f Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 20:49:34 +08:00
sc 8a5e0ecfd9 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-15 00:09:05 +08:00
sc ebcd5b7182 串口通讯部分修改 2025-10-15 00:09:03 +08:00
sc 7f905617fa Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:24 +08:00
sc 54d8cc7266 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 02:02:21 +08:00
sc 33e83fa5d6 Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement 2025-10-10 00:56:15 +08:00
sc 927c38853d 添加485串口线路指令 2025-10-10 00:56:14 +08:00
3 changed files with 129 additions and 102 deletions

No files matched your search

+51 -48
View File
@@ -60,17 +60,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
portclient.Received = (client, e) =>
{
//接受重置事件状态
_responseEvent.Set();
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
for (int i = 0; i < sArray.Length; i++)
{
if (sArray[i].Length>5)
if (sArray[i].Length > 5)
{
string SYSAPI = sArray[i].Substring(0, 5);
string Station = ClipBetween(sArray[i], '[', ']');
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
if (SYSAPI == "SC800")
{
try
@@ -99,7 +101,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex)
{
@@ -112,17 +114,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkorderSteps", new Dictionary<string, object> { { "Mode", 1 } },
"WorkOrder ='" + _dat.GetValue("Order") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Step ='" +
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Step ='" +
_dat.GetValue("Step") + "'", null);
int x = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='"+
_dat.GetValue("Order") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Mode <> '1'", null).Tables[0].Rows.Count;
int x = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
_dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Mode <> '1'", null).Tables[0].Rows.Count;
if (x == 0)
{
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
"WorkOrder ='" + _dat.GetValue("Order") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
@@ -135,7 +137,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
"WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}//回复的工单设置状态后就位101
@@ -161,28 +163,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
drEmployee["ERR"] = _new.GetValue("ERR");
drEmployee["LOCK"] = _new.GetValue("LOCK");
drEmployee["Message"] = _new.GetValue("Status");
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
drEmployee["WorkOrder"] = _new.GetValue("Work");
drEmployee["Temperature"] = _new.GetValue("MTT");
drEmployee["WaterLevel"] = _new.GetValue("MTL");
drEmployee["Process"] = _new.GetValue("Process");
drEmployee["Step"] = _new.GetValue("Step");
drEmployee["UserButton"] = _new.GetValue("UserButton");
if (_new.GetValue("UserInfoStart").ToString() != "900")
{ drEmployee["UserInfoStart"] = _new.GetValue("UserInfoStart"); }
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
drEmployee["UserButton"] = _new.GetValue("UserB");
if (_new.GetValue("InfoS").ToString() != "900")
{ drEmployee["UserInfoStart"] = _new.GetValue("InfoS"); }
drEmployee["UserInfo"] = _new.GetValue("Info");
drEmployee["WORK_RUN"] = _new.GetValue("RUN");
drEmployee["RUN_STEPID"] = _new.GetValue("STEPID");
drEmployee["CALL"] = _new.GetValue("CALL");
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
if (_new.GetValue("Status").ToString() != "----------")
{
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
Chart_new.Add("Machine", mac);
Chart_new.Add("Time", _new.GetValue("Time"));
Chart_new.Add("WorkOrder", _new.GetValue("Work"));
//Chart_new.Add("Machine", mac);
//Chart_new.Add("Time", _new.GetValue("Time"));
Chart_new.Add("MST", _new.GetValue("MST"));
Chart_new.Add("MTT", _new.GetValue("MTT"));
Chart_new.Add("MTL", _new.GetValue("MTL"));
@@ -198,7 +200,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
}
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
catch (Exception ex)
{
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
}
}//当前信息
else if (SYSAPI == "SC831")
@@ -403,8 +407,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
@"\n", RegexOptions.IgnoreCase);
return EasyTask.CompletedTask; ;
};
await portclient.SetupAsync(new TouchSocketConfig()
@@ -416,7 +418,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
PortName = com,//COM
StopBits = System.IO.Ports.StopBits.One,//停止位
})
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
.ConfigurePlugins(a =>
{
//a.Add<MyPlugin>();
@@ -444,35 +446,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
var t = CRCcheck16.ToCRC16(command);
_responseEvent.Reset();
serialPortClients.Send(command); // 发送指令
// 等待500毫秒或直到收到响应
_responseEvent.Wait(TimeSpan.FromMilliseconds(1000));
// 重置事件状态
_responseEvent.Set();
//清楚了解状态
string Station = ClipBetween(command, '[', ']');
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
// 等待500毫秒或直到收到响应
if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
{
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
Station + "' AND Serial = 'PORT1'").First();
if (drEmployee.Field<int>("State") != 800)
_responseEvent.Set();
//清楚了解状态
string Station = ClipBetween(command, '[', ']');
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
{
drEmployee.BeginEdit();
drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = "";
drEmployee["Step"] = "";
drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
Station + "' AND Serial = 'PORT1'").First();
if (drEmployee.Field<int>("State") != 800)
{
drEmployee.BeginEdit();
drEmployee["State"] = "800";
drEmployee["WorkOrder"] = "------";
drEmployee["Dyelot"] = "";
drEmployee["Temperature"] = 0.0;
drEmployee["WaterLevel"] = 0.0;
drEmployee["Process"] = "";
drEmployee["Step"] = "";
drEmployee["Message"] = "";
drEmployee["SYSKEY"] = "";
drEmployee["WORK_RUN"] = "-1";
drEmployee["ERR"] = false;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
}
}
}
}
catch (Exception) { }
}
+15 -9
View File
@@ -160,10 +160,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
"WorkOrder ='" + DAT + "'", null);
// Dictionary<string, object> _dat;
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex)
{
@@ -175,10 +178,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
try
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
Dictionary<string, object> _dat;
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
"WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='"+ _dat.GetValue("ReDye") + "'", null);
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
"WorkOrder ='" + DAT + "'", null);
// Dictionary<string, object> _dat;
// _dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
// MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
// "WorkOrder ='" + _dat.GetValue("WorkOrder") + "' AND ReDye ='"+ _dat.GetValue("ReDye") + "'", null);
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
@@ -331,7 +337,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
}//步骤信息
else if (SYSAPI == "SC832")
{
try
@@ -403,7 +409,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
}
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
}
}//信息
else if (SYSAPI == "SC910")
{
try
+63 -45
View File
@@ -79,7 +79,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static string SN_ID;
public static string SN_KEY;
public static bool DyelotsDispenser;
public static SqlConnection conn_SC =new SqlConnection();//数据库
public static SqlConnection conn_SC = new SqlConnection();//数据库
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
private BDC_SQL.BDCSqlHelper bDCSqlHelper = new BDC_SQL.BDCSqlHelper();
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
@@ -95,7 +95,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static int ERR_c = 0;//错误计数器
public bool UPort1, UPort2, UPort3;
public static bool[] USER_Capacity { set; get; } = new bool[99];
public MainWindowViewModel()
{
try
@@ -150,15 +150,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
}
}
else
else
{
for (int i = 0; i < 99; i++)
{
USER_Capacity[i] = true;
{
USER_Capacity[i] = true;
}
}
}
public async void SQL_LINK()//连接dbc数据库
{
if (conn_SC.State == ConnectionState.Open) conn_SC.Close();
@@ -180,7 +180,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
ERR_c++;
}
if (SQMOD == "Windows Authentication") //连接数据库测试
{
bDCSqlHelper.Config(SQLIP, SQLNAME, SQLUSER, SQLPASWORD, true);
@@ -254,7 +254,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
foreach (DataRow dataRow in dataTable.Select("Mode<>'1'"))
{
Dictionary<string, object> dat_ = new Dictionary<string, object>();
dat_.Add("Order", dataRow["WorkOrder"].ToString());
dat_.Add("Work", dataRow["WorkOrder"].ToString());
dat_.Add("Dye", dataRow["DYELOT"].ToString());
dat_.Add("Time", dataRow["StepTime"].ToString());
dat_.Add("ReDye", dataRow["ReDye"].ToString());
@@ -314,7 +314,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
ID = index,
DAT = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString()
});
} }
}
}
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT3")
{ // 检查队列中是否已存在相同项
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
@@ -337,11 +338,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
ID = index,
DAT = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString()
});
} }
}
}
}
}
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 112 } },
if (WorkOrderstepdata.Select()[k].Field<object>("State").ToString() == "111")
{
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 112 } },
"WorkOrder ='" + WorkOrderstepdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
}
}
}
/*下传工单总览*/
@@ -391,9 +396,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
dt_temp.EndEdit();
dataTable.Rows.Add(dt_temp.ItemArray);
Dictionary<string, object> dat_ = new Dictionary<string, object>();
dat_.Add("Work", dt_temp["WorkOrder"].ToString());
dat_.Add("Dye", dt_temp["DYELOT"].ToString());
dat_.Add("STime", dt_temp["StartTime"].ToString());
dat_.Add("Time", dt_temp["Time"].ToString());
dat_.Add("ReDye", 0);
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderdata_m + "'").ToString());
string dat = "SC810[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
DataTableToDictionary(dataTable).ToJsonString();
string dat = "SC810[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString();
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT1")
{ // 检查队列中是否已存在相同项
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
@@ -444,8 +455,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
}
}
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 110 } },
if (WorkOrderdata.Select()[k].Field<object>("State").ToString() == "110")
{
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 110 } },
"WorkOrder ='" + WorkOrderdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
}
}
}
/*下传工单设置*/
@@ -472,7 +486,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
ID = index,
DAT = "SC812" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + DataTableToDictionary(WorkOrder_set).ToJsonString()
});
}
}
}
else
{//串口
@@ -534,10 +548,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
});
}
}
}
}
}
if (WorkOrderset_.Select()[k].Field<object>("State").ToString() == "113")
{
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 114 } },
"WorkOrder ='" + WorkOrderset_.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
}
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 114 } },
"WorkOrder ='" + WorkOrderset_.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
}
}
@@ -633,6 +650,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
});
}
}
Updata_Machines(Machines, "State", "ID='" + MachinesRow["ID"] + "'", "101");
}
else if (MachinesRow["Serial"].ToString() == "PORT2")
{
@@ -870,7 +888,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
else { Time30++; }
}
async void Tick_Event_5S()//Tick_Event周期执行事件5S
{
{
try
{//处理呼叫请求列表完成发送后(202》203)
if (Dyelot_CALL.Select("State='202'").Count() > 0)
@@ -1246,7 +1264,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
catch (Exception EX) { LogGing.ERRDATA(EX); }
}
public static TcpClient[] MachiensTcpClient = new TcpClient[99];
public static SerialPortClient[] MachiensPortClient = new SerialPortClient[4];
//public static DataRow[] machinesdata = new DataRow[999];
@@ -1298,7 +1316,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD1")));
AsyncSerialPortClient._responseEvent.Set();
Port1_link();
Port1_link();
}
if (Machines.Select("Type='false' AND Serial='PORT2'").Length > 0)
{
@@ -1341,7 +1359,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
await Task.Run(() =>
{
while (MachiensPortClient[0].Online )
while (MachiensPortClient[0].Online)
{
try
{
@@ -1387,7 +1405,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
}
}
});
});
}//发送
private async void Port2_link()
{
@@ -1439,7 +1457,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
}
}
});
});
}//发送
private async void Port3_link()
{
@@ -1491,7 +1509,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
}
}
});
});
}//发送
private async void Port4_link()
{
@@ -1543,7 +1561,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
}
}
});
});
}//发送
public static string SYS_WorkNumder; //工单号
@@ -1558,12 +1576,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
}
public static string MachineLOG;
/* public string sys_machine; //显示log
public string Sys_machine //通知UI控件参数改变
{
get { return sys_machine; }
set { sys_machine = value; OnPropertyChanged("Sys_machine"); }
}*/
/* public string sys_machine; //显示log
public string Sys_machine //通知UI控件参数改变
{
get { return sys_machine; }
set { sys_machine = value; OnPropertyChanged("Sys_machine"); }
}*/
public static object Selet_Machines(DataTable DB, string name, string key)//查询
{
@@ -1577,7 +1595,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
}
catch (Exception ex)
{
{
LogGing.LogGingDATA("SDTD:" + ex.ToString());
return "ERR";
}
@@ -1593,14 +1611,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
drEmployee[name] = Value;
drEmployee.EndEdit();
drEmployee.AcceptChanges();
// drEmployee.ClearErrors();
// drEmployee.ClearErrors();
}
}
catch (Exception ex)
{
LogGing.LogGingDATA("SDTD:" + ex.ToString());
{
LogGing.LogGingDATA("SDTD:" + ex.ToString());
}
}
}
public static DataTable dt_d = new DataTable("DIO");
public static DataTable dt_a = new DataTable("AIO");
@@ -1609,20 +1627,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static DataTable dt_TP = new DataTable();
public static DataTable dt_ParameterSet = new DataTable();
public static DataTable dt_SysSet = new DataTable();
public static bool TechnologicalProcess_bool =true;
// public static bool A_view =true;
// public static bool D_view =true;
public static bool TechnologicalProcess_bool = true;
// public static bool A_view =true;
// public static bool D_view =true;
public static bool IO_view;
// public static bool ParameterSet_view=true;
// public static bool SysSet_view=true;
// public static bool ParameterSet_view=true;
// public static bool SysSet_view=true;
public static string machine;
public static string workOrder;
public static string dyelot;
public static string machin_LOG;
//通讯队列
public static UInt32 RX=0;
public static UInt32 TX=0;
public static UInt32 RX = 0;
public static UInt32 TX = 0;
public class QueueSerial
{
public int ID { get; set; }