Commit ca9ca76c LN

料架位置分开配置

1 个父辈 4793a6f7
此文件的差异太大,无法显示。
...@@ -786,7 +786,11 @@ namespace OnlineStore.ACPackingStore ...@@ -786,7 +786,11 @@ namespace OnlineStore.ACPackingStore
} }
//位置配置 //位置配置
string positionConfigFile = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config); string positionConfigFile = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config);
if (!File.Exists(positionConfigFile))
{
string nameStr = BoxBean.DeviceID.ToString();
positionConfigFile = positionConfigFile.Replace(".csv", "_" + nameStr + ".csv");
}
bool result = CSVPositionReader<ShelfPosition>.SavePostion(positionConfigFile, pso); bool result = CSVPositionReader<ShelfPosition>.SavePostion(positionConfigFile, pso);
if (!result) if (!result)
{ {
......
...@@ -98,8 +98,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,8 +98,8 @@ namespace OnlineStore.DeviceLibrary
for (int i = 1; i <= count; i++) for (int i = 1; i <= count; i++)
{ {
string nameStr = i.ToString().PadLeft(1, '0'); string nameStr = i.ToString().PadLeft(1, '0');
string fileN = positionConfigFile. Replace(".csv", "_" + nameStr + ".csv"); string fileN = positionConfigFile.Replace(".csv", "_" + nameStr + ".csv");
CSVPositionReader<ACBoxPosition>.AddCSVFile(fileN); CSVPositionReader<ACBoxPosition>.AddCSVFile(fileN, i);
} }
} }
else else
...@@ -111,11 +111,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,11 +111,23 @@ namespace OnlineStore.DeviceLibrary
} }
string shelfConfig = appPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config); string shelfConfig = appPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config);
if (File.Exists(shelfConfig)) //if (File.Exists(shelfConfig))
//{
// CSVPositionReader<ShelfPosition>.AddCSVFile(shelfConfig);
//}
if (count > 1 || (!File.Exists(shelfConfig)))
{
for (int i = 1; i <= count; i++)
{
string nameStr = i.ToString().PadLeft(1, '0');
string fileN = shelfConfig.Replace(".csv", "_" + nameStr + ".csv");
CSVPositionReader<ShelfPosition>.AddCSVFile(fileN, i);
}
}
else
{ {
CSVPositionReader<ShelfPosition>.AddCSVFile(shelfConfig); CSVPositionReader<ShelfPosition>.AddCSVFile(shelfConfig);
} }
Store = new PackingStoreBean(Config, storeConfig); Store = new PackingStoreBean(Config, storeConfig);
} }
} }
...@@ -123,7 +135,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,7 +135,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LOGGER.Error("出错:", ex); LOGGER.Error("出错:", ex);
MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)"); MessageBox.Show(ex.ToString(), "加载配置错误(请检查配置)");
Application.Exit();
} }
return Store; return Store;
} }
......
...@@ -122,7 +122,10 @@ ...@@ -122,7 +122,10 @@
<None Include="StoreConfig\linePositions_1.csv"> <None Include="StoreConfig\linePositions_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="StoreConfig\shelfPosition.csv"> <None Include="StoreConfig\shelfPosition_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\shelfPosition_2.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="StoreConfig\StoreConfig.csv"> <None Include="StoreConfig\StoreConfig.csv">
......
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
2#S_1_1,1,8,7,2,211783,51884,55245,81000
2#S_1_2,2,8,7,2,211783,67807,71168,81000
2#S_1_3,3,8,7,2,211783,83730,87091,81000
2#S_1_4,4,8,7,2,211783,99653,103014,81000
2#S_1_5,5,8,7,2,211783,115576,118937,81000
2#S_1_6,6,8,7,2,211783,131499,134860,81000
2#S_1_7,7,8,7,2,211783,147422,150783,81000
2#S_1_8,8,8,7,2,211783,163345,166706,81000
2#S_1_9,9,8,7,2,211783,179268,182629,81000
...@@ -10,9 +10,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -10,9 +10,11 @@ namespace OnlineStore.LoadCSVLibrary
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class CSVAttribute : Attribute public class CSVAttribute : Attribute
{ {
public CSVAttribute(string fieldName)
public CSVAttribute(string fieldName, bool ismust=true)
{ {
FieldName = fieldName; FieldName = fieldName;
IsMust = ismust;
} }
private string fieldName; private string fieldName;
...@@ -21,7 +23,10 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -21,7 +23,10 @@ namespace OnlineStore.LoadCSVLibrary
get { return fieldName; } get { return fieldName; }
set { fieldName = value; } set { fieldName = value; }
} }
/// <summary>
/// 是否必须的
/// </summary>
public bool IsMust { get; set; }
} }
} }
...@@ -132,14 +132,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -132,14 +132,14 @@ namespace OnlineStore.LoadCSVLibrary
} }
return titleIndex; return titleIndex;
} }
protected static Dictionary<string, int> GetTitleIndex(string lineValue, List<string> cvsTitleList) protected static Dictionary<string, int> GetTitleIndex(string filename, string lineValue, List<string> cvsTitleList)
{ {
Dictionary<string, int> titleIndex = new Dictionary<string, int>(); Dictionary<string, int> titleIndex = new Dictionary<string, int>();
var array = lineValue.Split(','); var array = lineValue.Split(',');
//验证列 //验证列
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
string title = array[i]; string title = array[i].Trim();
if (cvsTitleList.Contains(title)) if (cvsTitleList.Contains(title))
{ {
titleIndex.Add(title, i); titleIndex.Add(title, i);
...@@ -151,8 +151,8 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -151,8 +151,8 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (!titleIndex.ContainsKey(str)) if (!titleIndex.ContainsKey(str))
{ {
LOGGER.Error("未找到必须列:" + str + ",加载数据失败!"); LOGGER.Error(filename+":未找到必须列:" + str + ",加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!"); throw new CVSFieldNotMatchingExection(filename + ":未找到必须列:" + str + ",加载数据失败!");
} }
} }
} }
......
...@@ -11,11 +11,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -11,11 +11,7 @@ namespace OnlineStore.LoadCSVLibrary
/// 松下伺服485控制,单台料仓 /// 松下伺服485控制,单台料仓
/// </summary> /// </summary>
public class ACBoxPosition : PostionBase public class ACBoxPosition : PostionBase
{ /// <summary> {
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[CSVAttribute("料仓ID")]
public int StoreId { get; set; }
/// <summary> /// <summary>
/// 中轴位置(旋转轴库位点)P2 /// 中轴位置(旋转轴库位点)P2
......
...@@ -54,7 +54,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -54,7 +54,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
/// <param name="filePath">cvs文件路径+文件名</param> /// <param name="filePath">cvs文件路径+文件名</param>
/// <returns></returns> /// <returns></returns>
public static Dictionary<String, T> AddCSVFile(string filePath) public static Dictionary<String, T> AddCSVFile(string filePath,int storeId=0)
{ {
if (hasReadFileList.Contains(filePath)) if (hasReadFileList.Contains(filePath))
{ {
...@@ -81,7 +81,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -81,7 +81,7 @@ namespace OnlineStore.LoadCSVLibrary
var array = line.Split(Spilt_Char); var array = line.Split(Spilt_Char);
if (index == 0) if (index == 0)
{ {
titleIndex = GetTitleIndex(line, cvsTitleList); titleIndex = GetTitleIndex(filePath, line, cvsTitleList);
} }
else else
{ {
...@@ -116,7 +116,10 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -116,7 +116,10 @@ namespace OnlineStore.LoadCSVLibrary
listIndex++; listIndex++;
} }
result.Add(PositionNum, (T)bllIns); result.Add(PositionNum, (T)bllIns);
if (storeId > 0 && ((T)bllIns).StoreId <= 0)
{
((T)bllIns).StoreId = storeId;
}
if (!AllPositionMap.ContainsKey(tname)) if (!AllPositionMap.ContainsKey(tname))
{ {
AllPositionMap.Add(tname, new Dictionary<string, T>()); AllPositionMap.Add(tname, new Dictionary<string, T>());
...@@ -125,6 +128,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -125,6 +128,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
throw new PositionAlreadyExistingExection("仓位:" + PositionNum + "已存在!"); throw new PositionAlreadyExistingExection("仓位:" + PositionNum + "已存在!");
} }
AllPositionMap[tname].Add(PositionNum, (T)bllIns); AllPositionMap[tname].Add(PositionNum, (T)bllIns);
} }
else else
...@@ -187,7 +191,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -187,7 +191,7 @@ namespace OnlineStore.LoadCSVLibrary
var array = line.Split(','); var array = line.Split(',');
if (index == 0) if (index == 0)
{ {
titleIndex = GetTitleIndex(line, cvsTitleList); titleIndex = GetTitleIndex(filePath, line, cvsTitleList);
} }
else else
{ {
......
...@@ -28,5 +28,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -28,5 +28,11 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[CSVAttribute("宽度")] [CSVAttribute("宽度")]
public int BagWidth { get; set; } public int BagWidth { get; set; }
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[CSVAttribute("料仓ID")]
public int StoreId { get; set; }
} }
} }
...@@ -7,12 +7,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -7,12 +7,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
public class ShelfPosition:PostionBase public class ShelfPosition:PostionBase
{ {
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[CSVAttribute("料仓ID")]
public int StoreId { get; set; }
/// <summary> /// <summary>
/// 旋转轴位置P101 /// 旋转轴位置P101
/// </summary> /// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!