Browse Source

处理现场程序线程掉线的问题

master
志铭 吕 18 hours ago
parent
commit
05d8315383
  1. 6
      ControlMonitorClient/DBFactory.dll.config
  2. 4
      ControlMonitorClient/FrmBrowseInterFace.cs
  3. 1560
      ControlMonitorClient/FrmControlMonitor.designer.cs
  4. 2
      ControlMonitorClient/FrmControlMonitor.resx
  5. 6
      ControlMonitorClient/app.config
  6. 4
      WcfControlMonitorHost/DBFactory.dll.config
  7. 133
      WcfControlMonitorHost/FrmHost.Designer.cs
  8. 2
      WcfControlMonitorHost/FrmHost.cs
  9. 11
      WcfControlMonitorHost/app.config
  10. 179
      WcfControlMonitorLib/CCallService.cs
  11. 1
      WcfControlMonitorLib/CStaticClass.cs
  12. 85
      WcfControlMonitorLib/SControlMonitor.cs
  13. 1
      webapi/WindowsFormsApp1/APIChannel.cs
  14. 8
      webapi/WindowsFormsApp1/App.config

6
ControlMonitorClient/DBFactory.dll.config

@ -3,13 +3,15 @@
<appSettings>
<!-- SQL connection string for database-->
<!--<add key="ConnString" value="Server = 172.18.131.12; uid = sa ; pwd =sa; database = SSWCMS_aux; MAX Pool Size = 1024;Min Pool Size=0 " />-->
<add key="ConnString" value="Server = 192.168.20.252; uid = sa ; pwd = `123qwe; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<!--<add key="ConnString" value="Server = 192.168.20.252; uid = sa ; pwd = `123qwe; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />-->
<add key="ConnString" value="Server = localhost; uid = sa ; pwd = 420314; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<!--<add key="ConnString" value="Server = dzf-pc; uid = sa ; pwd =dzf123; database = SSWCS_MHES ; MAX Pool Size = 512 " />-->
<!-- OtherOLEDB connection strings -->
<!-- Oracle connection strings Data Source=Server IP/OracleServiceName-->
<!--<add key="ManConnString" value="Data Source=xjzh;User ID=zh ; Password=1; MAX Pool Size = 512;Unicode=True "/>-->
<add key="ManConnString" value="Server = 192.168.20.252; uid = sa ; pwd =`123qwe; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<!--<add key="ManConnString" value="Server = 192.168.20.252; uid = sa ; pwd =`123qwe; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />-->
<add key="ManConnString" value="Server = localhost; uid = sa ; pwd =420314; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<!--<add key="ManConnString" value="Server = dzf-pc; uid = sa ; pwd =dzf123; database = SSWCS_MHES ; MAX Pool Size = 512 " />-->
<!--<add key="ManConnString" value="Server = (local);uid = sa ; pwd =`123qwe; database =SSLMS_CGC2 ; MAX Pool Size = 512 " />-->

4
ControlMonitorClient/FrmBrowseInterFace.cs

@ -180,7 +180,7 @@ namespace wcfControlMonitorClient
var taskId = this.interfaceGridView.CurrentRow.Cells["任务编号"].Value.ToString();
if (MessageBox.Show($"您确认要任务{taskId}吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
if (this.interfaceGridView.CurrentRow.Cells["任务编号"].Value.ToString() == "999")
if (this.interfaceGridView.CurrentRow.Cells["任务状态"].Value.ToString() == "999")
{
string sql1 = $"delete from IO_CONTROL where CONTROL_ID={taskId}";//删除LCS不存在的任务流程
dboM.ExceSQL(sql.ToString());
@ -193,8 +193,6 @@ namespace wcfControlMonitorClient
}
}
//申请状态
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)

1560
ControlMonitorClient/FrmControlMonitor.designer.cs

File diff suppressed because it is too large

2
ControlMonitorClient/FrmControlMonitor.resx

@ -922,7 +922,7 @@
<value>572, 12</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>146</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

6
ControlMonitorClient/app.config

@ -11,7 +11,7 @@
<!--路径搜索方式:0,按照最优路径选择固定路线;1,每个正在工作的节点作为起始点,向末端节点重新搜索下一个最优路径的节点-->
<add key="RouteSearchMode" value="0"/>
<!--OPC服务器的主机IP-->
<add key="HostName" value="192.168.20.252"/>
<add key="HostName" value="localhost"/>
<!--OPC服务的ProgID-->
<add key="OPCProgID" value="OPC.SimaticNET.S7"/>
<!--移动设备是否被提前触发将取-->
@ -56,9 +56,9 @@
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://192.168.20.252:4524/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IControlMonitor" contract="WcfControlMonitor.IControlMonitor" name="NetTcpBinding_IControlMonitor">
<endpoint address="net.tcp://localhost:4524/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IControlMonitor" contract="WcfControlMonitor.IControlMonitor" name="NetTcpBinding_IControlMonitor">
<identity>
<dns value="192.168.20.252"/>
<dns value="localhost"/>
</identity>
</endpoint>
</client>

4
WcfControlMonitorHost/DBFactory.dll.config

