change - 界面修改

master
wenjy 9 months ago
parent 4bb2a4be80
commit 03dd75b6fa

@ -65,6 +65,9 @@
<!--自动升级--> <!--自动升级-->
<add key="AutoUpdaterPath" value="http://192.168.0.12:8085/jenkins/AutoUpdater.xml" /> <add key="AutoUpdaterPath" value="http://192.168.0.12:8085/jenkins/AutoUpdater.xml" />
<!--Sop文件路径-->
<add key="SopFilePath" value="E:\桌面\SOP培训文档\" />
<!--人脸识别系统相关配置信息--> <!--人脸识别系统相关配置信息-->
<add key="IsUseFace" value="false" /> <add key="IsUseFace" value="false" />

1470
Main.Designer.cs generated

File diff suppressed because it is too large Load Diff

@ -1,8 +1,10 @@
using DevExpress.XtraEditors; using DevExpress.XtraEditors;
using HslCommunication; using HslCommunication;
using Seagull.BarTender.Print;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Configuration; using System.Configuration;
using System.Drawing; using System.Drawing;
@ -12,6 +14,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using System.Windows.Documents;
using System.Windows.Forms; using System.Windows.Forms;
using ZJ_BYD.Common; using ZJ_BYD.Common;
using ZJ_BYD.DB; using ZJ_BYD.DB;
@ -35,7 +38,7 @@ namespace ZJ_BYD
myEventHandler.LogChanged += MyEventHandler_LogChanged; myEventHandler.LogChanged += MyEventHandler_LogChanged;
//动作项参数行-BindingList事件 //动作项参数行-BindingList事件
gridFinished.DataSource = _bindingResultFinishedCodeVMs; //gridFinished.DataSource = _bindingResultFinishedCodeVMs;
_bindingResultFinishedCodeVMs.ListChanged += OnParamBindingListChanged; _bindingResultFinishedCodeVMs.ListChanged += OnParamBindingListChanged;
Task.Run(() => Task.Run(() =>
@ -60,10 +63,10 @@ namespace ZJ_BYD
Program.type = typeof(T_Result);//获取类型 Program.type = typeof(T_Result);//获取类型
Program.properties = Program.type.GetProperties(); Program.properties = Program.type.GetProperties();
BindCombox.BindSystemMode(cmbMainSysMode); //BindCombox.BindSystemMode(cmbMainSysMode);
BindCombox.MainBindMachineType(lkMachineType); //BindCombox.MainBindMachineType(lkMachineType);
cmbMainSysMode.SelectedIndex = Program.SysMode ? 0 : 1; // cmbMainSysMode.SelectedIndex = Program.SysMode ? 0 : 1;
lblUser.Text = CurrentUser.RealName; //lblUser.Text = CurrentUser.RealName;
lblLineName.Text = Program.LineName; lblLineName.Text = Program.LineName;
var logoFileName = ConfigurationManager.AppSettings["logofilename"]; var logoFileName = ConfigurationManager.AppSettings["logofilename"];
@ -76,14 +79,14 @@ namespace ZJ_BYD
Program.ActiveStatinCode = btn.Name; Program.ActiveStatinCode = btn.Name;
var activeStation = Program.stationInfos.FirstOrDefault(m => m.StationCode == btn.Name); var activeStation = Program.stationInfos.FirstOrDefault(m => m.StationCode == btn.Name);
//在线模式才可绑定工单 //在线模式才可绑定工单
if (Program.SysMode) //if (Program.SysMode)
{ //{
btnBindOrder.Visible = activeStation.IsShowOrderBtn; // btnBindOrder.Visible = activeStation.IsShowOrderBtn;
} //}
else //else
{ //{
btnBindOrder.Visible = false; // btnBindOrder.Visible = false;
} //}
ChangeCurrentStationCode(btn); ChangeCurrentStationCode(btn);
} }
@ -98,6 +101,24 @@ namespace ZJ_BYD
ShowData(); ShowData();
}, cancellationTokenSource.Token); }, cancellationTokenSource.Token);
// 获取图片文件夹路径
string path = Program.SopFilePath;
// 获取文件夹内所有图片文件
string[] files = Directory.GetFiles(path);
// 清空ImageSlider
imageSlider1.Images.Clear();
// 遍历文件并依次添加到ImageSlider中
foreach (string file in files)
{
imageSlider1.Images.Add(System.Drawing.Image.FromFile(file));
}
// 刷新ImageSlider
imageSlider1.Refresh();
//初始化默认机型 //初始化默认机型
MskCodeHelper.InitMachineType(); MskCodeHelper.InitMachineType();
} }
@ -121,7 +142,7 @@ namespace ZJ_BYD
private void OnParamBindingListChanged(object sender, ListChangedEventArgs e) private void OnParamBindingListChanged(object sender, ListChangedEventArgs e)
{ {
gridView2.RefreshData(); //gridView2.RefreshData();
} }
private void MyMethod() private void MyMethod()
@ -157,22 +178,22 @@ namespace ZJ_BYD
} }
//总数 //总数
// var totalCount = ResultHelper.SyncQueryTotalCount().Result; // var totalCount = ResultHelper.SyncQueryTotalCount().Result;
UpdateControlContent(lblTotalCount, $"{totalCount} 个"); // UpdateControlContent(lblTotalCount, $"{totalCount} 个");
//OK数 //OK数
// var okCount = ResultHelper.SyncQueryOkCount().Result; // var okCount = ResultHelper.SyncQueryOkCount().Result;
UpdateControlContent(lblOkCount, $"{okCount} 个"); //UpdateControlContent(lblOkCount, $"{okCount} 个");
//合格率 //合格率
if (totalCount <= 0) //if (totalCount <= 0)
{ //{
UpdateControlContent(lblRate, "0%"); // UpdateControlContent(lblRate, "0%");
} //}
else //else
{ //{
var rate = okCount / (totalCount * 1.0); // var rate = okCount / (totalCount * 1.0);
UpdateControlContent(lblRate, $"{Math.Round(rate, 4) * 100}%"); // UpdateControlContent(lblRate, $"{Math.Round(rate, 4) * 100}%");
} //}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -186,31 +207,31 @@ namespace ZJ_BYD
{ {
try try
{ {
var object_txt = xtraTabPage1.Controls; //var object_txt = xtraTabPage1.Controls;
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
{ {
foreach (var item in object_txt) //foreach (var item in object_txt)
{ //{
if (stationCode == Program.ActiveStatinCode) // if (stationCode == Program.ActiveStatinCode)
{ // {
if (((MemoEdit)item).Name == Program.ActiveStatinCode + "X6") // if (((MemoEdit)item).Name == Program.ActiveStatinCode + "X6")
{ // {
txtLog.Visible = false; // //txtLog.Visible = false;
((MemoEdit)item).Visible = true; // ((MemoEdit)item).Visible = true;
UpdateMemo((MemoEdit)item, newValue.ToString()); // UpdateMemo((MemoEdit)item, newValue.ToString());
} // }
} // }
else // else
{ // {
var hide_memo_ID = ((MemoEdit)item).Name.Replace("X6", ""); // var hide_memo_ID = ((MemoEdit)item).Name.Replace("X6", "");
if (hide_memo_ID == stationCode) // if (hide_memo_ID == stationCode)
{ // {
((MemoEdit)item).Visible = false; // ((MemoEdit)item).Visible = false;
UpdateMemo((MemoEdit)item, newValue.ToString()); // UpdateMemo((MemoEdit)item, newValue.ToString());
} // }
} // }
} //}
}) })
); );
} }
@ -263,7 +284,7 @@ namespace ZJ_BYD
OperateResult result = WriteToPLCM2(heartPoints[i].Address); OperateResult result = WriteToPLCM2(heartPoints[i].Address);
if (result == null || !result.IsSuccess) if (result == null || !result.IsSuccess)
{ {
SetPlcStatusLbl(lblplcstatus, "PLC通讯状态异常", Color.Red); //SetPlcStatusLbl(lblplcstatus, "PLC通讯状态异常", Color.Red);
LogHelper.WriteLog($"心跳监测时,[{heartPoints[i].StationCode}]工位写入失败!"); LogHelper.WriteLog($"心跳监测时,[{heartPoints[i].StationCode}]工位写入失败!");
overWrite = true; overWrite = true;
} }
@ -294,7 +315,7 @@ namespace ZJ_BYD
Thread.Sleep(5); Thread.Sleep(5);
} }
} }
SetPlcStatusLbl(lblplcstatus, "PLC通讯状态正常", Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(229)))), ((int)(((byte)(255)))))); //SetPlcStatusLbl(lblplcstatus, "PLC通讯状态正常", Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(229)))), ((int)(((byte)(255))))));
overWrite = false; overWrite = false;
} }
} }
@ -404,7 +425,7 @@ namespace ZJ_BYD
Name = $"{stationItem.StationCode}X6" Name = $"{stationItem.StationCode}X6"
}; };
Memoedit_1.CustomHighlightText += CustomHighlightText.OnCustomHighlightText; Memoedit_1.CustomHighlightText += CustomHighlightText.OnCustomHighlightText;
xtraTabPage1.Controls.Add(Memoedit_1); //xtraTabPage1.Controls.Add(Memoedit_1);
#endregion #endregion
//读取点位信息 //读取点位信息
@ -418,35 +439,35 @@ namespace ZJ_BYD
private void DoSomething_LogChanged(object newValue, string stationCode) private void DoSomething_LogChanged(object newValue, string stationCode)
{ {
var object_txt = xtraTabPage1.Controls; //var object_txt = xtraTabPage1.Controls;
if (this.IsHandleCreated) if (this.IsHandleCreated)
{ {
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
{ {
foreach (var item in object_txt) //foreach (var item in object_txt)
{ //{
if (stationCode == Program.ActiveStatinCode) // if (stationCode == Program.ActiveStatinCode)
{ // {
if (((MemoEdit)item).Name == Program.ActiveStatinCode + "X6") // if (((MemoEdit)item).Name == Program.ActiveStatinCode + "X6")
{ // {
txtLog.Visible = false; // //txtLog.Visible = false;
((MemoEdit)item).Visible = true; // ((MemoEdit)item).Visible = true;
UpdateMemo((MemoEdit)item, newValue.ToString()); // UpdateMemo((MemoEdit)item, newValue.ToString());
} // }
} // }
else // else
{ // {
var hide_memo_ID = ((MemoEdit)item).Name.Replace("X6", ""); // var hide_memo_ID = ((MemoEdit)item).Name.Replace("X6", "");
if (hide_memo_ID == stationCode) // if (hide_memo_ID == stationCode)
{ // {
((MemoEdit)item).Visible = false; // ((MemoEdit)item).Visible = false;
UpdateMemo((MemoEdit)item, newValue.ToString()); // UpdateMemo((MemoEdit)item, newValue.ToString());
} // }
} // }
} //}
})); }));
} }
} }
@ -464,22 +485,22 @@ namespace ZJ_BYD
private void ChangeCurrentStationCode(SimpleButton thisBtn) private void ChangeCurrentStationCode(SimpleButton thisBtn)
{ {
var object_txt = xtraTabPage1.Controls; //var object_txt = xtraTabPage1.Controls;
var activeStation = Program.stationInfos.FirstOrDefault(m => m.StationCode == thisBtn.Name); var activeStation = Program.stationInfos.FirstOrDefault(m => m.StationCode == thisBtn.Name);
//在线模式才可绑定工单 //在线模式才可绑定工单
if (Program.SysMode) //if (Program.SysMode)
{ //{
btnBindOrder.Visible = activeStation.IsShowOrderBtn; // btnBindOrder.Visible = activeStation.IsShowOrderBtn;
} //}
//控制手动打印按钮的显示 //控制手动打印按钮的显示
if (activeStation.IsShowPrintBtn) //if (activeStation.IsShowPrintBtn)
{ //{
btnPrint.Visible = true; // btnPrint.Visible = true;
} //}
else //else
{ //{
btnPrint.Visible = false; // btnPrint.Visible = false;
} //}
var btns = stationpanel.Controls; var btns = stationpanel.Controls;
if (btns.Count > 0) if (btns.Count > 0)
{ {
@ -492,42 +513,42 @@ namespace ZJ_BYD
var btnImgPath = Path.Combine(Application.StartupPath, "image/btn.png"); var btnImgPath = Path.Combine(Application.StartupPath, "image/btn.png");
btn.BackgroundImage = System.Drawing.Image.FromFile(btnImgPath); btn.BackgroundImage = System.Drawing.Image.FromFile(btnImgPath);
btn.Appearance.ForeColor = Color.White; btn.Appearance.ForeColor = Color.White;
lblSite.Text = activeStation.Site; //lblSite.Text = activeStation.Site;
lblResource.Text = activeStation.Resource; //lblResource.Text = activeStation.Resource;
lblPredure.Text = activeStation.Procedure; //lblPredure.Text = activeStation.Procedure;
lblNgCode.Text = activeStation.NgCode; //lblNgCode.Text = activeStation.NgCode;
lblMesIp.Text = Program.MesIpAddress; //lblMesIp.Text = Program.MesIpAddress;
lblMesPort.Text = Program.MesPort; //lblMesPort.Text = Program.MesPort;
if (logs.Count > 0) //if (logs.Count > 0)
{ //{
foreach (var item_txt in object_txt) // foreach (var item_txt in object_txt)
{ // {
if (((MemoEdit)item_txt).Name == thisBtn.Name + "X6") // if (((MemoEdit)item_txt).Name == thisBtn.Name + "X6")
{ // {
txtLog.Visible = false; // txtLog.Visible = false;
((MemoEdit)item_txt).Visible = true; // ((MemoEdit)item_txt).Visible = true;
} // }
else // else
{ // {
((MemoEdit)item_txt).Visible = false; // ((MemoEdit)item_txt).Visible = false;
} // }
} // }
} //}
else //else
{ //{
foreach (var item_txt in object_txt) // foreach (var item_txt in object_txt)
{ // {
if (((MemoEdit)item_txt).Name == thisBtn.Name + "X6") // if (((MemoEdit)item_txt).Name == thisBtn.Name + "X6")
{ // {
txtLog.Visible = false; // txtLog.Visible = false;
((MemoEdit)item_txt).Visible = true; // ((MemoEdit)item_txt).Visible = true;
} // }
else // else
{ // {
((MemoEdit)item_txt).Visible = false; // ((MemoEdit)item_txt).Visible = false;
} // }
} // }
} //}
} }
else else
{ {
@ -575,7 +596,7 @@ namespace ZJ_BYD
private void BindOrder_ChangeOrderCode(string code) private void BindOrder_ChangeOrderCode(string code)
{ {
lblOrderCode.Text = code; //lblOrderCode.Text = code;
} }
/// <summary> /// <summary>
@ -617,23 +638,23 @@ namespace ZJ_BYD
/// <param name="e"></param> /// <param name="e"></param>
private void cmbMainSysMode_SelectedValueChanged(object sender, EventArgs e) private void cmbMainSysMode_SelectedValueChanged(object sender, EventArgs e)
{ {
var selectedItem = cmbMainSysMode.SelectedItem as ListItem; //var selectedItem = cmbMainSysMode.SelectedItem as ListItem;
if (!Program.SysMode && selectedItem.Value == "1") //if (!Program.SysMode && selectedItem.Value == "1")
{ //{
DialogResult dialogResult = XtraMessageBox.Show("离线模式转在线模式需要重新启动系统,确认要切换模式吗?", "提示", MessageBoxButtons.OKCancel); // DialogResult dialogResult = XtraMessageBox.Show("离线模式转在线模式需要重新启动系统,确认要切换模式吗?", "提示", MessageBoxButtons.OKCancel);
if (dialogResult != DialogResult.OK) // if (dialogResult != DialogResult.OK)
{ // {
return; // return;
} // }
//设置用户登录状态 // //设置用户登录状态
FaceDeviceHelper.Instance.faceLoginUserInfo.IsLogin = false; // FaceDeviceHelper.Instance.faceLoginUserInfo.IsLogin = false;
FaceDeviceHelper.Instance.faceLoginUserInfo.IsSuccess = false; // FaceDeviceHelper.Instance.faceLoginUserInfo.IsSuccess = false;
Environment.Exit(0); // Environment.Exit(0);
} //}
else if (selectedItem.Value == "0") //else if (selectedItem.Value == "0")
{ //{
Program.SysMode = false; // Program.SysMode = false;
} //}
} }
/// <summary> /// <summary>
@ -650,7 +671,7 @@ namespace ZJ_BYD
var M7 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M7"); var M7 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M7");
if (M7 != null) if (M7 != null)
{ {
UpdateControlContent(lblmachiestatus, $"机台{M7.Val}状态"); //UpdateControlContent(lblmachiestatus, $"机台{M7.Val}状态");
} }
//当前生产机型 //当前生产机型
@ -662,7 +683,7 @@ namespace ZJ_BYD
{ {
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
lkMachineType.EditValue = category.SortIndex.ToString();//设置机型下拉框选中项 //lkMachineType.EditValue = category.SortIndex.ToString();//设置机型下拉框选中项
machineOldVal = category.SortIndex.ToString(); machineOldVal = category.SortIndex.ToString();
isLoad = false; isLoad = false;
})); }));
@ -675,18 +696,18 @@ namespace ZJ_BYD
var M5 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M5"); var M5 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M5");
if (M5 != null && !string.IsNullOrWhiteSpace(M5.Val)) if (M5 != null && !string.IsNullOrWhiteSpace(M5.Val))
{ {
if (lblResult.Text.ToLower() == "ng") //if (lblResult.Text.ToLower() == "ng")
{ //{
UpdateControlContent(lblResult, M5.Val, Color.Red); // UpdateControlContent(lblResult, M5.Val, Color.Red);
} //}
else //else
{ //{
UpdateControlContent(lblResult, M5.Val, Color.FromArgb(146, 229, 255)); // UpdateControlContent(lblResult, M5.Val, Color.FromArgb(146, 229, 255));
} //}
} }
else else
{ {
UpdateControlContent(lblResult, ""); //UpdateControlContent(lblResult, "");
} }
//机型索引 //机型索引
var M14 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M14"); var M14 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M14");
@ -707,21 +728,21 @@ namespace ZJ_BYD
//主条码 //主条码
var M28 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M28"); var M28 = Program.PointKeyValues.FirstOrDefault(m => m.StationCode == Program.ActiveStatinCode && m.Key == "M28");
if (M28 != null && !string.IsNullOrWhiteSpace(M28.Val)) //if (M28 != null && !string.IsNullOrWhiteSpace(M28.Val))
{ //{
if (M28.Val.ToLower() == "error\r") // if (M28.Val.ToLower() == "error\r")
{ // {
UpdateControlContent(txtProductCode, M28.Val); // UpdateControlContent(txtProductCode, M28.Val);
} // }
else // else
{ // {
UpdateControlContent(txtProductCode, M28.Val); // UpdateControlContent(txtProductCode, M28.Val);
} // }
} //}
else //else
{ //{
UpdateControlContent(txtProductCode, ""); // UpdateControlContent(txtProductCode, "");
} //}
//组件条码 //组件条码
var subCodes = Program.PointKeyValues.Where(m => m.StationCode == Program.ActiveStatinCode && m.IsSub && m.Key != "M100").OrderBy(m=>m.SortIndex).ToList(); var subCodes = Program.PointKeyValues.Where(m => m.StationCode == Program.ActiveStatinCode && m.IsSub && m.Key != "M100").OrderBy(m=>m.SortIndex).ToList();
if (subCodes.Count > 0) if (subCodes.Count > 0)
@ -734,11 +755,11 @@ namespace ZJ_BYD
strSubCode += ($"{subCodes[i].Val}"); strSubCode += ($"{subCodes[i].Val}");
} }
} }
UpdateControlContent(txtSubCode, strSubCode.TrimEnd('')); //UpdateControlContent(txtSubCode, strSubCode.TrimEnd(''));
} }
else else
{ {
UpdateControlContent(txtSubCode, ""); //UpdateControlContent(txtSubCode, "");
} }
//测试数据 //测试数据
var testlist = Program.PointKeyValues.Where(m => m.StationCode == Program.ActiveStatinCode && m.IsTestItem).OrderBy(m => m.SortIndex).ToList(); var testlist = Program.PointKeyValues.Where(m => m.StationCode == Program.ActiveStatinCode && m.IsTestItem).OrderBy(m => m.SortIndex).ToList();

