You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
17 KiB
C#

using MaterialTraceability.Business;
using MaterialTraceabilityUI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MaterialTraceabilityUI
{
/// <summary>
/// ConfigInfo.xaml 的交互逻辑
/// </summary>
public partial class ConfigInfo : UserControl
{
/// <summary>
/// INIFile配置文件
/// </summary>
private IniFileHelper inifile = new IniFileHelper(System.Environment.CurrentDirectory + "/MesConfig/App.InI");
private IniFileHelper inifile2 = new IniFileHelper(System.Environment.CurrentDirectory + "/App.InI");
public ConfigInfo()
{
InitializeComponent();
}
private void SaveConfigInfo_Click(object sender, RoutedEventArgs e)
{
try
{
// 通过Rfid获取sfc ProcessLotServiceWSServiceParam节点
inifile.IniWriteValue("ProcessLotServiceWSServiceParam", "url", this.ProcessLotServiceWSServiceParamUrl.Text);
inifile.IniWriteValue("ProcessLotServiceWSServiceParam", "site", this.ProcessLotServiceWSServiceParamSite.Text);
inifile.IniWriteValue("ProcessLotServiceWSServiceParam", "user", this.ProcessLotServiceWSServiceParamUser.Text);
inifile.IniWriteValue("ProcessLotServiceWSServiceParam", "loginUser", this.ProcessLotServiceWSServiceParamLoginUser.Text);
inifile.IniWriteValue("ProcessLotServiceWSServiceParam", "password", this.ProcessLotServiceWSServiceParamPassword.Text);
// 新自动完工接口,Z_PR591调整数量, AdujustQtyParam节点
inifile.IniWriteValue("AdujustQtyParam", "url", this.AdujustQtyParamUrl.Text);
inifile.IniWriteValue("AdujustQtyParam", "site", this.AdujustQtyParamSite.Text);
inifile.IniWriteValue("AdujustQtyParam", "operationRevision", this.AdujustQtyParamOperationRevision.Text);
inifile.IniWriteValue("AdujustQtyParam", "user", this.AdujustQtyParamUser.Text);
inifile.IniWriteValue("AdujustQtyParam", "activity", this.AdujustQtyParamActivity.Text);
// 新自动完工接口,Z_PR571拆分, SplitSfcParam节点
inifile.IniWriteValue("SplitSfcParam", "url", this.SplitSfcParamUrl.Text);
inifile.IniWriteValue("SplitSfcParam", "site", this.SplitSfcParamSite.Text);
inifile.IniWriteValue("SplitSfcParam", "operationRevision", this.SplitSfcParamOperationRevision.Text);
inifile.IniWriteValue("SplitSfcParam", "user", this.SplitSfcParamUser.Text);
inifile.IniWriteValue("SplitSfcParam", "activity", this.SplitSfcParamActivity.Text);
inifile.IniWriteValue("HandSplitSfcParam", "user", this.HandSplitSfcParamUser.Text);
inifile.IniWriteValue("HandSplitSfcParam", "password", this.HandSplitSfcParamPwd.Text);
// 首工序获取SFC接口、自动入账接口、卷绕自动上料接口MiFirstOperationForsfcServiceServiceParam节点
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "url", this.MiFirstOperationForsfcServiceServiceParamUrl.Text);
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "site", this.MiFirstOperationForsfcServiceServiceParamSite.Text);
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "operationRevision", this.MiFirstOperationForsfcServiceServiceParamOperationRevision.Text);
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "user", this.MiFirstOperationForsfcServiceServiceParamUser.Text);
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "activity", this.MiFirstOperationForsfcServiceServiceParamActivity.Text);
inifile.IniWriteValue("MiFirstOperationForsfcServiceServiceParam", "modeProcessSfc", this.MiFirstOperationForsfcServiceServiceParamModeProcessSfc.Text);
// 涂布工单下达MiReleaseSfcWithActivityServiceServiceParam节点
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "url", this.MiReleaseSfcWithActivityServiceServiceParamUrl.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "site", this.MiReleaseSfcWithActivityServiceServiceParamSite.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "operationRevision", this.MiReleaseSfcWithActivityServiceServiceParamOperationRevision.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "user", this.MiReleaseSfcWithActivityServiceServiceParamUser.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "activity", this.MiReleaseSfcWithActivityServiceServiceParamActivity.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "loginUser", this.MiReleaseSfcWithActivityServiceServiceParamLoginUser.Text);
inifile.IniWriteValue("MiReleaseSfcWithActivityServiceServiceParam", "password", this.MiReleaseSfcWithActivityServiceServiceParamPassword.Text);
// 获取SFC数量 MiSFCQueryQtyServiceServiceParam节点
inifile.IniWriteValue("MiSFCQueryQtyServiceServiceParam", "url", this.MiSFCQueryQtyServiceServiceParamUrl.Text);
inifile.IniWriteValue("MiSFCQueryQtyServiceServiceParam", "site", this.MiSFCQueryQtyServiceServiceParamSite.Text);
// 注销接口, MiSignOffSFCsServiceServiceParam节点
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "url", this.MiSignOffSFCsServiceServiceParamUrl.Text);
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "site", this.MiSignOffSFCsServiceServiceParamSite.Text);
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "operationRevision", this.MiSignOffSFCsServiceServiceParamOperationRevision.Text);
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "user", this.MiSignOffSFCsServiceServiceParamUser.Text);
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "activityId", this.MiSignOffSFCsServiceServiceParamActivityId.Text);
inifile.IniWriteValue("MiSignOffSFCsServiceServiceParam", "amount", this.MiSignOffSFCsServiceServiceParamAmount.Text);
// 获取工单数量FindShopRequestParam节点
inifile.IniWriteValue("FindShopRequestParam", "url", this.FindShopRequestParamUrl.Text);
inifile.IniWriteValue("FindShopRequestParam", "site", this.FindShopRequestParamSite.Text);
// 物料特征数据上传接口,MachineIntegrationServiceParam接口
inifile.IniWriteValue("MachineIntegrationServiceParam", "url", this.MachineIntegrationServiceParamUrl.Text);
inifile.IniWriteValue("MachineIntegrationServiceParam", "site", this.MachineIntegrationServiceParamSite.Text);
inifile.IniWriteValue("MachineIntegrationServiceParam", "operationRevision", this.MachineIntegrationServiceParamOperationRevision.Text);
inifile.IniWriteValue("MachineIntegrationServiceParam", "activityId", this.MachineIntegrationServiceParamActivityId.Text);
inifile.IniWriteValue("MachineIntegrationServiceParam", "dcGroupRevision", this.MachineIntegrationServiceParamDcGroupRevision.Text);
// 获取Mes数据TBParametricValueParam节点
inifile.IniWriteValue("TBParametricValueParam", "url", this.TBParametricValueParamUrl.Text);
inifile.IniWriteValue("TBParametricValueParam", "site", this.TBParametricValueParamSite.Text);
// 系统参数配置SystemConfig节点
inifile2.IniWriteValue("SystemConfig", "plcAddress", this.AppConfigParamPlcAddress.Text);
inifile2.IniWriteValue("SystemConfig", "machineId", this.AppConfigParamMachineID.Text);
inifile2.IniWriteValue("SystemConfig", "processId", this.AppConfigParamProcessID.Text);
inifile2.IniWriteValue("SystemConfig", "resource", this.AppConfigParamResource.Text);
inifile2.IniWriteValue("SystemConfig", "operation", this.AppConfigParamOperation.Text);
inifile2.IniWriteValue("SystemConfig", "operationByA", this.AppConfigParamOperationByA.Text);
inifile2.IniWriteValue("SystemConfig", "operationByB", this.AppConfigParamOperationByB.Text);
inifile2.IniWriteValue("SystemConfig", "isMesFlag", this.AppConfigParamIsMesFlag.Text);
inifile2.IniWriteValue("SystemConfig", "plcSingalReadTime", this.AppConfigParamPlcSingalReadTime.Text);
inifile2.IniWriteValue("SystemConfig", "MesWebServiceTimeOut", this.AppConfigParamMesWebServiceTimeOut.Text);
MessageBox.Show("更新成功,重启生效");
}
catch(Exception ex)
{
LogHelperBusiness.LogError("配置信息保存异常", ex);
MessageBox.Show("配置信息保存异常");
}
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// 通过Rfid获取sfc ProcessLotServiceWSServiceParam节点
this.ProcessLotServiceWSServiceParamUrl.Text = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "url");
this.ProcessLotServiceWSServiceParamSite.Text = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "site");
this.ProcessLotServiceWSServiceParamUser.Text = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "user");
this.ProcessLotServiceWSServiceParamLoginUser.Text = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "loginUser");
this.ProcessLotServiceWSServiceParamPassword.Text = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "password");
// 新自动完工接口,Z_PR591调整数量, AdujustQtyParam节点
this.AdujustQtyParamUrl.Text = inifile.IniReadValue("AdujustQtyParam", "url");
this.AdujustQtyParamSite.Text = inifile.IniReadValue("AdujustQtyParam", "site");
this.AdujustQtyParamOperationRevision.Text = inifile.IniReadValue("AdujustQtyParam", "operationRevision");
this.AdujustQtyParamUser.Text = inifile.IniReadValue("AdujustQtyParam", "user");
this.AdujustQtyParamActivity.Text = inifile.IniReadValue("AdujustQtyParam", "activity");
// 新自动完工接口,Z_PR571拆分, SplitSfcParam节点
this.SplitSfcParamUrl.Text = inifile.IniReadValue("SplitSfcParam", "url");
this.SplitSfcParamSite.Text = inifile.IniReadValue("SplitSfcParam", "site");
this.SplitSfcParamOperationRevision.Text = inifile.IniReadValue("SplitSfcParam", "operationRevision");
this.SplitSfcParamUser.Text = inifile.IniReadValue("SplitSfcParam", "user");
this.SplitSfcParamActivity.Text = inifile.IniReadValue("SplitSfcParam", "activity");
this.HandSplitSfcParamUser.Text = inifile.IniReadValue("HandSplitSfcParam", "user");
this.HandSplitSfcParamPwd.Text = inifile.IniReadValue("HandSplitSfcParam", "password");
// 首工序获取SFC接口、自动入账接口、卷绕自动上料接口MiFirstOperationForsfcServiceServiceParam节点
this.MiFirstOperationForsfcServiceServiceParamUrl.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "url");
this.MiFirstOperationForsfcServiceServiceParamSite.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "site");
this.MiFirstOperationForsfcServiceServiceParamOperationRevision.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "operationRevision");
this.MiFirstOperationForsfcServiceServiceParamUser.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "user");
this.MiFirstOperationForsfcServiceServiceParamActivity.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "activity");
this.MiFirstOperationForsfcServiceServiceParamModeProcessSfc.Text = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "modeProcessSfc");
// 涂布工单下达MiReleaseSfcWithActivityServiceServiceParam节点
this.MiReleaseSfcWithActivityServiceServiceParamUrl.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "url");
this.MiReleaseSfcWithActivityServiceServiceParamSite.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "site");
this.MiReleaseSfcWithActivityServiceServiceParamOperationRevision.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "operationRevision");
this.MiReleaseSfcWithActivityServiceServiceParamUser.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "user");
this.MiReleaseSfcWithActivityServiceServiceParamActivity.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "activity");
this.MiReleaseSfcWithActivityServiceServiceParamLoginUser.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "loginUser");
this.MiReleaseSfcWithActivityServiceServiceParamPassword.Text = inifile.IniReadValue("MiReleaseSfcWithActivityServiceServiceParam", "password");
// 获取SFC数量 MiSFCQueryQtyServiceServiceParam节点
this.MiSFCQueryQtyServiceServiceParamUrl.Text = inifile.IniReadValue("MiSFCQueryQtyServiceServiceParam", "url");
this.MiSFCQueryQtyServiceServiceParamSite.Text = inifile.IniReadValue("MiSFCQueryQtyServiceServiceParam", "site");
// 注销接口, MiSignOffSFCsServiceServiceParam节点
this.MiSignOffSFCsServiceServiceParamUrl.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "url");
this.MiSignOffSFCsServiceServiceParamSite.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "site");
this.MiSignOffSFCsServiceServiceParamOperationRevision.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "operationRevision");
this.MiSignOffSFCsServiceServiceParamUser.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "user");
this.MiSignOffSFCsServiceServiceParamActivityId.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "activityId");
this.MiSignOffSFCsServiceServiceParamAmount.Text = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "amount");
// 获取工单数量FindShopRequestParam节点
this.FindShopRequestParamUrl.Text = inifile.IniReadValue("FindShopRequestParam", "url");
this.FindShopRequestParamSite.Text = inifile.IniReadValue("FindShopRequestParam", "site");
// 物料特征数据上传接口,MachineIntegrationServiceParam接口
this.MachineIntegrationServiceParamUrl.Text = inifile.IniReadValue("MachineIntegrationServiceParam", "url");
this.MachineIntegrationServiceParamSite.Text = inifile.IniReadValue("MachineIntegrationServiceParam", "site");
this.MachineIntegrationServiceParamOperationRevision.Text = inifile.IniReadValue("MachineIntegrationServiceParam", "operationRevision");
this.MachineIntegrationServiceParamActivityId.Text = inifile.IniReadValue("MachineIntegrationServiceParam", "activityId");
this.MachineIntegrationServiceParamDcGroupRevision.Text = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroupRevision");
// 获取Mes数据TBParametricValueParam节点
this.TBParametricValueParamUrl.Text = inifile.IniReadValue("TBParametricValueParam", "url");
this.TBParametricValueParamSite.Text = inifile.IniReadValue("TBParametricValueParam", "site");
// 系统参数配置SystemConfig节点
this.AppConfigParamPlcAddress.Text = inifile2.IniReadValue("SystemConfig", "plcAddress");
this.AppConfigParamMachineID.Text = inifile2.IniReadValue("SystemConfig", "machineId");
this.AppConfigParamProcessID.Text = inifile2.IniReadValue("SystemConfig", "processId");
this.AppConfigParamIsMesFlag.Text = inifile2.IniReadValue("SystemConfig", "isMesFlag");
this.AppConfigParamPlcSingalReadTime.Text = inifile2.IniReadValue("SystemConfig", "plcSingalReadTime");
this.AppConfigParamResource.Text = inifile2.IniReadValue("SystemConfig", "resource");
this.AppConfigParamOperation.Text = inifile2.IniReadValue("SystemConfig", "operation");
this.AppConfigParamOperationByA.Text = inifile2.IniReadValue("SystemConfig", "operationByA");
this.AppConfigParamOperationByB.Text = inifile2.IniReadValue("SystemConfig", "operationByB");
this.AppConfigParamMesWebServiceTimeOut.Text = inifile2.IniReadValue("SystemConfig", "MesWebServiceTimeOut");
}
}
}