| | |
| | | private void button9_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP3001.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP3001.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button11_Click(object sender, EventArgs e) |
| | |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP3003.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP3003.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button15_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP3007.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP3007.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button13_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP3004.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP3004.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button14_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP3005.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP3005.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button16_Click(object sender, EventArgs e) |
| | |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP8001.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP8001.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button21_Click(object sender, EventArgs e) |
| | |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP8003.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP8003.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button19_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP8004.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP8004.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button18_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP8005.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP8005.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | private void button17_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | |
| | | try |
| | | { |
| | | if (!SystemValue.isStartedImitateModel) |
| | | { |
| | | MessageBox.Show("请点击调试模式按钮"); |
| | | return; |
| | | } |
| | | DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | DataCaptureHandler_OP8007.Instance.DataCaptureStart(); |
| | | //try |
| | | //{ |
| | | // if (!SystemValue.isStartedImitateModel) |
| | | // { |
| | | // MessageBox.Show("请点击调试模式按钮"); |
| | | // return; |
| | | // } |
| | | // DataCaptureHandler.WorkPieceID = textBox10.Text.Trim(); |
| | | // DataCaptureHandler_OP8007.Instance.DataCaptureStart(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | } |
| | | //} |
| | | //catch (Exception ex) |
| | | //{ |
| | | // MessageBox.Show($"模拟异常:{ex.Message}"); |
| | | // Log4NetHelper.WriteErrorLog(LogType.FormMain, "----button10_Click all报错:", ex); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | } |
| | | |
| | | public WorkPieceLogMiddle GetCH5Info(string FullName, WorkPieceLogMiddle wplog) |
| | | { |
| | | try |
| | | { |
| | | string fileContent = File.ReadAllText(FullName); |
| | | string[] lines2 = fileContent.Split('\n'); |
| | | bool IDCodeIndex = false; |
| | | int Mcount = 0; |
| | | int i = 0; |
| | | int count = 0; |
| | | foreach (string line in lines2) |
| | | { |
| | | count++; |
| | | if (count == 4) |
| | | {//获取质量结果 |
| | | var list = line.Split(' '); |
| | | if (list.Count() > 0) |
| | | { |
| | | var str = list[list.Count() - 1].ToString().Trim(); |
| | | wplog.QualityStateStr = str.Equals("OK") ? "OK" : "NG"; |
| | | } |
| | | } |
| | | // 处理每一行的逻辑 |
| | | if (line.Contains("ID-Code"))//两个拧紧,每个前面都有ID-Code |
| | | { |
| | | i++; |
| | | IDCodeIndex = true; |
| | | Mcount = 0; |
| | | } |
| | | if (IDCodeIndex) |
| | | { |
| | | if (line.Contains(" M "))//第三个M行是拧紧数据 |
| | | {//最终力矩 |
| | | Mcount++; |
| | | if (Mcount == 3) |
| | | { |
| | | var str = line.Replace("+", "").Replace("-", ""); |
| | | var list = str.Split('M'); |
| | | if (list.Count() == 4) |
| | | { |
| | | if (i == 1) |
| | | {//CH3 |
| | | wplog.QualityOP30To3 = list[2].ToString().Trim(); |
| | | } |
| | | else |
| | | {//CH4 |
| | | wplog.QualityOP30To9 = list[2].ToString().Trim(); |
| | | } |
| | | } |
| | | IDCodeIndex = false; |
| | | } |
| | | } |
| | | //public WorkPieceLogMiddle GetCH5Info(string FullName, WorkPieceLogMiddle wplog) |
| | | //{ |
| | | // try |
| | | // { |
| | | // string fileContent = File.ReadAllText(FullName); |
| | | // string[] lines2 = fileContent.Split('\n'); |
| | | // bool IDCodeIndex = false; |
| | | // int Mcount = 0; |
| | | // int i = 0; |
| | | // int count = 0; |
| | | // foreach (string line in lines2) |
| | | // { |
| | | // count++; |
| | | // if (count == 4) |
| | | // {//获取质量结果 |
| | | // var list = line.Split(' '); |
| | | // if (list.Count() > 0) |
| | | // { |
| | | // var str = list[list.Count() - 1].ToString().Trim(); |
| | | // wplog.QualityStateStr = str.Equals("OK") ? "OK" : "NG"; |
| | | // } |
| | | // } |
| | | // // 处理每一行的逻辑 |
| | | // if (line.Contains("ID-Code"))//两个拧紧,每个前面都有ID-Code |
| | | // { |
| | | // i++; |
| | | // IDCodeIndex = true; |
| | | // Mcount = 0; |
| | | // } |
| | | // if (IDCodeIndex) |
| | | // { |
| | | // if (line.Contains(" M "))//第三个M行是拧紧数据 |
| | | // {//最终力矩 |
| | | // Mcount++; |
| | | // if (Mcount == 3) |
| | | // { |
| | | // var str = line.Replace("+", "").Replace("-", ""); |
| | | // var list = str.Split('M'); |
| | | // if (list.Count() == 4) |
| | | // { |
| | | // if (i == 1) |
| | | // {//CH3 |
| | | // wplog.QualityOP30To3 = list[2].ToString().Trim(); |
| | | // } |
| | | // else |
| | | // {//CH4 |
| | | // wplog.QualityOP30To9 = list[2].ToString().Trim(); |
| | | // } |
| | | // } |
| | | // IDCodeIndex = false; |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | if (line.Contains(" MWSP ")) |
| | | {//终拧紧力矩 终拧紧角度 |
| | | var list = line.Split(new String[] { " MWS " }, StringSplitOptions.None); |
| | | if (list.Count() == 2) |
| | | { |
| | | if (i == 1) |
| | | {//CH3 |
| | | wplog.QualityOP30To4 = list[1].ToString().Trim(); |
| | | } |
| | | else |
| | | {//CH4 |
| | | wplog.QualityOP30To10 = list[1].ToString().Trim(); |
| | | } |
| | | var list2 = list[0].Split(new String[] { " W " }, StringSplitOptions.None); |
| | | if (list2.Count() == 2) |
| | | { |
| | | var str = list2[1].ToString(); |
| | | if (i == 1) |
| | | {//CH3 |
| | | wplog.QualityOP30To5 = str.Substring(0, str.IndexOf("MWSP")).Trim(); |
| | | } |
| | | else |
| | | {//CH4 |
| | | wplog.QualityOP30To11 = str.Substring(0, str.IndexOf("MWSP")).Trim(); |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | // if (line.Contains(" MWSP ")) |
| | | // {//终拧紧力矩 终拧紧角度 |
| | | // var list = line.Split(new String[] { " MWS " }, StringSplitOptions.None); |
| | | // if (list.Count() == 2) |
| | | // { |
| | | // if (i == 1) |
| | | // {//CH3 |
| | | // wplog.QualityOP30To4 = list[1].ToString().Trim(); |
| | | // } |
| | | // else |
| | | // {//CH4 |
| | | // wplog.QualityOP30To10 = list[1].ToString().Trim(); |
| | | // } |
| | | // var list2 = list[0].Split(new String[] { " W " }, StringSplitOptions.None); |
| | | // if (list2.Count() == 2) |
| | | // { |
| | | // var str = list2[1].ToString(); |
| | | // if (i == 1) |
| | | // {//CH3 |
| | | // wplog.QualityOP30To5 = str.Substring(0, str.IndexOf("MWSP")).Trim(); |
| | | // } |
| | | // else |
| | | // {//CH4 |
| | | // wplog.QualityOP30To11 = str.Substring(0, str.IndexOf("MWSP")).Trim(); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}CH5工位质量数据异常工件号:{(wplog.WorkPieceID == null ? "" : wplog.WorkPieceID)} 文件名:{FullName}:", ex); |
| | | } |
| | | return wplog; |
| | | // } |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // //Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"读取 {DataCapturePointCode}CH5工位质量数据异常工件号:{(wplog.WorkPieceID == null ? "" : wplog.WorkPieceID)} 文件名:{FullName}:", ex); |
| | | // } |
| | | // return wplog; |
| | | |
| | | } |
| | | //} |
| | | private void button27_Click(object sender, EventArgs e) |
| | | { |
| | | try |