Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d4450cba
由
LN
编写于
2019-11-07 15:53:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加料架位置配置
1 个父辈
c4b93ce1
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
196 行增加
和
63 行删除
source/ACPackingStore/App.config
source/ACPackingStore/FrmStore.cs
source/Common/Setting_Init.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/ACPackingStore/StoreManager.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/StoreConfig/shelfPosition.csv
source/DeviceLibrary/store/StoreStep.cs
source/LoadCVSLibrary/LoadCSVLibrary.csproj
source/LoadCVSLibrary/position/ACBoxPosition.cs
source/LoadCVSLibrary/position/CSVPositionReader.cs
source/LoadCVSLibrary/position/StorePostionBase.cs → source/LoadCVSLibrary/position/PostionBase.cs
source/LoadCVSLibrary/position/ShelfPosition.cs
source/ACPackingStore/App.config
查看文件 @
d4450cb
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
<
add
key
=
"store_count"
value
=
"2"
/>
<
add
key
=
"store_count"
value
=
"2"
/>
<
add
key
=
"Store_ConfigPath"
value
=
"\StoreConfig\StoreConfig.csv"
/>
<
add
key
=
"Store_ConfigPath"
value
=
"\StoreConfig\StoreConfig.csv"
/>
<!--
start
one
store
config
-->
<!--
start
one
store
config
-->
<
add
key
=
"Shelf_Position_Config"
value
=
"\StoreConfig\shelfPosition.csv"
/>
<
add
key
=
"Store_Position_Config"
value
=
"\StoreConfig\linePositions.csv"
/>
<
add
key
=
"Store_Position_Config"
value
=
"\StoreConfig\linePositions.csv"
/>
<
add
key
=
"BOX_ConfigPath"
value
=
"\StoreConfig\BoxConfig.csv"
/>
<
add
key
=
"BOX_ConfigPath"
value
=
"\StoreConfig\BoxConfig.csv"
/>
<
add
key
=
"Store_Type"
value
=
"RC_AC_PA"
/>
<
add
key
=
"Store_Type"
value
=
"RC_AC_PA"
/>
...
...
source/ACPackingStore/FrmStore.cs
查看文件 @
d4450cb
...
@@ -41,6 +41,7 @@ namespace OnlineStore.ACPackingStore
...
@@ -41,6 +41,7 @@ namespace OnlineStore.ACPackingStore
if
(
store
==
null
)
if
(
store
==
null
)
{
{
this
.
Close
();
this
.
Close
();
return
;
}
}
else
else
{
{
...
...
source/Common/Setting_Init.cs
查看文件 @
d4450cb
...
@@ -87,5 +87,6 @@ namespace OnlineStore.Common
...
@@ -87,5 +87,6 @@ namespace OnlineStore.Common
public
static
string
Store_ConfigPath
=
"Store_ConfigPath"
;
public
static
string
Store_ConfigPath
=
"Store_ConfigPath"
;
public
static
string
UseBuzzer
=
"UseBuzzer"
;
public
static
string
UseBuzzer
=
"UseBuzzer"
;
public
static
string
Shelf_Position_Config
=
"Shelf_Position_Config"
;
}
}
}
}
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
查看文件 @
d4450cb
...
@@ -17,9 +17,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -17,9 +17,7 @@ namespace OnlineStore.DeviceLibrary
public
partial
class
AC_BOX_Bean
:
KTK_Store
public
partial
class
AC_BOX_Bean
:
KTK_Store
{
{
private
static
bool
IsIntSlvBlock
=
false
;
private
static
bool
IsIntSlvBlock
=
false
;
/// <summary>
/// 开始运行
/// </summary>
public
static
bool
IsRun
=
false
;
public
static
bool
IsRun
=
false
;
public
string
CID
=
""
;
public
string
CID
=
""
;
public
AC_BOX_Config
Config
;
public
AC_BOX_Config
Config
;
...
@@ -36,8 +34,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -36,8 +34,13 @@ namespace OnlineStore.DeviceLibrary
/// 轴报警信息
/// 轴报警信息
/// </summary>
/// </summary>
private
Dictionary
<
string
,
AxisAlarmInfo
>
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
private
Dictionary
<
string
,
AxisAlarmInfo
>
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
/// <summary>
/// 料仓内所有的位置列表
/// </summary>
public
List
<
string
>
PositionNumList
=
new
List
<
string
>();
public
List
<
string
>
ShelfPosList
=
new
List
<
string
>();
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
private
System
.
Timers
.
Timer
IoCheckTimer
=
new
System
.
Timers
.
Timer
();
private
System
.
Timers
.
Timer
IoCheckTimer
=
new
System
.
Timers
.
Timer
();
public
AC_BOX_Bean
(
AC_BOX_Config
config
)
public
AC_BOX_Bean
(
AC_BOX_Config
config
)
...
@@ -73,6 +76,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -73,6 +76,15 @@ namespace OnlineStore.DeviceLibrary
PositionNumList
.
Add
(
position
.
PositionNum
);
PositionNumList
.
Add
(
position
.
PositionNum
);
}
}
}
}
List
<
ShelfPosition
>
sPlist
=
CSVPositionReader
<
ShelfPosition
>.
getPositionList
();
ShelfPosList
=
new
List
<
string
>();
foreach
(
ShelfPosition
p
in
sPlist
)
{
if
(
p
.
StoreId
.
Equals
(
DeviceID
))
{
ShelfPosList
.
Add
(
p
.
PositionNum
);
}
}
mainTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
int
isAuto
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
);
int
isAuto
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
);
if
(
isAuto
==
1
)
if
(
isAuto
==
1
)
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
d4450cb
...
@@ -12,10 +12,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -12,10 +12,8 @@ namespace OnlineStore.DeviceLibrary
{
{
#
region
自动出入库参数
#
region
自动出入库参数
/// <summary>
/// 料仓内所有的位置列表
/// </summary>
public
List
<
string
>
PositionNumList
=
new
List
<
string
>();
/// <summary>
/// <summary>
/// 入库完成后自动出库,出库完成后自动入库
/// 入库完成后自动出库,出库完成后自动入库
/// </summary>
/// </summary>
...
...
source/DeviceLibrary/ACPackingStore/StoreManager.cs
查看文件 @
d4450cb
...
@@ -108,6 +108,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -108,6 +108,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
"加载料仓完成!"
);
LogUtil
.
info
(
LOGGER
,
"加载料仓完成!"
);
}
}
string
shelfConfig
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Shelf_Position_Config
);
if
(
File
.
Exists
(
shelfConfig
))
{
CSVPositionReader
<
ShelfPosition
>.
AddCSVFile
(
shelfConfig
);
}
Store
=
new
PackingStoreBean
(
Config
,
storeConfig
);
Store
=
new
PackingStoreBean
(
Config
,
storeConfig
);
}
}
}
}
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
d4450cb
...
@@ -117,6 +117,9 @@
...
@@ -117,6 +117,9 @@
<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">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\StoreConfig.csv">
<None Include="StoreConfig\StoreConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>
...
...
source/DeviceLibrary/StoreConfig/shelfPosition.csv
0 → 100644
查看文件 @
d4450cb
位置,优先级,高度,宽度,料仓ID,旋转轴位置,升降轴低点,升降轴高点,进出轴位置
1#AC1_1_1_4,1,8,7,1,211783,51884,55245,81000
1#AC1_1_1_5,2,8,7,1,211783,67807,71168,81000
1#AC1_1_1_6,3,8,7,1,211783,83730,87091,81000
1#AC1_1_1_7,4,8,7,1,211783,99653,103014,81000
1#AC1_1_1_8,5,8,7,1,211783,115576,118937,81000
1#AC1_1_1_9,6,8,7,1,211783,131499,134860,81000
1#AC1_1_1_10,7,8,7,1,211783,147422,150783,81000
1#AC1_1_1_11,8,8,7,1,211783,163345,166706,81000
1#AC1_1_1_12,9,8,7,1,211783,179268,182629,81000
1#AC1_1_1_13,10,8,7,1,211783,195191,198552,81000
1#AC1_1_1_14,11,8,7,1,211783,211114,214475,81000
1#AC1_1_1_15,12,8,7,1,211783,227037,230398,81000
1#AC1_1_1_16,13,8,7,1,211783,242960,246321,81000
1#AC1_1_1_17,14,8,7,1,211783,258883,262244,81000
1#AC1_1_1_18,15,8,7,1,211783,274806,278167,81000
1#AC1_1_1_19,16,8,7,1,211783,289000,294090,81000
1#AC1_1_1_20,17,8,7,1,211783,304652,310013,81000
1#AC1_1_1_21,18,8,7,1,211783,320575,325936,81000
1#AC1_1_1_22,19,8,7,1,211783,336498,341859,81000
1#AC1_1_2_3,20,8,7,1,211783,385700,389433,81000
1#AC1_1_2_4,21,8,7,1,211783,403000,405356,81000
1#AC1_1_2_5,22,8,7,1,211783,418345,421279,81000
1#AC1_1_2_6,23,8,7,1,211783,434000,437202,81000
1#AC1_1_2_7,24,8,7,1,211783,450000,453125,81000
1#AC1_1_2_8,25,8,7,1,211783,465900,469048,81000
1#AC1_1_2_9,26,8,7,1,211783,481800,484971,81000
1#AC1_1_2_10,27,8,7,1,211783,497660,500894,81000
1#AC1_1_2_11,28,8,7,1,211783,513600,516817,81000
1#AC1_1_2_12,29,8,7,1,211783,529200,532740,81000
1#AC1_1_2_13,30,8,7,1,211783,545100,548663,81000
1#AC1_1_2_14,31,8,7,1,211783,560500,564586,81000
1#AC1_1_2_15,32,8,7,1,211783,575500,580509,81000
1#AC1_1_2_16,33,8,7,1,211783,591500,596432,81000
1#AC1_1_2_17,34,8,7,1,211783,606000,612355,81000
1#AC1_1_2_18,35,8,7,1,211783,621000,628278,81000
,,,,,,,,
2#AC1_1_1_4,1,8,7,2,211783,51884,55245,81000
2#AC1_1_1_5,2,8,7,2,211783,67807,71168,81000
2#AC1_1_1_6,3,8,7,2,211783,83730,87091,81000
2#AC1_1_1_7,4,8,7,2,211783,99653,103014,81000
2#AC1_1_1_8,5,8,7,2,211783,115576,118937,81000
2#AC1_1_1_9,6,8,7,2,211783,131499,134860,81000
2#AC1_1_1_10,7,8,7,2,211783,147422,150783,81000
2#AC1_1_1_11,8,8,7,2,211783,163345,166706,81000
2#AC1_1_1_12,9,8,7,2,211783,179268,182629,81000
2#AC1_1_1_13,10,8,7,2,211783,195191,198552,81000
2#AC1_1_1_14,11,8,7,2,211783,211114,214475,81000
2#AC1_1_1_15,12,8,7,2,211783,227037,230398,81000
2#AC1_1_1_16,13,8,7,2,211783,242960,246321,81000
2#AC1_1_1_17,14,8,7,2,211783,258883,262244,81000
2#AC1_1_1_18,15,8,7,2,211783,274806,278167,81000
2#AC1_1_1_19,16,8,7,2,211783,289000,294090,81000
2#AC1_1_1_20,17,8,7,2,211783,304652,310013,81000
2#AC1_1_1_21,18,8,7,2,211783,320575,325936,81000
2#AC1_1_1_22,19,8,7,2,211783,336498,341859,81000
2#AC1_1_2_3,20,8,7,2,211783,385700,389433,81000
2#AC1_1_2_4,21,8,7,2,211783,403000,405356,81000
2#AC1_1_2_5,22,8,7,2,211783,418345,421279,81000
2#AC1_1_2_6,23,8,7,2,211783,434000,437202,81000
2#AC1_1_2_7,24,8,7,2,211783,450000,453125,81000
2#AC1_1_2_8,25,8,7,2,211783,465900,469048,81000
2#AC1_1_2_9,26,8,7,2,211783,481800,484971,81000
2#AC1_1_2_10,27,8,7,2,211783,497660,500894,81000
2#AC1_1_2_11,28,8,7,2,211783,513600,516817,81000
2#AC1_1_2_12,29,8,7,2,211783,529200,532740,81000
2#AC1_1_2_13,30,8,7,2,211783,545100,548663,81000
2#AC1_1_2_14,31,8,7,2,211783,560500,564586,81000
2#AC1_1_2_15,32,8,7,2,211783,575500,580509,81000
2#AC1_1_2_16,33,8,7,2,211783,591500,596432,81000
2#AC1_1_2_17,34,8,7,2,211783,606000,612355,81000
2#AC1_1_2_18,35,8,7,2,211783,621000,628278,81000
source/DeviceLibrary/store/StoreStep.cs
查看文件 @
d4450cb
此文件的差异被折叠,
点击展开。
source/LoadCVSLibrary/LoadCSVLibrary.csproj
查看文件 @
d4450cb
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
<ItemGroup>
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="CSVExection.cs" />
<Compile Include="position\ACBoxPosition.cs" />
<Compile Include="position\ACBoxPosition.cs" />
<Compile Include="position\ShelfPosition.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\Store_Config.cs" />
<Compile Include="storeConfig\config\Store_Config.cs" />
...
@@ -60,7 +61,7 @@
...
@@ -60,7 +61,7 @@
<Compile Include="CSVReaderBase.cs" />
<Compile Include="CSVReaderBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="storeConfig\config\BaseConfig.cs" />
<Compile Include="storeConfig\config\BaseConfig.cs" />
<Compile Include="position\
Store
PostionBase.cs" />
<Compile Include="position\PostionBase.cs" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<ProjectReference Include="..\Common\Common.csproj">
...
...
source/LoadCVSLibrary/position/ACBoxPosition.cs
查看文件 @
d4450cb
...
@@ -10,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -10,7 +10,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// <summary>
/// 松下伺服485控制,单台料仓
/// 松下伺服485控制,单台料仓
/// </summary>
/// </summary>
public
class
ACBoxPosition
:
Store
PostionBase
public
class
ACBoxPosition
:
PostionBase
{
/// <summary>
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
/// </summary>
...
...
source/LoadCVSLibrary/position/CSVPositionReader.cs
查看文件 @
d4450cb
...
@@ -11,14 +11,16 @@ using System.Text;
...
@@ -11,14 +11,16 @@ using System.Text;
namespace
OnlineStore.LoadCSVLibrary
namespace
OnlineStore.LoadCSVLibrary
{
{
public
class
CSVPositionReader
<
T
>
:
CSVReaderBase
where
T
:
Store
PostionBase
public
class
CSVPositionReader
<
T
>
:
CSVReaderBase
where
T
:
PostionBase
{
{
/// <summary>
/// <summary>
/// 所有的位置集合,key=位置
/// 所有的位置集合,key=位置
/// </summary>
/// </summary>
public
static
Dictionary
<
string
,
T
>
allPositionMap
=
new
Dictionary
<
string
,
T
>();
public
static
Dictionary
<
string
,
Dictionary
<
string
,
T
>>
AllPositionMap
=
new
Dictionary
<
string
,
Dictionary
<
string
,
T
>
>();
public
static
List
<
string
>
hasReadFileList
=
new
List
<
string
>();
private
static
List
<
string
>
hasReadFileList
=
new
List
<
string
>();
/// <summary>
/// <summary>
/// 重新加载配置,会删除之前的所有信息,重新读取
/// 重新加载配置,会删除之前的所有信息,重新读取
...
@@ -27,19 +29,25 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -27,19 +29,25 @@ namespace OnlineStore.LoadCSVLibrary
/// <returns></returns>
/// <returns></returns>
public
static
Dictionary
<
String
,
T
>
ReloadCSVFile
(
string
filePath
)
public
static
Dictionary
<
String
,
T
>
ReloadCSVFile
(
string
filePath
)
{
{
allPositionMap
=
new
Dictionary
<
string
,
T
>();
AllPositionMap
=
new
Dictionary
<
string
,
Dictionary
<
string
,
T
>
>();
hasReadFileList
=
new
List
<
string
>();
hasReadFileList
=
new
List
<
string
>();
return
AddCSVFile
(
filePath
);
return
AddCSVFile
(
filePath
);
}
}
p
ublic
static
List
<
string
>
getPositionKeyList
()
p
rivate
static
string
GetTName
()
{
{
return
new
List
<
string
>(
allPositionMap
.
Keys
);
Type
type
=
typeof
(
T
);
return
type
.
Name
;
}
}
public
static
List
<
T
>
getPositionList
()
public
static
List
<
T
>
getPositionList
()
{
{
List
<
T
>
list
=
new
List
<
T
>(
allPositionMap
.
Values
);
string
name
=
GetTName
();
return
list
;
if
(
AllPositionMap
.
ContainsKey
(
name
))
{
List
<
T
>
list
=
new
List
<
T
>(
AllPositionMap
[
name
].
Values
);
return
list
;
}
return
new
List
<
T
>();
}
}
/// <summary>
/// <summary>
/// 添加一个csv文件的数据到位置集合中
/// 添加一个csv文件的数据到位置集合中
...
@@ -54,7 +62,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -54,7 +62,7 @@ namespace OnlineStore.LoadCSVLibrary
return
null
;
return
null
;
}
}
Type
type
=
typeof
(
T
);
Type
type
=
typeof
(
T
);
string
tname
=
GetTName
();
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
if
(
proTitleMap
.
Count
<=
4
)
if
(
proTitleMap
.
Count
<=
4
)
{
{
...
@@ -94,7 +102,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -94,7 +102,7 @@ namespace OnlineStore.LoadCSVLibrary
foreach
(
string
key
in
cvsTitleList
)
foreach
(
string
key
in
cvsTitleList
)
{
{
int
titIndex
=
titleIndex
[
key
];
int
titIndex
=
titleIndex
[
key
];
string
value
=
array
[
titIndex
];
string
value
=
array
[
titIndex
]
.
Trim
()
;
string
proName
=
propertyList
[
listIndex
];
string
proName
=
propertyList
[
listIndex
];
PropertyInfo
prop
=
props
.
First
(
c
=>
c
.
Name
==
proName
);
//获取同名属性
PropertyInfo
prop
=
props
.
First
(
c
=>
c
.
Name
==
proName
);
//获取同名属性
if
(
prop
!=
null
)
if
(
prop
!=
null
)
...
@@ -108,11 +116,16 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -108,11 +116,16 @@ namespace OnlineStore.LoadCSVLibrary
listIndex
++;
listIndex
++;
}
}
result
.
Add
(
PositionNum
,
(
T
)
bllIns
);
result
.
Add
(
PositionNum
,
(
T
)
bllIns
);
if
(
allPositionMap
.
ContainsKey
(
PositionNum
))
if
(!
AllPositionMap
.
ContainsKey
(
tname
))
{
AllPositionMap
.
Add
(
tname
,
new
Dictionary
<
string
,
T
>());
}
if
(
AllPositionMap
[
tname
].
ContainsKey
(
PositionNum
))
{
{
throw
new
PositionAlreadyExistingExection
(
"仓位:"
+
PositionNum
+
"已存在!"
);
throw
new
PositionAlreadyExistingExection
(
"仓位:"
+
PositionNum
+
"已存在!"
);
}
}
allPositionMap
.
Add
(
PositionNum
,
(
T
)
bllIns
);
AllPositionMap
[
tname
]
.
Add
(
PositionNum
,
(
T
)
bllIns
);
}
}
else
else
{
{
...
@@ -137,22 +150,25 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -137,22 +150,25 @@ namespace OnlineStore.LoadCSVLibrary
{
{
return
null
;
return
null
;
}
}
StorePostionBase
result
=
null
;
PostionBase
result
=
null
;
if
(
allPositionMap
.
ContainsKey
(
positionNum
))
string
tname
=
GetTName
();
if
(
AllPositionMap
.
ContainsKey
(
tname
))
{
{
result
=
allPositionMap
[
positionNum
];
if
(
AllPositionMap
[
tname
].
ContainsKey
(
positionNum
))
return
(
T
)
result
;
{
}
result
=
AllPositionMap
[
tname
][
positionNum
];
else
return
(
T
)
result
;
{
}
return
null
;
}
}
return
null
;
}
}
public
static
bool
SavePostion
(
string
filePath
,
T
position
)
public
static
bool
SavePostion
(
string
filePath
,
T
position
)
{
{
Type
type
=
typeof
(
T
);
Type
type
=
typeof
(
T
);
string
tName
=
GetTName
();
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
Dictionary
<
string
,
string
>
proTitleMap
=
getProAttributeMap
(
typeof
(
T
));
if
(
proTitleMap
.
Count
<=
4
)
if
(
proTitleMap
.
Count
<=
4
)
{
{
...
@@ -184,12 +200,16 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -184,12 +200,16 @@ namespace OnlineStore.LoadCSVLibrary
string
value
=
array
[
csvIndex
];
string
value
=
array
[
csvIndex
];
if
(
value
.
Equals
(
position
.
PositionNum
))
if
(
value
.
Equals
(
position
.
PositionNum
))
{
{
//更新缓存
allPositionMap
.
Remove
(
position
.
PositionNum
);
if
(
AllPositionMap
.
ContainsKey
(
tName
))
allPositionMap
.
Add
(
position
.
PositionNum
,
position
);
{
string
newValue
=
PostionToString
(
position
,
titleIndex
,
proTitleMap
);
//更新缓存
lines
[
index
]
=
newValue
;
AllPositionMap
[
tName
].
Remove
(
position
.
PositionNum
);
return
WriteCSVFile
(
filePath
,
lines
);
AllPositionMap
[
tName
].
Add
(
position
.
PositionNum
,
position
);
string
newValue
=
PostionToString
(
position
,
titleIndex
,
proTitleMap
);
lines
[
index
]
=
newValue
;
return
WriteCSVFile
(
filePath
,
lines
);
}
}
}
}
}
}
}
...
@@ -198,7 +218,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -198,7 +218,7 @@ namespace OnlineStore.LoadCSVLibrary
return
true
;
return
true
;
}
}
private
static
string
PostionToString
(
Store
PostionBase
position
,
Dictionary
<
string
,
int
>
titleIndex
,
Dictionary
<
string
,
string
>
proTitleMap
)
private
static
string
PostionToString
(
PostionBase
position
,
Dictionary
<
string
,
int
>
titleIndex
,
Dictionary
<
string
,
string
>
proTitleMap
)
{
{
//取得属性集合
//取得属性集合
PropertyInfo
[]
props
=
typeof
(
T
).
GetProperties
();
PropertyInfo
[]
props
=
typeof
(
T
).
GetProperties
();
...
@@ -230,28 +250,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -230,28 +250,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
return
newStr
;
return
newStr
;
}
}
//private void ReadTest( )
//{
// Dictionary<string, string> dic = new Dictionary<string, string>();
// string path = Application.StartupPath + @"\Test.csv";
// dic.Add("AxisPosition", "中轴位置");
// dic.Add("ModbusHighPosition", "电钢高位");
// dic.Add("ModbusLowPosition", "电钢低位");
// Dictionary<string, KTKStorePostion> ddd = LoadCVSLibrary.CSVReaderHelper<KTKStorePostion>.ReadCVS(path, dic, typeof(KTKStorePostion));
// if (ddd != null)
// {
// MessageBox.Show("读取成功!");
// }
// else
// {
// MessageBox.Show("读取失败,请检查数据格式!");
// }
//}
}
}
...
...
source/LoadCVSLibrary/position/
Store
PostionBase.cs
→
source/LoadCVSLibrary/position/PostionBase.cs
查看文件 @
d4450cb
...
@@ -6,7 +6,7 @@ using System.Text;
...
@@ -6,7 +6,7 @@ using System.Text;
namespace
OnlineStore.LoadCSVLibrary
namespace
OnlineStore.LoadCSVLibrary
{
{
public
class
Store
PostionBase
public
class
PostionBase
{
{
/// <summary>
/// <summary>
/// 位置
/// 位置
...
...
source/LoadCVSLibrary/position/ShelfPosition.cs
0 → 100644
查看文件 @
d4450cb
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
OnlineStore.LoadCSVLibrary
{
public
class
ShelfPosition
:
PostionBase
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[
CSVAttribute
(
"料仓ID"
)]
public
int
StoreId
{
get
;
set
;
}
/// <summary>
/// 旋转轴位置
/// </summary>
[
CSVAttribute
(
"旋转轴位置"
)]
public
int
MiddleAxis_P100
{
get
;
set
;
}
/// <summary>
/// 升降轴高点
/// </summary>
[
CSVAttribute
(
"升降轴低点"
)]
public
int
UpDownAxis_HP100
{
get
;
set
;
}
/// <summary>
/// 升降轴高点
/// /// </summary>
[
CSVAttribute
(
"升降轴高点"
)]
public
int
UpDownAxis_LP100
{
get
;
set
;
}
/// <summary>
/// 进出轴位置
/// </summary>
[
CSVAttribute
(
"进出轴位置"
)]
public
int
UpDownAxis_P100
{
get
;
set
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论