Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
0c8cb5b6be
2 files changed
+70
-27
No files matched your search
+38
-25
@@ -19,6 +19,8 @@ using ScottPlot.Colormaps;
|
|||||||
using static System.Windows.Forms.AxHost;
|
using static System.Windows.Forms.AxHost;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
|
|
||||||
namespace DyeingComputer.UserClass
|
namespace DyeingComputer.UserClass
|
||||||
{/// <summary>
|
{/// <summary>
|
||||||
@@ -93,33 +95,24 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, object> Chart_dat;
|
Dictionary<string, object> WorkOrder_dat;
|
||||||
Chart_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
Chart_dat.GetValue("WorkOrder");
|
WorkOrder_dat.GetValue("WorkOrder");
|
||||||
/* string WorkOrder = Chart_dat.GetValue("WorkOrder").ToString();
|
bool dat_w= SQLDATA.WorkOrder(WorkOrder_dat.GetValue("WorkOrder").ToString(),
|
||||||
string ProcessName = Chart_dat.GetValue("ProcessName").ToString();
|
WorkOrder_dat.GetValue("ProcessName").ToString(),
|
||||||
string StartTime = Chart_dat.GetValue("StartTime").ToString();
|
WorkOrder_dat.GetValue("StartTime").ToString(),
|
||||||
string EndTime = Chart_dat.GetValue("EndTime").ToString();
|
WorkOrder_dat.GetValue("EndTime").ToString(),
|
||||||
string Time = Chart_dat.GetValue("Time").ToString();
|
WorkOrder_dat.GetValue("Time").ToString(),
|
||||||
string lock_ = Chart_dat.GetValue("lock").ToString();
|
WorkOrder_dat.GetValue("Remark").ToString(),
|
||||||
string state = Chart_dat.GetValue("State").ToString();
|
WorkOrder_dat.GetValue("lock").ToString(),
|
||||||
string ProcessID = Chart_dat.GetValue("ProcessID").ToString();
|
WorkOrder_dat.GetValue("State").ToString(),
|
||||||
string Remark = Chart_dat.GetValue("Remark").ToString();*/
|
WorkOrder_dat.GetValue("ProcessID").ToString());
|
||||||
bool dat_w= SQLDATA.WorkOrder(Chart_dat.GetValue("WorkOrder").ToString(),
|
|
||||||
Chart_dat.GetValue("ProcessName").ToString(),
|
|
||||||
Chart_dat.GetValue("StartTime").ToString(),
|
|
||||||
Chart_dat.GetValue("EndTime").ToString(),
|
|
||||||
Chart_dat.GetValue("Time").ToString(),
|
|
||||||
Chart_dat.GetValue("Remark").ToString(),
|
|
||||||
Chart_dat.GetValue("lock").ToString(),
|
|
||||||
Chart_dat.GetValue("State").ToString(),
|
|
||||||
Chart_dat.GetValue("ProcessID").ToString());
|
|
||||||
if (!dat_w) { client.SendAsync("SC910"); }
|
if (!dat_w) { client.SendAsync("SC910"); }
|
||||||
else { client.SendAsync("SC810"+SYSKEY+SYSDAT); }
|
else { client.SendAsync("SC810"+SYSKEY+SYSDAT); }
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
client.SendAsync("SC910");
|
client.SendAsync("SC990");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
@@ -130,18 +123,24 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
DataTable WorkOrder_dat;
|
||||||
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<DataTable>(SYSDAT);
|
||||||
|
bool dat_w = SQLDATA.WorkOderStep(WorkOrder_dat);
|
||||||
|
if (!dat_w) { client.SendAsync("SC911"); }
|
||||||
|
else { client.SendAsync("SC811" + SYSKEY + SYSDAT); }
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
client.SendAsync("SC911");
|
client.SendAsync("SC991");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}
|
}//WorkOrderstep表信息检查写入
|
||||||
else if (SYSAPI == "SC820")
|
else if (SYSAPI == "SC820")
|
||||||
{
|
{
|
||||||
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (SYSDAT.Length == 21)
|
if (SYSDAT.Length == 21)
|
||||||
{
|
{
|
||||||
@@ -152,8 +151,22 @@ namespace DyeingComputer.UserClass
|
|||||||
}
|
}
|
||||||
client.SendAsync("[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]");
|
client.SendAsync("[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]");
|
||||||
}
|
}
|
||||||
|
catch { client.SendAsync("SC920"); }
|
||||||
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}//设置系统时间
|
}//设置系统时间
|
||||||
|
else if (SYSAPI == "SC821")
|
||||||
|
{
|
||||||
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
catch { client.SendAsync("SC921"); }
|
||||||
|
}
|
||||||
|
else { client.SendAsync("SC999"); }
|
||||||
|
}//指令
|
||||||
else if (SYSAPI == "SC830")
|
else if (SYSAPI == "SC830")
|
||||||
{
|
{
|
||||||
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
|
|||||||
+32
-2
@@ -1,6 +1,8 @@
|
|||||||
using ScottPlot.Colormaps;
|
using DyeingComputer.ViewModel;
|
||||||
|
using ScottPlot.Colormaps;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -39,6 +41,34 @@ namespace DyeingComputer.UserClass
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool WorkOderStep(DataTable WorkOrderStep_)
|
||||||
|
{
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
DataTable data_t = WorkOrderStep_.Clone();
|
||||||
|
int a = WorkOrderStep_.Rows.Count;
|
||||||
|
if (a < 1)
|
||||||
|
{
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
string Program = WorkOrderStep_.Rows[0][0].ToString();
|
||||||
|
object n = SQLiteHelpers.ExecuteScalar("select * from WorkorderSteps where Program = " + Program, null);
|
||||||
|
if (n != null)//如id存在着返回错误状态
|
||||||
|
{
|
||||||
|
SQLiteHelpers.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < a; i++)
|
||||||
|
{
|
||||||
|
data_t.Clear();//清空
|
||||||
|
DataRow dr = data_t.NewRow();
|
||||||
|
dr.ItemArray = WorkOrderStep_.Rows[i].ItemArray;
|
||||||
|
data_t.Rows.InsertAt(dr, 0);
|
||||||
|
SQLiteHelpers.InsertData("WorkorderSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||||
|
}
|
||||||
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user