显示下料的接口

dep_nodyang
nodyang 1 year ago
parent a4cd1b8cf5
commit 656c118b10

@ -1,4 +1,6 @@
using Mesnac.Controls.ChemicalWeighing;
using DevExpress.Utils.MVVM;
using Mesnac.Controls.ChemicalWeighing;
using System;
using System.Collections.Generic;
@ -21,4 +23,20 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity
}
public class HslLanternSimpleEntity
{
public HslLanternSimple HslLanternSimple1 { get; set; }
public HslLanternSimple HslLanternSimple2 { get; set; }
public HslLanternSimple HslLanternSimple3 { get; set; }
public HslLanternSimple HslLanternSimple4 { get; set; }
public HslLanternSimple HslLanternSimple5 { get; set; }
public HslLanternSimple HslLanternSimple6 { get; set; }
public HslLanternSimple HslLanternSimple7 { get; set; }
public HslLanternSimple HslLanternSimple8 { get; set; }
}
}

@ -22,6 +22,7 @@ using Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity;
using Mesnac.Action.ChemicalWeighing.RgvPlc;
using System.Reflection;
using DataBlockHelper;
using System.Drawing;
namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
{
@ -60,7 +61,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
private MCLabel MCWatchDog;
HslLanternAlarmEntity hslAlarmEntity;
HslLanternSimpleEntity hslLanternSimpleEntity;
#endregion
@ -81,6 +82,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
//更细自定义控件报警灯
FillControlHslLanternAlarm();
FillHslLanternSimple();
MCWatchDog =Controls.FirstOrDefault(x => x.Name == "MCWatchDog") as MCLabel;
@ -210,6 +212,18 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm7, list[6].Error);
SetHslLanternAlarm(hslAlarmEntity.HslLanternAlarm8, list[7].Error);
var sim = Db3000Helper.ReadDb();
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple1, sim[0]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple2, sim[1]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple3, sim[2]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple4, sim[3]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple5, sim[4]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple6, sim[5]);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple7, false);
SetHslLanternSimple(hslLanternSimpleEntity.HslLanternSimple8, false);
@ -2409,6 +2423,22 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
}
public void SetHslLanternSimple(HslLanternSimple lanternSimple, bool su)
{
if (su == true)
{
lanternSimple.LanternBackground = Color.LimeGreen;
}
else
{
lanternSimple.LanternBackground = Color.Transparent;
}
}
//HslLanternSimpleEntity
private void FillControlHslLanternAlarm()
{
hslAlarmEntity = new HslLanternAlarmEntity();
@ -2423,6 +2453,20 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
}
private void FillHslLanternSimple()
{
hslLanternSimpleEntity=new HslLanternSimpleEntity();
var sourceType = hslLanternSimpleEntity.GetType();
PropertyInfo[] sourcePropertyInfoList = sourceType.GetProperties();
foreach (PropertyInfo sourceProperty in sourcePropertyInfoList)
{
string name = sourceProperty.Name;
var pro = Controls.FirstOrDefault(x => x.Name == name) as HslLanternSimple;
sourceProperty.SetValue(hslLanternSimpleEntity, pro);
}
}
#endregion
}

@ -176,6 +176,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PlugInPlatform\Mesnac.PlugIn.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel">
<HintPath>..\..\Microsoft.Office.Interop.Excel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />

