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

159 lines
9.8 KiB

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.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using KPlan.Util;
namespace KPlan.Forms {
/// <summary>
/// Interaction logic for Config_Others.xaml
/// </summary>
public partial class Config_Others : System.Windows.Controls.UserControl {
public Config_Others() {
InitializeComponent();
}
public void SaveConfiguration() {
Dictionary<string, string> queryProjConfig = new Dictionary<string, string>();
queryProjConfig.Add(KConfigure.QUERY_PROJ_NAME, tb_QueryName.Text);
queryProjConfig.Add(KConfigure.QUERY_PROJ_FIELDS, tb_QueryField.Text);
queryProjConfig.Add(KConfigure.QUERY_PROJ_RESULTS, tb_QueryTable.Text);
queryProjConfig.Add(KConfigure.QUERY_PROJ_HEIGHT, tb_QueryHeight.Text);
KUtil.SetConfigValue(KConfigure.QUERY_PROJ_SECTION, queryProjConfig);
Dictionary<string, string> fmsConfig = new Dictionary<string, string>();
fmsConfig.Add(KConfigure.FMS_URL, tb_FMSUrl.Text);
fmsConfig.Add(KConfigure.FMS_PATH, tb_FMSTemp.Text);
KUtil.SetConfigValue(KConfigure.FMS_SECTION, fmsConfig);
Dictionary<string, string> edConfig = new Dictionary<string, string>();
edConfig.Add(KConfigure.EPLAN_DATA_FOLDER, tb_EPLANData.Text);
edConfig.Add(KConfigure.EPLAN_DATA_SKIP_FOLDER, tb_EPLANDataSkip.Text);
edConfig.Add(KConfigure.EPLAN_DATASET_UID, tb_EPLANDataDsUid.Text);
edConfig.Add(KConfigure.EPLAN_TEMPLATE_ITEM_ID, tb_TemplateItemID.Text);
edConfig.Add(KConfigure.EPLAN_TEMPLATE_DATASET_TYPE, tb_TemplateDatasetType.Text);
edConfig.Add(KConfigure.EPLAN_WORKSAPCE, tb_workspace.Text);
edConfig.Add(KConfigure.EPLAN_EN_TO_CN, tb_en_cn.Text);
edConfig.Add(KConfigure.EPLAN_KEEP_ZIP, tb_keepzip.Text);
KUtil.SetConfigValue(KConfigure.EPLAN_DATA_SECTION, edConfig);
Dictionary<string, string> partQueryConfig = new Dictionary<string, string>();
partQueryConfig.Add(KConfigure.PART_QUERY_NAME, tb_Query_Part_Name.Text);
partQueryConfig.Add(KConfigure.PART_QUERY_ITEM_ID, tb_Query_Part_Field_ItemID.Text);
partQueryConfig.Add(KConfigure.PART_QUERY_ORDERNR, tb_Query_Part_Field_PartNr.Text);
KUtil.SetConfigValue(KConfigure.PART_QUERY_SECTION, partQueryConfig);
Dictionary<string, string> uiConfig = new Dictionary<string, string>();
uiConfig.Add(KConfigure.UI_PROP_DESC, tb_UI_PROP_DESC.Text);
uiConfig.Add(KConfigure.UI_PROP_MANUFACTURER, tb_UI_PROP_MANUFACTURER.Text);
KUtil.SetConfigValue(KConfigure.UI_SOME_SECTION, uiConfig);
Dictionary<string, string> bmsqConfig = new Dictionary<string, string>();
bmsqConfig.Add(KConfigure.BMSQ_ITEMTYPE, tb_BMSQ_TYPE.Text);
bmsqConfig.Add(KConfigure.BMSQ_ROWTYPE, tb_BMSQ_ROWTYPE.Text);
bmsqConfig.Add(KConfigure.BMSQ_TABLE, tb_BMSQ_TABLE.Text);
bmsqConfig.Add(KConfigure.BMSQ_ORDERNR, tb_BMSQ_DHH.Text);
bmsqConfig.Add(KConfigure.BMSQ_GUID, tb_BMSQ_GUID.Text);
bmsqConfig.Add(KConfigure.BMSQ_UNIT, tb_BMSQ_JLDW.Text);
bmsqConfig.Add(KConfigure.BMSQ_DESC_CN, tb_BMSQ_MSCN.Text);
bmsqConfig.Add(KConfigure.BMSQ_DESC_EN, tb_BMSQ_MCEN.Text);
bmsqConfig.Add(KConfigure.BMSQ_POSITION_PREF, tb_BMSQ_PREF.Text);
bmsqConfig.Add(KConfigure.BMSQ_PROCESS_TEMPLATE, tb_BMSQ_PROCESS.Text);
KUtil.SetConfigValue(KConfigure.BMSQ_SECTION, bmsqConfig);
Dictionary<string, string> checkConfig = new Dictionary<string, string>();
checkConfig.Add(KConfigure.CHECK_TITLE, tb_Checktable.Text);
checkConfig.Add(KConfigure.CHECK_WIRE, tb_CheckWire.Text);
checkConfig.Add(KConfigure.CHECK_SAVEXML, tb_SaveAfterCheck.Text);
checkConfig.Add(KConfigure.SAVE_BOM_PROP, tb_bomprop.Text);
checkConfig.Add(KConfigure.ERROR_ARRAY_PROP, tb_PropError.Text);
KUtil.SetConfigValue(KConfigure.CHECK_SECTION, checkConfig);
Dictionary<string, string> refConfig = new Dictionary<string, string>();
refConfig.Add(KConfigure.REF_BOM_TITILE, tb_BomTitle.Text);
refConfig.Add(KConfigure.REF_ERPCODE, tb_erpcode.Text);
refConfig.Add(KConfigure.REF_LINECOUNT, tb_linecount.Text);
refConfig.Add(KConfigure.REF_DELETEXML, tb_deleteXML.Text);
//refConfig.Add(KConfigure.REF_DATABSE_ITEMID, tb_Database_ItemID.Text);
//refConfig.Add(KConfigure.REF_UNZIP_PATH, tb_UnzipPath.Text);
//refConfig.Add(KConfigure.REF_BOM_PROPS, tb_bomprop.Text);
KUtil.SetConfigValue(KConfigure.REF_SECTION, refConfig);
}
public void LoadConfiguration() {
//读取查询项目配置
tb_QueryName.Text = KUtil.GetConfigValue(KConfigure.QUERY_PROJ_SECTION, KConfigure.QUERY_PROJ_NAME);
tb_QueryField.Text = KUtil.GetConfigValue(KConfigure.QUERY_PROJ_SECTION, KConfigure.QUERY_PROJ_FIELDS);
tb_QueryTable.Text = KUtil.GetConfigValue(KConfigure.QUERY_PROJ_SECTION, KConfigure.QUERY_PROJ_RESULTS);
tb_QueryHeight.Text = KUtil.GetConfigValue(KConfigure.QUERY_PROJ_SECTION, KConfigure.QUERY_PROJ_HEIGHT);
//FMS配置
tb_FMSUrl.Text = KUtil.GetConfigValue(KConfigure.FMS_SECTION, KConfigure.FMS_URL);
tb_FMSTemp.Text = KUtil.GetConfigValue(KConfigure.FMS_SECTION, KConfigure.FMS_PATH);
//EPLAN数据配置
tb_EPLANData.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_DATA_FOLDER);
tb_EPLANDataSkip.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_DATA_SKIP_FOLDER);
tb_EPLANDataDsUid.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_DATASET_UID);
tb_TemplateItemID.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_TEMPLATE_ITEM_ID);
tb_TemplateDatasetType.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_TEMPLATE_DATASET_TYPE);
tb_workspace.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_WORKSAPCE);
tb_en_cn.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_EN_TO_CN);
tb_keepzip.Text = KUtil.GetConfigValue(KConfigure.EPLAN_DATA_SECTION, KConfigure.EPLAN_KEEP_ZIP);
//Part查询
tb_Query_Part_Name.Text = KUtil.GetConfigValue(KConfigure.PART_QUERY_SECTION, KConfigure.PART_QUERY_NAME);
tb_Query_Part_Field_ItemID.Text = KUtil.GetConfigValue(KConfigure.PART_QUERY_SECTION, KConfigure.PART_QUERY_ITEM_ID);
tb_Query_Part_Field_PartNr.Text = KUtil.GetConfigValue(KConfigure.PART_QUERY_SECTION, KConfigure.PART_QUERY_ORDERNR);
//UI杂项
tb_UI_PROP_DESC.Text = KUtil.GetConfigValue(KConfigure.UI_SOME_SECTION, KConfigure.UI_PROP_DESC);
tb_UI_PROP_MANUFACTURER.Text = KUtil.GetConfigValue(KConfigure.UI_SOME_SECTION, KConfigure.UI_PROP_MANUFACTURER);
//编码申请
tb_BMSQ_TYPE.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_ITEMTYPE);
tb_BMSQ_ROWTYPE.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_ROWTYPE);
tb_BMSQ_TABLE.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_TABLE);
tb_BMSQ_DHH.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_ORDERNR);
tb_BMSQ_GUID.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_GUID);
tb_BMSQ_JLDW.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_UNIT);
tb_BMSQ_MSCN.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_DESC_CN);
tb_BMSQ_MCEN.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_DESC_EN);
tb_BMSQ_PREF.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_POSITION_PREF);
tb_BMSQ_PROCESS.Text = KUtil.GetConfigValue(KConfigure.BMSQ_SECTION, KConfigure.BMSQ_PROCESS_TEMPLATE);
//检查
tb_Checktable.Text = KUtil.GetConfigValue(KConfigure.CHECK_SECTION, KConfigure.CHECK_TITLE);
tb_CheckWire.Text = KUtil.GetConfigValue(KConfigure.CHECK_SECTION, KConfigure.CHECK_WIRE);
tb_SaveAfterCheck.Text = KUtil.GetConfigValue(KConfigure.CHECK_SECTION, KConfigure.CHECK_SAVEXML);
tb_bomprop.Text = KUtil.GetConfigValue(KConfigure.CHECK_SECTION, KConfigure.SAVE_BOM_PROP);
tb_PropError.Text = KUtil.GetConfigValue(KConfigure.CHECK_SECTION, KConfigure.ERROR_ARRAY_PROP);
//引用功能
tb_BomTitle.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_BOM_TITILE);
tb_erpcode.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_ERPCODE);
tb_linecount.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_LINECOUNT);
tb_deleteXML.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_DELETEXML);
//tb_Database_ItemID.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_DATABSE_ITEMID);
//tb_UnzipPath.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_UNZIP_PATH);
//tb_bomprop.Text = KUtil.GetConfigValue(KConfigure.REF_SECTION, KConfigure.REF_BOM_PROPS);
}
private void ChooseFolder_Button_Click(object sender, RoutedEventArgs e) {
FolderBrowserDialog fb = new FolderBrowserDialog();
fb.RootFolder = Environment.SpecialFolder.Desktop;
fb.Description = "选择EPLAN数据文件夹";
if (fb.ShowDialog() == DialogResult.OK) {
tb_EPLANData.Text = fb.SelectedPath;
}
}
}
}