change - 界面修改

master
wenjy 9 months ago
parent 4bb2a4be80
commit 03dd75b6fa

@ -66,6 +66,9 @@
<!--自动升级-->
<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="DeviceIp" value="192.168.0.75" />

1470
Main.Designer.cs generated

File diff suppressed because it is too large Load Diff

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

Loading…
Cancel
Save