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.

91 lines
3.2 KiB
C#

using Admin.Core.Common;
using Admin.Core.Common.Config;
using Aucma.Core.Palletiz.Models;
using NPOI.SS.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
namespace Aucma.Core.Palletiz.config
{
internal class AppConfig
{
private static IniHelper iniHelper = new IniHelper(System.Environment.CurrentDirectory + "/config/App.InI");
public AppConfig()
{
}
public List<JumpRange> GetJumpRanges()
{
List<JumpRange> jumpRanges = new List<JumpRange>();
int id = 1;
string configStr = RangeConfig;
string[] configs = configStr.Split(new[] { "][" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < configs.Length; i++)
{
configs[i] = configs[i].Trim('[', ']');
// Console.WriteLine(configs[i]);
}
foreach (string config in configs)
{
string[] parts = config.Split('-');
List<int> ints = new List<int>();
foreach (string part in parts)
{
ints.Add(int.Parse(part));
}
JumpRange temp = new JumpRange()
{
ObjId = id++,
MinModel = ints[0],
MaxModel = ints[1],
OddSpaceRange = ints[2],
EvenSpaceRange = ints[3]
};
jumpRanges.Add(temp);
}
return jumpRanges;
}
/// <summary>
/// 仓库编号
/// </summary>
public string storeCode = Appsettings.app("StoreInfo", "StoreCode");
public List<PlcConfig> plcAddr = new List<PlcConfig>()
{
new PlcConfig(){spaceCode = 1,spaceArea = "A",address = "X10D3"},
new PlcConfig(){spaceCode = 2,spaceArea = "A",address = "X10D9"},
new PlcConfig(){spaceCode = 3,spaceArea = "A",address = "X10E3"},
new PlcConfig(){spaceCode = 4,spaceArea = "A",address = "X10E9"},
new PlcConfig(){spaceCode = 5,spaceArea = "A",address = "X10F3"},
new PlcConfig(){spaceCode = 6,spaceArea = "A",address = "X10F9"},
new PlcConfig(){spaceCode = 7,spaceArea = "A",address = "X1103"},
new PlcConfig(){spaceCode = 8,spaceArea = "A",address = "X1109"},
new PlcConfig(){spaceCode = 9,spaceArea = "A",address = "X1113"},
new PlcConfig(){spaceCode = 10,spaceArea = "A",address = "X1119"},
new PlcConfig(){spaceCode = 11,spaceArea = "A",address = "X1123"},
new PlcConfig(){spaceCode = 12,spaceArea = "A",address = "X1129"},
new PlcConfig(){spaceCode = 13,spaceArea = "A",address = "X1133"},
new PlcConfig(){spaceCode = 14,spaceArea = "A",address = "X1139"}
};
public string RangeConfig
{
get { return iniHelper.IniReadValue("RangeConfig", "rangeString"); }
set { iniHelper.IniWriteValue("RangeConfig", "rangeString", value); }
}
}
}