Commit 033376d3 LN

增加点料按钮

1 个父辈 4e2f4d73
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
this.txtSlaveId = new System.Windows.Forms.TextBox(); this.txtSlaveId = new System.Windows.Forms.TextBox();
this.cmbWriteIO = new System.Windows.Forms.ComboBox(); this.cmbWriteIO = new System.Windows.Forms.ComboBox();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.btnImage = new System.Windows.Forms.Button();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
...@@ -220,11 +221,12 @@ ...@@ -220,11 +221,12 @@
// //
// groupBox7 // groupBox7
// //
this.groupBox7.Controls.Add(this.btnImage);
this.groupBox7.Controls.Add(this.btnXStart); this.groupBox7.Controls.Add(this.btnXStart);
this.groupBox7.Controls.Add(this.btnXStop); this.groupBox7.Controls.Add(this.btnXStop);
this.groupBox7.Location = new System.Drawing.Point(294, 306); this.groupBox7.Location = new System.Drawing.Point(294, 306);
this.groupBox7.Name = "groupBox7"; this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(258, 168); this.groupBox7.Size = new System.Drawing.Size(337, 168);
this.groupBox7.TabIndex = 283; this.groupBox7.TabIndex = 283;
this.groupBox7.TabStop = false; this.groupBox7.TabStop = false;
this.groupBox7.Text = "X光测试"; this.groupBox7.Text = "X光测试";
...@@ -736,6 +738,19 @@ ...@@ -736,6 +738,19 @@
this.tabPage2.Text = " X光射线 "; this.tabPage2.Text = " X光射线 ";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
// btnImage
//
this.btnImage.BackColor = System.Drawing.Color.White;
this.btnImage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnImage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImage.Location = new System.Drawing.Point(158, 63);
this.btnImage.Name = "btnImage";
this.btnImage.Size = new System.Drawing.Size(130, 35);
this.btnImage.TabIndex = 287;
this.btnImage.Text = "拍照片";
this.btnImage.UseVisualStyleBackColor = false;
this.btnImage.Click += new System.EventHandler(this.btnImage_Click);
//
// FrmXRay // FrmXRay
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
...@@ -824,6 +839,7 @@ ...@@ -824,6 +839,7 @@
private System.Windows.Forms.GroupBox groupBox7; private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Button btnXStart; private System.Windows.Forms.Button btnXStart;
private System.Windows.Forms.Button btnXStop; private System.Windows.Forms.Button btnXStop;
private System.Windows.Forms.Button btnImage;
} }
} }
...@@ -23,7 +23,7 @@ namespace OnlineStore.AutoCountClient ...@@ -23,7 +23,7 @@ namespace OnlineStore.AutoCountClient
internal partial class FrmXRay : FrmEquipBase internal partial class FrmXRay : FrmEquipBase
{ {
private bool IsLoad = false; private bool IsLoad = false;
private X_RAY_Equip equipBean; private X_RAY_Equip equipBean;
internal FrmXRay(X_RAY_Equip moveEquip) internal FrmXRay(X_RAY_Equip moveEquip)
{ {
...@@ -46,7 +46,7 @@ namespace OnlineStore.AutoCountClient ...@@ -46,7 +46,7 @@ namespace OnlineStore.AutoCountClient
IsLoad = true; IsLoad = true;
} }
private void LoadIOList() private void LoadIOList()
{ {
int roleindex = 0; int roleindex = 0;
...@@ -104,7 +104,7 @@ namespace OnlineStore.AutoCountClient ...@@ -104,7 +104,7 @@ namespace OnlineStore.AutoCountClient
ReadBtnDO(); ReadBtnDO();
lblLastS.Text = equipBean.LastXRayState; lblLastS.Text = equipBean.LastXRayState;
if (equipBean.xRay.IsRayOpen) if (equipBean.xRay.IsRayOpen)
{ {
lblXrOpen.Text = "XRay射线已打开"; lblXrOpen.Text = "XRay射线已打开";
} }
else else
...@@ -158,7 +158,7 @@ namespace OnlineStore.AutoCountClient ...@@ -158,7 +158,7 @@ namespace OnlineStore.AutoCountClient
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error("",ex); LogUtil.error("", ex);
} }
} }
private void btnOpenDo_Click(object sender, EventArgs e) private void btnOpenDo_Click(object sender, EventArgs e)
...@@ -175,7 +175,7 @@ namespace OnlineStore.AutoCountClient ...@@ -175,7 +175,7 @@ namespace OnlineStore.AutoCountClient
int index = FormUtil.GetIntValue(txtDOIndex); int index = FormUtil.GetIntValue(txtDOIndex);
ConfigIO io = GetSelectDO(); ConfigIO io = GetSelectDO();
if (io.ProName.Equals(IO_Type.X_Lock_On)&&value.Equals(IO_VALUE.HIGH)) if (io.ProName.Equals(IO_Type.X_Lock_On) && value.Equals(IO_VALUE.HIGH))
{ {
if (!equipBean.LockOnCanMove()) if (!equipBean.LockOnCanMove())
{ {
...@@ -223,7 +223,7 @@ namespace OnlineStore.AutoCountClient ...@@ -223,7 +223,7 @@ namespace OnlineStore.AutoCountClient
IOTextControl newControl = DOControlList[io.ProName]; IOTextControl newControl = DOControlList[io.ProName];
if (selectControl != null) { selectControl.BorderStyle = BorderStyle.None; } if (selectControl != null) { selectControl.BorderStyle = BorderStyle.None; }
newControl.BorderStyle = BorderStyle.FixedSingle; newControl.BorderStyle = BorderStyle.FixedSingle;
// newControl.BackColor = Color.SkyBlue; // newControl.BackColor = Color.SkyBlue;
selectControl = newControl; selectControl = newControl;
} }
} }
...@@ -260,7 +260,7 @@ namespace OnlineStore.AutoCountClient ...@@ -260,7 +260,7 @@ namespace OnlineStore.AutoCountClient
else else
{ {
btnStart.Text = "启动调试"; btnStart.Text = "启动调试";
} }
} }
...@@ -271,14 +271,14 @@ namespace OnlineStore.AutoCountClient ...@@ -271,14 +271,14 @@ namespace OnlineStore.AutoCountClient
} }
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
StartDebug(btnStart); StartDebug(btnStart);
} }
private void btnStop_Click(object sender, EventArgs e) private void btnStop_Click(object sender, EventArgs e)
{ {
StopRun(btnStop); StopRun(btnStop);
} }
private void chbDebug_CheckedChanged(object sender, EventArgs e) private void chbDebug_CheckedChanged(object sender, EventArgs e)
{ {
...@@ -302,13 +302,13 @@ namespace OnlineStore.AutoCountClient ...@@ -302,13 +302,13 @@ namespace OnlineStore.AutoCountClient
} }
} }
} }
private void btnInDoorUp_Click(object sender, EventArgs e) private void btnInDoorUp_Click(object sender, EventArgs e)
{ {
equipBean.CylinderMove(null, IO_Type.X_InDoor_Down, IO_Type.X_InDoor_Up); equipBean.CylinderMove(null, IO_Type.X_InDoor_Down, IO_Type.X_InDoor_Up);
} }
private void btnInDoor_Down_Click(object sender, EventArgs e) private void btnInDoor_Down_Click(object sender, EventArgs e)
{ {
...@@ -316,17 +316,17 @@ namespace OnlineStore.AutoCountClient ...@@ -316,17 +316,17 @@ namespace OnlineStore.AutoCountClient
} }
private void btnOutDoor_Up_Click(object sender, EventArgs e) private void btnOutDoor_Up_Click(object sender, EventArgs e)
{ {
equipBean.CylinderMove(null, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up); equipBean.CylinderMove(null, IO_Type.X_OutDoor_Down, IO_Type.X_OutDoor_Up);
} }
private void btnOutDoor_Down_Click(object sender, EventArgs e) private void btnOutDoor_Down_Click(object sender, EventArgs e)
{ {
equipBean.CylinderMove(null, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down); equipBean.CylinderMove(null, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
} }
private void btnCloseAll_Click(object sender, EventArgs e) private void btnCloseAll_Click(object sender, EventArgs e)
{ {
foreach (Control con in groupBox5.Controls) foreach (Control con in groupBox5.Controls)
{ {
if (con is Button) if (con is Button)
...@@ -354,7 +354,7 @@ namespace OnlineStore.AutoCountClient ...@@ -354,7 +354,7 @@ namespace OnlineStore.AutoCountClient
{ {
Control c = (Control)sender; Control c = (Control)sender;
string ioType = c.Name; string ioType = c.Name;
if (ioType.Equals(IO_Type.X_Lock_On) &&( !equipBean.IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.HIGH))) if (ioType.Equals(IO_Type.X_Lock_On) && (!equipBean.IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.HIGH)))
{ {
if (!equipBean.LockOnCanMove()) if (!equipBean.LockOnCanMove())
{ {
...@@ -385,8 +385,8 @@ namespace OnlineStore.AutoCountClient ...@@ -385,8 +385,8 @@ namespace OnlineStore.AutoCountClient
if (!equipBean.xRayCanStart) if (!equipBean.xRayCanStart)
{ {
LogUtil.info(equipBean.Name + "用户点击 打开X光 :"+ "不能打开X光, 当前状态:" + equipBean.LastXRayState); LogUtil.info(equipBean.Name + "用户点击 打开X光 :" + "不能打开X光, 当前状态:" + equipBean.LastXRayState);
MessageBox.Show("不能打开X光, 当前状态:"+ equipBean.LastXRayState, "警告 ", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("不能打开X光, 当前状态:" + equipBean.LastXRayState, "警告 ", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (!equipBean.LockOnCanMove()) if (!equipBean.LockOnCanMove())
...@@ -408,6 +408,13 @@ namespace OnlineStore.AutoCountClient ...@@ -408,6 +408,13 @@ namespace OnlineStore.AutoCountClient
LogUtil.info(equipBean.Name + "用户点击 关闭X光 "); LogUtil.info(equipBean.Name + "用户点击 关闭X光 ");
equipBean.xRay.Stop(); equipBean.xRay.Stop();
} }
private void btnImage_Click(object sender, EventArgs e)
{
LogUtil.info(equipBean.Name + "用户点击 拍照片 ");
string fileName = equipBean.CapImage();
MessageBox.Show("获取图片完成:" + fileName);
}
} }
} }
......
...@@ -315,39 +315,40 @@ namespace OnlineStore.DeviceLibrary ...@@ -315,39 +315,40 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage); MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 "); WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
string lastData = DateTime.Now.ToString("yyyy-MM-dd"); //string lastData = DateTime.Now.ToString("yyyy-MM-dd");
ConfigAppSettings.SaveValue(Setting_Init.XRay_Data, lastData); //ConfigAppSettings.SaveValue(Setting_Init.XRay_Data, lastData);
ClearFilePath(); //ClearFilePath();
carerayImage.GetImage(); //carerayImage.GetImage();
carerayImage.WindowWidth = Config.WindowWidth; //carerayImage.WindowWidth = Config.WindowWidth;
carerayImage.WindowLevel = Config.WindowLevel; //carerayImage.WindowLevel = Config.WindowLevel;
Bitmap bmp = carerayImage.Get48bImage(); //Bitmap bmp = carerayImage.Get48bImage();
lastFileName =Work_ReelInfo.GetRealId()+"-"+ DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; //lastFileName =Work_ReelInfo.GetRealId()+"-"+ DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
string fileP = path1_tif + @"\" + lastFileName; //string fileP = path1_tif + @"\" + lastFileName;
bmp.Save(fileP, System.Drawing.Imaging.ImageFormat.Png); //bmp.Save(fileP, System.Drawing.Imaging.ImageFormat.Png);
string backFile = path_XRAY + lastFileName; //string backFile = path_XRAY + lastFileName;
try //try
{ //{
bmp.Save(backFile, System.Drawing.Imaging.ImageFormat.Png); // bmp.Save(backFile, System.Drawing.Imaging.ImageFormat.Png);
} //}
catch (Exception ex) //catch (Exception ex)
{ //{
LogUtil.error("X图片备份到【" + backFile + "】错误:" + ex.ToString()); // LogUtil.error("X图片备份到【" + backFile + "】错误:" + ex.ToString());
} //}
WorkLog("点料:获取X射线图形,保存到: " + fileP + ",备份到:" + backFile + ",记录时间" + lastData + ",停止X射线"); //WorkLog("点料:获取X射线图形,保存到: " + fileP + ",备份到:" + backFile + ",记录时间" + lastData + ",停止X射线");
GetImageEvent?.Invoke(bmp); //GetImageEvent?.Invoke(bmp);
bool result = xRay.Stop(); //bool result = xRay.Stop();
if (!result) //if (!result)
{ //{
LogUtil.error(" xRay.Stop() 第一次失败,再次调用Stop"); // LogUtil.error(" xRay.Stop() 第一次失败,再次调用Stop");
result = xRay.Stop(); // result = xRay.Stop();
if (!result) // if (!result)
{ // {
LogUtil.error(" xRay.Stop()失败:" + result); // LogUtil.error(" xRay.Stop()失败:" + result);
} // }
} //}
CapImage();
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
} }
...@@ -403,6 +404,53 @@ namespace OnlineStore.DeviceLibrary ...@@ -403,6 +404,53 @@ namespace OnlineStore.DeviceLibrary
}); });
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
} }
public string CapImage()
{
try
{
string lastData = DateTime.Now.ToString("yyyy-MM-dd");
ConfigAppSettings.SaveValue(Setting_Init.XRay_Data, lastData);
ClearFilePath();
carerayImage.GetImage();
carerayImage.WindowWidth = Config.WindowWidth;
carerayImage.WindowLevel = Config.WindowLevel;
Bitmap bmp = carerayImage.Get48bImage();
lastFileName = Work_ReelInfo.GetRealId() + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
string fileP = path1_tif + @"\" + lastFileName;
bmp.Save(fileP, System.Drawing.Imaging.ImageFormat.Png);
string backFile = path_XRAY + lastFileName;
try
{
bmp.Save(backFile, System.Drawing.Imaging.ImageFormat.Png);
}
catch (Exception ex)
{
LogUtil.error("X图片备份到【" + backFile + "】错误:" + ex.ToString());
}
WorkLog("点料:获取X射线图形,保存到: " + fileP + ",备份到:" + backFile + ",记录时间" + lastData + ",停止X射线");
GetImageEvent?.Invoke(bmp);
bool result = xRay.Stop();
if (!result)
{
LogUtil.error(" xRay.Stop() 第一次失败,再次调用Stop");
result = xRay.Stop();
if (!result)
{
LogUtil.error(" xRay.Stop()失败:" + result);
}
}
}
catch (Exception ex)
{
LogUtil.error(" CapImage 出错:" + ex.ToString());
}
return lastFileName;
}
private void ClearFilePath() private void ClearFilePath()
{ {
try try
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!