Commit 033376d3 LN

增加点料按钮

1 个父辈 4e2f4d73
......@@ -69,6 +69,7 @@
this.txtSlaveId = new System.Windows.Forms.TextBox();
this.cmbWriteIO = new System.Windows.Forms.ComboBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.btnImage = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage3.SuspendLayout();
......@@ -220,11 +221,12 @@
//
// groupBox7
//
this.groupBox7.Controls.Add(this.btnImage);
this.groupBox7.Controls.Add(this.btnXStart);
this.groupBox7.Controls.Add(this.btnXStop);
this.groupBox7.Location = new System.Drawing.Point(294, 306);
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.TabStop = false;
this.groupBox7.Text = "X光测试";
......@@ -736,6 +738,19 @@
this.tabPage2.Text = " X光射线 ";
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......@@ -824,6 +839,7 @@
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Button btnXStart;
private System.Windows.Forms.Button btnXStop;
private System.Windows.Forms.Button btnImage;
}
}
......@@ -158,7 +158,7 @@ namespace OnlineStore.AutoCountClient
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace, "Exception(异常)", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.error("",ex);
LogUtil.error("", ex);
}
}
private void btnOpenDo_Click(object sender, EventArgs e)
......@@ -175,7 +175,7 @@ namespace OnlineStore.AutoCountClient
int index = FormUtil.GetIntValue(txtDOIndex);
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())
{
......@@ -354,7 +354,7 @@ namespace OnlineStore.AutoCountClient
{
Control c = (Control)sender;
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())
{
......@@ -385,8 +385,8 @@ namespace OnlineStore.AutoCountClient
if (!equipBean.xRayCanStart)
{
LogUtil.info(equipBean.Name + "用户点击 打开X光 :"+ "不能打开X光, 当前状态:" + equipBean.LastXRayState);
MessageBox.Show("不能打开X光, 当前状态:"+ equipBean.LastXRayState, "警告 ", MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.info(equipBean.Name + "用户点击 打开X光 :" + "不能打开X光, 当前状态:" + equipBean.LastXRayState);
MessageBox.Show("不能打开X光, 当前状态:" + equipBean.LastXRayState, "警告 ", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!equipBean.LockOnCanMove())
......@@ -408,6 +408,13 @@ namespace OnlineStore.AutoCountClient
LogUtil.info(equipBean.Name + "用户点击 关闭X光 ");
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
MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
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);
}
}
//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);
// }
//}
CapImage();
MoveInfo.EndStepWait();
}
......@@ -403,6 +404,53 @@ namespace OnlineStore.DeviceLibrary
});
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()
{
try
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!