Compare commits
26
Commits
878d49c4a0
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2828aab0 | ||
|
|
33b970eff9 | ||
|
|
5caf92be59 | ||
|
|
437b8957ce | ||
|
|
a68fb9ae01 | ||
|
|
68b98ac7e4 | ||
|
|
2329ac9abc | ||
|
|
b062420be1 | ||
|
|
a248c41163 | ||
|
|
2b676adbba | ||
|
|
00a5cd3ec7 | ||
|
|
abfcf6e36a | ||
|
|
1df7212414 | ||
|
|
751a2b092f | ||
|
|
8a5e0ecfd9 | ||
|
|
ebcd5b7182 | ||
|
|
7f905617fa | ||
|
|
54d8cc7266 | ||
|
|
33e83fa5d6 | ||
|
|
927c38853d | ||
|
|
552d45485d | ||
|
|
17a5d6b718 | ||
|
|
34d3e6c292 | ||
|
|
5b60ea4765 | ||
|
|
b2817d1b01 | ||
|
|
7403914ba5 |
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -60,17 +60,19 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
portclient.Closed = (client, e) => { return EasyTask.CompletedTask; };//从端口断开连接,当连接不成功时不会触发。
|
||||||
portclient.Received = (client, e) =>
|
portclient.Received = (client, e) =>
|
||||||
{
|
{
|
||||||
|
//接受重置事件状态
|
||||||
_responseEvent.Set();
|
_responseEvent.Set();
|
||||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||||
@"\n", RegexOptions.IgnoreCase);
|
@"\n", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
for (int i = 0; i < sArray.Length; i++)
|
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 SYSAPI = sArray[i].Substring(0, 5);
|
||||||
string Station = ClipBetween(sArray[i], '[', ']');
|
string Station = ClipBetween(sArray[i], '[', ']');
|
||||||
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
string DAT = sArray[i].Substring(sArray[i].IndexOf("]") + 1);
|
||||||
|
|
||||||
if (SYSAPI == "SC800")
|
if (SYSAPI == "SC800")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -95,32 +97,50 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
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 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++;
|
||||||
}
|
}
|
||||||
}
|
}//回复的工单记录状态后就位111
|
||||||
else if (SYSAPI == "SC811")
|
else if (SYSAPI == "SC811")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
Dictionary<string, object> _dat;
|
||||||
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT);
|
||||||
|
MainWindowViewModel.SQLiteHelpers.Update("WorkorderSteps", new Dictionary<string, object> { { "Mode", 1 } },
|
||||||
|
"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("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("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}//回复的工单明细状态后就位113
|
||||||
else if (SYSAPI == "SC812")
|
else if (SYSAPI == "SC812")
|
||||||
{
|
{
|
||||||
try
|
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", 101 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 101 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"WorkOrder ='" + _dat.GetValue("Work") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}//回复的工单设置状态后就位101
|
||||||
else if (SYSAPI == "SC827")
|
else if (SYSAPI == "SC827")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -143,28 +163,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
drEmployee["ERR"] = _new.GetValue("ERR");
|
drEmployee["ERR"] = _new.GetValue("ERR");
|
||||||
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
drEmployee["LOCK"] = _new.GetValue("LOCK");
|
||||||
drEmployee["Message"] = _new.GetValue("Status");
|
drEmployee["Message"] = _new.GetValue("Status");
|
||||||
drEmployee["WorkOrder"] = _new.GetValue("WorkNumder");
|
drEmployee["WorkOrder"] = _new.GetValue("Work");
|
||||||
drEmployee["Temperature"] = _new.GetValue("MTT");
|
drEmployee["Temperature"] = _new.GetValue("MTT");
|
||||||
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
drEmployee["WaterLevel"] = _new.GetValue("MTL");
|
||||||
drEmployee["Process"] = _new.GetValue("Process");
|
drEmployee["Process"] = _new.GetValue("Process");
|
||||||
drEmployee["Step"] = _new.GetValue("Step");
|
drEmployee["Step"] = _new.GetValue("Step");
|
||||||
drEmployee["UserButton"] = _new.GetValue("UserButton");
|
drEmployee["UserButton"] = _new.GetValue("UserB");
|
||||||
if (_new.GetValue("UserInfoStart").ToString() != "900")
|
if (_new.GetValue("InfoS").ToString() != "900")
|
||||||
{ drEmployee["UserInfoStart"] = _new.GetValue("UserInfoStart"); }
|
{ drEmployee["UserInfoStart"] = _new.GetValue("InfoS"); }
|
||||||
drEmployee["UserInfo"] = _new.GetValue("UserInfo");
|
drEmployee["UserInfo"] = _new.GetValue("Info");
|
||||||
drEmployee["WORK_RUN"] = _new.GetValue("WORK_RUN");
|
drEmployee["WORK_RUN"] = _new.GetValue("RUN");
|
||||||
drEmployee["RUN_STEPID"] = _new.GetValue("RUN_STEPID");
|
drEmployee["RUN_STEPID"] = _new.GetValue("STEPID");
|
||||||
drEmployee["CALL"] = _new.GetValue("CALL");
|
drEmployee["CALL"] = _new.GetValue("CALL");
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_new.GetValue("Status").ToString() != "----------")
|
if (_new.GetValue("Status").ToString() != "----------")
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||||
Chart_new.Add("WorkOrder", _new.GetValue("WorkNumder"));
|
Chart_new.Add("WorkOrder", _new.GetValue("Work"));
|
||||||
Chart_new.Add("Machine", mac);
|
//Chart_new.Add("Machine", mac);
|
||||||
Chart_new.Add("Time", _new.GetValue("Time"));
|
//Chart_new.Add("Time", _new.GetValue("Time"));
|
||||||
Chart_new.Add("MST", _new.GetValue("MST"));
|
Chart_new.Add("MST", _new.GetValue("MST"));
|
||||||
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
Chart_new.Add("MTT", _new.GetValue("MTT"));
|
||||||
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
Chart_new.Add("MTL", _new.GetValue("MTL"));
|
||||||
@@ -180,7 +200,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
MainWindowViewModel.SQLiteChartAdress.InsertData("Chart", Chart_new);// 执行插入
|
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")
|
else if (SYSAPI == "SC831")
|
||||||
@@ -385,8 +407,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
string[] sArray = Regex.Split(e.ByteBlock.Span.ToString(Encoding.UTF8),
|
||||||
@"\n", RegexOptions.IgnoreCase);
|
@"\n", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return EasyTask.CompletedTask; ;
|
return EasyTask.CompletedTask; ;
|
||||||
};
|
};
|
||||||
await portclient.SetupAsync(new TouchSocketConfig()
|
await portclient.SetupAsync(new TouchSocketConfig()
|
||||||
@@ -398,7 +418,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
PortName = com,//COM
|
PortName = com,//COM
|
||||||
StopBits = System.IO.Ports.StopBits.One,//停止位
|
StopBits = System.IO.Ports.StopBits.One,//停止位
|
||||||
})
|
})
|
||||||
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(100) })
|
.SetSerialDataHandlingAdapter(() => new PeriodPackageAdapter() { CacheTimeout = TimeSpan.FromMilliseconds(500) })
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//a.Add<MyPlugin>();
|
//a.Add<MyPlugin>();
|
||||||
@@ -426,35 +446,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
var t = CRCcheck16.ToCRC16(command);
|
var t = CRCcheck16.ToCRC16(command);
|
||||||
_responseEvent.Reset();
|
_responseEvent.Reset();
|
||||||
serialPortClients.Send(command); // 发送指令
|
serialPortClients.Send(command); // 发送指令
|
||||||
// 等待500毫秒或直到收到响应
|
|
||||||
_responseEvent.Wait(TimeSpan.FromMilliseconds(500));
|
// 等待500毫秒或直到收到响应
|
||||||
// 重置事件状态
|
if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
|
||||||
_responseEvent.Set();
|
|
||||||
//清楚了解状态
|
|
||||||
string Station = ClipBetween(command, '[', ']');
|
|
||||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
|
||||||
{
|
{
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
_responseEvent.Set();
|
||||||
Station + "' AND Serial = 'PORT1'").First();
|
//清楚了解状态
|
||||||
if (drEmployee.Field<int>("State") != 800)
|
string Station = ClipBetween(command, '[', ']');
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
drEmployee.BeginEdit();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("Station='" +
|
||||||
drEmployee["State"] = "800";
|
Station + "' AND Serial = 'PORT1'").First();
|
||||||
drEmployee["WorkOrder"] = "------";
|
if (drEmployee.Field<int>("State") != 800)
|
||||||
drEmployee["Dyelot"] = "";
|
{
|
||||||
drEmployee["Temperature"] = 0.0;
|
drEmployee.BeginEdit();
|
||||||
drEmployee["WaterLevel"] = 0.0;
|
drEmployee["State"] = "800";
|
||||||
drEmployee["Process"] = "";
|
drEmployee["WorkOrder"] = "------";
|
||||||
drEmployee["Step"] = "";
|
drEmployee["Dyelot"] = "";
|
||||||
drEmployee["Message"] = "";
|
drEmployee["Temperature"] = 0.0;
|
||||||
drEmployee["SYSKEY"] = "";
|
drEmployee["WaterLevel"] = 0.0;
|
||||||
drEmployee["WORK_RUN"] = "-1";
|
drEmployee["Process"] = "";
|
||||||
drEmployee["ERR"] = false;
|
drEmployee["Step"] = "";
|
||||||
drEmployee.EndEdit();
|
drEmployee["Message"] = "";
|
||||||
drEmployee.AcceptChanges();
|
drEmployee["SYSKEY"] = "";
|
||||||
|
drEmployee["WORK_RUN"] = "-1";
|
||||||
|
drEmployee["ERR"] = false;
|
||||||
|
drEmployee.EndEdit();
|
||||||
|
drEmployee.AcceptChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,9 +159,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
|
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", 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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -173,8 +178,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
|
||||||
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 113 } },
|
|
||||||
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 111 } },
|
||||||
"WorkOrder ='" + DAT + "'", null);
|
"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++; }
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; }
|
||||||
}
|
}
|
||||||
@@ -327,7 +337,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
MainWindowViewModel.dt_TP = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
}
|
}
|
||||||
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 == "SC832")
|
else if (SYSAPI == "SC832")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -399,7 +409,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
|||||||
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
MachinesView.LOG_dataTable = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
|
||||||
}
|
}
|
||||||
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 == "SC910")
|
else if (SYSAPI == "SC910")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
|
||||||
|
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
+224
-149
@@ -79,7 +79,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public static string SN_ID;
|
public static string SN_ID;
|
||||||
public static string SN_KEY;
|
public static string SN_KEY;
|
||||||
public static bool DyelotsDispenser;
|
public static bool DyelotsDispenser;
|
||||||
public static SqlConnection conn_SC =new SqlConnection();//数据库
|
public static SqlConnection conn_SC = new SqlConnection();//数据库
|
||||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private BDC_SQL.BDCSqlHelper bDCSqlHelper = new BDC_SQL.BDCSqlHelper();
|
private BDC_SQL.BDCSqlHelper bDCSqlHelper = new BDC_SQL.BDCSqlHelper();
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||||
@@ -95,7 +95,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public static int ERR_c = 0;//错误计数器
|
public static int ERR_c = 0;//错误计数器
|
||||||
public bool UPort1, UPort2, UPort3;
|
public bool UPort1, UPort2, UPort3;
|
||||||
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -150,15 +150,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 99; i++)
|
for (int i = 0; i < 99; i++)
|
||||||
{
|
{
|
||||||
USER_Capacity[i] = true;
|
USER_Capacity[i] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void SQL_LINK()//连接dbc数据库
|
public async void SQL_LINK()//连接dbc数据库
|
||||||
{
|
{
|
||||||
if (conn_SC.State == ConnectionState.Open) conn_SC.Close();
|
if (conn_SC.State == ConnectionState.Open) conn_SC.Close();
|
||||||
@@ -180,7 +180,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
|
LogGing.LogGingDATA("[Database='" + ex + "']=SQLSERVER");
|
||||||
ERR_c++;
|
ERR_c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SQMOD == "Windows Authentication") //连接数据库测试
|
if (SQMOD == "Windows Authentication") //连接数据库测试
|
||||||
{
|
{
|
||||||
bDCSqlHelper.Config(SQLIP, SQLNAME, SQLUSER, SQLPASWORD, true);
|
bDCSqlHelper.Config(SQLIP, SQLNAME, SQLUSER, SQLPASWORD, true);
|
||||||
@@ -230,80 +230,127 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
/*下传工单信息*/
|
/*下传工单信息*/
|
||||||
DataTable WorkOrderstepdata = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='111' or State='112') AND EndTime >'" +
|
DataTable WorkOrderstepdata = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='111' OR State='112') AND StartTime >'" +
|
||||||
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
||||||
for (int k = 0; k < WorkOrderstepdata.Rows.Count; k++)
|
for (int k = 0; k < WorkOrderstepdata.Rows.Count; k++)
|
||||||
{
|
{
|
||||||
string WorkOrderdata_m = WorkOrderstepdata.Select()[k].Field<object>("Machines").ToString();
|
string WorkOrderdata_m = WorkOrderstepdata.Select()[k].Field<object>("Machines").ToString();
|
||||||
//string m= WorkOrderstepdata.Rows[k].Field<string>("Machines");
|
DataTable dataTable = SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
|
||||||
|
WorkOrderstepdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null).Tables[0];
|
||||||
|
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderdata_m + "'").ToString());
|
||||||
|
|
||||||
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(Selet_Machines(Machines, "Type", "Name='" + WorkOrderdata_m + "'")))
|
if (Convert.ToBoolean(Selet_Machines(Machines, "Type", "Name='" + WorkOrderdata_m + "'")))
|
||||||
{//网络
|
{//网络
|
||||||
//string WorkOrderdata_m = WorkOrderstepdata.Select()[k].Field<object>("Machines").ToString();
|
|
||||||
DataTable dataTable = SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
|
|
||||||
WorkOrderstepdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null).Tables[0];
|
|
||||||
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderdata_m + "'").ToString());
|
|
||||||
stringQueue.Enqueue(new QueueString
|
stringQueue.Enqueue(new QueueString
|
||||||
{
|
{
|
||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC811" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + dataTable.ToJsonString()
|
DAT = "SC811" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + dataTable.ToJsonString()
|
||||||
});
|
});
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 112 } },
|
|
||||||
"WorkOrder ='" + WorkOrderstepdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//串口
|
{//串口
|
||||||
DataTable dataTable = SQLiteHelpers.ExecuteDataSet("select * from WorkorderSteps where WorkOrder='" +
|
foreach (DataRow dataRow in dataTable.Select("Mode<>'1'"))
|
||||||
WorkOrderstepdata.Select()[k].Field<object>("WorkOrder").ToString() + "' AND ReDye ='" +
|
{
|
||||||
WorkOrderstepdata.Select()[k].Field<object>("ReDye").ToString() + "' AND Mode<> '201'", null).Tables[0];
|
Dictionary<string, object> dat_ = new Dictionary<string, object>();
|
||||||
|
dat_.Add("Work", dataRow["WorkOrder"].ToString());
|
||||||
|
dat_.Add("Dye", dataRow["DYELOT"].ToString());
|
||||||
|
dat_.Add("Time", dataRow["StepTime"].ToString());
|
||||||
|
dat_.Add("ReDye", dataRow["ReDye"].ToString());
|
||||||
|
dat_.Add("Program", dataRow["Program"].ToString());
|
||||||
|
dat_.Add("Step", dataRow["Step"].ToString());
|
||||||
|
dat_.Add("StepID", dataRow["StepID"].ToString());
|
||||||
|
dat_.Add("P1", dataRow["Parameter1"].ToString());
|
||||||
|
dat_.Add("P2", dataRow["Parameter2"].ToString());
|
||||||
|
dat_.Add("P3", dataRow["Parameter3"].ToString());
|
||||||
|
dat_.Add("P4", dataRow["Parameter4"].ToString());
|
||||||
|
dat_.Add("P5", dataRow["Parameter5"].ToString());
|
||||||
|
dat_.Add("P6", dataRow["Parameter6"].ToString());
|
||||||
|
dat_.Add("P7", dataRow["Parameter7"].ToString());
|
||||||
|
dat_.Add("P8", dataRow["Parameter8"].ToString());
|
||||||
|
dat_.Add("P9", dataRow["Parameter9"].ToString());
|
||||||
|
dat_.Add("P10", dataRow["Parameter10"].ToString());
|
||||||
|
dat_.Add("SIDS1", dataRow["StepID_S1"].ToString());
|
||||||
|
dat_.Add("SIDS2", dataRow["StepID_S2"].ToString());
|
||||||
|
dat_.Add("SIDS3", dataRow["StepID_S3"].ToString());
|
||||||
|
dat_.Add("P1S1", dataRow["Parameter1_S1"].ToString());
|
||||||
|
dat_.Add("P2S1", dataRow["Parameter2_S1"].ToString());
|
||||||
|
dat_.Add("P3S1", dataRow["Parameter3_S1"].ToString());
|
||||||
|
dat_.Add("P4S1", dataRow["Parameter4_S1"].ToString());
|
||||||
|
dat_.Add("P5S1", dataRow["Parameter5_S1"].ToString());
|
||||||
|
dat_.Add("P1S2", dataRow["Parameter1_S2"].ToString());
|
||||||
|
dat_.Add("P2S2", dataRow["Parameter2_S2"].ToString());
|
||||||
|
dat_.Add("P3S2", dataRow["Parameter3_S2"].ToString());
|
||||||
|
dat_.Add("P4S2", dataRow["Parameter4_S2"].ToString());
|
||||||
|
dat_.Add("P5S2", dataRow["Parameter5_S2"].ToString());
|
||||||
|
dat_.Add("P1S3", dataRow["Parameter1_S3"].ToString());
|
||||||
|
dat_.Add("P2S3", dataRow["Parameter2_S3"].ToString());
|
||||||
|
dat_.Add("P3S3", dataRow["Parameter3_S3"].ToString());
|
||||||
|
dat_.Add("P4S3", dataRow["Parameter4_S3"].ToString());
|
||||||
|
dat_.Add("P5S3", dataRow["Parameter5_S3"].ToString());
|
||||||
|
|
||||||
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderdata_m + "'").ToString());
|
string dat = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString();
|
||||||
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT1")
|
|
||||||
{
|
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT1")
|
||||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
{ // 检查队列中是否已存在相同项
|
||||||
{
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
|
||||||
ID = index,
|
if (!exists)
|
||||||
DAT = "SC811[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
dataTable.Rows[0].ToJsonString()
|
{
|
||||||
});
|
ID = index,
|
||||||
}
|
DAT = dat
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT2")
|
});
|
||||||
{
|
}
|
||||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
}
|
||||||
{
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT2")
|
||||||
ID = index,
|
{ // 检查队列中是否已存在相同项
|
||||||
DAT = "SC811[" +
|
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
if (!exists)
|
||||||
dataTable.Rows[0].ToJsonString()
|
{
|
||||||
});
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
}
|
{
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT3")
|
ID = index,
|
||||||
{
|
DAT = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString()
|
||||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
});
|
||||||
{
|
}
|
||||||
ID = index,
|
}
|
||||||
DAT = "SC811[" +
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT3")
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
{ // 检查队列中是否已存在相同项
|
||||||
dataTable.Rows[0].ToJsonString()
|
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
|
||||||
});
|
if (!exists)
|
||||||
}
|
{
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT4")
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
{
|
{
|
||||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
ID = index,
|
||||||
{
|
DAT = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString()
|
||||||
ID = index,
|
});
|
||||||
DAT = "SC811[" +
|
}
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
}
|
||||||
dataTable.Rows[0].ToJsonString()
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT4")
|
||||||
});
|
{ // 检查队列中是否已存在相同项
|
||||||
|
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = "SC811[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*下传工单总览*/
|
/*下传工单总览*/
|
||||||
DataTable WorkOrderdata = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='100' or State='110') AND EndTime >'" +
|
DataTable WorkOrderdata = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='100' OR State='110') AND StartTime >'" +
|
||||||
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
||||||
for (int k = 0; k < WorkOrderdata.Rows.Count; k++)
|
for (int k = 0; k < WorkOrderdata.Rows.Count; k++)
|
||||||
{
|
{
|
||||||
@@ -332,8 +379,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
ID = index,
|
ID = index,
|
||||||
DAT = "SC810" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + DataTableToDictionary(dataTable).ToJsonString()
|
DAT = "SC810" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + DataTableToDictionary(dataTable).ToJsonString()
|
||||||
});
|
});
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 110 } },
|
|
||||||
"WorkOrder ='" + WorkOrderdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -341,7 +386,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
//string WorkOrderdata_m = WorkOrderdata.Select()[k].Field<object>("Machines").ToString();
|
//string WorkOrderdata_m = WorkOrderdata.Select()[k].Field<object>("Machines").ToString();
|
||||||
string State = Selet_Machines(Machines, "State", "Name='" + WorkOrderdata_m + "'").ToString();
|
string State = Selet_Machines(Machines, "State", "Name='" + WorkOrderdata_m + "'").ToString();
|
||||||
|
|
||||||
if ((State == "101") || (State == "201") || (State == "202") || (State == "309"))
|
if ((State == "101") || (State == "201") || (State == "202") || (State == "309") || (State == "802"))
|
||||||
{
|
{
|
||||||
DataTable dataTable = WorkOrderdata.Clone();
|
DataTable dataTable = WorkOrderdata.Clone();
|
||||||
// WorkOrderdata.Columns.Remove("Machines");
|
// WorkOrderdata.Columns.Remove("Machines");
|
||||||
@@ -351,56 +396,74 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
dt_temp.EndEdit();
|
dt_temp.EndEdit();
|
||||||
dataTable.Rows.Add(dt_temp.ItemArray);
|
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());
|
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderdata_m + "'").ToString());
|
||||||
|
string dat = "SC810[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" + dat_.ToJsonString();
|
||||||
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT1")
|
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT1")
|
||||||
{
|
{ // 检查队列中是否已存在相同项
|
||||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
DAT = "SC810[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(dataTable).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT2")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT2")
|
||||||
{
|
{ // 检查队列中是否已存在相同项
|
||||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
DAT = "SC810[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(dataTable).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT3")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT3")
|
||||||
{
|
{ // 检查队列中是否已存在相同项
|
||||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
DAT = "SC810[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(dataTable).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT4")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderdata_m + "'").ToString() == "PORT4")
|
||||||
{
|
{ // 检查队列中是否已存在相同项
|
||||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
DAT = "SC810[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(dataTable).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 110 } },
|
|
||||||
"WorkOrder ='" + WorkOrderdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*下传工单设置*/
|
/*下传工单设置*/
|
||||||
DataTable WorkOrderset_ = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='113'or State='114') AND EndTime >'" +
|
DataTable WorkOrderset_ = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where (State='113' OR State='114') AND StartTime >'" +
|
||||||
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
||||||
for (int k = 0; k < WorkOrderset_.Rows.Count; k++)
|
for (int k = 0; k < WorkOrderset_.Rows.Count; k++)
|
||||||
{
|
{
|
||||||
@@ -424,9 +487,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
DAT = "SC812" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + DataTableToDictionary(WorkOrder_set).ToJsonString()
|
DAT = "SC812" + Selet_Machines(Machines, "SYSKEY", "ID='" + index + "'") + DataTableToDictionary(WorkOrder_set).ToJsonString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 114 } },
|
|
||||||
"WorkOrder ='" + WorkOrderset_.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//串口
|
{//串口
|
||||||
@@ -438,49 +498,62 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
if (WorkOrder_set.Rows.Count > 0)
|
if (WorkOrder_set.Rows.Count > 0)
|
||||||
{
|
{
|
||||||
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderset_m + "'").ToString());
|
int index = Convert.ToInt16(Selet_Machines(Machines, "ID", "Name='" + WorkOrderset_m + "'").ToString());
|
||||||
|
string dat = "SC812[" + Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
||||||
|
DataTableToDictionary(WorkOrder_set).ToJsonString();
|
||||||
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT1")
|
if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT1")
|
||||||
{
|
{
|
||||||
stringQueueSerial_1.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
DAT = "SC812[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(WorkOrder_set).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT2")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT2")
|
||||||
{
|
{
|
||||||
stringQueueSerial_2.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
DAT = "SC812[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(WorkOrder_set).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT3")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT3")
|
||||||
{
|
{
|
||||||
stringQueueSerial_3.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
DAT = "SC812[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(WorkOrder_set).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT4")
|
else if (Selet_Machines(Machines, "Serial", "Name='" + WorkOrderset_m + "'").ToString() == "PORT4")
|
||||||
{
|
{
|
||||||
stringQueueSerial_4.Enqueue(new QueueSerial
|
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
{
|
{
|
||||||
ID = index,
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
DAT = "SC812[" +
|
{
|
||||||
Selet_Machines(Machines, "Station", "ID='" + index + "'") + "]" +
|
ID = index,
|
||||||
DataTableToDictionary(WorkOrder_set).ToJsonString()
|
DAT = dat
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 110 } },
|
}
|
||||||
"WorkOrder ='" + WorkOrderdata.Select()[k].Field<object>("WorkOrder").ToString() + "'", null);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,6 +650,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Updata_Machines(Machines, "State", "ID='" + MachinesRow["ID"] + "'", "101");
|
||||||
}
|
}
|
||||||
else if (MachinesRow["Serial"].ToString() == "PORT2")
|
else if (MachinesRow["Serial"].ToString() == "PORT2")
|
||||||
{
|
{
|
||||||
@@ -1094,6 +1168,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception EX) { LogGing.ERRDATA(EX); }
|
catch (Exception EX) { LogGing.ERRDATA(EX); }
|
||||||
|
/**染机呼叫完成**/
|
||||||
try
|
try
|
||||||
{//301列表发送完成至染机(203=>301)
|
{//301列表发送完成至染机(203=>301)
|
||||||
foreach (DataRow row in Dyelot_CALL.Select("State='301' OR State='309'"))
|
foreach (DataRow row in Dyelot_CALL.Select("State='301' OR State='309'"))
|
||||||
@@ -1189,7 +1264,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
}
|
}
|
||||||
catch (Exception EX) { LogGing.ERRDATA(EX); }
|
catch (Exception EX) { LogGing.ERRDATA(EX); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TcpClient[] MachiensTcpClient = new TcpClient[99];
|
public static TcpClient[] MachiensTcpClient = new TcpClient[99];
|
||||||
public static SerialPortClient[] MachiensPortClient = new SerialPortClient[4];
|
public static SerialPortClient[] MachiensPortClient = new SerialPortClient[4];
|
||||||
//public static DataRow[] machinesdata = new DataRow[999];
|
//public static DataRow[] machinesdata = new DataRow[999];
|
||||||
@@ -1241,7 +1316,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD1")));
|
, Convert.ToInt32(Configini.IniReadvalue("SYS", "BAUD1")));
|
||||||
AsyncSerialPortClient._responseEvent.Set();
|
AsyncSerialPortClient._responseEvent.Set();
|
||||||
|
|
||||||
Port1_link();
|
Port1_link();
|
||||||
}
|
}
|
||||||
if (Machines.Select("Type='false' AND Serial='PORT2'").Length > 0)
|
if (Machines.Select("Type='false' AND Serial='PORT2'").Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1284,7 +1359,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
while (MachiensPortClient[0].Online )
|
while (MachiensPortClient[0].Online)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1330,7 +1405,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private async void Port2_link()
|
private async void Port2_link()
|
||||||
{
|
{
|
||||||
@@ -1382,7 +1457,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private async void Port3_link()
|
private async void Port3_link()
|
||||||
{
|
{
|
||||||
@@ -1434,7 +1509,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//发送
|
}//发送
|
||||||
private async void Port4_link()
|
private async void Port4_link()
|
||||||
{
|
{
|
||||||
@@ -1486,7 +1561,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//发送
|
}//发送
|
||||||
|
|
||||||
public static string SYS_WorkNumder; //工单号
|
public static string SYS_WorkNumder; //工单号
|
||||||
@@ -1501,12 +1576,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||||
}
|
}
|
||||||
public static string MachineLOG;
|
public static string MachineLOG;
|
||||||
/* public string sys_machine; //显示log
|
/* public string sys_machine; //显示log
|
||||||
public string Sys_machine //通知UI控件参数改变
|
public string Sys_machine //通知UI控件参数改变
|
||||||
{
|
{
|
||||||
get { return sys_machine; }
|
get { return sys_machine; }
|
||||||
set { sys_machine = value; OnPropertyChanged("Sys_machine"); }
|
set { sys_machine = value; OnPropertyChanged("Sys_machine"); }
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public static object Selet_Machines(DataTable DB, string name, string key)//查询
|
public static object Selet_Machines(DataTable DB, string name, string key)//查询
|
||||||
{
|
{
|
||||||
@@ -1520,7 +1595,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
||||||
return "ERR";
|
return "ERR";
|
||||||
}
|
}
|
||||||
@@ -1536,14 +1611,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
drEmployee[name] = Value;
|
drEmployee[name] = Value;
|
||||||
drEmployee.EndEdit();
|
drEmployee.EndEdit();
|
||||||
drEmployee.AcceptChanges();
|
drEmployee.AcceptChanges();
|
||||||
// drEmployee.ClearErrors();
|
// drEmployee.ClearErrors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
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_d = new DataTable("DIO");
|
||||||
public static DataTable dt_a = new DataTable("AIO");
|
public static DataTable dt_a = new DataTable("AIO");
|
||||||
@@ -1552,20 +1627,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
public static DataTable dt_TP = new DataTable();
|
public static DataTable dt_TP = new DataTable();
|
||||||
public static DataTable dt_ParameterSet = new DataTable();
|
public static DataTable dt_ParameterSet = new DataTable();
|
||||||
public static DataTable dt_SysSet = new DataTable();
|
public static DataTable dt_SysSet = new DataTable();
|
||||||
public static bool TechnologicalProcess_bool =true;
|
public static bool TechnologicalProcess_bool = true;
|
||||||
// public static bool A_view =true;
|
// public static bool A_view =true;
|
||||||
// public static bool D_view =true;
|
// public static bool D_view =true;
|
||||||
public static bool IO_view;
|
public static bool IO_view;
|
||||||
// public static bool ParameterSet_view=true;
|
// public static bool ParameterSet_view=true;
|
||||||
// public static bool SysSet_view=true;
|
// public static bool SysSet_view=true;
|
||||||
public static string machine;
|
public static string machine;
|
||||||
public static string workOrder;
|
public static string workOrder;
|
||||||
public static string dyelot;
|
public static string dyelot;
|
||||||
public static string machin_LOG;
|
public static string machin_LOG;
|
||||||
|
|
||||||
//通讯队列
|
//通讯队列
|
||||||
public static UInt32 RX=0;
|
public static UInt32 RX = 0;
|
||||||
public static UInt32 TX=0;
|
public static UInt32 TX = 0;
|
||||||
public class QueueSerial
|
public class QueueSerial
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
using ScottPlot.TickGenerators.TimeUnits;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -22,6 +23,7 @@ using System.Windows.Threading;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||||
{
|
{
|
||||||
@@ -51,11 +53,70 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
dat_821.Add("WorkOrder", WorkOrder_);
|
dat_821.Add("WorkOrder", WorkOrder_);
|
||||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine_ + "'").First();
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine_ + "'").First();
|
||||||
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID"));
|
||||||
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
string dat = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString();
|
||||||
|
|
||||||
|
lock (MainWindowViewModel.Machines.Rows.SyncRoot)
|
||||||
{
|
{
|
||||||
ID = index,
|
if (drEmployee.Field<bool>("Type"))
|
||||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
{//网络
|
||||||
});
|
MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//串口
|
||||||
|
if (drEmployee.Field<string>("Serial") == "PORT1")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_1.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT2")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_2.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_2.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT3")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_3.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_3.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drEmployee.Field<string>("Serial") == "PORT4")
|
||||||
|
{
|
||||||
|
bool exists = stringQueueSerial_4.Any(item => item.ID == index && item.DAT == dat);
|
||||||
|
if (!exists)
|
||||||
|
{
|
||||||
|
stringQueueSerial_4.Enqueue(new QueueSerial
|
||||||
|
{
|
||||||
|
ID = index,
|
||||||
|
DAT = dat
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user