File diff suppressed because it is too large Load Diff

@ -420,6 +420,11 @@ namespace ZJ_BYD
/// </summary> /// </summary>
public static string DongPan_Param { get; set; } public static string DongPan_Param { get; set; }
/// <summary>
/// SOP文件路径
/// </summary>
public static string SopFilePath { get;set; }
/// <summary> /// <summary>
/// 动静盘差值 /// 动静盘差值
/// </summary> /// </summary>
@ -474,6 +479,7 @@ namespace ZJ_BYD
DongPanProcedure = ConfigurationManager.AppSettings["DongPanProcedure"]; DongPanProcedure = ConfigurationManager.AppSettings["DongPanProcedure"];
DongPanLines = ConfigurationManager.AppSettings["DongPanLines"]?.Split(','); DongPanLines = ConfigurationManager.AppSettings["DongPanLines"]?.Split(',');
DongPan_Param = ConfigurationManager.AppSettings["DongPan_Param"]; DongPan_Param = ConfigurationManager.AppSettings["DongPan_Param"];
SopFilePath = ConfigurationManager.AppSettings["SopFilePath"];
DongJingDvalue = new List<float>(); DongJingDvalue = new List<float>();
var strDongJing = ConfigurationManager.AppSettings["DongJingDvalue"]; var strDongJing = ConfigurationManager.AppSettings["DongJingDvalue"];
if (!string.IsNullOrWhiteSpace(strDongJing)) if (!string.IsNullOrWhiteSpace(strDongJing))

Loading…
Cancel
Save