@ -0,0 +1,37 @@
namespace Mesnac.Controls.ChemicalWeighing
{
partial class HslLanternSimple
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

@ -0,0 +1,273 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Controls.ChemicalWeighing
{
[Description("一个圆形的信号灯,支持设置颜色,是否渐变")]
public partial class HslLanternSimple : UserControl
{
public HslLanternSimple()
{
InitializeComponent();
base.AutoScaleMode = AutoScaleMode.None;
this.BackColor = Color.Transparent;
base.Name = "HslLanternSimple";
base.Size = new Size(78, 94);
base.ResumeLayout(false);
this.sf = new StringFormat();
this.sf.Alignment = StringAlignment.Center;
this.sf.LineAlignment = StringAlignment.Center;
base.SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
base.SetStyle(ControlStyles.ResizeRedraw, true);
base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
LanternBackground = Color.Transparent;
}
// Token: 0x040002C0 RID: 704
private Color colorBackground = Color.LimeGreen;
// Token: 0x040002C1 RID: 705
private Brush brushBackground = new SolidBrush(Color.LimeGreen);
// Token: 0x040002C2 RID: 706
private StringFormat sf = null;
// Token: 0x040002C3 RID: 707
private Color centerColor = Color.White;
// Token: 0x040002C4 RID: 708
private bool isUseGradientColor = false;
/// <summary>
/// 获取或设置控件的背景色
/// </summary>
// Token: 0x170001B1 RID: 433
// (get) Token: 0x0600057F RID: 1407 RVA: 0x000362BC File Offset: 0x000344BC
// (set) Token: 0x06000580 RID: 1408 RVA: 0x000362C4 File Offset: 0x000344C4
[Browsable(true)]
[Description("获取或设置控件的背景色")]
[Category("HslControls")]
[DefaultValue(typeof(Color), "Transparent")]
[EditorBrowsable(EditorBrowsableState.Always)]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
}
}
/// <summary>
/// 获取或设置灯信号的前景色
/// </summary>
// Token: 0x170001B2 RID: 434
// (get) Token: 0x06000581 RID: 1409 RVA: 0x000362D0 File Offset: 0x000344D0
// (set) Token: 0x06000582 RID: 1410 RVA: 0x000362E8 File Offset: 0x000344E8
[Browsable(true)]
[Description("获取或设置信号灯的背景色")]
[Category("HslControls")]
[DefaultValue(typeof(Color), "LimeGreen")]
public Color LanternBackground
{
get
{
return this.colorBackground;
}
set
{
this.colorBackground = value;
Brush brush = this.brushBackground;
if (brush != null)
{
brush.Dispose();
}
this.brushBackground = new SolidBrush(this.colorBackground);
base.Invalidate();
}
}
/// <summary>
/// 获取或设置中心点的颜色当且仅当UseGradientColor属性为True时生效
/// </summary>
// Token: 0x170001B3 RID: 435
// (get) Token: 0x06000583 RID: 1411 RVA: 0x0003631C File Offset: 0x0003451C
// (set) Token: 0x06000584 RID: 1412 RVA: 0x00036334 File Offset: 0x00034534
[Browsable(true)]
[Description("获取或设置中心点的颜色当且仅当UseGradientColor属性为True时生效")]
[Category("HslControls")]
[DefaultValue(typeof(Color), "White")]
public Color CenterBackground
{
get
{
return this.centerColor;
}
set
{
this.centerColor = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置当前的灯信号是否启用渐变色的画刷
/// </summary>
// Token: 0x170001B4 RID: 436
// (get) Token: 0x06000585 RID: 1413 RVA: 0x00036348 File Offset: 0x00034548
// (set) Token: 0x06000586 RID: 1414 RVA: 0x00036360 File Offset: 0x00034560
[Browsable(true)]
[Description("获取或设置当前的灯信号是否启用渐变色的画刷")]
[Category("HslControls")]
[DefaultValue(false)]
public bool UseGradientColor
{
get
{
return this.isUseGradientColor;
}
set
{
this.isUseGradientColor = value;
base.Invalidate();
}
}
/// <summary>
/// 获取或设置当前控件的文本
/// </summary>
// Token: 0x170001B5 RID: 437
// (get) Token: 0x06000587 RID: 1415 RVA: 0x00036374 File Offset: 0x00034574
// (set) Token: 0x06000588 RID: 1416 RVA: 0x0003638C File Offset: 0x0003458C
[Browsable(true)]
[Description("获取或设置当前控件的文本")]
[Category("HslControls")]
[EditorBrowsable(EditorBrowsableState.Always)]
[Bindable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
base.Invalidate();
}
}
/// <summary>
/// 触发一次鼠标点击的事件
/// </summary>
// Token: 0x06000589 RID: 1417 RVA: 0x0003639E File Offset: 0x0003459E
public void PerformClick()
{
this.OnClick(new EventArgs());
}
/// <inheritdoc />
// Token: 0x0600057D RID: 1405 RVA: 0x00035FA0 File Offset: 0x000341A0
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
this.PaintHslControls(e.Graphics, base.Width, base.Height);
base.OnPaint(e);
}
/// <inheritdoc cref="M:HslControls.HslArrow.PaintHslControls(System.Drawing.Graphics,System.Single,System.Single)" />
// Token: 0x0600057E RID: 1406 RVA: 0x00036004 File Offset: 0x00034204
public void PaintHslControls(Graphics g, int width, int height)
{
bool flag = false;
if (!flag)
{
int num = Math.Min(width, height);
num--;
Point point = new Point(num / 2, num / 2);
g.TranslateTransform((float)point.X, (float)point.Y);
float num2 = (float)(point.X * 17) / 20f;
float num3 = (float)point.X / 20f;
bool flag2 = num2 < 2f;
if (!flag2)
{
RectangleF rect = new RectangleF(-num2 - 2f * num3, -num2 - 2f * num3, 2f * num2 + 4f * num3, 2f * num2 + 4f * num3);
RectangleF rect2 = new RectangleF(-num2, -num2, 2f * num2, 2f * num2);
using (Pen pen = new Pen(this.colorBackground, num3))
{
g.DrawEllipse(pen, rect);
}
bool flag3 = !this.UseGradientColor;
if (flag3)
{
g.FillEllipse(this.brushBackground, rect2);
}
else
{
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddEllipse(-num2, -num2, 2f * num2, 2f * num2);
PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath);
pathGradientBrush.CenterPoint = new Point(0, 0);
pathGradientBrush.InterpolationColors = new ColorBlend
{
Positions = new float[]
{
0f,
1f
},
Colors = new Color[]
{
this.colorBackground,
this.centerColor
}
};
g.FillEllipse(pathGradientBrush, rect2);
using (Pen pen2 = new Pen(this.colorBackground))
{
g.DrawEllipse(pen2, -num2, -num2, 2f * num2, 2f * num2);
}
pathGradientBrush.Dispose();
graphicsPath.Dispose();
}
g.TranslateTransform((float)(-(float)point.X), (float)(-(float)point.Y));
bool flag4 = height - num > 0;
if (flag4)
{
bool flag5 = !string.IsNullOrEmpty(this.Text);
if (flag5)
{
using (Brush brush = new SolidBrush(this.ForeColor))
{
g.DrawString(this.Text, this.Font, brush, new Rectangle(0, num, num, height - num), this.sf);
}
}
}
}
}
}
}
}

