Browse Source

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

master
志铭 吕 19 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. 235
      WcfControlMonitorLib/CCallService.cs
  11. 1
      WcfControlMonitorLib/CStaticClass.cs
  12. 563
      WcfControlMonitorLib/SControlMonitor.cs
  13. 3
      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"/>

235
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;
}
}
@ -722,7 +723,7 @@ namespace WcfControlMonitorLib
/// <param name="ask_data"></param>
/// <param name="resp_data"></param>
/// <returns></returns>
public static string UpdateTaskStatusToWMS(long Managertask_Id,int state,out WMS_WCS_PARAM_UPDATE resp_data)
public static string UpdateTaskStatusToWMS(long Managertask_Id,int state,out WMS_WCS_PARAM_UPDATE resp_data)
{
string bResult = string.Empty;
bool sResult = true;
@ -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)
{
@ -1163,21 +1161,118 @@ namespace WcfControlMonitorLib
if (dataIOtaskstart.Count > 0) {
for (int i = 0; i < dataIOtaskstart.Count; i++)
{
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)
{ //成功
sql.Clear();
sql.Append($"update IO_Control set IsSendLCS=1 where CONTROL_ID={dataIOtaskstart[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
dbo.ExceSQL(sql.ToString());
}
else {
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", "taskStatusReporstart", "开始调用wms服务失败:", $"返回报错{resp_data.data}:{resp_data.msg}");
return;
}
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 == 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
{
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,39 +1291,82 @@ namespace WcfControlMonitorLib
}
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
await Task.Run(() =>
{
//if ((resp_data.msg.Contains("不存在") && resp_data.msg.Contains("流程任务"))|| resp_data.msg.Contains("请求失败")) {
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 == 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但是任务状态已经是拆分完的状态的任务
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;
}
// }
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是回退任务
dataIOBacktaskfinish = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
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());
sql.Clear();
sql.Append($"delete from IO_CONTROL where CONTROL_ID={dataIOBacktaskfinish[i]["CONTROL_ID"]}");//查询还未发送给WMS但是任务状态已经是拆分完的状态的任务
dbo.ExceSQL(sql.ToString());
}
}
#endregion
@ -1235,7 +1374,7 @@ namespace WcfControlMonitorLib
catch (Exception ex)
{
_CCallServiceError = ex.StackTrace + ex.Message;
CommonClassLib.CCarryConvert.WriteDarkCasket("CallService", "DealCallService", $"接口名称:taskStatusReporstart:", "调用接口时异常:", ex.Message.ToString());
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
@ -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 对目标库位进行重新分配。

563
WcfControlMonitorLib/SControlMonitor.cs

@ -788,7 +788,7 @@ namespace WcfControlMonitorLib
ob = new object[7] { apptype, dcode, barcode, 0, dtime, "", ccf.GetWarehouseIndex() };
try
{
// dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}')", ob));
// dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}')", ob));
}
//20101124
@ -2586,40 +2586,40 @@ namespace WcfControlMonitorLib
#region 获得货位信息
else
if (CellCode != "")
{
cell = CellCode.Split(cc);
if (cell.Length == 3)
{
cell = CellCode.Split(cc);
if (cell.Length == 3)
{
#region 获得物料条码信息,连接管理系统数据库
#region 获得物料条码信息,连接管理系统数据库
//根据托盘条码查询物料信息
sqlstr = string.Format("SELECT STOCK_BARCODE,GOODS_PROPERTY1,GOODS_PROPERTY2,GOODS_PROPERTY3,GOODS_PROPERTY4,GOODS_CLASS_NAME From V_STORAGE_LIST where CELL_CODE = '{0:D2}-{1:D2}-{2:D2}'", cell[0], cell[1], cell[2]);
dvclient = dboMan.ExceSQL(sqlstr).Tables[0].DefaultView;
if (dvclient.Count > 0)
{
PalletBarCode = dvclient[0]["STOCK_BARCODE"].ToString();//托盘条码
GoodsType = dvclient[0]["GOODS_CLASS_NAME"].ToString();//物料类型
GoodsBarCode = string.Format("{0}|{1}|{2}|{3}",
dvclient[0]["GOODS_PROPERTY1"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY2"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY3"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY4"].ToString().Trim());
//根据托盘条码查询物料信息
sqlstr = string.Format("SELECT STOCK_BARCODE,GOODS_PROPERTY1,GOODS_PROPERTY2,GOODS_PROPERTY3,GOODS_PROPERTY4,GOODS_CLASS_NAME From V_STORAGE_LIST where CELL_CODE = '{0:D2}-{1:D2}-{2:D2}'", cell[0], cell[1], cell[2]);
dvclient = dboMan.ExceSQL(sqlstr).Tables[0].DefaultView;
if (dvclient.Count > 0)
{
PalletBarCode = dvclient[0]["STOCK_BARCODE"].ToString();//托盘条码
GoodsType = dvclient[0]["GOODS_CLASS_NAME"].ToString();//物料类型
GoodsBarCode = string.Format("{0}|{1}|{2}|{3}",
dvclient[0]["GOODS_PROPERTY1"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY2"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY3"].ToString().Trim(),
dvclient[0]["GOODS_PROPERTY4"].ToString().Trim());
}
}
#endregion
}
_tempSB
.Append(CellCode.Trim()).Append(",")//货位
.Append(PalletBarCode.Trim()).Append(",")//托盘条码
.Append(GoodsType.Trim()).Append(",")//物料类型
.Append(GoodsBarCode.Trim());//物料条码
//.Append(";");
#endregion
}
_tempSB
.Append(CellCode.Trim()).Append(",")//货位
.Append(PalletBarCode.Trim()).Append(",")//托盘条码
.Append(GoodsType.Trim()).Append(",")//物料类型
.Append(GoodsBarCode.Trim());//物料条码
//.Append(";");
}
#endregion
@ -2742,7 +2742,7 @@ namespace WcfControlMonitorLib
CStaticClass.ObtainManageTask = true;
CCallService.StartListen();//民航二所 打开开关后启用线程调用管理系统的webapi接口
// CObtainTask.StartListen();
// CObtainTask.StartListen();
return true;
}
catch
@ -2811,9 +2811,9 @@ namespace WcfControlMonitorLib
CStaticClass.ReConnect();
SocketsTCPIP.CClientTCPIP.InitAllClientTCPIP();
CParsePLCData.StartListen();
// CCallService.StartListenPLC();//山东时代
// CDisassembleTask.StartListen();
// CDisassembleTask.StartListen();
// CCallService.StartListenPLC();//山东时代
// CDisassembleTask.StartListen();
// CDisassembleTask.StartListen();
CUpdateIoControl.StartListen(); // NewWrieDarkCasket 位置1
OPCClient.CCommonOPCClient.CreateSubscriptionGroup();
@ -2855,7 +2855,7 @@ namespace WcfControlMonitorLib
//SocketsTCPIP.CClientTCPIP.EndConnect();
CParsePLCData.EndListen();
CUpdateIoControl.EndListen(); // NewWrieDarkCasket 位置2'
// CCallService.EndListenPLC();//山东时代
// CCallService.EndListenPLC();//山东时代
return true;
}
catch
@ -3520,12 +3520,12 @@ namespace WcfControlMonitorLib
}
}
string FLOGIC_AREA = string.Empty;//逻辑区域
if (_tasktype == "2" )//出库任务
if (_tasktype == "2")//出库任务
{
FLOGIC_AREA = FENDDEVICE.ToString();
iStartLayer = Convert.ToInt16(FSTARTCELL.Split('-')[2]);
}
if ( _tasktype == "3")//移库任务
if (_tasktype == "3")//移库任务
{
FLOGIC_AREA = FENDDEVICE.ToString();
iStartLayer = Convert.ToInt16(FSTARTCELL.Split('-')[2]);
@ -3913,11 +3913,11 @@ namespace WcfControlMonitorLib
var client = (IClient)OperationContext.Current.Channel;
if (ClientCallbackLists[client] == null)
{
userDescription = "";
userDescription = "";
}
else
{
userDescription = ClientCallbackLists[client].ToString();
userDescription = ClientCallbackLists[client].ToString();
}
//string userID = ClientShowLists[client].ToString();
@ -4934,8 +4934,8 @@ namespace WcfControlMonitorLib
CUpdateIoControl.EndListen(); //民航二所
CCallService.EndListen();//民航二所 结束调用管理系统接口
// CCallService.EndListenPLC();//山东时代
//Application.Exit();
// CCallService.EndListenPLC();//山东时代
//Application.Exit();
return true;
}
catch (Exception ex)
@ -5310,7 +5310,7 @@ namespace WcfControlMonitorLib
devicebegin = Convert.ToInt32(dv[0]["F_DeviceIndex"]);
DBW2Addressbegin = Convert.ToInt32(dv[0]["F_DBW2Address"]);
SplitBytebegin = Convert.ToInt32(dv[0]["F_SplitByte"]);
SplitBytebegin = Convert.ToInt32(dv[0]["F_SplitByte"]);
S7Connection = dv[0]["F_S7Connection"].ToString();
sql.Clear();
@ -5419,7 +5419,7 @@ namespace WcfControlMonitorLib
int xc = 0; int yc = 0;
int xc = 0; int yc = 0;
int devkind = ccf.GetDeviceKindIdx(devidx);
if (devkind == 31)
{//解析南京14所得高端自动化的是否有物信号,高位低位信号(I/O信号字节填写在状态字节的后面)
@ -5651,12 +5651,12 @@ namespace WcfControlMonitorLib
task23.Append(",3叉任务号:").Append(taskindex3).Append(",3叉条码:").Append(GetBarcodeFromMonitorIndex(taskindex3));
}
#region AGV取放货的输送线状态实时跟新 PLC断开连接后,该值不会变更,可能存在BUG,需要加以限制 有货可取货
if (devinfo.DeviceIndex>=30002&&devinfo.DeviceIndex<=30005)
if (devinfo.DeviceIndex >= 30002 && devinfo.DeviceIndex <= 30005)
{
sql.Remove(0, sql.Length);
sql.Append("select * from T_AGVIOStation where F_PLCOtherDevice=").Append(devinfo.DeviceIndex);
DataView data= dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
DataView data = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView;
int status = 0;
if (data[0]["F_AGVStatus"].ToString() == "6")
{
@ -5694,28 +5694,28 @@ namespace WcfControlMonitorLib
string aa;
int mankind = 0, tindex = 0;
long relFID = 0,fid1 = 0, fid2 = 0, fid3 = 0;
long relFID = 0, fid1 = 0, fid2 = 0, fid3 = 0;
if (taskindex3 > 0)
{
mankind = GetManageTaskKindFromMonitor(out aa, taskindex3);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex3);
mankind = GetManageTaskKindFromMonitor(out aa, taskindex3);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex3);
tindex = taskindex3;
}
if (taskindex2 > 0)
{
mankind = GetManageTaskKindFromMonitor(out aa, taskindex2);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex2);
mankind = GetManageTaskKindFromMonitor(out aa, taskindex2);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex2);
tindex = taskindex2;
}
if (taskindex > 0)
{
mankind = GetManageTaskKindFromMonitor(out aa, taskindex);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex);
mankind = GetManageTaskKindFromMonitor(out aa, taskindex);
relFID = GetManageTaskIndexFromMonitor(out aa, taskindex);
tindex = taskindex;
}
fid1 = GetManageTaskIndexFromMonitor(out aa, taskindex);
fid2 = GetManageTaskIndexFromMonitor(out aa, taskindex2);
fid3 = GetManageTaskIndexFromMonitor(out aa, taskindex3);
fid1 = GetManageTaskIndexFromMonitor(out aa, taskindex);
fid2 = GetManageTaskIndexFromMonitor(out aa, taskindex2);
fid3 = GetManageTaskIndexFromMonitor(out aa, taskindex3);
//关联分配三叉
sql.Remove(0, sql.Length);
sql.Append("update T_Manage_Task set FUseAwayFork=1,F_RELATIVECONTORLID=").Append(relFID).Append(" where F_ManageTaskKindIndex=").Append(mankind).Append(" and FID=").Append(fid1);
@ -5846,7 +5846,7 @@ namespace WcfControlMonitorLib
}
int size = devicestates[tempdb2addr + 1]; //异常信息// 高度值 1:矮货 2:高货
devinfo.RunState = size;
// int Weight = devicestates[tempdb2addr + 5] + (devicestates[tempdb2addr + 4] << 8) + (devicestates[tempdb2addr + 3] << 16) + (devicestates[tempdb2addr + 2] << 32); ;//称重重量:1轻,2重 3 超重
// int Weight = devicestates[tempdb2addr + 5] + (devicestates[tempdb2addr + 4] << 8) + (devicestates[tempdb2addr + 3] << 16) + (devicestates[tempdb2addr + 2] << 32); ;//称重重量:1轻,2重 3 超重
int BarcodeTotalLength = BarcodeReservedLength * BoxQuality;
int PalletBarcodeLength = Convert.ToInt32(dvsp[0]["F_PalletBarcodeLength"]);//电力纸箱码垛机器人专用\普通条码申请
int PalletBarcodeReservedLength = Convert.ToInt32(dvsp[0]["F_PalletBarcodeReservedLength"]);//电力纸箱码垛机器人专用\普通条码申请
@ -5880,14 +5880,14 @@ namespace WcfControlMonitorLib
{
incompleteBarcode.Clear();//20150103
noneBarcode.Clear();//20150103
for (int j = 2; j <= PalletBarcodeLength+2; j++)
for (int j = 2; j <= PalletBarcodeLength + 2; j++)
{//20150103
incompleteBarcode.Append("1");//PLC扫到残码,但是有货物,转换为字符'1'
noneBarcode.Append("0");//PLC没扫描,没货物,保留的空值0,转换为字符'\0'
}
//获得托盘条码值
//emptypallet=devicestates[tempdb2addr + 1];//托盘高度检测标志,0表示空托盘,1表示实托盘
for (int j = 10; j < PalletBarcodeLength+10; j++)//标志位+空、实托盘+条码值
for (int j = 10; j < PalletBarcodeLength + 10; j++)//标志位+空、实托盘+条码值
{
if (devicestates[tempdb2addr + j] == 1)
{
@ -5954,28 +5954,28 @@ namespace WcfControlMonitorLib
if (barcode.ToString() == incompleteBarcode.ToString())
{//扫到残码
RefreshMonitorEventArgs rmea;
int abst;
//if (int.TryParse(dvsp[0]["F_Remark"].ToString(), out abst) == true)
//{
// if (IfExitDeviceBarcodeTask(dcode, barcode.ToString()) == false)
// {
// object[] ob = new object[17] { ccf.GetTempManageIdx(), 2, barcode.ToString(), 1, 2, 1, 1, ccf.GetWarehouseIndex(), ccf.GetWarehouseIndex(), "-", dcode, dvsp[0]["F_Remark"].ToString(), "-", 0, DateTime.Now.ToString("u"), 0, Model.CGeneralFunction.TASKABEND };
// dbo.ExceSQL(string.Format("INSERT INTO T_Manage_Task(FID, F_ManageTaskKindIndex,FPALLETBARCODE,FMANAGETASKTYPE,FCONTROLTASKTYPE, FTASKLEVEL, FISRETURN,FSTARTWAREHOUSE,FENDWAREHOUSE, FSTARTCELL, FSTARTDEVICE, FENDDEVICE, FENDCELL, FSTATUS, FBEGTIME, FIntoStepOK,FExceptionNO)VALUES({0},{1},'{2}',{3},{4},{5},{6},'{7}','{8}','{9}',{10},{11},'{12}',{13},'{14}','{15}',{16})", ob));
// }
//}
//else
//{
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务时:", devidx.ToString(), ",站台:" + dcode + ",扫到残缺条码!" + barcode.ToString().ToUpper());
// rmea = new RefreshMonitorEventArgs("notifyIcon1", "警告:向管理条码申请任务时,站台:" + dcode + ",扫到残缺条码!时间:" + DateTime.Now.ToString("u"));
// OnRefreshMonitor(rmea);
//}
//wv[0].Clear();
//wv[0].Append("2");
//sdo = CommModeCreate.CreateSendDeviceOrder(devidx);
//sdo.WriteDBData(witemnames, wv, devinfo.S7Connection);
//dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode = '{1}',F_Time='{2}',F_Size='{3}',F_Hight='{4}' WHERE (F_DeviceIndex = {0}) ", devidx, barcode.ToString(), DateTime.Now, Weight, size));
//continue;//20160120
}
int abst;
//if (int.TryParse(dvsp[0]["F_Remark"].ToString(), out abst) == true)
//{
// if (IfExitDeviceBarcodeTask(dcode, barcode.ToString()) == false)
// {
// object[] ob = new object[17] { ccf.GetTempManageIdx(), 2, barcode.ToString(), 1, 2, 1, 1, ccf.GetWarehouseIndex(), ccf.GetWarehouseIndex(), "-", dcode, dvsp[0]["F_Remark"].ToString(), "-", 0, DateTime.Now.ToString("u"), 0, Model.CGeneralFunction.TASKABEND };
// dbo.ExceSQL(string.Format("INSERT INTO T_Manage_Task(FID, F_ManageTaskKindIndex,FPALLETBARCODE,FMANAGETASKTYPE,FCONTROLTASKTYPE, FTASKLEVEL, FISRETURN,FSTARTWAREHOUSE,FENDWAREHOUSE, FSTARTCELL, FSTARTDEVICE, FENDDEVICE, FENDCELL, FSTATUS, FBEGTIME, FIntoStepOK,FExceptionNO)VALUES({0},{1},'{2}',{3},{4},{5},{6},'{7}','{8}','{9}',{10},{11},'{12}',{13},'{14}','{15}',{16})", ob));
// }
//}
//else
//{
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务时:", devidx.ToString(), ",站台:" + dcode + ",扫到残缺条码!" + barcode.ToString().ToUpper());
// rmea = new RefreshMonitorEventArgs("notifyIcon1", "警告:向管理条码申请任务时,站台:" + dcode + ",扫到残缺条码!时间:" + DateTime.Now.ToString("u"));
// OnRefreshMonitor(rmea);
//}
//wv[0].Clear();
//wv[0].Append("2");
//sdo = CommModeCreate.CreateSendDeviceOrder(devidx);
//sdo.WriteDBData(witemnames, wv, devinfo.S7Connection);
//dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode = '{1}',F_Time='{2}',F_Size='{3}',F_Hight='{4}' WHERE (F_DeviceIndex = {0}) ", devidx, barcode.ToString(), DateTime.Now, Weight, size));
//continue;//20160120
}
#endregion
@ -6017,7 +6017,7 @@ namespace WcfControlMonitorLib
string errormsg = "";
if (err != null)
{
errormsg= err.ErrorName + ",代码:" + devinfo.ErrorCode.ToString();
errormsg = err.ErrorName + ",代码:" + devinfo.ErrorCode.ToString();
}
string sql5 = string.Format("insert into IO_CONTROL_APPLY_HIS(CONTROL_APPLY_ID,CONTROL_ID,CONTROL_APPLY_TYPE,WAREHOUSE_CODE,DEVICE_CODE,STOCK_BARCODE,APPLY_TASK_STATUS,CREATE_TIME,CONTROL_APPLY_PARAMETER,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02,CONTROL_APPLY_REMARK)" +
@ -6069,31 +6069,31 @@ namespace WcfControlMonitorLib
//dvbc = dboMan.ExceSQL(string.Format("select CONTROL_ID from IO_CONTROL where STOCK_BARCODE like '%{0}%'", barcode)).Tables[0].DefaultView;
//if (dvbc.Count <= 0)
//{
//dvbc = dbo.ExceSQL(string.Format("select fid from T_Manage_Task where FPALLETBARCODE like '%{0}%'", barcode)).Tables[0].DefaultView;
//if (dvbc.Count <= 0)
//{
StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u"));
dtime.Remove(dtime.Length - 1, 1);
//int appid = dboMan.GetManageTableIndex("IO_CONTROL_APPLY", true);//CONTROL_APPLY_ID
//object[] ob = new object[9] { apptype, dcode, barcode, 0, dtime, "", warehouse.ToString(), appid, BoxQuality };
object[] ob = new object[9] { apptype, dcode, barcode, 0, dtime, "", warehouse.ToString(),Weight, size };
try
{
//dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY(CONTROL_APPLY_ID, CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,BOX_QUANTITY)VALUES ({7},{0},'{1}','{2}',{3},'{4}','{5}','{6}',{8})", ob));
dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY(CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}')", ob));
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper() + ",申请类型:" + apptype.ToString()+"申请高度:"+size+"申请重量:"+ Weight);//20140218
}
catch (Exception ex)
{
RefreshMonitorEventArgs rmea = new RefreshMonitorEventArgs("tsStatus", "向管理申请入库任务时发生错误:" + ex.StackTrace + ex.Message);
OnRefreshMonitor(rmea);
continue;//20140218
}
//dvbc = dbo.ExceSQL(string.Format("select fid from T_Manage_Task where FPALLETBARCODE like '%{0}%'", barcode)).Tables[0].DefaultView;
//if (dvbc.Count <= 0)
//{
StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u"));
dtime.Remove(dtime.Length - 1, 1);
//int appid = dboMan.GetManageTableIndex("IO_CONTROL_APPLY", true);//CONTROL_APPLY_ID
//object[] ob = new object[9] { apptype, dcode, barcode, 0, dtime, "", warehouse.ToString(), appid, BoxQuality };
object[] ob = new object[9] { apptype, dcode, barcode, 0, dtime, "", warehouse.ToString(), Weight, size };
try
{
//dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY(CONTROL_APPLY_ID, CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,BOX_QUANTITY)VALUES ({7},{0},'{1}','{2}',{3},'{4}','{5}','{6}',{8})", ob));
dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY(CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARA01,CONTROL_APPLY_PARA02)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}')", ob));
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper() + ",申请类型:" + apptype.ToString() + "申请高度:" + size + "申请重量:" + Weight);//20140218
}
catch (Exception ex)
{
RefreshMonitorEventArgs rmea = new RefreshMonitorEventArgs("tsStatus", "向管理申请入库任务时发生错误:" + ex.StackTrace + ex.Message);
OnRefreshMonitor(rmea);
continue;//20140218
}
//}
//}
//}
}
@ -6893,7 +6893,7 @@ namespace WcfControlMonitorLib
break;
#endregion
#endregion
case 32:
#region 高端触摸屏
if (devicestates[tempdb2addr + 0] != 1) continue;
@ -7020,7 +7020,7 @@ namespace WcfControlMonitorLib
break;
#endregion
#endregion
#endregion
#region 高端设备
@ -7519,9 +7519,9 @@ namespace WcfControlMonitorLib
}
else
if (dcode == 22066)
{
deviceend = 21001;
}
{
deviceend = 21001;
}
dvbc =
dbo.ExceSQL(
string.Format(
@ -7752,107 +7752,107 @@ namespace WcfControlMonitorLib
#region 检尺
case 37:
//if (devicestates[tempdb2addr + 0] != 1) continue;
//dvsp = dbo.ExceSQL(string.Format("select F_BarCode,F_Time, F_PalletBarcodeLength,F_PalletBarcodeReservedLength,F_BarcodeReservedLength,F_WareHouse,F_ManageAskkind,F_BarcodeForkAmount,F_BarcodeLength,F_BindingDevice,F_Askkind,F_Remark,F_TaskIndex from T_Base_PLC_Ask WHERE (F_DeviceIndex = {0}) ", devidx)).Tables[0].DefaultView; //20130510F_ManageAskkind
//if (dvsp.Count > 0)
//{
// StringBuilder warehouse = new StringBuilder(dvsp[0]["F_WareHouse"].ToString());
// int dcode = Convert.ToInt32(dvsp[0]["F_BindingDevice"]);
// int apptype = Convert.ToInt32(dvsp[0]["F_ManageAskkind"]);
// int sb = Convert.ToInt32(dvsp[0]["F_remark"]);
// int BoxQuality = devicestates[tempdb2addr + 1];
// DateTime appdt = new DateTime();
// if (dvsp[0]["F_Time"] == DBNull.Value)
// {
// appdt = DateTime.Now.AddSeconds(-10);
// }
// else
// {
// DateTime.TryParse(dvsp[0]["F_Time"].ToString(), out appdt);
// }
// if (dvsp[0]["F_TaskIndex"] != DBNull.Value)
// {
// if ((appdt.AddSeconds(5) > DateTime.Now) && (dvsp[0]["F_TaskIndex"].ToString() == BoxQuality.ToString()))
// {
// dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_TaskIndex = '{1}',F_Time='{2}' WHERE (F_DeviceIndex = {0}) ", devidx, BoxQuality, DateTime.Now));
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "PLC重复上报检尺:", devidx.ToString(), ",检尺:" + devidx + ",高度:" + BoxQuality.ToString().ToUpper());
// break;
// }
// }
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "检尺上报", devidx.ToString(), "读标志1**:" + BoxQuality.ToString());
// StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u"));
// dtime.Remove(dtime.Length - 1, 1);
// barcode.Clear();
// dvsp = dbo.ExceSQL(string.Format("select F_BarCode,F_BindingDevice from T_Base_PLC_Ask WHERE (F_DeviceIndex = {0}) ", dcode)).Tables[0].DefaultView; //20130510F_ManageAskkind
// if (dvsp.Count > 0)
// {
// barcode.Append(dvsp[0]["F_BarCode"]);
// }
// string jic = string.Empty;
// switch (BoxQuality)
// {
// case 1:
// jic = "Low";
// break;
// case 2:
// jic = "Height%";
// break;
// case 3:
// jic = "Height";
// break;
// default:
// jic = BoxQuality.ToString();
// break;
// }
// //int appid = dboMan.GetManageTableIndex("IO_CONTROL_APPLY", true);//CONTROL_APPLY_ID
// object[] ob = new object[8] { apptype, sb, barcode, 0, dtime, "", warehouse.ToString(), jic };
// if (CStaticClass.StopTestLane == true)
// {
// if ((!WcfControlMonitorLib.CStaticClass.StopTest.ContainsKey(18001)) || ((WcfControlMonitorLib.CStaticClass.StopTest.ContainsKey(18001)) && WcfControlMonitorLib.CStaticClass.StopTest[18001] == true))
// {
// try
// {
// dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARAMETER)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}')", ob));
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper());//20140218
// }
// catch (Exception ex)
// {
// RefreshMonitorEventArgs rmea = new RefreshMonitorEventArgs("tsStatus", "向管理申请入库任务时发生错误:" + ex.StackTrace + ex.Message);
// OnRefreshMonitor(rmea);
// continue;//20140218
// }
// }
// }
// else
// {
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "调度系统测试:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper());//20140218
// }
// witemnames[0].Clear();
// witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(devinfo.Dbw2Address + 0)).Append(",b");//20130510
// wv[0].Clear();
// wv[0].Append("2");
// sdo = CommModeCreate.CreateSendDeviceOrder(devidx);
// sdo.WriteDBData(witemnames, wv, devinfo.S7Connection);
//if (devicestates[tempdb2addr + 0] != 1) continue;
//dvsp = dbo.ExceSQL(string.Format("select F_BarCode,F_Time, F_PalletBarcodeLength,F_PalletBarcodeReservedLength,F_BarcodeReservedLength,F_WareHouse,F_ManageAskkind,F_BarcodeForkAmount,F_BarcodeLength,F_BindingDevice,F_Askkind,F_Remark,F_TaskIndex from T_Base_PLC_Ask WHERE (F_DeviceIndex = {0}) ", devidx)).Tables[0].DefaultView; //20130510F_ManageAskkind
//if (dvsp.Count > 0)
//{
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "写检尺应答", devidx.ToString(), "写标志2**检尺:" + BoxQuality.ToString());
// ob = new object[4] { devidx, BoxQuality.ToString(), DateTime.Now, barcode };
// dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode='{3}',F_Time='{2}', F_TaskIndex ={1} WHERE (F_DeviceIndex = {0}) ", ob));
// StringBuilder warehouse = new StringBuilder(dvsp[0]["F_WareHouse"].ToString());
// int dcode = Convert.ToInt32(dvsp[0]["F_BindingDevice"]);
// int apptype = Convert.ToInt32(dvsp[0]["F_ManageAskkind"]);
// int sb = Convert.ToInt32(dvsp[0]["F_remark"]);
// int BoxQuality = devicestates[tempdb2addr + 1];
// DateTime appdt = new DateTime();
// if (dvsp[0]["F_Time"] == DBNull.Value)
// {
// appdt = DateTime.Now.AddSeconds(-10);
// }
// else
// {
// DateTime.TryParse(dvsp[0]["F_Time"].ToString(), out appdt);
// }
// if (dvsp[0]["F_TaskIndex"] != DBNull.Value)
// {
// if ((appdt.AddSeconds(5) > DateTime.Now) && (dvsp[0]["F_TaskIndex"].ToString() == BoxQuality.ToString()))
// {
// dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_TaskIndex = '{1}',F_Time='{2}' WHERE (F_DeviceIndex = {0}) ", devidx, BoxQuality, DateTime.Now));
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "PLC重复上报检尺:", devidx.ToString(), ",检尺:" + devidx + ",高度:" + BoxQuality.ToString().ToUpper());
// break;
// }
// }
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "检尺上报", devidx.ToString(), "读标志1**:" + BoxQuality.ToString());
// StringBuilder dtime = new StringBuilder(DateTime.Now.ToString("u"));
// dtime.Remove(dtime.Length - 1, 1);
// barcode.Clear();
// dvsp = dbo.ExceSQL(string.Format("select F_BarCode,F_BindingDevice from T_Base_PLC_Ask WHERE (F_DeviceIndex = {0}) ", dcode)).Tables[0].DefaultView; //20130510F_ManageAskkind
// if (dvsp.Count > 0)
// {
// barcode.Append(dvsp[0]["F_BarCode"]);
// }
// string jic = string.Empty;
// switch (BoxQuality)
// {
// case 1:
// jic = "Low";
// break;
// case 2:
// jic = "Height%";
// break;
// case 3:
// jic = "Height";
// break;
// default:
// jic = BoxQuality.ToString();
// break;
// }
// //int appid = dboMan.GetManageTableIndex("IO_CONTROL_APPLY", true);//CONTROL_APPLY_ID
// object[] ob = new object[8] { apptype, sb, barcode, 0, dtime, "", warehouse.ToString(), jic };
// if (CStaticClass.StopTestLane == true)
// {
// if ((!WcfControlMonitorLib.CStaticClass.StopTest.ContainsKey(18001)) || ((WcfControlMonitorLib.CStaticClass.StopTest.ContainsKey(18001)) && WcfControlMonitorLib.CStaticClass.StopTest[18001] == true))
// {
// try
// {
// dboMan.ExecuteSql(string.Format("INSERT INTO IO_CONTROL_APPLY( CONTROL_APPLY_TYPE,DEVICE_CODE, STOCK_BARCODE, APPLY_TASK_STATUS, CREATE_TIME,CONTROL_APPLY_REMARK,WAREHOUSE_CODE,CONTROL_APPLY_PARAMETER)VALUES ({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}')", ob));
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "向管理条码申请任务:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper());//20140218
// }
// catch (Exception ex)
// {
// RefreshMonitorEventArgs rmea = new RefreshMonitorEventArgs("tsStatus", "向管理申请入库任务时发生错误:" + ex.StackTrace + ex.Message);
// OnRefreshMonitor(rmea);
// continue;//20140218
// }
// }
// }
// else
// {
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "调度系统测试:", devidx.ToString(), ",站台:" + dcode + ",条码:" + barcode.ToString().ToUpper());//20140218
// }
// witemnames[0].Clear();
// witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(devinfo.Dbw2Address + 0)).Append(",b");//20130510
// wv[0].Clear();
// wv[0].Append("2");
// sdo = CommModeCreate.CreateSendDeviceOrder(devidx);
// sdo.WriteDBData(witemnames, wv, devinfo.S7Connection);
// CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "写检尺应答", devidx.ToString(), "写标志2**检尺:" + BoxQuality.ToString());
// ob = new object[4] { devidx, BoxQuality.ToString(), DateTime.Now, barcode };
// dbo.ExecuteSql(string.Format("UPDATE T_Base_PLC_Ask SET F_BarCode='{3}',F_Time='{2}', F_TaskIndex ={1} WHERE (F_DeviceIndex = {0}) ", ob));
//}
//break;
//}
//break;
#endregion
#region 每楼层报警点
@ -7948,8 +7948,8 @@ namespace WcfControlMonitorLib
int mankindd = 0;
long fidd1 = 0, fidd2 = 0, relFIDD = 0;
string aainfo = string.Empty;
int mankind = GetManageTaskKindFromMonitor(out aainfo, taskindex);
long mantaskindex = GetManageTaskIndexFromMonitor(out aainfo, taskindex);
int mankind = GetManageTaskKindFromMonitor(out aainfo, taskindex);
long mantaskindex = GetManageTaskIndexFromMonitor(out aainfo, taskindex);
int tasktypee = ccf.GetFCONTROLTASKTYPEFromManageTask(mankind, mantaskindex);
int layer = 0;
layer = ccf.getLayerFromMonitorTask(taskindex);
@ -7958,7 +7958,7 @@ namespace WcfControlMonitorLib
int[] corrtasks = Model.CGeneralFunction.MutiForkIfSync(taskindex, devidx, 40);
int boxnum = Model.CGeneralFunction.getDoubleForkMonitorCount(taskindex, tasktypee, order);
cgs.ActionComplete(devidx, taskindex, 1);
if(corrtasks[0] != 0)
if (corrtasks[0] != 0)
{
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "多工位提升机状态:", devidx.ToString(), "报完成时:查找关联任务:" + corrtasks[0] + "当前任务:" + taskindex.ToString() + "箱数:" + boxnum);
}
@ -7976,7 +7976,7 @@ namespace WcfControlMonitorLib
#region 20180427 add by lyj提升机送货完成解除关联
string sqlrela = string.Empty;
if (order == 5 && devinfo.SplitByte_0 == 0 && devinfo.SplitByte_1 == 0&&tasktypee==1)
if (order == 5 && devinfo.SplitByte_0 == 0 && devinfo.SplitByte_1 == 0 && tasktypee == 1)
{
sqlrela = "update T_Manage_Task set F_RELATIVECONTORLID=-" + relaid.ToString() + " where F_RELATIVECONTORLID=" + relaid.ToString();
@ -7988,7 +7988,7 @@ namespace WcfControlMonitorLib
cgs.ActionComplete(devidx, taskindex, 1);
}
#endregion
#endregion
#region add by lyj20180507出库不同层配关联
if (tasktypee == 2 && order == 4 && relaid <= 0)
@ -8057,7 +8057,7 @@ namespace WcfControlMonitorLib
#endregion
#region 20210324_上海晟碟,拣选塔灯清零确认
case 41:
if(states[0] == 1)
if (states[0] == 1)
{
//int iStation = deviceindex / 10;
//sql.Remove(0, sql.Length);
@ -8078,7 +8078,7 @@ namespace WcfControlMonitorLib
//}
}
break;
#endregion
#endregion
}
#endregion
@ -8154,7 +8154,7 @@ namespace WcfControlMonitorLib
wv[0].Clear();
wv[0].Append(Wdata);
sdo = CommModeCreate.CreateSendDeviceOrder(deviceIndex);
sdo.WriteDBData(wn, wv, md.S7Connection);
sdo.WriteDBData(wn, wv, md.S7Connection);
CommonClassLib.CCarryConvert.WriteDarkCasket("OPCClient", "写堆垛机急停按钮信号:", deviceIndex.ToString(), md.S7Connection + ";" + DBBlock + ";" + (md.Dbw1Address + 22).ToString() + ";" + Wdata);
@ -8242,7 +8242,7 @@ namespace WcfControlMonitorLib
if (DBBlock == "DB2")
{
StringBuilder[] wv = { new StringBuilder("") ,new StringBuilder("")};
StringBuilder[] wv = { new StringBuilder(""), new StringBuilder("") };
StringBuilder[] wn = { new StringBuilder(""), new StringBuilder("") };
wn[0].Clear();
wn[0].Append(DBBlock).Append(".").Append(Convert.ToString(md.Dbw1Address + 1)).Append(",b");//
@ -8289,7 +8289,7 @@ namespace WcfControlMonitorLib
/// <param name="byteindex">索引</param>
/// <param name="errtext"></param>
/// <returns></returns>
public bool WriteDBData2(int deviceIndex, string DBBlock, string Wdata,string byteindex, out string errtext)
public bool WriteDBData2(int deviceIndex, string DBBlock, string Wdata, string byteindex, out string errtext)
{
errtext = string.Empty;
try
@ -8928,11 +8928,11 @@ namespace WcfControlMonitorLib
md.RunState = Convert.ToInt32(dv[i]["INOut_Value"]);
//Model.CGetInfo.SetDeviceMessage(devinfo);
WriteDBDataConveyor(Convert.ToInt32(dv[i]["Device_Index"]),"DB1", dv[i]["INOut_Value"].ToString(), out string errtext);
if (errtext != null&&errtext!="")
WriteDBDataConveyor(Convert.ToInt32(dv[i]["Device_Index"]), "DB1", dv[i]["INOut_Value"].ToString(), out string errtext);
if (errtext != null && errtext != "")
{
CommonClassLib.CCarryConvert.WriteDarkCasket("opcclient", "设备编号:" + Convert.ToInt32(dv[i]["Device_Index"]).ToString(),
"写入的值:" + dv[i]["INOut_Value"].ToString()+"异常信息:"+errtext.ToString(), "PLC标识:" + md.S7Connection.ToString());
"写入的值:" + dv[i]["INOut_Value"].ToString() + "异常信息:" + errtext.ToString(), "PLC标识:" + md.S7Connection.ToString());
}
}
}
@ -8966,8 +8966,8 @@ namespace WcfControlMonitorLib
int[] States;
if (CStaticClass.Order == true)
{
int[] iDeviceIn = { 12004 };//出库路径终点设备
int[] iDevice = { 15102};//写点灯,指示灯设备名称
int[] iDeviceIn = { 12004 };//出库路径终点设备
int[] iDevice = { 15102 };//写点灯,指示灯设备名称
DataView dvi = new DataView();
DataView dviMon = new DataView();
DataView dv = new DataView();
@ -8992,14 +8992,14 @@ namespace WcfControlMonitorLib
if (States != null)
{
Model.MDevice md = Model.CGetInfo.GetDeviceInfo(iDevice[i]);
witemnames[0].Clear();
witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(md.Dbw2Address + 2)).Append(",b");//
wv[0].Clear();
wv[0].Append("1");
sdo = CommModeCreate.CreateSendDeviceOrder(iDevice[i]);
sdo.WriteDBData(witemnames, wv, md.S7Connection);
// CommonClassLib.CCarryConvert.WriteDarkCasket("发送", "亮灯", "指令", "2,亮灯站台:" + iDeviceIn[i].ToString());
Model.MDevice md = Model.CGetInfo.GetDeviceInfo(iDevice[i]);
witemnames[0].Clear();
witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(md.Dbw2Address + 2)).Append(",b");//
wv[0].Clear();
wv[0].Append("1");
sdo = CommModeCreate.CreateSendDeviceOrder(iDevice[i]);
sdo.WriteDBData(witemnames, wv, md.S7Connection);
// CommonClassLib.CCarryConvert.WriteDarkCasket("发送", "亮灯", "指令", "2,亮灯站台:" + iDeviceIn[i].ToString());
}
}
else //灭灯
@ -9008,14 +9008,14 @@ namespace WcfControlMonitorLib
States = CStaticClass.GetDeviceState(iDevice[i]); //1为亮绿灯 2为灭灯
if (States != null)
{
Model.MDevice md = Model.CGetInfo.GetDeviceInfo(iDevice[i]);
witemnames[0].Clear();
witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(md.Dbw2Address + 2)).Append(",b");//
wv[0].Clear();
wv[0].Append("2");
sdo = CommModeCreate.CreateSendDeviceOrder(iDevice[i]);
sdo.WriteDBData(witemnames, wv, md.S7Connection);
// CommonClassLib.CCarryConvert.WriteDarkCasket("发送", "灭灯", "指令", "1,灭灯站台:" + iDeviceIn[i].ToString());
Model.MDevice md = Model.CGetInfo.GetDeviceInfo(iDevice[i]);
witemnames[0].Clear();
witemnames[0].Append(Model.CGeneralFunction.DBGet).Append(".").Append(Convert.ToString(md.Dbw2Address + 2)).Append(",b");//
wv[0].Clear();
wv[0].Append("2");
sdo = CommModeCreate.CreateSendDeviceOrder(iDevice[i]);
sdo.WriteDBData(witemnames, wv, md.S7Connection);
// CommonClassLib.CCarryConvert.WriteDarkCasket("发送", "灭灯", "指令", "1,灭灯站台:" + iDeviceIn[i].ToString());
}
}
@ -9036,68 +9036,61 @@ 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";
}
else {
startCode = data[0]["LastTaskEndDevice"].ToString();
//CCallService.mythread.Start();
CCallService.mythread = new Thread(new ThreadStart(CCallService.BeginListen));
CCallService.mythread.IsBackground = true;
CCallService.mythread.Start();
}
#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)
{
endCode = data1[0]["FCELLCODE"].ToString();//获取终点
}
else {
return;
if (CCallService.mythread.IsAlive == false) {
CCallService.mythread.Abort();
CCallService. mythread = 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.mythread1 == null)
{
// CCallService.mythread1.Start();
CCallService.mythread1 = new Thread(new ThreadStart(CCallService.BeginListen1));
CCallService.mythread1.IsBackground = true;
CCallService.mythread1.Start();
}
else
{
if (CCallService.mythread1.IsAlive == false)
{
endCode = data1[0]["FCELLCODE"].ToString();//获取终点
CCallService.mythread1.Abort();
CCallService.mythread1 = null;
}
else
}
if (CCallService.mythread2 == null)
{
// CCallService.mythread2.Start();
CCallService.mythread2 = new Thread(new ThreadStart(CCallService.BeginListen2));
CCallService.mythread2.IsBackground = true;
CCallService.mythread2.Start();
}
else
{
if (CCallService.mythread2.IsAlive == false)
{
return;
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) {
}
}
}
}
public void SendConveyorTestTask2()
{

3
webapi/WindowsFormsApp1/APIChannel.cs

@ -206,8 +206,7 @@ namespace WindowsFormsApp1
else if (stepOk == 1 && FSTATUS == 0) {
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());
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