@ -3,14 +3,14 @@
<appSettings>
<!-- SQL connection string for database-->
<!--<add key="ConnString" value="Server = 172.18.131.12; uid = sa ; pwd =sa; database = SSWCMS_aux; MAX Pool Size = 1024;Min Pool Size=0 " />-->
<add key="ConnString" value="Server =localhost; uid = sa ; pwd =`123qwe; database = SSWCS_JNWCS; MAX Pool Size = 512 " />
<add key="ConnString" value="Server =localhost; uid = sa ; pwd =420314; database = SSWCS_JNWCS; MAX Pool Size = 512 " />
<!--<add key="ConnString" value="Server = dzf-pc; uid = sa ; pwd =dzf123; database = SSWCS_MHES ; MAX Pool Size = 512 " />-->
<!-- OtherOLEDB connection strings -->
<!-- Oracle connection strings Data Source=Server IP/OracleServiceName-->
<!--<add key="ManConnString" value="Data Source=xjzh;User ID=zh ; Password=1; MAX Pool Size = 512;Unicode=True "/>-->
<!--<add key="ManConnString" value="Server = dzf-pc; uid = sa ; pwd =dzf123; database = SSWCS_MHES ; MAX Pool Size = 512 " />-->
<add key="ManConnString" value="Server = localhost; uid = sa ; pwd =`123qwe; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<add key="ManConnString" value="Server = localhost; uid = sa ; pwd =420314; database = SSWCS_JNWCS ; MAX Pool Size = 512 " />
<!--<add key="ManConnString" value="Server = (local);uid = sa ; pwd =`123qwe; database =SSLMS_CGC2 ; MAX Pool Size = 512 " />-->

133
WcfControlMonitorHost/FrmHost.Designer.cs