@ -138,6 +138,12 @@
<Compile Include="HslLanternAlarm.Designer.cs">
<DependentUpon>HslLanternAlarm.cs</DependentUpon>
</Compile>
<Compile Include="HslLanternSimple.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="HslLanternSimple.Designer.cs">
<DependentUpon>HslLanternSimple.cs</DependentUpon>
</Compile>
<Compile Include="HslPipeLine.cs">
<SubType>UserControl</SubType>
</Compile>

@ -1637,6 +1637,21 @@
</DataBinding>
</Component>
<Component Name="HslLanternSimple" Namespace="Mesnac.Controls.ChemicalWeighing" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="位置" Group=""/>
<Property Name="Name" Caption="名称" Group=""/>
<Property Name="Size" Caption="大小" Group=""/>
<Property Name="Status" Caption="状态" Group=""/>
</Propertys>
<DataBinding>
</DataBinding>
</Component>
<Component Name="DailyTank" Namespace="Mesnac.Controls.ChemicalWeighing" Asm="Mesnac.Controls.ChemicalWeighing.dll">
<Propertys>
<Property Name="Location" Caption="λÖÃ" Group=""/>

@ -1,6 +1,46 @@
<Object type="Mesnac.Gui.Common.FrmRunTemplate, Mesnac.Gui.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MainDetail" children="Controls">
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple8" children="Controls">
<Property name="Location">1850, 470</Property>
<Property name="Name">HslLanternSimple8</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple7" children="Controls">
<Property name="Location">1676, 470</Property>
<Property name="Name">HslLanternSimple7</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple6" children="Controls">
<Property name="Location">1533, 470</Property>
<Property name="Name">HslLanternSimple6</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple5" children="Controls">
<Property name="Location">1365, 470</Property>
<Property name="Name">HslLanternSimple5</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple4" children="Controls">
<Property name="Location">1290, 470</Property>
<Property name="Name">HslLanternSimple4</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple3" children="Controls">
<Property name="Location">1118, 470</Property>
<Property name="Name">HslLanternSimple3</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple2" children="Controls">
<Property name="Location">990, 472</Property>
<Property name="Name">HslLanternSimple2</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.ChemicalWeighing.HslLanternSimple, Mesnac.Controls.ChemicalWeighing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="HslLanternSimple1" children="Controls">
<Property name="Location">815, 472</Property>
<Property name="Name">HslLanternSimple1</Property>
<Property name="Size">15, 17</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCLabel, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="ValueWeight4" children="Controls">
<Property name="Format" />
<Property name="TextName" />

@ -115,7 +115,7 @@
<ToolComponent chineseName="备料桶" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.BeiLiaoTong" />
<ToolComponent chineseName="自定义小车" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslTruck" />
<ToolComponent chineseName="HslLanternAlarm" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternAlarm" />
<ToolComponent chineseName="HslLanternSimple" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslLanternSimple" />
<!--<ToolComponent chineseName="管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLine" />-->
<ToolComponent chineseName="3管道" assembly="3" enabled="True" class="Mesnac.Controls.ChemicalWeighing.HslPipeLineThree" />

Loading…
Cancel
Save