Commit a83352f5 刘韬

汇川伺服稳定版本

1 个父辈 f1521d0c
正在显示 49 个修改的文件 包含 1479 行增加246 行删除
...@@ -50,23 +50,18 @@ ...@@ -50,23 +50,18 @@
<conversionPattern value="[%date][%t]%-5p %m%n"/> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs/aio/AIOBOX.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</logger> </logger>
<logger name="AIOBOX"> <logger name="HIK.IPCamera" additivity="false">
<level value="Info" /> <level value="All" />
<appender-ref ref="AIOBOX" /> <appender-ref ref="Camera" />
</logger>
<logger name="HCBOARD" additivity="false">
<level value="All" />
<appender-ref ref="Camera" />
</logger> </logger>
<root> <root>
<level value="Info"/> <level value="Info"/>
......
using DeviceLib; using log4net;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
......
...@@ -44,12 +44,10 @@ namespace OnlineStore.TinPasteStore ...@@ -44,12 +44,10 @@ namespace OnlineStore.TinPasteStore
} }
return str; return str;
} }
internal static string GetCodeNum(string codeName = "TinPasteStore") internal static string GetCodeNum(string codeName = "SO852-ACSingleStore")
{ {
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes(codeName); var xx = (System.Reflection.AssemblyProductAttribute)System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(System.Reflection.AssemblyProductAttribute), false)[0];
string result = ""; return xx.Product;
result = AcSerialBean.ByteToString(byteArray);
return result;
} }
public FrmBase() public FrmBase()
{ {
......
...@@ -56,8 +56,14 @@ ...@@ -56,8 +56,14 @@
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.btnWDis = new System.Windows.Forms.Button(); this.btnWDis = new System.Windows.Forms.Button();
this.btnWInit = new System.Windows.Forms.Button(); this.btnWInit = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnColdInit = new System.Windows.Forms.Button();
this.btnColddis = new System.Windows.Forms.Button();
this.btnColdState = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox7.SuspendLayout(); this.groupBox7.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox7 // groupBox7
...@@ -386,11 +392,66 @@ ...@@ -386,11 +392,66 @@
this.btnWInit.UseVisualStyleBackColor = true; this.btnWInit.UseVisualStyleBackColor = true;
this.btnWInit.Click += new System.EventHandler(this.btnWInit_Click); this.btnWInit.Click += new System.EventHandler(this.btnWInit_Click);
// //
// groupBox2
//
this.groupBox2.Controls.Add(this.textBox1);
this.groupBox2.Controls.Add(this.btnColdInit);
this.groupBox2.Controls.Add(this.btnColdState);
this.groupBox2.Controls.Add(this.btnColddis);
this.groupBox2.Location = new System.Drawing.Point(559, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(476, 201);
this.groupBox2.TabIndex = 275;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "制冷系统参数";
//
// btnColdInit
//
this.btnColdInit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnColdInit.Location = new System.Drawing.Point(24, 26);
this.btnColdInit.Name = "btnColdInit";
this.btnColdInit.Size = new System.Drawing.Size(106, 33);
this.btnColdInit.TabIndex = 88;
this.btnColdInit.Text = "初始化";
this.btnColdInit.UseVisualStyleBackColor = true;
this.btnColdInit.Click += new System.EventHandler(this.btnColdInit_Click);
//
// btnColddis
//
this.btnColddis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnColddis.Location = new System.Drawing.Point(24, 148);
this.btnColddis.Name = "btnColddis";
this.btnColddis.Size = new System.Drawing.Size(106, 33);
this.btnColddis.TabIndex = 89;
this.btnColddis.Text = "断开";
this.btnColddis.UseVisualStyleBackColor = true;
this.btnColddis.Click += new System.EventHandler(this.btnColddis_Click);
//
// btnColdState
//
this.btnColdState.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnColdState.Location = new System.Drawing.Point(24, 67);
this.btnColdState.Name = "btnColdState";
this.btnColdState.Size = new System.Drawing.Size(106, 33);
this.btnColdState.TabIndex = 262;
this.btnColdState.Text = "查询状态";
this.btnColdState.UseVisualStyleBackColor = true;
this.btnColdState.Click += new System.EventHandler(this.btnColdState_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(164, 26);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(250, 155);
this.textBox1.TabIndex = 263;
//
// FrmDeviceDebug // FrmDeviceDebug
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 490); this.ClientSize = new System.Drawing.Size(1180, 490);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox7); this.Controls.Add(this.groupBox7);
this.Name = "FrmDeviceDebug"; this.Name = "FrmDeviceDebug";
...@@ -400,6 +461,8 @@ ...@@ -400,6 +461,8 @@
this.groupBox7.PerformLayout(); this.groupBox7.PerformLayout();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -434,5 +497,10 @@ ...@@ -434,5 +497,10 @@
private System.Windows.Forms.TextBox txtW; private System.Windows.Forms.TextBox txtW;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button btnColdInit;
private System.Windows.Forms.Button btnColdState;
private System.Windows.Forms.Button btnColddis;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -44,11 +44,12 @@ namespace OnlineStore.TinPasteStore ...@@ -44,11 +44,12 @@ namespace OnlineStore.TinPasteStore
private void FrmDeviceDebug_Load(object sender, EventArgs e) private void FrmDeviceDebug_Load(object sender, EventArgs e)
{ {
cmbHum.Items.Clear(); cmbHum.Items.Clear();
cmbHum.Items.Add(StoreManager.Store.Config.Humiture_Colding_Port); //cmbHum.Items.Add(StoreManager.Store.Config.Humiture_Colding_Port);
cmbHum.Items.Add(StoreManager.Store.Config.Humiture_Warming_Port); cmbHum.Items.Add(StoreManager.Store.Config.Humiture_Warming_Port);
cmbHum.SelectedIndex = 0; cmbHum.SelectedIndex = 0;
lblTempInfo.Text = "冷藏区温湿度端口号:" + StoreManager.Store.Config.Humiture_Colding_Port + "\r\n回温区温湿度端口号:" + StoreManager.Store.Config.Humiture_Warming_Port; //lblTempInfo.Text = "冷藏区温湿度端口号:" + StoreManager.Store.Config.Humiture_Colding_Port + "\r\n回温区温湿度端口号:" + StoreManager.Store.Config.Humiture_Warming_Port;
lblTempInfo.Text = "回温区温湿度端口号:" + StoreManager.Store.Config.Humiture_Warming_Port;
cmbOKLE.Items.Clear(); cmbOKLE.Items.Clear();
cmbOKLE.Items.Add(StoreManager.Store.Config.Weight_Left_Port); cmbOKLE.Items.Add(StoreManager.Store.Config.Weight_Left_Port);
cmbOKLE.Items.Add(StoreManager.Store.Config.Weight_Right_Port); cmbOKLE.Items.Add(StoreManager.Store.Config.Weight_Right_Port);
...@@ -150,5 +151,31 @@ namespace OnlineStore.TinPasteStore ...@@ -150,5 +151,31 @@ namespace OnlineStore.TinPasteStore
{ {
} }
private void btnColdInit_Click(object sender, EventArgs e)
{
string port = StoreManager.Store.Config.Refrigerator_Port;
if (RefrigeratorController.IsRun(port))
{
RefrigeratorController.Release(port);
}
bool result = RefrigeratorController.Init(port);
if (!result)
{
MessageBox.Show("打开" + port + "失败");
}
}
private void btnColdState_Click(object sender, EventArgs e)
{
string port = StoreManager.Store.Config.Refrigerator_Port;
RefrigeratorController.queryData(port,out string state,out _, out _);
textBox1.Text = state;
}
private void btnColddis_Click(object sender, EventArgs e)
{
RefrigeratorController.Release();
}
} }
} }
...@@ -49,7 +49,7 @@ namespace OnlineStore.TinPasteStore ...@@ -49,7 +49,7 @@ namespace OnlineStore.TinPasteStore
this.tableLayoutPanel1.RowCount = boxBean.Config.StoreDIList.Count; this.tableLayoutPanel1.RowCount = boxBean.Config.StoreDIList.Count;
foreach (ConfigIO ioValue in boxBean.Config.StoreDIList.Values) foreach (ConfigIO ioValue in boxBean.Config.StoreDIList.Values)
{ {
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 28)); this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName); IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
control.Click += Control_Click; control.Click += Control_Click;
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex); this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
...@@ -62,7 +62,7 @@ namespace OnlineStore.TinPasteStore ...@@ -62,7 +62,7 @@ namespace OnlineStore.TinPasteStore
roleindex = 0; roleindex = 0;
foreach (ConfigIO ioValue in boxBean.Config.StoreDOList.Values) foreach (ConfigIO ioValue in boxBean.Config.StoreDOList.Values)
{ {
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28)); this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName); IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName);
control.Click += Control_Click; control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex); this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
...@@ -166,10 +166,6 @@ namespace OnlineStore.TinPasteStore ...@@ -166,10 +166,6 @@ namespace OnlineStore.TinPasteStore
} }
} }
private void btnReadIO_Click(object sender, EventArgs e)
{
ReadIOList();
}
private void ReadIOList() private void ReadIOList()
{ {
...@@ -214,21 +210,6 @@ namespace OnlineStore.TinPasteStore ...@@ -214,21 +210,6 @@ namespace OnlineStore.TinPasteStore
timer1.Start(); timer1.Start();
} }
private void btnOpenAxisBreak_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.HIGH);
}
private void btnCloseAxisBreak_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOpenLed_Click(object sender, EventArgs e) private void btnOpenLed_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
...@@ -264,16 +245,6 @@ namespace OnlineStore.TinPasteStore ...@@ -264,16 +245,6 @@ namespace OnlineStore.TinPasteStore
WriteDO(IO_VALUE.LOW); WriteDO(IO_VALUE.LOW);
} }
private void btn_Colding_Start_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Colding_Start, IO_VALUE.HIGH);
}
private void btn_Colding_Stop_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Colding_Start, IO_VALUE.LOW);
}
private void btn_Warming_Start_Click(object sender, EventArgs e) private void btn_Warming_Start_Click(object sender, EventArgs e)
{ {
...@@ -282,7 +253,6 @@ namespace OnlineStore.TinPasteStore ...@@ -282,7 +253,6 @@ namespace OnlineStore.TinPasteStore
private void btn_Warming_Stop_Click(object sender, EventArgs e) private void btn_Warming_Stop_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.Warming_Start, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Warming_Start, IO_VALUE.LOW);
} }
...@@ -293,7 +263,6 @@ namespace OnlineStore.TinPasteStore ...@@ -293,7 +263,6 @@ namespace OnlineStore.TinPasteStore
private void btn_Clamping_Relax_Click(object sender, EventArgs e) private void btn_Clamping_Relax_Click(object sender, EventArgs e)
{ {
StoreManager.Store.CylinderMove(null, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax); StoreManager.Store.CylinderMove(null, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
} }
...@@ -319,14 +288,22 @@ namespace OnlineStore.TinPasteStore ...@@ -319,14 +288,22 @@ namespace OnlineStore.TinPasteStore
private void btnULi_Click(object sender, EventArgs e) private void btnULi_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.HIGH);
} }
private void btnUNU_Click(object sender, EventArgs e) private void btnUNU_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.LOW);
} }
private void btn_openDeviceLed_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
}
private void btn_closeDeviceLed_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.LOW);
}
} }
} }
...@@ -17,7 +17,7 @@ using OnlineStore.DeviceLibrary; ...@@ -17,7 +17,7 @@ using OnlineStore.DeviceLibrary;
using System.IO.Ports; using System.IO.Ports;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using CodeLibrary; using CodeLibrary;
using DeviceLib; using System.Threading.Tasks;
namespace OnlineStore.TinPasteStore namespace OnlineStore.TinPasteStore
{ {
...@@ -64,13 +64,32 @@ namespace OnlineStore.TinPasteStore ...@@ -64,13 +64,32 @@ namespace OnlineStore.TinPasteStore
ShowPosition(ktkPosition); ShowPosition(ktkPosition);
timer1.Enabled = true; timer1.Enabled = true;
AddForm(" IO调试 ", new FrmIOStatus(store));
} }
#endregion #endregion
private void AddForm<T>(string text, T form) where T : Form
{
TabPage lineTabPage = new TabPage(text);
Panel linePan = new Panel();
linePan.Dock = DockStyle.Fill;
linePan.AutoScroll = true;
form.FormBorderStyle = FormBorderStyle.None;
form.TopLevel = false;
lineTabPage.Controls.Add(form);
//linePan.Controls.Add(form);
form.Dock = DockStyle.Fill;
linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.AutoScroll = true;
form.Show();
tabControl1.Controls.Add(lineTabPage);
}
private void start_button_Click(object sender, EventArgs e) private void start_button_Click(object sender, EventArgs e)
{ {
LogUtil.info(LOGGER, "界面点击启动");
store.StartRun(); store.StartRun();
if (store.runStatus >= StoreRunStatus.HomeMoving) if (store.runStatus >= StoreRunStatus.HomeMoving)
{ {
...@@ -108,7 +127,6 @@ namespace OnlineStore.TinPasteStore ...@@ -108,7 +127,6 @@ namespace OnlineStore.TinPasteStore
} }
private bool LoadOk = false; private bool LoadOk = false;
private void FrmTest_Load(object sender, EventArgs e) private void FrmTest_Load(object sender, EventArgs e)
{ {
...@@ -116,12 +134,14 @@ namespace OnlineStore.TinPasteStore ...@@ -116,12 +134,14 @@ namespace OnlineStore.TinPasteStore
cmbPosition.Items.Clear(); cmbPosition.Items.Clear();
LogUtil.logBox = this.richTextBox1; LogUtil.logBox = this.richTextBox1;
InitStoreValue(); InitStoreValue();
HIKCamera.camera_event += Camera_camera_event; ;
Task.Run(() => { HIKCamera.LoadCameraConfig(); });
this.ShowInTaskbar = true; this.ShowInTaskbar = true;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title); this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
notifyIcon1.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title); notifyIcon1.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
this.chbBuzzer.Checked = store.UseBuzzer; this.chbBuzzer.Checked = store.UseBuzzer;
axisMoveControl1.LoadData(store, store.moveAxisList.ToArray()); axisMoveControl1.LoadData(store);
FrmDeviceDebug frmd = new FrmDeviceDebug(); FrmDeviceDebug frmd = new FrmDeviceDebug();
AddForm(" 温湿度/称重 ", frmd); AddForm(" 温湿度/称重 ", frmd);
...@@ -132,6 +152,15 @@ namespace OnlineStore.TinPasteStore ...@@ -132,6 +152,15 @@ namespace OnlineStore.TinPasteStore
this.Opacity = 1; this.Opacity = 1;
} }
private void Camera_camera_event(object sender, Bitmap e)
{
this.Invoke((EventHandler<Bitmap>)delegate {
pictureBox1.Visible = true;
pictureBox1.Image = e;
}, sender, e);
}
private void AddForm(string text, Form form) private void AddForm(string text, Form form)
{ {
text = text.PadLeft(10, ' '); text = text.PadLeft(10, ' ');
...@@ -207,11 +236,12 @@ namespace OnlineStore.TinPasteStore ...@@ -207,11 +236,12 @@ namespace OnlineStore.TinPasteStore
} }
if (store.Config.IsHasDoorLimit.Equals(1)) if (store.Config.IsHasDoorLimit.Equals(1))
{ {
if (IOManager.IOValue(IO_Type.Door_Limit).Equals(IO_VALUE.LOW)) //if (IOManager.IOValue(IO_Type.Door_Limit).Equals(IO_VALUE.LOW))
{ //{
lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关"; // lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关";
} //}
else if (store.Config.StoreDIList.ContainsKey(IO_Type.Door_LeftLimit) && IOManager.IOValue(IO_Type.Door_LeftLimit).Equals(IO_VALUE.LOW)) //else
if (store.Config.StoreDIList.ContainsKey(IO_Type.Door_LeftLimit) && IOManager.IOValue(IO_Type.Door_LeftLimit).Equals(IO_VALUE.LOW))
{ {
lblWarnMsg.Text = lblWarnMsg.Text + " 左侧门未关"; lblWarnMsg.Text = lblWarnMsg.Text + " 左侧门未关";
} }
...@@ -220,6 +250,11 @@ namespace OnlineStore.TinPasteStore ...@@ -220,6 +250,11 @@ namespace OnlineStore.TinPasteStore
lblWarnMsg.Text = lblWarnMsg.Text + " 右侧门未关"; lblWarnMsg.Text = lblWarnMsg.Text + " 右侧门未关";
} }
} }
if (IOManager.IOValue(IO_Type.Refrigeration_failure).Equals(IO_VALUE.HIGH))
{
lblWarnMsg.Text = lblWarnMsg.Text + " 冷气机故障,请检查";
}
//如果不在出入库中,且叉子上有信号,需要提示检查叉子 //如果不在出入库中,且叉子上有信号,需要提示检查叉子
if (store.runStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TinCheck_Clamping).Equals(IO_VALUE.HIGH)) if (store.runStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TinCheck_Clamping).Equals(IO_VALUE.HIGH))
{ {
...@@ -547,7 +582,7 @@ namespace OnlineStore.TinPasteStore ...@@ -547,7 +582,7 @@ namespace OnlineStore.TinPasteStore
} }
int targetPosition = FormUtil.GetIntValue(txt); int targetPosition = FormUtil.GetIntValue(txt);
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 5, targetSpeed * 5);
} }
...@@ -955,7 +990,7 @@ namespace OnlineStore.TinPasteStore ...@@ -955,7 +990,7 @@ namespace OnlineStore.TinPasteStore
private void btnUpdown_Click(object sender, EventArgs e) private void btnUpdown_Click(object sender, EventArgs e)
{ {
string PortName = store.Config.UpDown_Axis.DeviceName; string PortName = store.Config.UpDown_Axis.DeviceName;
int slvAddr = store.Config.UpDown_Axis.GetAxisValue(); short slvAddr = store.Config.UpDown_Axis.GetAxisValue();
string ioIP = "192.168.200.13"; string ioIP = "192.168.200.13";
int ioIndex = 0; int ioIndex = 0;
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal)) // if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
...@@ -1017,6 +1052,7 @@ namespace OnlineStore.TinPasteStore ...@@ -1017,6 +1052,7 @@ namespace OnlineStore.TinPasteStore
{ {
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
CodeLibrary.FrmCodeDecode frm = new FrmCodeDecode(); CodeLibrary.FrmCodeDecode frm = new FrmCodeDecode();
frm.chbZxing.Checked = false;
frm.ShowDialog(); frm.ShowDialog();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
} }
...@@ -1192,5 +1228,24 @@ namespace OnlineStore.TinPasteStore ...@@ -1192,5 +1228,24 @@ namespace OnlineStore.TinPasteStore
IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.LOW); IOManager.IOMove(IO_Type.Door_Limit, IO_VALUE.LOW);
} }
private void pictureBox1_DoubleClick(object sender, EventArgs e)
{
var obj = sender as PictureBox;
if (obj.Dock == DockStyle.Fill)
obj.Dock = DockStyle.None;
else
{
obj.BringToFront();
obj.Dock = DockStyle.Fill;
}
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
var obj = sender as PictureBox;
if (obj.Dock == DockStyle.Fill)
obj.Dock = DockStyle.None;
}
} }
} }
...@@ -93,6 +93,7 @@ namespace OnlineStore.TinPasteStore ...@@ -93,6 +93,7 @@ namespace OnlineStore.TinPasteStore
} }
if (!isShow) if (!isShow)
{ {
Environment.CurrentDirectory = Application.StartupPath;
log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID); log4net.GlobalContext.Properties["fname"] = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
log4net.Config.XmlConfigurator.Configure(); log4net.Config.XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
......
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下 // 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改 // 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("ACSingleStore")] [assembly: AssemblyTitle("ACSingleStore")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ACSingleStore")] [assembly: AssemblyProduct("master f1521d0c004f66eddbc784fc7a3a3f3a6c658297")]
[assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyCopyright("Copyright ? 2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型 // 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。 // 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1b0a0559-e045-4edb-9dac-740eb0d8bb52")] [assembly: Guid("1b0a0559-e045-4edb-9dac-740eb0d8bb52")]
// 程序集的版本信息由下面四个值组成: // 程序集的版本信息由下面四个值组成:
// //
// 主版本 // 主版本
// 次版本 // 次版本
// 生成号 // 生成号
// 修订号 // 修订号
// //
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
...@@ -52,18 +52,24 @@ ...@@ -52,18 +52,24 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>box.ico</ApplicationIcon> <ApplicationIcon>box.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary, Version=1.0.7499.24663, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath> <SpecificVersion>False</SpecificVersion>
</Reference> <HintPath>..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
<Reference Include="DeviceLib">
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath> <HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net"> <Reference Include="HuichuanLibrary, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\log4net.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -76,7 +82,6 @@ ...@@ -76,7 +82,6 @@
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="TinPasteStore, Version=1.0.7417.20542, Culture=neutral, PublicKeyToken=null" />
<Reference Include="UserFromControl, Version=1.0.7388.25333, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="UserFromControl, Version=1.0.7388.25333, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\UserFromControl.dll</HintPath> <HintPath>..\..\dll\UserFromControl.dll</HintPath>
...@@ -141,6 +146,12 @@ ...@@ -141,6 +146,12 @@
<Compile Include="useControl\AxisMoveControl.Designer.cs"> <Compile Include="useControl\AxisMoveControl.Designer.cs">
<DependentUpon>AxisMoveControl.cs</DependentUpon> <DependentUpon>AxisMoveControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="useControl\AxisMoveControl1.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="useControl\AxisMoveControl1.Designer.cs">
<DependentUpon>AxisMoveControl1.cs</DependentUpon>
</Compile>
<Compile Include="useControl\AxisJogControl.cs"> <Compile Include="useControl\AxisJogControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -184,9 +195,13 @@ ...@@ -184,9 +195,13 @@
<EmbeddedResource Include="useControl\AxisMoveControl.resx"> <EmbeddedResource Include="useControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon> <DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="useControl\AxisMoveControl1.resx">
<DependentUpon>AxisMoveControl1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="useControl\AxisJogControl.resx"> <EmbeddedResource Include="useControl\AxisJogControl.resx">
<DependentUpon>AxisJogControl.cs</DependentUpon> <DependentUpon>AxisJogControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<None Include="app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
...@@ -249,6 +264,9 @@ ...@@ -249,6 +264,9 @@
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>powershell.exe -command "$ci=(git rev-parse HEAD);$bi=git rev-parse --abbrev-ref HEAD ;$ti=Get-Content ..\..\Properties\AssemblyInfo.cs ; Foreach-Object {$ti -replace 'AssemblyProduct.*',\"AssemblyProduct(\"\"$bi $ci\"\")]\"} | Set-Content ..\..\Properties\AssemblyInfo.cs"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
 using OnlineStore.Common;
using DeviceLib;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -22,12 +20,11 @@ namespace OnlineStore.TinPasteStore ...@@ -22,12 +20,11 @@ namespace OnlineStore.TinPasteStore
{ {
private string LogName = ResourceCulture.GetString("升降轴位置调试:"); private string LogName = ResourceCulture.GetString("升降轴位置调试:");
private string PortName = ""; private string PortName = "";
private int SlvAddr = 0; private short SlvAddr = 0;
private string IoIp = ""; private string IoIp = "";
private int IoIndex = 0; private int IoIndex = 0;
public string Axis_Brake = IO_Type.Axis_Brake;
private System.Timers.Timer toolTimer = new System.Timers.Timer(); private System.Timers.Timer toolTimer = new System.Timers.Timer();
public FrmPositionTool(string protName, int slvAddr,string ioIp, int ioIndex) public FrmPositionTool(string protName, short slvAddr,string ioIp, int ioIndex)
{ {
InitializeComponent(); InitializeComponent();
this.PortName = protName; this.PortName = protName;
...@@ -95,9 +92,8 @@ namespace OnlineStore.TinPasteStore ...@@ -95,9 +92,8 @@ namespace OnlineStore.TinPasteStore
private void btnServoOn_Click(object sender, EventArgs e) private void btnServoOn_Click(object sender, EventArgs e)
{ {
this.PortName = txtPortName.Text; this.PortName = txtPortName.Text;
this.SlvAddr = FormUtil.GetIntValue(txtAddr); this.SlvAddr = FormUtil.GetShortValue(txtAddr);
int bro = ConfigAppSettings.GetIntValue(Setting_Init.ACBaudRate); bool result = ACServerManager.OpenPort(PortName);
bool result = ACServerManager.OpenPort(PortName,bro);
if (!result) if (!result)
{ {
MessageBox.Show(ResourceCulture.GetString("打开串口失败")); MessageBox.Show(ResourceCulture.GetString("打开串口失败"));
...@@ -110,13 +106,6 @@ namespace OnlineStore.TinPasteStore ...@@ -110,13 +106,6 @@ namespace OnlineStore.TinPasteStore
ACServerManager.AlarmClear(PortName, SlvAddr); ACServerManager.AlarmClear(PortName, SlvAddr);
ACServerManager.ServoOn(PortName, SlvAddr); ACServerManager.ServoOn(PortName, SlvAddr);
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.HIGH);
}catch(Exception ex)
{
}
} }
...@@ -126,14 +115,6 @@ namespace OnlineStore.TinPasteStore ...@@ -126,14 +115,6 @@ namespace OnlineStore.TinPasteStore
// toolTimer.Stop(); // toolTimer.Stop();
ACServerManager.SuddenStop(PortName, SlvAddr); ACServerManager.SuddenStop(PortName, SlvAddr);
Thread.Sleep(100); Thread.Sleep(100);
try
{
IOManager.IOMove(Axis_Brake, IO_VALUE.LOW);
}
catch (Exception ex)
{
}
ACServerManager.ServoOff(PortName, SlvAddr); ACServerManager.ServoOff(PortName, SlvAddr);
formStatus(false); formStatus(false);
} }
...@@ -163,12 +144,12 @@ namespace OnlineStore.TinPasteStore ...@@ -163,12 +144,12 @@ namespace OnlineStore.TinPasteStore
{ {
int speed = Convert.ToInt32(txtSpeed.Text); int speed = Convert.ToInt32(txtSpeed.Text);
int position = Convert.ToInt32(txtPosition.Text); int position = Convert.ToInt32(txtPosition.Text);
ACServerManager.RelMove(PortName, SlvAddr, position,speed); ACServerManager.RelMove(PortName, SlvAddr, position,speed, speed / 10, speed * 5);
} }
private void btnHomeMove_Click(object sender, EventArgs e) private void btnHomeMove_Click(object sender, EventArgs e)
{ {
int speed = Convert.ToInt32(txtSpeed.Text); int speed = Convert.ToInt32(txtSpeed.Text);
ACServerManager.HomeMove(PortName, SlvAddr, speed); ACServerManager.HomeMove(PortName, SlvAddr, speed, speed / 10, speed * 5);
} }
private void btnSpeedMove_Click(object sender, EventArgs e) private void btnSpeedMove_Click(object sender, EventArgs e)
{ {
...@@ -226,7 +207,7 @@ namespace OnlineStore.TinPasteStore ...@@ -226,7 +207,7 @@ namespace OnlineStore.TinPasteStore
PositionList = new List<int>(); PositionList = new List<int>();
LogUtil.info(LogName + "伺服开始运动,速度【" + speed + "】位置【" + position + "】启动定时器 "); LogUtil.info(LogName + "伺服开始运动,速度【" + speed + "】位置【" + position + "】启动定时器 ");
formMoveStatus(false); formMoveStatus(false);
ACServerManager.AbsMove(PortName, SlvAddr, position, speed); ACServerManager.AbsMove(PortName, SlvAddr, position, speed, speed * 5, speed * 5);
toolTimer.Start(); toolTimer.Start();
} }
private int P3Offset = 0; private int P3Offset = 0;
......
...@@ -4,7 +4,6 @@ using System.Windows.Forms; ...@@ -4,7 +4,6 @@ using System.Windows.Forms;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using DeviceLib;
namespace OnlineStore.TinPasteStore.useControl namespace OnlineStore.TinPasteStore.useControl
{ {
......
...@@ -117,4 +117,7 @@ ...@@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace> <RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName> <AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
......
...@@ -5,7 +5,8 @@ using System.Text; ...@@ -5,7 +5,8 @@ using System.Text;
using log4net; using log4net;
using System.Reflection; using System.Reflection;
using System.Drawing; using System.Drawing;
using System.Diagnostics;
using System.IO;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
...@@ -30,8 +31,22 @@ namespace OnlineStore.Common ...@@ -30,8 +31,22 @@ namespace OnlineStore.Common
{ {
return; return;
} }
StackTrace st = new StackTrace(true);
StackFrame sf;
int fc = st.FrameCount;
int i = 1;
while (true)
{
sf = st.GetFrame(i);
if (sf.GetMethod().DeclaringType.Name != "LogUtil" || i>= fc) {
break;
}
i++;
}
string filename = Path.GetFileName(sf.GetFileName());
int codeline = sf.GetFileLineNumber();
log.Info( msg); log.Info($"[{filename}:{codeline}] {msg}");
if (logBox == null) if (logBox == null)
{ {
return; return;
...@@ -171,6 +186,8 @@ namespace OnlineStore.Common ...@@ -171,6 +186,8 @@ namespace OnlineStore.Common
public static void info(string msg) public static void info(string msg)
{ {
info(LOGGER,msg ); info(LOGGER,msg );
} }
......
...@@ -36,21 +36,25 @@ ...@@ -36,21 +36,25 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\..\camera\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference> </Reference>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary, Version=1.0.7499.24663, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath> <SpecificVersion>False</SpecificVersion>
</Reference> <HintPath>..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
<Reference Include="DeviceLib">
<HintPath>..\..\dll\DeviceLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\..\..\HC_TinPasteStore\dll\halcondotnet.dll</HintPath> <HintPath>..\..\..\HC_TinPasteStore\dll\halcondotnet.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="HuichuanLibrary">
<HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\HuichuanLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -70,11 +74,16 @@ ...@@ -70,11 +74,16 @@
<Compile Include="acTinStore\TinStoreBean_Partial.cs" /> <Compile Include="acTinStore\TinStoreBean_Partial.cs" />
<Compile Include="acTinStore\TinStoreBean_InOut.cs" /> <Compile Include="acTinStore\TinStoreBean_InOut.cs" />
<Compile Include="acTinStore\StoreManager.cs" /> <Compile Include="acTinStore\StoreManager.cs" />
<Compile Include="device\HC\ACServerManager.cs" />
<Compile Include="device\HC\ACServerManager_Partial.cs" />
<Compile Include="device\halcon\CodeManager.cs" /> <Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="device\HC\HCAxisManager.cs" />
<Compile Include="device\IO\HCIOManager.cs" />
<Compile Include="device\IO\IOManager.cs" /> <Compile Include="device\IO\IOManager.cs" />
<Compile Include="device\RefrigeratorController.cs" />
<Compile Include="device\weights\OKLE.cs" /> <Compile Include="device\weights\OKLE.cs" />
<Compile Include="device\weights\OKLEController.cs" /> <Compile Include="device\weights\OKLEController.cs" />
<Compile Include="store\Camera.cs" />
<Compile Include="store\StoreMoveP.cs" /> <Compile Include="store\StoreMoveP.cs" />
<Compile Include="store\StoreAlarm.cs"> <Compile Include="store\StoreAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
...@@ -109,9 +118,15 @@ ...@@ -109,9 +118,15 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="StoreConfig\Camera.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\linePositions.csv"> <None Include="StoreConfig\linePositions.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="StoreConfig\StoreConfig - 复制.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\StoreConfig.csv"> <None Include="StoreConfig\StoreConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
......
{
"HIKIPCamera": [
{
"Name": "monitor",
"IP": "192.168.1.64",
"User": "admin",
"Password": "acc123456",
"Port": 8000
}
]
}
\ No newline at end of file \ No newline at end of file
...@@ -87,6 +87,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -87,6 +87,10 @@ namespace OnlineStore.DeviceLibrary
Store = new TinStoreBean(Config); Store = new TinStoreBean(Config);
Store.CID = CID; Store.CID = CID;
LogUtil.info("加载料仓完成!"); LogUtil.info("加载料仓完成!");
//InOutParam inOutParam = new InOutParam(MoveType.InStore, "");
//inOutParam.Weight = 460;
//inOutParam.UpdateFama();
return Store; return Store;
} }
} }
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 外部调用的接口放在此文件中
/// </summary>
public partial class ACServerManager
{
public static bool IsShowMsg = false ;
static HCAxisManager HCAxis = new HCAxisManager();
public static bool OpenPort(string portName)
{
return true;
}
public static void ColsePort(string portName)
{
}
public static void CloseAllPort()
{
}
/// <summary>
/// 是否成功打开伺服
/// </summary>
public static bool ServerOnStatus(string portName, short slvAddr)
{
return HCAxis.IsServeoOn(portName, slvAddr);
}
/// <summary>
/// 是否原点返回完成
/// </summary>
public static bool IsHomeMoveEnd(string portName, short slvAddr)
{
return HCAxis.IsHomeMoveEnd(portName, slvAddr);
}
public static void InitSlvAddr(string portName, int slvAddr)
{
}
public static void InitSlvAddr(string portName, int slvAddr,int targetSpeed,int addSpeed,int delSpeed )
{
}
public static void ServoOn(string portName, short slvAddr)
{
HCAxis.ServoOn(portName, slvAddr);
}
public static void ServoOff(string portName, short slvAddr)
{
HCAxis.ServoOff(portName, slvAddr);
}
public static void RelMove(string portName, short slvAddr, int targetPosition, int targetSpeed, int ptpAcc, int ptpDec)
{
HCAxis.RelMove(portName, slvAddr, targetPosition, targetSpeed, ptpAcc, ptpDec);
}
public static void HomeMove(string portName, short slvAddr, int highVel,int lowVel,int acc)
{
try
{
//先判断是否在原点,如果已经在原点,先向正方向走2000
int homeSingle = GetHomeSingle(portName, slvAddr);
if (homeSingle.Equals(1))
{
int isHomeEnd = GetHomeEndStatus(portName, slvAddr);
if (isHomeEnd.Equals(1))
{
int value = 2000;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】原点返回时发现原点已亮且回过原点,需要先相对走" + value);
HCAxis.RelMove(portName, slvAddr, value, highVel, acc, acc);
bool isStop = false;
for (int i = 0; i <= 10; i++)
{
Thread.Sleep(200);
if (GetBusyStatus(portName, slvAddr).Equals(0))
{
isStop = true;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】 相对走" + value + "已结束");
break;
}
}
if (!isStop)
{
LogUtil.info("轴【" + portName + "_" + slvAddr + "】 相对走" + value + "已等待2分钟,直接停止");
SuddenStop(portName, slvAddr);
}
}
else
{
int volSpeed = Math.Abs(acc / 5);
int time = 1500;
LogUtil.info("轴【" + portName + "_" + slvAddr + "】原点返回时发现原点已亮但未回过原点,先匀速向上走" + time + ",速度[" + volSpeed + "]");
//需要匀速向上走
ACServerManager.SpeedMove(portName, slvAddr, volSpeed);
Thread.Sleep(time);
LogUtil.info("轴【" + portName + "_" + slvAddr + "】匀速 已等待" + time + ",直接停止");
SuddenStop(portName, slvAddr);
Thread.Sleep(100);
}
}
}
catch (Exception ex)
{
LogUtil.error("轴【" + portName + "_" + slvAddr + "】原点返回前验证是否在原点出错:" + ex.StackTrace);
}
HCAxis.HomeMove(portName, slvAddr, highVel, lowVel, acc);
}
public static void SpeedMove(string portName, short slvAddr, int speed)
{
HCAxis.SpeedMove(portName, slvAddr, speed);
}
public static bool isInPosition(ConfigMoveAxis Axis, int PPosition)
{
int outCount = ACServerManager.GetActualtPosition(Axis.DeviceName, Axis.GetAxisValue());
int errorCount = Math.Abs(outCount - PPosition);
if (errorCount <= Axis.CanErrorCountMin)
{
return true;
}
else
{
return false;
}
}
public static void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed, int ptpAcc, int ptpDec)
{
//绝对运动
HCAxis.AbsMove(portName, slvAddr, targetPosition, targetSpeed, ptpAcc, ptpDec);
}
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
partial class ACServerManager
{
public static void SuddenStop(ConfigMoveAxis axis)
{
if (GetBusyStatus(axis.DeviceName, axis.GetAxisValue()).Equals(1))
{
SuddenStop(axis.DeviceName, axis.GetAxisValue());
}
}
public static void SuddenStop(string portName, short slvAddr)
{
HCAxis.SuddenStop(portName, slvAddr);
}
public static void AlarmClear(string portName, short slvAddr)
{
HCAxis.AlarmClear(portName, slvAddr);
}
public static int GetTargetPosition(string portName, short slvAddr)
{
return HCAxis.GetTargetPosition(portName, slvAddr);
}
public static int GetActualtPosition(string portName, short slvAddr)
{
return HCAxis.GetActualtPosition(portName, slvAddr);
}
public static int GetAlarmStatus(string portName, short slvAddr)
{
return HCAxis.GetAlarmStatus(portName, slvAddr);
}
public static int GetBusyStatus(string portName, short slvAddr)
{
return HCAxis.GetBusyStatus(portName, slvAddr);
}
public static int GetHomeEndStatus(string portName, short slvAddr)
{
return HCAxis.GetHomeEndStatus(portName, slvAddr);
}
public static int GetHomeSingle(string portName, short slvAddr)
{
return HCAxis.GetHomeSingle(portName, slvAddr);
}
/// <summary>
/// 负极限
/// </summary>
public static int GetLimitNegativeSingle(string portName, short slvAddr)
{
return HCAxis.GetLimitNegativeSingle(portName, slvAddr);
}
/// <summary>
/// 正极限
/// </summary>
public static int GetLimitPositiveSingle(string portName, short slvAddr)
{
return HCAxis.GetLimitPositiveSingle(portName, slvAddr);
}
}
}
using HuichuanLibrary;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class HCAxisManager
{
public bool OpenCard()
{
return HCBoardManager.OpenCard();
}
public bool CloseCard()
{
return HCBoardManager.CloseCard();
}
public void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed, int ptpAcc, int ptpDec)
{
HCLogUtil.LOGGER.Info($"slvAddr={slvAddr},targetPosition={targetPosition},targetSpeed={targetSpeed},ptpAcc={ptpAcc},ptpDec={ptpDec}");
HCBoardManager.AbsMove((short)slvAddr, targetPosition, targetSpeed, ptpAcc, ptpDec);
}
public void AlarmClear(string portName, short slvAddr)
{
HCBoardManager.ClearAxisSts((short)slvAddr);
}
public bool OpenPort(string portName)
{
return true;
}
public void ClearSpeed()
{
}
public void CloseAllPort()
{
}
public void ColsePort(string portName)
{
}
public void InitSlvAddr(string portName, short slvAddr, int targetSpeed, int addSpeed, int delSpeed)
{
}
public int GetActualtPosition(string portName, short slvAddr)
{
return (int)HCBoardManager.GetAxisCurrPos(slvAddr);
}
public int GetAlarmStatus(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ALM;
}
public int GetBusyStatus(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.BUSY;
}
public int GetHomeEndStatus(string portName, short slvAddr)
{
return (int)HCBoardManager.GetHomeStatus(slvAddr);
}
public int GetHomeSingle(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ALM;
}
public int GetLimitNegativeSingle(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.NEL;
}
public int GetLimitPositiveSingle(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.PEL;
}
public int GetTargetPosition(string portName, short slvAddr)
{
return (int)HCBoardManager.GetAxisPrfPos(slvAddr);
}
public void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{
HCBoardManager.StartHomeMove(slvAddr, (uint)highVel, (uint)lowVel, (uint)acc);
}
public bool IsHomeMoveEnd(string portName, short slvAddr)
{
return HCBoardManager.HomeingIsEnd(slvAddr);
}
public bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount, bool isLog = false)
{
return HCBoardManager.IsInPosition(slvAddr, PPosition, canErrorCount);
}
public void RelMove(string portName, short slvAddr, int position, int targetSpeed, int ptpAcc, int ptpDec)
{
HCBoardManager.RelMove(slvAddr, position, targetSpeed, ptpAcc, ptpDec);
}
public bool IsServeoOn(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ServoOn.Equals(1);
}
public void ServoOff(string portName, short slvAddr)
{
HCBoardManager.ServoOff(slvAddr);
}
public void ServoOn(string portName, short slvAddr)
{
HCBoardManager.ServoOn(slvAddr);
}
public void SpeedMove(string portName, short slvAddr, int speed)
{
HCBoardManager.SpeedMove(slvAddr, speed);
}
public void SuddenStop(string portName, short slvAddr)
{
HCBoardManager.AxisStop(slvAddr);
}
public bool AbsMoveIsEnd(string portName, short axisNo, int targetPosition, int canErrorCount, out bool countError)
{
countError = false;
bool isOk = HCBoardManager.MoveIsEnd(axisNo);
if (isOk)
{
if (HCBoardManager.IsInPosition(axisNo, targetPosition, canErrorCount))
{
return true;
}
else
{
countError = true;
}
}
return false;
}
public short GetErrorCode(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
HCLogUtil.LOGGER.Info(axisS.ToStr());
return HCBoardManager.GetAxErrCode(slvAddr);
}
}
}
using HuichuanLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public class HCIOManager
{
public void CloseAllConnection()
{
HCBoardManager.CloseCard();
}
public void CloseAllDO()
{
HCBoardManager.CloseAllDO();
}
public bool ConnectionIOList(List<string> dIODeviceNameList)
{
if (!HCBoardManager.CardInitOk())
{
HCBoardManager.InitConfig("", "", "HCBOARD");
if (!HCBoardManager.OpenCard())
{
LogUtil.info("板卡第一次打开失败,关闭后重新打开");
HCBoardManager.CloseCard();
Thread.Sleep(2000);
return HCBoardManager.OpenCard();
}
}
return true;
}
public IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort index)
{
short v = HCBoardManager.GetBitDI((short)index);
return (IO_VALUE)v;
}
public IO_VALUE GetDOValue(string deviceName, byte slaveID, ushort index)
{
short v = HCBoardManager.GetBitDO((short)index);
return (IO_VALUE)v;
}
public IO_VALUE GetIOValue(ConfigIO configIO)
{
short index =(short) configIO.GetIOAddr();
if (configIO.ProType=="DI")
return (IO_VALUE)HCBoardManager.GetBitDI(index);
else
return (IO_VALUE)HCBoardManager.GetBitDO(index);
}
public void ReadAllDI(string deviceName, byte slaveId)
{
}
public void ReadAllDO(string deviceName, byte slaveId)
{
}
public short GetAdVal(short index)
{
short v = HCBoardManager.GetAdVal(index);
return v;
}
public void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value, int time)
{
try
{
short v = (short)value;
HCBoardManager.SetBitDO((short)index, v);
short targetV = 0;
if (v.Equals((short)0))
{
targetV = 1;
}
//写入之后,等待指定间隔后回写
System.Timers.Timer mytimer = new System.Timers.Timer(time);
mytimer.Elapsed += (o1, e1) =>
{
try
{
HCBoardManager.SetBitDO((short)index, targetV);
}
catch (Exception ex)
{
LogUtil.error("**********定时回写入 出错:" + ex.StackTrace);
}
};
mytimer.AutoReset = false;
mytimer.Enabled = true;
}
catch (Exception ex)
{
LogUtil.error("AIO WriteSingleDO [" + index + "] 出错:" + ex.ToString());
}
}
public void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value)
{
short v = (short)value;
HCBoardManager.SetBitDO((short)index, v);
}
}
}
...@@ -10,7 +10,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -10,7 +10,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public abstract class IOManager public abstract class IOManager
{ {
public static IOManager instance = null; public static HCIOManager instance = null;
public abstract void ConnectionIOList(List<string> dIODeviceNameList); public abstract void ConnectionIOList(List<string> dIODeviceNameList);
...@@ -68,7 +68,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -68,7 +68,7 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
public static void Init() public static void Init()
{ {
instance = new AIOBOXManager(); instance = new HCIOManager();
} }
public abstract void ReadAllDI(string deviceName, byte slaveId); public abstract void ReadAllDI(string deviceName, byte slaveId);
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore
{
public class RefrigeratorController
{
private static int bautRate = 9600;//波特率
private static Parity parity = Parity.None;//校验位
private static int dataBits = 8;//数据位
private static StopBits stopBits = StopBits.One; //停止位
private static Dictionary<string, AcSerialBean> SerialMap = new Dictionary<string, AcSerialBean>();
private static string LogName = "";
private static AcSerialBean GetSerialBean(string port)
{
if (SerialMap.ContainsKey(port))
{
return SerialMap[port];
}
return null;
}
public static void OpenAll(string[] ports)
{
foreach (string port in ports)
{
Init(port);
}
}
public static bool Init(string port)
{
if (SerialMap.ContainsKey(port))
{
return true;
}
LogName = "制冷机[" + port + "]";
AcSerialBean sb = new AcSerialBean(port, bautRate, parity, dataBits, stopBits);
try
{
if (sb.openPort())
{
if (SerialMap.ContainsKey(port))
{
SerialMap.Remove(port);
}
SerialMap.Add(port, sb);
return true;
}
else
{
LogUtil.error(LogName + "串口打开失败!");
return false;
}
}
catch (Exception ex)
{
LogUtil.error(LogName + " 打开串口出错:" + ex.ToString());
}
return true;
}
public static bool IsRun(string port)
{
if (GetSerialBean(port) != null)
{
return true;
}
return false;
}
/// <summary>
/// 释放资源
/// </summary>
public static void Release(params string[] ports)
{
if (ports.Length <= 0)
{
ports = (new List<string>(SerialMap.Keys)).ToArray();
}
foreach (string port in ports)
{
try
{
AcSerialBean sb = GetSerialBean(port);
if (sb != null)
{
sb.closePort();
}
//IsRun = false;
SerialMap.Remove(port);
}
catch (Exception ex)
{
LogUtil.error("Release Humiture port [" + port + "] error :" + ex.ToString());
}
}
}
/// <summary>
/// 返回温度和湿度
/// </summary>
/// <returns></returns>
public static double queryData(string port,out string state,out string als,out string sls)
{
Dictionary<uint, string> AlertState = new Dictionary<uint, string>();
AlertState.Add(0b10000000, "压力开关报警");
AlertState.Add(0b01000000, "紧急外部报警");
AlertState.Add(0b00100000, "普通外部报警");
AlertState.Add(0b00010000, "超出试用时间报警");
AlertState.Add(0b00001000, "库温超下限报警");
AlertState.Add(0b00000100, "库温超上限报警");
AlertState.Add(0b00000010, "化霜探头故障报警");
AlertState.Add(0b00000001, "库温探头故障报警");
Dictionary<uint, string> RunState = new Dictionary<uint, string>();
RunState.Add(0b10000000, "保留");
RunState.Add(0b01000000, "保留");
RunState.Add(0b00100000, "保留");
RunState.Add(0b00010000, "制冷或制热状态");
RunState.Add(0b00001000, "风机状态");
RunState.Add(0b00000100, "制热开机状态");
RunState.Add(0b00000010, "制冷开机状态");
RunState.Add(0b00000001, "化霜状态");
state = "";
als = "";
sls = "";
AcSerialBean sb = GetSerialBean(port);
if (sb == null)
{
return -1;
}
byte[] sendData = new byte[7];
sendData[0] = 0x01;
sendData[1] = 0x42;
sendData[2] = 0x09;
sendData[3] = 0x00;
sendData[4] = 0x00;
sendData[5] = 0x00;
sendData[6] = 0x00;
sendData = buildCheckData(sendData, sendData.Length - 2);
string str = AcSerialBean.byteToHexStr(sendData);
LogUtil.debug("制冷控制器发送:" + str);
byte[] reviceData = new byte[23];
bool isOk = false;
sb.SendCommand(sendData, ref reviceData, 100, out isOk);
LogUtil.debug("制冷控制器接收:" + AcSerialBean.byteToHexStr(reviceData,""));
var b = reviceData;
double temp = -1;
var ss = "";
if (b[0] != 0x01 || b[1] != 0x42 || b[2] != 0x09)
{
ss += "通讯错误";
}
else
{
//ss += ($"ver:{BitConverter.ToUInt16(b, 4)}\r\n");
ss += ($"库温探头传感器温度:{modbusValueConvert(b, 6):##.#}\r\n");
ss += ($"化霜探头传感器温度:{modbusValueConvert(b, 8):##.#}\r\n");
ss += ($"制冷开机温度:{modbusValueConvert(b, 10):##.#}\r\n");
ss += ($"制冷停机温度:{modbusValueConvert(b, 12):##.#}\r\n");
ss += ($"制热开机温度:{modbusValueConvert(b, 14):##.#}\r\n");
ss += ($"制热停机温度:{modbusValueConvert(b, 16):##.#}\r\n");
var a1 = Convert.ToString(b[18], 2).PadLeft(8, '0');
var a2 = Convert.ToString(b[19], 2).PadLeft(8, '0');
var s1 = Convert.ToString(b[20], 2).PadLeft(8, '0');
var s2 = Convert.ToString(b[21], 2).PadLeft(8, '0');
temp = (double)BitConverter.ToInt16(b, 6) / 10;
for (int i = 0; i < 8; i++)
{
int p = 1 << i;
{
var xxx = b[18] & p;
if (xxx > 0)
als += AlertState[(uint)xxx] + ",";
}
{
var xxx = b[20] & p;
if (xxx > 0)
sls += RunState[(uint)xxx] + ",";
}
}
ss += ($"报警状态:{als}\r\n");
ss += ($"设备状态:{sls}\r\n");
}
state = ss;
//LogUtil.debug(ss);
return temp;
}
static double modbusValueConvert(byte[] b, int index)
{
double sss;
if (false && (uint)b[index + 1] >= 254)
{
b[index + 1] = 0x00;
sss = (double)BitConverter.ToInt16(b, index) / -10;
}
else
{
sss = (double)BitConverter.ToInt16(b, index) / 10;
}
return sss;
}
private static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
sendData[length] = checkByte[0];
sendData[length + 1] = 0x00;
}
else
{
sendData[length + 1] = checkByte[0];
sendData[length] = checkByte[1];
}
return sendData;
}
private static int getReviceIntData(byte[] dataArray)
{
List<double> list = new List<double>();
try
{
if (dataArray == null)
{
return -1;
}
if (dataArray.Length >= 9)
{
string data = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6] + String.Format("{0:X2}", dataArray[3]) + String.Format("{0:X2}", dataArray[4]));
int tempV = Convert.ToInt32(data, 16);
return tempV;
}
}
catch (Exception ex)
{
LogUtil.info(LogName + "转换出错:" + ex.ToString());
}
return -1;
}
private static List<double> getReviceData(byte[] dataArray)
{
List<double> list = new List<double>();
try
{
if (dataArray == null)
{
return list;
}
if (dataArray.Length >= 9)
{
string temp = String.Format("{0:X2}", dataArray[3]) + String.Format("{0:X2}", dataArray[4]);
string hum = String.Format("{0:X2}", dataArray[5]) + String.Format("{0:X2}", dataArray[6]);
double tempV = (double)Convert.ToInt32(temp, 16) / 10;
double humV = (double)Convert.ToInt32(hum, 16) / 10;
list.Add(tempV);
list.Add(humV);
}
}
catch (Exception ex)
{
LogUtil.info(LogName + "转换出错:" + ex.ToString());
}
return list;
}
} /// <summary>
}
...@@ -167,7 +167,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -167,7 +167,7 @@ namespace OnlineStore.DeviceLibrary
public static double CalWeight(double value,double dValue=0,double xishu=1) public static double CalWeight(double value,double dValue=0,double xishu=1)
{ {
double v= (double)(value - dValue) / xishu; double v= (double)(value - dValue) / xishu;
LogUtil.info("重量计算 ("+value+"-"+dValue+")/"+xishu+"=" + v); LogUtil.debug("重量计算 ("+value+"-"+dValue+")/"+xishu+"=" + v);
return v; return v;
} }
private static double getReviceData(byte[] dataArray) private static double getReviceData(byte[] dataArray)
......
using Asa.Camera;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore
{
public static class HIKCamera
{
static Thread camerathread;
static VisionLib camera;
static public string Name = "";
static public event EventHandler<Bitmap> camera_event;
static string DeviceName = "monitor1";
static public void LoadCameraConfig()
{
string path = @".\StoreConfig\Camera.json";
if (!File.Exists(path))
{
LogUtil.error(Name + "找不到监控相机配置文件" + path);
return;
}
try
{
var configtxt = File.ReadAllText(path);
if (configtxt.IndexOf("Pwd") > 0)
{
configtxt = configtxt.Replace("Pwd", "Password");
configtxt = configtxt.Replace("\"8000\"", "8000");
File.WriteAllText(path, configtxt);
}
var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
DeviceName = m.Groups[1].Value;
camera = new VisionLib(path, "HIK.IPCamera");
}
catch (Exception e)
{
LogUtil.error(Name + "加载监控相机配置文件失败:" + e.ToString());
return;
}
camera.Open(DeviceName);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp == null)
{
LogUtil.error(Name + $"监控相机打开失败");
//camera.Close(DeviceName);
//Thread.Sleep(5000);
//camera.Open(DeviceName);
}
camerathread = new Thread(new ThreadStart(startCamera));
camerathread.Start();
GC.KeepAlive(camerathread);
}
static int errortimes = 0;
static void startCamera()
{
while (true)
{
try
{
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
errortimes = 0;
camera_event?.Invoke(null, bmp);
}
else if (bmp == null && errortimes < 5)
{
errortimes++;
LogUtil.error(Name + $"相机获取图像出错,{errortimes}");
}
else if (errortimes == 5)
{
camera.Open(DeviceName);
errortimes++;
LogUtil.error(Name + $"相机错误次数过多,重新打开,{errortimes}");
}
else if (errortimes == 6)
{
//LogUtil.error(Name + $"相机连接失败, 相机线程退出,{errortimes}");
//break;
errortimes = 0;
LogUtil.error(Name + $"相机连接失败, 30秒后再次尝试,{errortimes}");
Thread.Sleep(30 * 1000);
camera.Open(DeviceName);
}
Thread.Sleep(1000 / 7);
}
catch
{
errortimes++;
}
}
camera.Close(DeviceName);
camera.Dispose();
}
static public void CameraGrabOne(string filename)
{
try
{
LogUtil.info(Name + "库位文件名:" + filename);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
}
catch (Exception e)
{
LogUtil.error(Name + e.ToString());
}
}
static public string GetFixtureStateFilename(string PosId,string PosCode, MoveType storeMoveType, FixtureState fixtureState)
{
string dir = $"\\image\\Fixture\\{storeMoveType}\\{PosId}\\";
Directory.CreateDirectory(dir);
string filename = $"{PosCode}@@{fixtureState}.jpg";
foreach (var x in Path.GetInvalidFileNameChars())
{
filename = filename.Replace(x.ToString(), "");
}
return dir + filename;
}
public enum FixtureState
{
In,
Up,
Down,
Out,
DoorIn,
DoorBack
}
}
}
...@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary
} }
private TinStorePosition GetStriWeightPos(int weight) private TinStorePosition GetStriWeightPos(int weight)
{ {
if (weight < 0)
weight = 0;
//根据重量获取砝码库位 //根据重量获取砝码库位
List<TinStorePosition> allList = new List<TinStorePosition>(CSVPositionReader<TinStorePosition>.allPositionMap.Values); List<TinStorePosition> allList = new List<TinStorePosition>(CSVPositionReader<TinStorePosition>.allPositionMap.Values);
List<TinStorePosition> weightList = (from m in allList where m.PosType >= 100 orderby m.PosType descending select m).ToList<TinStorePosition>(); List<TinStorePosition> weightList = (from m in allList where m.PosType >= 100 orderby m.PosType descending select m).ToList<TinStorePosition>();
......
using DeviceLib; using log4net;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -223,10 +222,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -223,10 +222,10 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis) protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.info( moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.info( moveAxis.DisplayStr + "speed[" + moveAxis.HomeHighSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeHighSpeed/10, moveAxis.HomeHighSpeed*5);
} }
/// <summary> /// <summary>
...@@ -236,7 +235,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -236,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition,targetSpeed, targetSpeed * 5, targetSpeed * 5);
} }
/// <summary> /// <summary>
...@@ -272,7 +271,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -272,7 +271,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error( moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error( moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 5, targetSpeed * 5);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
} }
else else
...@@ -301,7 +300,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -301,7 +300,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error( moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次"); LogUtil.error( moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点"); //LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed, moveAxis.HomeHighSpeed / 10, moveAxis.HomeHighSpeed * 5);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
} }
else else
......
...@@ -680,6 +680,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -680,6 +680,7 @@ namespace OnlineStore.DeviceLibrary
/// 搅拌2回库:叉子从库位中返回,进出轴动作至P1 /// 搅拌2回库:叉子从库位中返回,进出轴动作至P1
/// </summary> /// </summary>
SR_84_InOutToP1, SR_84_InOutToP1,
R03_OtherAxisBack_wait,
#endregion #endregion
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace> <RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName> <AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\..\HuichuanLibrary\HuichuanLibrary\bin\Debug\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
......
...@@ -175,7 +175,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -175,7 +175,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
else else
{ {
if (array.Length == titleIndex.Count) if (array.Length >= titleIndex.Count)
{ {
if (csvIndex < 0) if (csvIndex < 0)
{ {
......
...@@ -135,12 +135,12 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -135,12 +135,12 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (PosType.Equals(1)) if (PosType.Equals(1))
{ {
return "冷藏区库位"; return $"冷藏区库位[{BagWidth}x{BagHigh}]";
} }
else if (PosType.Equals(2)) else if (PosType.Equals(2))
{ {
return "回温区库位"; return $"回温区库位[{BagWidth}x{BagHigh}]";
} }
else else
{ {
......
...@@ -286,21 +286,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -286,21 +286,11 @@ namespace OnlineStore.LoadCSVLibrary
} }
else if (ProType.Equals(ConfigItemType.DI)) else if (ProType.Equals(ConfigItemType.DI))
{ {
IoValue = Convert.ToInt32(ProVale, 8); IoValue = Convert.ToInt32(ProVale);
} }
else if (ProType.Equals(ConfigItemType.DO)) else if (ProType.Equals(ConfigItemType.DO))
{ {
if (ProVale.Length == 2) IoValue = Convert.ToInt32(ProVale);
{
int a = Convert.ToInt32(ProVale.Substring(0, 1), 16) - 8;
string str =a+ProVale.Substring(1,1);
IoValue = Convert.ToInt32( str, 8);
//IoValue = a + b;
}
else
{
IoValue = Convert.ToInt32(ProVale, 16) - Convert.ToInt32("80", 16);
}
} }
//LOGGER.Info("IO转换:(" + ElectricalDefinition + ")" + ProVale + "=" + IoValue); //LOGGER.Info("IO转换:(" + ElectricalDefinition + ")" + ProVale + "=" + IoValue);
} }
......
...@@ -91,10 +91,20 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -91,10 +91,20 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public static string TinCheck_Clamping = "TinCheck_Clamping"; public static string TinCheck_Clamping = "TinCheck_Clamping";
/// <summary> /// <summary>
/// DI,冷气机故障,Refrigeration_failure,15,192.168.200.21,0,冷气机故障,X7,X7,0,
/// </summary>
public static string Refrigeration_failure = "Refrigeration_failure";
/// <summary>
/// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,0,自动指示灯,Y01,Y01,0, /// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,0,自动指示灯,Y01,Y01,0,
/// </summary> /// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed"; public static string AutoRun_HddLed = "AutoRun_HddLed";
/// <summary> /// <summary>
/// DO,设备照明开,Device_Led,0,192.168.200.21,0,设备照明开,Y04,Y04,0,
/// </summary>
public static string Device_Led = "Device_Led";
/// <summary>
/// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,0,故障指示灯,Y02,Y02,0, /// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,0,故障指示灯,Y02,Y02,0,
/// </summary> /// </summary>
public static string Alarm_HddLed = "Alarm_HddLed"; public static string Alarm_HddLed = "Alarm_HddLed";
...@@ -107,14 +117,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -107,14 +117,6 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public static string Alarm_Buzzer = "Alarm_Buzzer"; public static string Alarm_Buzzer = "Alarm_Buzzer";
/// <summary> /// <summary>
/// DO,料仓运转ON,Run_Signal,4,192.168.200.21,0,料仓运转ON,Y05,Y05,0,
/// </summary>
public static string Run_Signal = "Run_Signal";
/// <summary>
/// DO,取料机构刹车电源ON,Axis_Brake,5,192.168.200.21,0,取料机构刹车电源ON,Y06,Y06,0,
/// </summary>
public static string Axis_Brake = "Axis_Brake";
/// <summary>
/// DO,相机照明开,Camera_Led,6,192.168.200.21,0,相机照明开,Y07,Y07,0, /// DO,相机照明开,Camera_Led,6,192.168.200.21,0,相机照明开,Y07,Y07,0,
/// </summary> /// </summary>
public static string Camera_Led = "Camera_Led"; public static string Camera_Led = "Camera_Led";
...@@ -125,7 +127,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -125,7 +127,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// DO,冷气机启动,Colding_Start,8,192.168.200.21,0,冷气机启动,Y09,Y09,0, /// DO,冷气机启动,Colding_Start,8,192.168.200.21,0,冷气机启动,Y09,Y09,0,
/// </summary> /// </summary>
public static string Colding_Start = "Colding_Start"; //public static string Colding_Start = "Colding_Start";
/// <summary> /// <summary>
/// DO,回温区风机启动,Warming_Start,9,192.168.200.21,0,回温区风机启动,Y10,Y10,0, /// DO,回温区风机启动,Warming_Start,9,192.168.200.21,0,回温区风机启动,Y10,Y10,0,
/// </summary> /// </summary>
......
...@@ -16,16 +16,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,16 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
: base(id, cid, type, filepath) : base(id, cid, type, filepath)
{ {
} }
/// <summary>
/// PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#8,,,,,,,
/// </summary>
[ConfigProAttribute("IO_DILength")]
public string IO_DILength { get; set; }
/// <summary>
/// PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16;192.168.200.22#8,,,,,,,
/// </summary>
[ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; }
/// <summary> /// <summary>
/// AXIS,(轴一)取料旋转轴,Middle_Axis,1,COM1,0,,,,, /// AXIS,(轴一)取料旋转轴,Middle_Axis,1,COM1,0,,,,,
/// </summary> /// </summary>
...@@ -392,6 +383,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -392,6 +383,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("Weight_Right_Port")] [ConfigProAttribute("Weight_Right_Port")]
public string Weight_Right_Port { get; set; } public string Weight_Right_Port { get; set; }
/// <summary>
/// PRO,制冷控制器,Refrigerator_Port,COM6,,,,,,,
/// </summary>
[ConfigProAttribute("Refrigerator_Port")]
public string Refrigerator_Port { get; set; }
/// <summary> /// <summary>
...@@ -456,7 +452,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -456,7 +452,6 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDIList.Add(IO_Type.Door_Up); MustHaveDIList.Add(IO_Type.Door_Up);
MustHaveDIList.Add(IO_Type.Door_Down); MustHaveDIList.Add(IO_Type.Door_Down);
MustHaveDIList.Add(IO_Type.SafetyLightCurtains); MustHaveDIList.Add(IO_Type.SafetyLightCurtains);
MustHaveDIList.Add(IO_Type.SafetyLightCurtains);
MustHaveDIList.Add(IO_Type.Door_Limit); MustHaveDIList.Add(IO_Type.Door_Limit);
MustHaveDIList.Add(IO_Type.Door_LeftLimit); MustHaveDIList.Add(IO_Type.Door_LeftLimit);
MustHaveDIList.Add(IO_Type.Door_RightLimit); MustHaveDIList.Add(IO_Type.Door_RightLimit);
...@@ -467,8 +462,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -467,8 +462,7 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDOList.Add(IO_Type.RunSign_HddLed); MustHaveDOList.Add(IO_Type.RunSign_HddLed);
MustHaveDOList.Add(IO_Type.Alarm_Buzzer); MustHaveDOList.Add(IO_Type.Alarm_Buzzer);
// MustHaveDOList.Add(IO_Type.StartOrStopBlow); // MustHaveDOList.Add(IO_Type.StartOrStopBlow);
MustHaveDOList.Add(IO_Type.Run_Signal); // MustHaveDOList.Add(IO_Type.Run_Signal);
MustHaveDOList.Add(IO_Type.Axis_Brake);
MustHaveDOList.Add(IO_Type.Door_Up); MustHaveDOList.Add(IO_Type.Door_Up);
MustHaveDOList.Add(IO_Type.Door_Down); MustHaveDOList.Add(IO_Type.Door_Down);
MustHaveDOList.Add(IO_Type.Camera_Led); MustHaveDOList.Add(IO_Type.Camera_Led);
...@@ -509,68 +503,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -509,68 +503,6 @@ namespace OnlineStore.LoadCSVLibrary
con.Colding_Axis.DefaultPosition = con.Colding_Axis_P1; con.Colding_Axis.DefaultPosition = con.Colding_Axis_P1;
con.Stir_Axis.DefaultPosition = con.Stir_Axis_P1; con.Stir_Axis.DefaultPosition = con.Stir_Axis_P1;
} }
private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null;
public ushort GetDILength(string ip)
{
try
{
if (DILengthMap == null)
{
DILengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DILength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DILengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DILengthMap.ContainsKey(ip))
{
return DILengthMap[ip];
}
return 16;
}
public ushort GetDOLength(string ip)
{
try
{
if (DOLengthMap == null)
{
DOLengthMap = new Dictionary<string, ushort>();
string[] arrayList = IO_DOLength.Split(';');
foreach (string str in arrayList)
{
string[] arrStr = str.Split('#');
if (arrStr.Length == 2)
{
string ioip = arrStr[0];
ushort length = Convert.ToUInt16(arrStr[1]);
DOLengthMap.Add(ioip, length);
}
}
}
}
catch (Exception ex)
{
}
if (DOLengthMap.ContainsKey(ip))
{
return DOLengthMap[ip];
}
return 16;
}
private Dictionary<string, string> CodeSizeMap = null; private Dictionary<string, string> CodeSizeMap = null;
private static char codeSpilt = '#'; private static char codeSpilt = '#';
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!