Commit e618cd30 LN

增加配置,表示状态灯区域地址。

1 个父辈 01df7a66
......@@ -30,5 +30,10 @@ namespace SmartShelf.Common
public static string DeviceLedType = "DeviceLedType";
public static string DefaultDeviceIP = "DefaultDeviceIP";
/// <summary>
/// 状态灯区域ID
/// </summary>
public static string StatusLedDmx = "StatusLedDmx";
}
}
......@@ -15,9 +15,7 @@ namespace SmartShelf.DeviceLibrary
public static int DeviceLedType = ConfigAppSettings.GetIntValue(Setting_Init.DeviceLedType);
public static string DefaultIP = ConfigAppSettings.GetValue(Setting_Init.DefaultDeviceIP);
public void Init()
{
}
public static LEDBaseModule GetLedModule(string ip)
{
LEDBaseModule led = null;
......@@ -32,12 +30,36 @@ namespace SmartShelf.DeviceLibrary
}
return led;
}
public static void LoadStatusDMX()
{
StatusLedDmx = new List<int>();
string str = ConfigAppSettings.GetValue(Setting_Init.StatusLedDmx);
if (String.IsNullOrEmpty(str))
{
str = "0";
ConfigAppSettings.SaveValue(Setting_Init.StatusLedDmx, str);
}
string[] array = str.Split(';');
foreach (string s in array)
{
try
{
int a = Convert.ToInt32(s);
StatusLedDmx.Add(a);
}
catch (Exception ex)
{
}
}
}
/// <summary>
/// 1=绿灯,2=黄灯
/// </summary>
public static int CurrLedStatus = -1;
private static int StatusLedDmx = 0;
private static List<int> StatusLedDmx = new List<int>();
/// <summary>
/// 打开状态灯
......@@ -49,17 +71,20 @@ namespace SmartShelf.DeviceLibrary
{
List<Light> sLed = new List<Light>();
foreach (int dmx in StatusLedDmx)
{
for (int index = 0; index < module.Max_Light; index++)
{
if ("green".Equals(color))
{
CurrLedStatus = 1;
sLed.Add(Light.GreenLight(StatusLedDmx, index));
sLed.Add(Light.GreenLight(dmx, index));
}
else if ("yellow".Equals(color))
{
CurrLedStatus = 2;
sLed.Add(Light.YellowLight(StatusLedDmx, index));
sLed.Add(Light.YellowLight(dmx, index));
}
}
}
module.LightOn(sLed.ToArray());
......@@ -76,7 +101,10 @@ namespace SmartShelf.DeviceLibrary
CurrLedStatus = 0;
foreach (LEDBaseModule module in deviceMap.Values)
{
module.AllLightOff(StatusLedDmx);
foreach (int dmx in StatusLedDmx)
{
module.AllLightOff(dmx);
}
}
}
}
......
......@@ -71,6 +71,7 @@ namespace SmartShelf.DeviceLibrary
{
return false;
}
LEDManager.LoadStatusDMX();
LEDManager.deviceMap = new Dictionary<string, LEDBaseModule>();
StatusColorMap = new Dictionary<string, string>();
foreach (BoxPosition box in PositionMap.Values)
......
......@@ -18,6 +18,8 @@
<add key="Store_CID" value="rc1272_1" />
<add key ="BoxCount" value ="1"/>
<add key ="DefaultDeviceIP" value ="192.168.201.191"/>
<!--状态灯地址,;分割-->
<add key ="StatusLedDmx" value ="0"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -33,6 +33,8 @@
this.btnSave = new System.Windows.Forms.Button();
this.btnBack = new System.Windows.Forms.Button();
this.txtIP = new System.Windows.Forms.TextBox();
this.txtStaDmxId = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
......@@ -50,7 +52,7 @@
this.btnSave.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(192, 115);
this.btnSave.Location = new System.Drawing.Point(192, 231);
this.btnSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(103, 36);
......@@ -64,7 +66,7 @@
this.btnBack.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(84, 115);
this.btnBack.Location = new System.Drawing.Point(84, 231);
this.btnBack.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(103, 36);
......@@ -83,11 +85,32 @@
this.txtIP.TabIndex = 276;
this.txtIP.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPwd_KeyDown);
//
// txtStaDmxId
//
this.txtStaDmxId.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtStaDmxId.Location = new System.Drawing.Point(84, 157);
this.txtStaDmxId.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtStaDmxId.Name = "txtStaDmxId";
this.txtStaDmxId.Size = new System.Drawing.Size(211, 29);
this.txtStaDmxId.TabIndex = 278;
//
// label2
//
this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(12, 123);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(356, 20);
this.label2.TabIndex = 277;
this.label2.Text = "状态灯区域地址(用;分隔):";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// FrmConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(380, 205);
this.ClientSize = new System.Drawing.Size(380, 308);
this.Controls.Add(this.txtStaDmxId);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtIP);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.btnBack);
......@@ -111,5 +134,7 @@
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.TextBox txtIP;
private System.Windows.Forms.TextBox txtStaDmxId;
private System.Windows.Forms.Label label2;
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ namespace SmartShelf
private void FrmPwd_Load(object sender, EventArgs e)
{
txtIP.Text = LEDManager.DefaultIP;
txtStaDmxId.Text = ConfigAppSettings.GetValue(Setting_Init.StatusLedDmx);
}
private void btnNext_Click(object sender, EventArgs e)
......@@ -31,6 +32,11 @@ namespace SmartShelf
ConfigAppSettings.SaveValue(Setting_Init.DefaultDeviceIP, ip);
LEDManager.DefaultIP = ip;
string dmxIds = txtStaDmxId.Text.Trim();
ConfigAppSettings.SaveValue(Setting_Init.StatusLedDmx, dmxIds);
LEDManager.LoadStatusDMX();
MessageBox.Show("保存成功,重启软件后生效");
this.Close();
}
......
......@@ -13,3 +13,10 @@ linePositions.csv文件里面:
20200601
增加与电脑连接的模块IP地址的配置。
库位中对应的IP转为站号使用
20200602
/rest/api/v1/shelf/allPosOff 增加 shelf参数 表示料架号
增加配置,表示状态灯区域地址。
<!--状态灯地址,;分割-->
<add key ="StatusLedDmx" value ="0"/>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!