Commit 30aca5c0 LN

调试修改

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