Commit 30aca5c0 LN

调试修改

1 个父辈 b4cfc899
...@@ -105,6 +105,8 @@ class NanjingSDotIO : IOBase ...@@ -105,6 +105,8 @@ class NanjingSDotIO : IOBase
/// </summary> /// </summary>
void iomonitor() void iomonitor()
{ {
try
{
iomonitorrun = true; iomonitorrun = true;
while (iomonitorrun && systemrun) while (iomonitorrun && systemrun)
{ {
...@@ -115,7 +117,7 @@ class NanjingSDotIO : IOBase ...@@ -115,7 +117,7 @@ class NanjingSDotIO : IOBase
} }
catch (SocketException) catch (SocketException)
{ {
if (tcpClient!=null && tcpClient.Connected) if (tcpClient != null && tcpClient.Connected)
tcpClient.Close(); tcpClient.Close();
ConnectionState_Event?.Invoke(this, false); ConnectionState_Event?.Invoke(this, false);
iomonitorrun = false; iomonitorrun = false;
...@@ -129,6 +131,11 @@ class NanjingSDotIO : IOBase ...@@ -129,6 +131,11 @@ class NanjingSDotIO : IOBase
} while (systemrun && !Open()); } while (systemrun && !Open());
} }
} }
catch (Exception ex)
{
TSA_V.Common.LogUtil.error($"IO模块{IP}出错:" + ex.ToString());
}
}
/// <summary> /// <summary>
/// 写io /// 写io
......
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
...@@ -36,7 +37,7 @@ namespace TSA_V.DeviceLibrary ...@@ -36,7 +37,7 @@ namespace TSA_V.DeviceLibrary
{ {
string url = $"http://{ip}/wms/associate/lightTagsLed"; string url = $"http://{ip}/wms/associate/lightTagsLed";
string json = JsonHelper.SerializeObject(getLedMaps(macs, ledvs)); string json = JsonHelper.SerializeObject(getLedMaps(macs, ledvs));
Post(url, json); Post(url, json,(open ? "打开所有":"关闭所有"));
} }
} }
public static LabelInfo GetLabel(TSAVPosition position, ComponetInfo com, bool opendLed = false) public static LabelInfo GetLabel(TSAVPosition position, ComponetInfo com, bool opendLed = false)
...@@ -107,7 +108,7 @@ namespace TSA_V.DeviceLibrary ...@@ -107,7 +108,7 @@ namespace TSA_V.DeviceLibrary
Dictionary<string, object> keyValuePairss = getLedMap(mac, ledrgb); Dictionary<string, object> keyValuePairss = getLedMap(mac, ledrgb);
string json = JsonHelper.SerializeObject(keyValuePairss); string json = JsonHelper.SerializeObject(keyValuePairss);
string value = $"[{json}]"; string value = $"[{json}]";
Post(url, value); Post(url, value, mac + (openLed ?"开灯":"关灯"));
} }
public static void UpdateScreen(LabelInfo label) public static void UpdateScreen(LabelInfo label)
{ {
...@@ -141,10 +142,12 @@ namespace TSA_V.DeviceLibrary ...@@ -141,10 +142,12 @@ namespace TSA_V.DeviceLibrary
} }
string json = JsonHelper.SerializeObject(dic); string json = JsonHelper.SerializeObject(dic);
string value = $"[{json}]"; string value = $"[{json}]";
Post(url, value); Post(url, value,"更新屏幕");
} }
public static async void Post(string url, string json) public static async void Post(string url, string json, string opName = "")
{
try
{ {
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
...@@ -152,25 +155,27 @@ namespace TSA_V.DeviceLibrary ...@@ -152,25 +155,27 @@ namespace TSA_V.DeviceLibrary
{ {
var contents = new StringContent($"{json}", null, "application/json"); var contents = new StringContent($"{json}", null, "application/json");
request.Content = contents; request.Content = contents;
using (HttpResponseMessage response = await client.SendAsync(request) ) using (HttpResponseMessage response = await client.SendAsync(request))
{ {
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
string jsonResponse = response.Content.ReadAsStringAsync().Result; string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse); LogUtil.info($"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
} }
else else
{ {
string jsonResponse = response.Content.ReadAsStringAsync().Result; string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse); LogUtil.info($"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
} }
} }
} }
} }
} }
catch (Exception ex)
{
LogUtil.info($"电子屏 {opName} 发送{json} 出错 {ex.ToString()}");
}
}
// { // {
// "mac":"99.96.19.64", // "mac":"99.96.19.64",
// "mappingtype":868, // "mappingtype":868,
......
...@@ -55,6 +55,11 @@ namespace TSA_V.DeviceLibrary ...@@ -55,6 +55,11 @@ namespace TSA_V.DeviceLibrary
currIndex = ConfigAppSettings.GetIntValue(Setting_Init.TagNumber); currIndex = ConfigAppSettings.GetIntValue(Setting_Init.TagNumber);
isContinue = false; isContinue = false;
} }
else
{
LogUtil.info("开始程序【" + boardInfo.boardName + "】的插件,关闭所有灯");
LedLabelController.CloseAll();
}
IsShowAOI = false; IsShowAOI = false;
currPoint = null; currPoint = null;
IsWorking = true; IsWorking = true;
...@@ -191,6 +196,11 @@ namespace TSA_V.DeviceLibrary ...@@ -191,6 +196,11 @@ namespace TSA_V.DeviceLibrary
//上一个节点返回原点 //上一个节点返回原点
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition); PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
} }
if (PreLabel != null)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
}
//if (TSAVBean.IsNeedSoldering) //if (TSAVBean.IsNeedSoldering)
//{ //{
// LogUtil.info(" 程序【" + currBoard.boardName + "】需要焊接,打开烙铁灯 "); // LogUtil.info(" 程序【" + currBoard.boardName + "】需要焊接,打开烙铁灯 ");
...@@ -302,6 +312,7 @@ namespace TSA_V.DeviceLibrary ...@@ -302,6 +312,7 @@ namespace TSA_V.DeviceLibrary
if (PreLabel != null) if (PreLabel != null)
{ {
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
} }
//LedManager.LedOFFALL(); //LedManager.LedOFFALL();
if (position.PositionType.Equals(1)) if (position.PositionType.Equals(1))
......
...@@ -12,6 +12,7 @@ using System.Windows.Forms; ...@@ -12,6 +12,7 @@ using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary; using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
using UserFromControl;
namespace TSA_V namespace TSA_V
{ {
...@@ -316,8 +317,8 @@ namespace TSA_V ...@@ -316,8 +317,8 @@ namespace TSA_V
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent; xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.XValue = TSAVBean.X_Max/2; xyMoveControl1.XValue = TSAVBean.X_Max/2;
xyMoveControl1.YValue = TSAVBean.Y_Max/2; xyMoveControl1.YValue = TSAVBean.Y_Max/2;
xyMoveControl1.MaxX =(int) TSAVBean.X_Max; ProjectorControl.MaxX =(int) TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max; ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
xyMoveControl1.ShowText = ""; xyMoveControl1.ShowText = "";
rdbUpload.Checked = true; rdbUpload.Checked = true;
......
...@@ -13,6 +13,7 @@ using TSA_V.Common; ...@@ -13,6 +13,7 @@ using TSA_V.Common;
using PUSICANLibrary; using PUSICANLibrary;
using TSA_V.LoadCSVLibrary; using TSA_V.LoadCSVLibrary;
using AccAOI; using AccAOI;
using UserFromControl;
namespace TSA_V namespace TSA_V
{ {
...@@ -41,8 +42,8 @@ namespace TSA_V ...@@ -41,8 +42,8 @@ namespace TSA_V
xyMoveControl1.XValue = nodex; xyMoveControl1.XValue = nodex;
xyMoveControl1.YValue = nodey; xyMoveControl1.YValue = nodey;
xyMoveControl1.MaxX = (int)TSAVBean.X_Max; ProjectorControl.MaxX = (int)TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max; ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
this.txtX.Text = x.ToString(); this.txtX.Text = x.ToString();
this.txtY.Text = y.ToString(); this.txtY.Text = y.ToString();
...@@ -122,8 +123,8 @@ namespace TSA_V ...@@ -122,8 +123,8 @@ namespace TSA_V
return; return;
} }
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent; xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.MaxX = (int)TSAVBean.X_Max; ProjectorControl.MaxX = (int)TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max; ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
this.PointList = list; this.PointList = list;
this.CurrIndex = currIndex; this.CurrIndex = currIndex;
ShowPoint(); ShowPoint();
......
...@@ -10,6 +10,7 @@ using System.Threading.Tasks; ...@@ -10,6 +10,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TSA_V.Common; using TSA_V.Common;
using TSA_V.DeviceLibrary; using TSA_V.DeviceLibrary;
using UserFromControl;
namespace TSA_V namespace TSA_V
{ {
...@@ -33,7 +34,7 @@ namespace TSA_V ...@@ -33,7 +34,7 @@ namespace TSA_V
// private bool hasShow = false; // private bool hasShow = false;
private void FrmScreenTest_Load(object sender, EventArgs e) private void FrmScreenTest_Load(object sender, EventArgs e)
{ {
this.Text = "显示测试_" + ScreenIndex; this.Text = "投影_" + ScreenIndex;
this.StartPosition = FormStartPosition.Manual; this.StartPosition = FormStartPosition.Manual;
timer1.Start(); timer1.Start();
if (panel1.BackgroundImage != null) if (panel1.BackgroundImage != null)
...@@ -76,12 +77,13 @@ namespace TSA_V ...@@ -76,12 +77,13 @@ namespace TSA_V
TSAVBean.Y_Max = ScreenHeight; TSAVBean.Y_Max = ScreenHeight;
TSAVBean.X_Min = 1; TSAVBean.X_Min = 1;
TSAVBean.Y_Min = 1; TSAVBean.Y_Min = 1;
ProjectorControl.MaxX = (int)TSAVBean.X_Max;
ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
ISShow = true; ISShow = true;
this.Location = new Point(screen.Bounds.Left, screen.Bounds.Top); this.Location = new Point(screen.Bounds.Left, screen.Bounds.Top);
this.Show(); this.Show();
LogUtil.info($"投影显示成功,屏幕索引={ ScreenIndex} , 位置X:{screen.Bounds.Left} ,Y:{screen.Bounds.Top} "); LogUtil.info($"投影显示成功,屏幕索引={ ScreenIndex} , 位置X:{screen.Bounds.Left} ,Y:{screen.Bounds.Top} ,范围 X:{ScreenWidth},Y:{ScreenHeight}");
return true; return true;
} }
else else
...@@ -118,22 +120,29 @@ namespace TSA_V ...@@ -118,22 +120,29 @@ namespace TSA_V
//循环画线 //循环画线
for (int i = 0; i <= Point_X_Length; i++) for (int i = 0; i <= Point_X_Length; i++)
{ {
float line = 0.2F; float line = 2F;
float picLocationX = startX + lineWidth * i; float picLocationX = startX + lineWidth * i;
if (picLocationX >= ScreenWidth) if (picLocationX >= ScreenWidth)
{ {
picLocationX = ScreenWidth - 2; picLocationX = ScreenWidth - 2;
} }
else if (picLocationX == 0)
{
picLocationX = 2;
}
grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight); grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
} }
for (int i = 0; i <= Point_Y_Length; i++) for (int i = 0; i <= Point_Y_Length; i++)
{ {
float line = 0.2F; float line = 2F;
float picLocationY = startY + lineHeight * i; float picLocationY = startY + lineHeight * i;
if (picLocationY >= ScreenHeight) if (picLocationY >= ScreenHeight)
{ {
picLocationY = ScreenHeight - 1; picLocationY = ScreenHeight - 1;
}else if(picLocationY== 0)
{
picLocationY = 2;
} }
grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY); grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
} }
......
...@@ -14,8 +14,8 @@ namespace UserFromControl ...@@ -14,8 +14,8 @@ namespace UserFromControl
{ {
public partial class ProjectorControl : UserControl public partial class ProjectorControl : UserControl
{ {
public int MaxX = 1920; public static int MaxX = 1920;
public int MaxY = 1280; public static int MaxY = 1280;
public delegate bool ShowPointDelegate(ProjectorPInfo p); public delegate bool ShowPointDelegate(ProjectorPInfo p);
public event ShowPointDelegate ShowPointEvent; public event ShowPointDelegate ShowPointEvent;
public ProjectorControl() public ProjectorControl()
...@@ -31,7 +31,7 @@ namespace UserFromControl ...@@ -31,7 +31,7 @@ namespace UserFromControl
PointType = TSAVBean.DefaultPType; PointType = TSAVBean.DefaultPType;
numSizeX.Maximum = MaxX / 2; numSizeX.Maximum = MaxX / 2;
numSizeY.Maximum=MaxY/ 2; numSizeY.Maximum=MaxY/ 2;
//LogUtil.info($"投影点位范围:X:{MaxX},Y:{MaxY}");
typeList = new List<string>(); typeList = new List<string>();
this.cmbType.Items.Clear(); this.cmbType.Items.Clear();
typeList.AddRange(new string[] { typeList.AddRange(new string[] {
...@@ -130,6 +130,11 @@ namespace UserFromControl ...@@ -130,6 +130,11 @@ namespace UserFromControl
numY.Text = targetValue.ToString(); numY.Text = targetValue.ToString();
ShowCurrPoint(); ShowCurrPoint();
} }
else
{
numY.Text = 1.ToString();
ShowCurrPoint();
}
} }
private void btnLeft_Click(object sender, EventArgs e) private void btnLeft_Click(object sender, EventArgs e)
...@@ -141,6 +146,11 @@ namespace UserFromControl ...@@ -141,6 +146,11 @@ namespace UserFromControl
numX.Text = targetValue.ToString(); numX.Text = targetValue.ToString();
ShowCurrPoint(); ShowCurrPoint();
} }
else
{
numX.Text = 1.ToString();
ShowCurrPoint();
}
} }
private void btnRight_Click(object sender, EventArgs e) private void btnRight_Click(object sender, EventArgs e)
...@@ -153,6 +163,11 @@ namespace UserFromControl ...@@ -153,6 +163,11 @@ namespace UserFromControl
numX.Text = targetValue .ToString(); numX.Text = targetValue .ToString();
ShowCurrPoint(); ShowCurrPoint();
} }
else
{
numX.Text = MaxX.ToString();
ShowCurrPoint();
}
} }
private void btnDown_Click(object sender, EventArgs e) private void btnDown_Click(object sender, EventArgs e)
...@@ -164,6 +179,11 @@ namespace UserFromControl ...@@ -164,6 +179,11 @@ namespace UserFromControl
numY.Text = targetValue .ToString(); numY.Text = targetValue .ToString();
ShowCurrPoint(); ShowCurrPoint();
} }
else
{
numY.Text = MaxY.ToString();
ShowCurrPoint();
}
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!