|
|
@ -2,6 +2,7 @@ |
|
|
|
using ScottPlot.Plottables; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.View; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.WindowsView; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
@ -17,6 +18,7 @@ using TouchSocket.SerialPorts; |
|
|
|
using TouchSocket.Sockets; |
|
|
|
using static SkiaSharp.HarfBuzz.SKShaper; |
|
|
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper; |
|
|
|
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel; |
|
|
|
using static System.Net.Mime.MediaTypeNames; |
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
@ -95,7 +97,6 @@ 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 } }, |
|
|
@ -110,7 +111,6 @@ 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("WorkorderSteps", new Dictionary<string, object> { { "Mode", 1 } }, |
|
|
@ -131,7 +131,6 @@ 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", 101 } }, |
|
|
@ -143,9 +142,80 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
Dictionary<string, object> _dat; |
|
|
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT); |
|
|
|
DataTable dataTable = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder='" + |
|
|
|
_dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "' AND Step = '"+ _dat.GetValue("Step") + "'", null).Tables[0]; |
|
|
|
foreach (DataRow sourceRow in dataTable.Rows) |
|
|
|
{ |
|
|
|
lock (MainWindowViewModel.Dyelot_CALL.Rows.SyncRoot) |
|
|
|
{ |
|
|
|
// 创建新行(基于目标表结构)
|
|
|
|
DataRow newRow = MainWindowViewModel.Dyelot_CALL.NewRow(); |
|
|
|
// 复制源表中存在的列数据
|
|
|
|
foreach (DataColumn column in dataTable.Columns) |
|
|
|
{ |
|
|
|
if (MainWindowViewModel.Dyelot_CALL.Columns.Contains(column.ColumnName)) |
|
|
|
{ |
|
|
|
newRow[column.ColumnName] = sourceRow[column.ColumnName]; |
|
|
|
} |
|
|
|
} |
|
|
|
MainWindowViewModel.Dyelot_CALL.Rows.Add(newRow); |
|
|
|
|
|
|
|
Dictionary<string, object> Product_ = new Dictionary<string, object>();//缓存函数
|
|
|
|
Product_.Add("State", 202); |
|
|
|
Product_.Add("Dyelot", newRow.Field<string>("Dyelot")); |
|
|
|
Product_.Add("Step", newRow.Field<int>("Step")); |
|
|
|
|
|
|
|
newRow.BeginEdit(); |
|
|
|
newRow["State"] = 202; |
|
|
|
newRow.EndEdit(); |
|
|
|
|
|
|
|
MainWindowViewModel.SQLiteHelpers.InsertData("DyelotHistory", MainWindowViewModel.SQLiteHelpers.ToDictionary(newRow));// 执行插入
|
|
|
|
int index = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Machines where Serial='PORT1' AND Station ='" + |
|
|
|
Station + "' ", null).Tables[0].Rows[0].Field<int>("ID"); |
|
|
|
string dat_ = "SC828[" + Station + "]" + Product_.ToJsonString(); |
|
|
|
bool exists = stringQueueSerial_1.Any(item => item.ID == index && item.DAT == dat_); |
|
|
|
if (!exists) |
|
|
|
{ |
|
|
|
stringQueueSerial_1.Enqueue(new QueueSerial |
|
|
|
{ |
|
|
|
ID = index, |
|
|
|
DAT = dat_ |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//获取呼叫领料单
|
|
|
|
else if (SYSAPI == "SC822") |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
DAT = DAT.Substring(DAT.IndexOf("]") + 1); |
|
|
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(DAT).Copy();//反序列化
|
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
UserWorkOrder userWorkOrder = new UserWorkOrder(); |
|
|
|
userWorkOrder.WorkOrderTable = dataTable; |
|
|
|
userWorkOrder.Show(); |
|
|
|
}); |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
System.Windows.Application.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
|
UserInf userInf = new UserInf(); |
|
|
|
userInf.Inf_DAT = "没有等待中的工艺"; |
|
|
|
userInf.Show(); |
|
|
|
userInf.Activate(); |
|
|
|
}); |
|
|
|
|
|
|
|
// LogGing.LogGingDATA("[ERR='" + ex + "']=Exception");
|
|
|
|
MainWindowViewModel.ERR_c++; |
|
|
|
} |
|
|
|
}//可用工单
|
|
|
|
else if (SYSAPI == "SC830") |
|
|
|
{ |
|
|
|
try |
|
|
@ -205,9 +275,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
Dictionary<string, object> _dat; |
|
|
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT); |
|
|
|
MainWindowViewModel.dt_TP = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * WorkorderSteps Dyelot where WorkOrder='" + |
|
|
|
_dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null).Tables[0]; |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
} |
|
|
|
}//当前步骤信息
|
|
|
|
else if (SYSAPI == "SC832") |
|
|
|
{ |
|
|
|
try |
|
|
@ -220,6 +294,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
Dictionary<string, object> _dat; |
|
|
|
_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(DAT); |
|
|
|
MonitorView.Product_DAT = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder='" + |
|
|
|
_dat.GetValue("WorkOrder") + "' AND ReDye ='" + _dat.GetValue("ReDye") + "'", null).Tables[0]; |
|
|
|
MonitorView.Product_bool = true; |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//当前领料单信息
|
|
|
@ -227,6 +306,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//数字开关表
|
|
|
@ -234,6 +314,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//寄存器表
|
|
|
@ -242,6 +323,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//缓存表
|
|
|
@ -273,7 +355,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 109 } }, |
|
|
|
"WorkOrder ='" + DAT + "'", null); |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//发布失败
|
|
|
@ -281,13 +364,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
MainWindowViewModel.SQLiteHelpers.Update("WorkOrder", new Dictionary<string, object> { { "State", 119 } }, |
|
|
|
"WorkOrder ='" + DAT + "'", null); |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//细节错误
|
|
|
|
else if (SYSAPI == "SC921") |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
} |
|
|
|
catch (Exception ex) { LogGing.LogGingDATA("[ERR='" + ex + "']=Exception"); MainWindowViewModel.ERR_c++; } |
|
|
|
}//错误
|
|
|
|
else if (SYSAPI == "SC980") |
|
|
|
{ |
|
|
|
|
|
|
|
MessageBox.Show(DAT, "SCCM", MessageBoxButton.OK, MessageBoxImage.Question); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|