@ -96,11 +96,12 @@
this.listBox1.FormattingEnabled = true;
this.listBox1.HorizontalScrollbar = true;
this.listBox1.ItemHeight = 15;
this.listBox1.Location = new System.Drawing.Point(12, 45);
this.listBox1.Location = new System.Drawing.Point(16, 56);
this.listBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.listBox1.Name = "listBox1";
this.listBox1.ScrollAlwaysVisible = true;
this.listBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.listBox1.Size = new System.Drawing.Size(632, 394);
this.listBox1.Size = new System.Drawing.Size(841, 484);
this.listBox1.TabIndex = 0;
//
// contextMenuStrip1
@ -115,51 +116,51 @@
this.toolStripSeparator9,
this.toolStripMenuItem9});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(149, 126);
this.contextMenuStrip1.Size = new System.Drawing.Size(169, 136);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.DoubleClickEnabled = true;
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(148, 22);
this.toolStripMenuItem8.Size = new System.Drawing.Size(168, 24);
this.toolStripMenuItem8.Text = "显示主界面";
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(148, 22);
this.toolStripMenuItem10.Size = new System.Drawing.Size(168, 24);
this.toolStripMenuItem10.Text = "最小化窗口";
this.toolStripMenuItem10.Click += new System.EventHandler(this.toolStripMenuItem10_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(145, 6);
this.toolStripSeparator12.Size = new System.Drawing.Size(165, 6);
//
// tsmTurnOn
//
this.tsmTurnOn.Name = "tsmTurnOn";
this.tsmTurnOn.Size = new System.Drawing.Size(148, 22);
this.tsmTurnOn.Size = new System.Drawing.Size(168, 24);
this.tsmTurnOn.Text = "打开命令开关";
this.tsmTurnOn.Click += new System.EventHandler(this.toolStripMenuItem13_Click);
//
// tsmTurnOff
//
this.tsmTurnOff.Name = "tsmTurnOff";
this.tsmTurnOff.Size = new System.Drawing.Size(148, 22);
this.tsmTurnOff.Size = new System.Drawing.Size(168, 24);
this.tsmTurnOff.Text = "关闭命令开关";
this.tsmTurnOff.Click += new System.EventHandler(this.toolStripMenuItem14_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(145, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(165, 6);
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(148, 22);
this.toolStripMenuItem9.Size = new System.Drawing.Size(168, 24);
this.toolStripMenuItem9.Text = "退出系统";
this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click);
//
@ -197,11 +198,12 @@
this.tsStatus.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tsStatus.Font = new System.Drawing.Font("黑体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tsStatus.ForeColor = System.Drawing.Color.Red;
this.tsStatus.Location = new System.Drawing.Point(10, 492);
this.tsStatus.Location = new System.Drawing.Point(13, 615);
this.tsStatus.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tsStatus.Multiline = true;
this.tsStatus.Name = "tsStatus";
this.tsStatus.ReadOnly = true;
this.tsStatus.Size = new System.Drawing.Size(1006, 30);
this.tsStatus.Size = new System.Drawing.Size(1341, 38);
this.tsStatus.TabIndex = 1564;
//
// button1
@ -209,9 +211,10 @@
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Image = global::wcfControlMonitorClient.Properties.Resources.call_modul_volume_reduce;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Location = new System.Drawing.Point(545, 455);
this.button1.Location = new System.Drawing.Point(727, 569);
this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(87, 34);
this.button1.Size = new System.Drawing.Size(116, 42);
this.button1.TabIndex = 1565;
this.button1.Text = "清空日志";
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -223,18 +226,20 @@
this.listBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox2.FormattingEnabled = true;
this.listBox2.ItemHeight = 12;
this.listBox2.Location = new System.Drawing.Point(663, 45);
this.listBox2.ItemHeight = 15;
this.listBox2.Location = new System.Drawing.Point(884, 56);
this.listBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(353, 400);
this.listBox2.Size = new System.Drawing.Size(469, 499);
this.listBox2.TabIndex = 1567;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 29);
this.label1.Location = new System.Drawing.Point(16, 36);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(125, 12);
this.label1.Size = new System.Drawing.Size(157, 15);
this.label1.TabIndex = 1568;
this.label1.Text = "与客户端交互的消息:";
//
@ -242,9 +247,10 @@
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(661, 29);
this.label2.Location = new System.Drawing.Point(881, 36);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(101, 12);
this.label2.Size = new System.Drawing.Size(127, 15);
this.label2.TabIndex = 1568;
this.label2.Text = "在线客户端信息:";
//
@ -254,9 +260,10 @@
this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.button4.Image = global::wcfControlMonitorClient.Properties.Resources.MSN;
this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button4.Location = new System.Drawing.Point(845, 455);
this.button4.Location = new System.Drawing.Point(1127, 569);
this.button4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(157, 34);
this.button4.Size = new System.Drawing.Size(209, 42);
this.button4.TabIndex = 1569;
this.button4.Text = "刷新在线客户端列表";
this.button4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -274,8 +281,8 @@
this.MMExitSystem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(3, 1, 0, 1);
this.menuStrip1.Size = new System.Drawing.Size(962, 24);
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1);
this.menuStrip1.Size = new System.Drawing.Size(1283, 26);
this.menuStrip1.TabIndex = 1570;
this.menuStrip1.Text = "menuStrip1";
//
@ -285,20 +292,20 @@
this.MISystemInit,
this.MIDataClear});
this.MMInit.Name = "MMInit";
this.MMInit.Size = new System.Drawing.Size(56, 22);
this.MMInit.Size = new System.Drawing.Size(68, 24);
this.MMInit.Text = "初始化";
//
// MISystemInit
//
this.MISystemInit.Name = "MISystemInit";
this.MISystemInit.Size = new System.Drawing.Size(148, 22);
this.MISystemInit.Size = new System.Drawing.Size(182, 26);
this.MISystemInit.Text = "设备初始化";
this.MISystemInit.Click += new System.EventHandler(this.MISystemInit_Click);
//
// MIDataClear
//
this.MIDataClear.Name = "MIDataClear";
this.MIDataClear.Size = new System.Drawing.Size(148, 22);
this.MIDataClear.Size = new System.Drawing.Size(182, 26);
this.MIDataClear.Text = "调度数据清理";
this.MIDataClear.Visible = false;
this.MIDataClear.Click += new System.EventHandler(this.MIDataClear_Click);
@ -309,20 +316,20 @@
this.MIStartRetrieveTask,
this.MIStopRetrieveTask});
this.MMRetriveTask.Name = "MMRetriveTask";
this.MMRetriveTask.Size = new System.Drawing.Size(68, 22);
this.MMRetriveTask.Size = new System.Drawing.Size(83, 24);
this.MMRetriveTask.Text = "获取任务";
//
// MIStartRetrieveTask
//
this.MIStartRetrieveTask.Name = "MIStartRetrieveTask";
this.MIStartRetrieveTask.Size = new System.Drawing.Size(148, 22);
this.MIStartRetrieveTask.Size = new System.Drawing.Size(182, 26);
this.MIStartRetrieveTask.Text = "开始获取任务";
this.MIStartRetrieveTask.Click += new System.EventHandler(this.MIStartRetrieveTask_Click);
//
// MIStopRetrieveTask
//
this.MIStopRetrieveTask.Name = "MIStopRetrieveTask";
this.MIStopRetrieveTask.Size = new System.Drawing.Size(148, 22);
this.MIStopRetrieveTask.Size = new System.Drawing.Size(182, 26);
this.MIStopRetrieveTask.Text = "停止获取任务";
this.MIStopRetrieveTask.Click += new System.EventHandler(this.MIStopRetrieveTask_Click);
//
@ -332,20 +339,20 @@
this.MITurnOn,
this.MITurnOff});
this.MMMonitorControl.Name = "MMMonitorControl";
this.MMMonitorControl.Size = new System.Drawing.Size(68, 22);
this.MMMonitorControl.Size = new System.Drawing.Size(83, 24);
this.MMMonitorControl.Text = "调度控制";
//
// MITurnOn
//
this.MITurnOn.Name = "MITurnOn";
this.MITurnOn.Size = new System.Drawing.Size(148, 22);
this.MITurnOn.Size = new System.Drawing.Size(182, 26);
this.MITurnOn.Text = "打开命令开关";
this.MITurnOn.Click += new System.EventHandler(this.MITurnOn_Click);
//
// MITurnOff
//
this.MITurnOff.Name = "MITurnOff";
this.MITurnOff.Size = new System.Drawing.Size(148, 22);
this.MITurnOff.Size = new System.Drawing.Size(182, 26);
this.MITurnOff.Text = "关闭命令开关";
this.MITurnOff.Click += new System.EventHandler(this.MITurnOff_Click);
//
@ -357,34 +364,34 @@
this.toolStripMenuItem1,
this.MIDarketFileSet});
this.MMDarketManage.Name = "MMDarketManage";
this.MMDarketManage.Size = new System.Drawing.Size(68, 22);
this.MMDarketManage.Size = new System.Drawing.Size(83, 24);
this.MMDarketManage.Text = "数据查询";
//
// MIAutoTaskHistory
//
this.MIAutoTaskHistory.Name = "MIAutoTaskHistory";
this.MIAutoTaskHistory.Size = new System.Drawing.Size(172, 22);
this.MIAutoTaskHistory.Size = new System.Drawing.Size(212, 26);
this.MIAutoTaskHistory.Text = "查询历史任务记录";
this.MIAutoTaskHistory.Click += new System.EventHandler(this.MIAutoTaskHistory_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(172, 22);
this.toolStripMenuItem2.Size = new System.Drawing.Size(212, 26);
this.toolStripMenuItem2.Text = "查询设备报警记录";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(172, 22);
this.toolStripMenuItem1.Size = new System.Drawing.Size(212, 26);
this.toolStripMenuItem1.Text = "查询货位状态";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// MIDarketFileSet
//
this.MIDarketFileSet.Name = "MIDarketFileSet";
this.MIDarketFileSet.Size = new System.Drawing.Size(172, 22);
this.MIDarketFileSet.Size = new System.Drawing.Size(212, 26);
this.MIDarketFileSet.Text = "文件设置";
this.MIDarketFileSet.Visible = false;
this.MIDarketFileSet.Click += new System.EventHandler(this.MIDarketFileSet_Click);
@ -392,7 +399,7 @@
// MMExitSystem
//
this.MMExitSystem.Name = "MMExitSystem";
this.MMExitSystem.Size = new System.Drawing.Size(68, 22);
this.MMExitSystem.Size = new System.Drawing.Size(83, 24);
this.MMExitSystem.Text = "退出系统";
this.MMExitSystem.Click += new System.EventHandler(this.MMExitSystem_Click);
//
@ -402,9 +409,10 @@
this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.button3.Image = global::wcfControlMonitorClient.Properties.Resources.SCDCNCLL;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Location = new System.Drawing.Point(669, 455);
this.button3.Location = new System.Drawing.Point(892, 569);
this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(118, 34);
this.button3.Size = new System.Drawing.Size(157, 42);
this.button3.TabIndex = 1569;
this.button3.Text = "注销在线客户端";
this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -420,9 +428,10 @@
// pbF1S7
//
this.pbF1S7.Image = global::wcfControlMonitorClient.Properties.Resources.linkerror;
this.pbF1S7.Location = new System.Drawing.Point(305, 26);
this.pbF1S7.Location = new System.Drawing.Point(407, 32);
this.pbF1S7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.pbF1S7.Name = "pbF1S7";
this.pbF1S7.Size = new System.Drawing.Size(22, 17);
this.pbF1S7.Size = new System.Drawing.Size(29, 21);
this.pbF1S7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pbF1S7.TabIndex = 2659;
this.pbF1S7.TabStop = false;
@ -430,9 +439,10 @@
// lblFloor1S7
//
this.lblFloor1S7.AutoSize = true;
this.lblFloor1S7.Location = new System.Drawing.Point(219, 26);
this.lblFloor1S7.Location = new System.Drawing.Point(292, 32);
this.lblFloor1S7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblFloor1S7.Name = "lblFloor1S7";
this.lblFloor1S7.Size = new System.Drawing.Size(71, 12);
this.lblFloor1S7.Size = new System.Drawing.Size(91, 15);
this.lblFloor1S7.TabIndex = 2656;
this.lblFloor1S7.Text = "PLC连接状态";
this.lblFloor1S7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -440,9 +450,10 @@
// btcelltest
//
this.btcelltest.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btcelltest.Location = new System.Drawing.Point(435, 461);
this.btcelltest.Location = new System.Drawing.Point(580, 576);
this.btcelltest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btcelltest.Name = "btcelltest";
this.btcelltest.Size = new System.Drawing.Size(92, 29);
this.btcelltest.Size = new System.Drawing.Size(123, 36);
this.btcelltest.TabIndex = 2668;
this.btcelltest.Text = "货位测试";
this.btcelltest.UseVisualStyleBackColor = true;
@ -452,9 +463,10 @@
// btStopOut
//
this.btStopOut.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btStopOut.Location = new System.Drawing.Point(222, 461);
this.btStopOut.Location = new System.Drawing.Point(296, 576);
this.btStopOut.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btStopOut.Name = "btStopOut";
this.btStopOut.Size = new System.Drawing.Size(92, 29);
this.btStopOut.Size = new System.Drawing.Size(123, 36);
this.btStopOut.TabIndex = 2667;
this.btStopOut.Text = "StopOut";
this.btStopOut.UseVisualStyleBackColor = false;
@ -464,9 +476,10 @@
// btStopIn
//
this.btStopIn.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btStopIn.Location = new System.Drawing.Point(320, 461);
this.btStopIn.Location = new System.Drawing.Point(427, 576);
this.btStopIn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btStopIn.Name = "btStopIn";
this.btStopIn.Size = new System.Drawing.Size(92, 29);
this.btStopIn.Size = new System.Drawing.Size(123, 36);
this.btStopIn.TabIndex = 2666;
this.btStopIn.Text = "StopIn";
this.btStopIn.UseVisualStyleBackColor = false;
@ -476,9 +489,10 @@
// btStopTest
//
this.btStopTest.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btStopTest.Location = new System.Drawing.Point(124, 461);
this.btStopTest.Location = new System.Drawing.Point(165, 576);
this.btStopTest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btStopTest.Name = "btStopTest";
this.btStopTest.Size = new System.Drawing.Size(92, 29);
this.btStopTest.Size = new System.Drawing.Size(123, 36);
this.btStopTest.TabIndex = 2665;
this.btStopTest.Text = "StopTest";
this.btStopTest.UseVisualStyleBackColor = true;
@ -488,9 +502,10 @@
// btStartTest
//
this.btStartTest.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btStartTest.Location = new System.Drawing.Point(26, 461);
this.btStartTest.Location = new System.Drawing.Point(35, 576);
this.btStartTest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btStartTest.Name = "btStartTest";
this.btStartTest.Size = new System.Drawing.Size(92, 29);
this.btStartTest.Size = new System.Drawing.Size(123, 36);
this.btStartTest.TabIndex = 2664;
this.btStartTest.Text = "StartTest";
this.btStartTest.UseVisualStyleBackColor = true;
@ -516,6 +531,7 @@
//
// timer3
//
this.timer3.Enabled = true;
this.timer3.Interval = 1000;
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
//
@ -533,9 +549,9 @@
//
// FrmHost
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(962, 529);
this.ClientSize = new System.Drawing.Size(1283, 661);
this.Controls.Add(this.btcelltest);
this.Controls.Add(this.btStopOut);
this.Controls.Add(this.btStopIn);
@ -553,6 +569,7 @@
this.Controls.Add(this.button3);
this.Controls.Add(this.button1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FrmHost";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

2
WcfControlMonitorHost/FrmHost.cs

@ -1529,7 +1529,7 @@ namespace wcfControlMonitorClient
try
{
//CStaticClass.WcfControl
//CStaticClass.WcfControl.SendConveyorTestTask();
CStaticClass.WcfControl.SendConveyorTestTask();
//CStaticClass.WcfControl.SendConveyorTestTask2();
//CStaticClass.WcfControl.SendConveyorTestTask3();
}

11
WcfControlMonitorHost/app.config

@ -29,20 +29,20 @@
<service name="WcfControlMonitorLib.SControlMonitor">
<endpoint address="" binding="netTcpBinding" contract="WcfControlMonitorLib.IControlMonitor">
<identity>
<dns value="192.168.20.252"/>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="" binding="basicHttpBinding" contract="WcfControlMonitorLib.IBasicControlMonitor">
<identity>
<dns value="192.168.20.252" />
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex1" binding="mexTcpBinding" contract="IMetadataExchange"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://192.168.20.252:4524"/>
<add baseAddress="http://192.168.20.252:4525"/>
<add baseAddress="net.tcp://localhost:4524"/>
<add baseAddress="http://localhost:4525"/>
</baseAddresses>
</host>
</service>
@ -72,7 +72,7 @@
<!--路径搜索方式:0,按照最优路径选择固定路线;1,每个正在工作的节点作为起始点,向末端节点重新搜索下一个最优路径的节点-->
<add key="RouteSearchMode" value="0"/>
<!--OPC服务器的主机IP-->
<add key="HostName" value="192.168.20.252"/>
<add key="HostName" value="localhost"/>
<!--OPC服务的ProgID-->
<add key="OPCProgID" value="OPC.SimaticNET.S7"/>
<!--移动设备是否被提前触发将取-->
@ -103,6 +103,7 @@
<!--立库到化成B倒箔间任务每个巷道最多两个-->
<add key="HCBLanewayOutDB" value="2"/>
<!--WMS服务地址1任务状态-->
<!--<add key="ManageServiceAddress" value="http://localhost:5252/lcs/thirdParty/taskStatusReport"/>-->
<add key="ManageServiceAddress" value="http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/taskStatusReport"/>
<!--WMS服务地址2任务删除-->
<add key="ManageServiceAddressTwo" value="http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/inboundApply"/>

179
WcfControlMonitorLib/CCallService.cs

@ -21,7 +21,7 @@ using System.Xml.Serialization;
using Newtonsoft.Json;
using System.Threading.Tasks;
using System.Timers;
using System.Diagnostics.Eventing.Reader;
namespace WcfControlMonitorLib
{
@ -711,6 +711,7 @@ namespace WcfControlMonitorLib
responseStream.Close();
}
result = "获取数据失败,请重试!" + address + ex.ToString() + " 返回数据" + result;
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", $"接口名称{address}:", "异常信息:", result.ToString());
return false;
}
}
@ -765,7 +766,6 @@ namespace WcfControlMonitorLib
else
{
resp_data = Model.JsonHelper.Deserialize<WMS_WCS_PARAM_UPDATE>(outJson);//WMS的返回值需要反序列化
}
}
return bResult;
@ -1113,7 +1113,9 @@ namespace WcfControlMonitorLib
static StringBuilder[] witemnames = { new StringBuilder("") };
static Model.MDevice devinfo = new Model.MDevice();
static CCommonFunction ccf = new CCommonFunction();
static Thread mythread;
public static Thread mythread;
public static Thread mythread1;
public static Thread mythread2;
static Thread mythreadUpdatestatus;
static Thread mythreadGetTaskCanMove;
static Thread threadAGVStatusSend;
@ -1130,13 +1132,9 @@ namespace WcfControlMonitorLib
set { _CCallServiceError = value; }
}
//static Dictionary<string, string> ErrorStation = new Dictionary<string, string>
//{
// {"12005","12006"},{"12008","12007"},{"22009","22008"}
//};
//任务执行状态上报定时器
private static void BeginListen()
public static async void BeginListen()
{//20091107
while (!exitThread)
{
@ -1162,22 +1160,119 @@ namespace WcfControlMonitorLib
dataIOtaskstart = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
if (dataIOtaskstart.Count > 0) {
for (int i = 0; i < dataIOtaskstart.Count; i++)
{
await Task.Run(() =>
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "准备开始调用wms服务:", $"ID:{dataIOtaskstart[i]["CONTROL_ID"]},条码{dataIOtaskstart[i]["STOCK_BARCODE"]}");
UpdateTaskStatusToWMS(Convert.ToInt64(dataIOtaskstart[i]["CONTROL_ID"]), 1, out WMS_WCS_PARAM_UPDATE resp_data);//1任务开始
if (resp_data.code == 0)
if (resp_data == null)
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"接口通讯异常返回报错:");
return;
}
else if (resp_data.code == 0)
{ //成功
sql.Clear();
sql.Append($"update IO_Control set IsSendLCS=1 where CONTROL_ID={dataIOtaskstart[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
dbo.ExceSQL(sql.ToString());
}
else {
else
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"返回报错{resp_data.data}:{resp_data.msg}");
return;
}
});
}
}
#endregion
//#region 发送任务完成给LCS 900任务直接删除
//sql.Clear();
//sql.Append("select * from IO_CONTROL WHERE (CONTROL_STATUS = 999 or CONTROL_STATUS=900 ) and CONTROL_TASK_TYPE<>99 ");//查询还未发送给WMS但是任务状态已经是完成的状态的任务 不用校验issendlcs=1的情况,防止还没上传给WMS就报错了
//dataIOtask2finish = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
//if (dataIOtask2finish.Count > 0)
//{
// for (int i = 0; i < dataIOtask2finish.Count; i++)
// {
// if (dataIOtask2finish[i]["CONTROL_STATUS"].ToString() == "900")
// {
// sql.Clear();
// sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOtask2finish[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
// dbo.ExceSQL(sql.ToString());
// }
// else
// {
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "taskStatusReporfinish", "准备开始调用wms任务状态上报服务:", $"ID:{dataIOtask2finish[i]["CONTROL_ID"]},条码{dataIOtask2finish[i]["STOCK_BARCODE"]}");
// UpdateTaskStatusToWMS(Convert.ToInt64(dataIOtask2finish[i]["CONTROL_ID"]), 2, out WMS_WCS_PARAM_UPDATE resp_data);//2任务结束
// if (resp_data.code == 0)
// { //成功
// sql.Clear();
// sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOtask2finish[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
// dbo.ExceSQL(sql.ToString());
// }
// else
// {
// //if ((resp_data.msg.Contains("不存在") && resp_data.msg.Contains("流程任务"))|| resp_data.msg.Contains("请求失败")) {
// sql.Clear();
// sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOtask2finish[i]["CONTROL_ID"]}");//删除LCS不存在的任务流程
// dbo.ExceSQL(sql.ToString());
// // }
// CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"返回报错{resp_data.data}:{resp_data.msg}");
// //return;
// }
// }
// }
//}
//#endregion
//#region 处理回退任务
//sql.Clear();
//sql.Append("select * from IO_CONTROL WHERE ( CONTROL_STATUS = 999 OR CONTROL_STATUS = 900 OR CONTROL_STATUS = 970 ) and CONTROL_TASK_TYPE=99");//直接删除回退任务 //ControlTaskType=99是回退任务
// dataIOBacktaskfinish = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
//if (dataIOBacktaskfinish.Count > 0)
//{
// for (int i = 0; i < dataIOBacktaskfinish.Count; i++)
// {
// sql.Clear();
// sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOBacktaskfinish[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
// dbo.ExceSQL(sql.ToString());
// }
//}
//#endregion
}
catch (Exception ex)
{
_CCallServiceError = ex.StackTrace + ex.Message;
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", $"接口名称:taskStatusReporstart:", "调用接口时异常:", ex.Message.ToString());
//dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set APPLY_TASK_STATUS = 2 where APPLY_TASK_STATUS = 0"));
}
finally
{
Thread.Sleep(3000);
}
}
}
public static async void BeginListen1()
{//20091107
while (!exitThread)
{
try
{
StringBuilder sql = new StringBuilder();
StringBuilder sql2 = new StringBuilder();
string bResult = "";
DataView dataIOtaskstart = new DataView();
//DataView dvl = new DataView();
DataView dataIOtask2finish = new DataView();
DataView dataIOBacktaskfinish = new DataView();
string dtime = DateTime.Now.ToString("u");
dtime = dtime.Substring(0, dtime.Length - 1);
//int AutoManageIdx = 0; int a = 0;
//string FSTARTCELL = ""; string FENDCELL = "";
//int FSTARTDEVICE = 0; int FENDDEVICE = 0;
//int flaneway = 0; int fstack = 0;
//int FControlTaskType = 0;
#region 发送任务完成给LCS 900任务直接删除
sql.Clear();
sql.Append("select * from IO_CONTROL WHERE (CONTROL_STATUS = 999 or CONTROL_STATUS=900 ) and CONTROL_TASK_TYPE<>99 ");//查询还未发送给WMS但是任务状态已经是完成的状态的任务 不用校验issendlcs=1的情况,防止还没上传给WMS就报错了
@ -1187,6 +1282,7 @@ namespace WcfControlMonitorLib
{
for (int i = 0; i < dataIOtask2finish.Count; i++)
{
if (dataIOtask2finish[i]["CONTROL_STATUS"].ToString() == "900")
{
sql.Clear();
@ -1195,9 +1291,17 @@ namespace WcfControlMonitorLib
}
else
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "taskStatusReporfinish", "准备开始调用wms服务:", $"ID:{dataIOtask2finish[i]["CONTROL_ID"]},条码{dataIOtask2finish[i]["STOCK_BARCODE"]}");
await Task.Run(() =>
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "taskStatusReporfinish", "准备开始调用wms任务状态上报服务:", $"ID:{dataIOtask2finish[i]["CONTROL_ID"]},条码{dataIOtask2finish[i]["STOCK_BARCODE"]}");
UpdateTaskStatusToWMS(Convert.ToInt64(dataIOtask2finish[i]["CONTROL_ID"]), 2, out WMS_WCS_PARAM_UPDATE resp_data);//2任务结束
if (resp_data.code == 0)
if (resp_data == null)
{
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"接口通讯异常返回报错:");
return;
}
else if (resp_data.code == 0)
{ //成功
sql.Clear();
sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOtask2finish[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
@ -1213,10 +1317,45 @@ namespace WcfControlMonitorLib
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"返回报错{resp_data.data}:{resp_data.msg}");
//return;
}
});
}
}
}
#endregion
}
catch (Exception ex)
{
_CCallServiceError = ex.StackTrace + ex.Message;
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", $"接口名称:taskStatusReporstart:", "调用接口时异常:", ex.Message.ToString());
//dbo.ExecuteSql(string.Format("UPDATE IO_CONTROL_APPLY set APPLY_TASK_STATUS = 2 where APPLY_TASK_STATUS = 0"));
}
finally
{
Thread.Sleep(1000);
}
}
}
public static void BeginListen2()
{//20091107
while (!exitThread)
{
try
{
StringBuilder sql = new StringBuilder();
StringBuilder sql2 = new StringBuilder();
string bResult = "";
DataView dataIOtaskstart = new DataView();
//DataView dvl = new DataView();
DataView dataIOtask2finish = new DataView();
DataView dataIOBacktaskfinish = new DataView();
string dtime = DateTime.Now.ToString("u");
dtime = dtime.Substring(0, dtime.Length - 1);
//int AutoManageIdx = 0; int a = 0;
//string FSTARTCELL = ""; string FENDCELL = "";
//int FSTARTDEVICE = 0; int FENDDEVICE = 0;
//int flaneway = 0; int fstack = 0;
//int FControlTaskType = 0;
#region 处理回退任务
sql.Clear();
sql.Append("select * from IO_CONTROL WHERE ( CONTROL_STATUS = 999 OR CONTROL_STATUS = 900 OR CONTROL_STATUS = 970 ) and CONTROL_TASK_TYPE=99");//直接删除回退任务 //ControlTaskType=99是回退任务
@ -1409,6 +1548,16 @@ namespace WcfControlMonitorLib
mythread.Abort();
mythread = null;
}
if (mythread1 != null)
{
mythread1.Abort();
mythread1 = null;
}
if (mythread2 != null)
{
mythread2.Abort();
mythread2 = null;
}
if (mythreadGetTaskCanMove != null) {
mythreadGetTaskCanMove.Abort();
mythreadGetTaskCanMove = null;
@ -1440,6 +1589,12 @@ namespace WcfControlMonitorLib
mythread = new Thread(new ThreadStart(BeginListen));
mythread.IsBackground = true;
mythread.Start();
mythread1 = new Thread(new ThreadStart(BeginListen1));
mythread1.IsBackground = true;
mythread1.Start();
mythread2 = new Thread(new ThreadStart(BeginListen2));
mythread2.IsBackground = true;
mythread2.Start();
exitThreadInRequestDeal = false;
mythreadUpdatestatus = new Thread(new ThreadStart(BeginListenUpdatestatus)); //

1
WcfControlMonitorLib/CStaticClass.cs

@ -115,6 +115,7 @@ namespace WcfControlMonitorLib
//http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/inboundApply
//20091107
static string _ManageServiceAddress = "http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/taskStatusReport";//WCS 任务执行过程,将任务执行的状态回传给 LCS 系统。
//static string _ManageServiceAddress = "http://localhost:5252/lcs/thirdParty/taskStatusReport";
static string _ManageServiceAddress2 = "http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/inboundApply";//当入库的作业需要经过外部扫码设备触发分配库位或校验是否能入库时,WCS 通过此 接口向 LCS 申请。
static string _ManageServiceAddress3 = "http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/wcsTaskInfo";//WCS 通知 LCS 调用 AGV 取货
static string _ManageServiceAddress4 = "http://jndwllcs.catl.com/catl-be/api-lcs/lcs/thirdParty/requestRescore";//WCS 通过该接口请求 LCS 对目标库位进行重新分配。

85
WcfControlMonitorLib/SControlMonitor.cs

@ -9036,65 +9036,58 @@ namespace WcfControlMonitorLib
//堆垛机测试
public void SendConveyorTestTask() {
if (1==1) {
string startCode = "01-02-01";
string endCode = "01-01-01";
int Y = 3;//最高层
int hand = 19; //中间货位(2+37)/2 中间货位到后正常排序
int ConveryorDeviceIndex = 18001;
int deviceIndex = 11001;
StringBuilder sql1 = new StringBuilder();
sql1.Append("select * from T_Manage_Task where F_ManageTaskKindIndex=2 and FSTARTDEVICE='").Append(ConveryorDeviceIndex).Append("'");//查找任务类型为自动任务的某台堆垛机的任务
int Count= dbo.ExceSQL(sql1.ToString()).Tables[0].DefaultView.Count;
if (Count == 0) {
#region 寻找起点
sql1.Clear();
sql1.Append("SELECT LastTaskEndDevice from T_LastDeviceTaskMsg where ConveryorDeviceIndex='").Append(ConveryorDeviceIndex).Append("'");
DataView data = dbo.ExceSQL(sql1.ToString()).Tables[0].DefaultView;
var a = data[0]["LastTaskEndDevice"].ToString();
if (data[0]["LastTaskEndDevice"].ToString() == null|| data[0]["LastTaskEndDevice"].ToString() == "")
if (CStaticClass.ObtainManageTask == true) {
try {
if (CCallService.mythread == null)
{
startCode = "01-02-01";
//CCallService.mythread.Start();
CCallService.mythread = new Thread(new ThreadStart(CCallService.BeginListen));
CCallService.mythread.IsBackground = true;
CCallService.mythread.Start();
}
else {
startCode = data[0]["LastTaskEndDevice"].ToString();
}
#endregion
#region 寻找终点
DataView data1 = new DataView();
var row = Convert.ToInt32(startCode.Split('-')[1]);//获取列
if (row < hand)//后半区
else
{
sql1.Clear();
sql1 = new StringBuilder("select top 1 FCELLCODE from ST_CELL where FLaneWay='").Append(ConveryorDeviceIndex).Append("' and F_FLAG=0 order by F_Z desc,F_X desc,F_Y DESC");
data1 = dbo.ExceSQL(sql1.ToString()).Tables[0].DefaultView;
if (data1.Count > 0)
if (CCallService.mythread.IsAlive == false) {
CCallService.mythread.Abort();
CCallService. mythread = null;
}
}
if (CCallService.mythread1 == null)
{
endCode = data1[0]["FCELLCODE"].ToString();//获取终点
// CCallService.mythread1.Start();
CCallService.mythread1 = new Thread(new ThreadStart(CCallService.BeginListen1));
CCallService.mythread1.IsBackground = true;
CCallService.mythread1.Start();
}
else {
return;
else
{
if (CCallService.mythread1.IsAlive == false)
{
CCallService.mythread1.Abort();
CCallService.mythread1 = null;
}
}
else {
sql1.Clear();
sql1 = new StringBuilder("select top 1 FCELLCODE from ST_CELL where FLaneWay='").Append(ConveryorDeviceIndex).Append("' and F_FLAG=0 order by F_Z,F_X ,F_Y");
data1 = dbo.ExceSQL(sql1.ToString()).Tables[0].DefaultView;
if (data1.Count > 0)
if (CCallService.mythread2 == null)
{
endCode = data1[0]["FCELLCODE"].ToString();//获取终点
// CCallService.mythread2.Start();
CCallService.mythread2 = new Thread(new ThreadStart(CCallService.BeginListen2));
CCallService.mythread2.IsBackground = true;
CCallService.mythread2.Start();
}
else
{
return;
if (CCallService.mythread2.IsAlive == false)
{
CCallService.mythread2.Abort();
CCallService.mythread2 = null;
}
}
Model.AutoTask at = new Model.AutoTask(3, "111111", ConveryorDeviceIndex.ToString(), startCode, ConveryorDeviceIndex.ToString(), endCode, false, false, 0);
BuildAutoTask(at, out string _listenPLCAskError);
#endregion
}
catch (Exception ex) {
}
}
}

1
webapi/WindowsFormsApp1/APIChannel.cs

@ -207,7 +207,6 @@ namespace WindowsFormsApp1
sql.Remove(0, sql.Length);
sql.Append("INSERT INTO T_Manage_Task_BAK SELECT * FROM T_Manage_Task where FID=").Append(wms_wcs_cancel.taskId).Append(" and F_ManageTaskKindIndex>=1");
dbo.ExecuteSql(sql.ToString());
sql.Clear();
sql.Append("delete from T_Monitor_Task where F_ManageTaskIndex = '").Append(wms_wcs_cancel.taskId).Append("'");
dbo.ExecuteSql(sql.ToString());

8
webapi/WindowsFormsApp1/App.config

@ -10,8 +10,8 @@
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.101.68.19:8080/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_I_Managely5" contract="ServiceReference1.I_Managely5" name="BasicHttpBinding_I_Managely5"/>
<!--<endpoint address="http://localhost:8080/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_I_Managely5" contract="ServiceReference1.I_Managely5" name="BasicHttpBinding_I_Managely5"/>-->
<!--<endpoint address="http://10.101.68.19:8080/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_I_Managely5" contract="ServiceReference1.I_Managely5" name="BasicHttpBinding_I_Managely5"/>-->
<endpoint address="http://localhost:8080/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_I_Managely5" contract="ServiceReference1.I_Managely5" name="BasicHttpBinding_I_Managely5"/>
</client>
</system.serviceModel>
<appSettings>
@ -20,8 +20,8 @@
<!--只保留最近记录通讯黑匣子的文件个数,默认60,代表60个-->
<add key="DarkCasketSum" value="60"/>
<!--serveradderss-->
<add key="Serveradderss" value="http://10.101.68.19:8080"/>
<!--<add key="Serveradderss" value="http://localhost:8080"/>-->
<!--<add key="Serveradderss" value="http://10.101.68.19:8080"/>-->
<add key="Serveradderss" value="http://localhost:8080"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<system.web>

Loading…
Cancel
Save