Compare commits
20
Commits
552d45485d
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2828aab0 | ||
|
|
33b970eff9 | ||
|
|
5caf92be59 | ||
|
|
437b8957ce | ||
|
|
a68fb9ae01 | ||
|
|
68b98ac7e4 | ||
|
|
2329ac9abc | ||
|
|
b062420be1 | ||
|
|
a248c41163 | ||
|
|
2b676adbba | ||
|
|
00a5cd3ec7 | ||
|
|
abfcf6e36a | ||
|
|
1df7212414 | ||
|
|
751a2b092f | ||
|
|
8a5e0ecfd9 | ||
|
|
ebcd5b7182 | ||
|
|
7f905617fa | ||
|
|
54d8cc7266 | ||
|
|
33e83fa5d6 | ||
|
|
927c38853d |
No files matched your search
@@ -60,6 +60,7 @@ 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);
|
||||
@@ -71,6 +72,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
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)
|
||||
{
|
||||
@@ -114,15 +116,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
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;
|
||||
_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,17 +163,17 @@ 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();
|
||||
@@ -180,9 +182,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
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,9 +446,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
var t = CRCcheck16.ToCRC16(command);
|
||||
_responseEvent.Reset();
|
||||
serialPortClients.Send(command); // 发送指令
|
||||
|
||||
// 等待500毫秒或直到收到响应
|
||||
_responseEvent.Wait(TimeSpan.FromMilliseconds(1000));
|
||||
// 重置事件状态
|
||||
if (!_responseEvent.Wait(TimeSpan.FromMilliseconds(1000)))
|
||||
{
|
||||
_responseEvent.Set();
|
||||
//清楚了解状态
|
||||
string Station = ClipBetween(command, '[', ']');
|
||||
@@ -472,7 +475,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
drEmployee.AcceptChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,13 +338,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
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 StartTime >'" +
|
||||
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
||||
@@ -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,10 +455,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
}
|
||||
}
|
||||
}
|
||||
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 StartTime >'" +
|
||||
DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'", null).Tables[0]; //读取表写入缓存
|
||||
@@ -536,10 +550,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//系统时间
|
||||
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
@@ -633,6 +650,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
});
|
||||
}
|
||||
}
|
||||
Updata_Machines(Machines, "State", "ID='" + MachinesRow["ID"] + "'", "101");
|
||||
}
|
||||
else if (MachinesRow["Serial"].ToString() == "PORT2")
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user