Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7073b288
由
LN
编写于
2020-01-04 10:20:11 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加入料口移门启用配置。增加出库完成处理。
1 个父辈
123aacbd
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
184 行增加
和
36 行删除
source/ACPackingStore/App.config
source/Common/Setting_Init.cs
source/Common/util/LogUtil.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/ACPackingStore/EnteryDoorBean.cs
source/DeviceLibrary/ACPackingStore/StoreManager.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/device/RFID/RFIDManager.cs
source/ACPackingStore/App.config
查看文件 @
7073b28
...
...
@@ -51,7 +51,9 @@
<
add
key
=
"AgvServerIp"
value
=
"192.168.103.22"
/>
<
add
key
=
"CodeCount"
value
=
"2"
/>
<!--检测到料架后自动开始入库-->
<
add
key
=
"AutoShelfInstore"
value
=
"1"
/>
<
add
key
=
"AutoShelfInstore"
value
=
"1"
/>
<!--是否启用入料口移门,
1
=启用,
0
=禁用-->
<
add
key
=
"UseDoor"
value
=
"1"
/>
</
appSettings
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
source/Common/Setting_Init.cs
查看文件 @
7073b28
...
...
@@ -101,5 +101,6 @@ namespace OnlineStore.Common
public
static
string
AgvServerIp
=
"AgvServerIp"
;
public
static
string
CodeCount
=
"CodeCount"
;
public
static
string
AutoShelfInstore
=
"AutoShelfInstore"
;
public
static
string
UseDoor
=
"UseDoor"
;
}
}
source/Common/util/LogUtil.cs
查看文件 @
7073b28
...
...
@@ -122,6 +122,8 @@ namespace OnlineStore.Common
{
text
+=
str
;
}
System
.
DateTime
now
=
System
.
DateTime
.
Now
;
logList
.
Add
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
if
(
logBox
==
null
)
{
return
;
...
...
@@ -129,8 +131,6 @@ namespace OnlineStore.Common
logBox
.
Text
=
text
;
System
.
DateTime
now
=
System
.
DateTime
.
Now
;
logList
.
Add
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
// logBox.Focus(); //使文本框获取焦点
logBox
.
AppendText
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
//增加文本
logBox
.
Select
(
logBox
.
Text
.
Length
,
0
);
//设置光标的位置到文本尾
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
查看文件 @
7073b28
...
...
@@ -18,6 +18,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
partial
class
AC_BOX_Bean
:
KTK_Store
{
private
ShelfData
serverShelfData
=
null
;
public
EnteryDoorBean
DoorBean
=
null
;
private
bool
IsIntSlvBlock
=
false
;
public
AutoInoutInfo
AutoInout
=
new
AutoInoutInfo
();
...
...
@@ -197,11 +198,7 @@ namespace OnlineStore.DeviceLibrary
public
string
GetWarnMsg
()
{
string
msg
=
WarnMsg
;
//if (IOValue(IO_Type.DoorLimit).Equals(IO_VALUE.LOW))
//{
// msg = msg + " 前门未关";
//}
string
msg
=
WarnMsg
;
if
(
IOValue
(
IO_Type
.
DoorLimit
).
Equals
(
IO_VALUE
.
LOW
))
{
msg
=
msg
+
" 无门禁信号"
;
...
...
@@ -209,8 +206,7 @@ namespace OnlineStore.DeviceLibrary
if
(
humBean
.
TempOrHumidityIsAlarm
)
{
msg
=
msg
+
" 温湿度报警["
+
humBean
.
TempAlarmTime
.
ToLongTimeString
()
+
"]"
;
}
}
return
msg
;
}
...
...
@@ -218,11 +214,9 @@ namespace OnlineStore.DeviceLibrary
#
region
原点返回和复位处理
private
void
ReturnHome
()
{
AutoInout
.
ClearCount
();
AutoInout
.
ClearCount
();
storeRunStatus
=
StoreRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
StoreMoveType
.
ReturnHome
);
MoveInfo
.
NewMove
(
StoreMoveType
.
ReturnHome
);
InoutStartReset
();
}
public
void
MoveToP1
()
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
7073b28
...
...
@@ -1067,8 +1067,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
" 启动出库【"
+
param
.
ToStr
()
+
"】出错,找不到库位信息"
);
return
false
;
}
serverShelfData
=
null
;
storeStatus
=
StoreStatus
.
OutStoreExecute
;
storeRunStatus
=
StoreRunStatus
.
Busy
;
MoveInfo
.
NewMove
(
StoreMoveType
.
OutStore
,
param
);
...
...
@@ -1186,6 +1186,17 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog
(
"出库 "
+
MoveInfo
.
SLog
+
":放下物品,压紧轴到P1,升降轴至P101 "
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P1
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_LP101
,
Config
.
UpDownAxis_P101_Speed
);
Task
.
Factory
.
StartNew
(
delegate
{
int
posLoc
=
ShelfPosList
.
IndexOf
(
MoveInfo
.
MoveParam
.
ShelfPosID
);
string
msg
=
StoreManager
.
PutShelfFinished
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LastShelfData
.
ToStr
(),
posLoc
.
ToString
(),
out
serverShelfData
);
if
(
String
.
IsNullOrEmpty
(
msg
).
Equals
(
false
))
{
LogUtil
.
error
(
Name
+
"【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【"
+
LastShelfData
+
"】【"
+
posLoc
+
"】PutShelfFinished 结果:"
+
msg
);
serverShelfData
=
null
;
}
});
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_12_DevicePutWare
)
{
...
...
@@ -1204,7 +1215,27 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_14_GoBack
)
{
//判断是否需要送出料架
if
(
EmprtShelfList
.
Count
<=
0
)
bool
isNeedSend
=
false
;
//包装料料仓料架=A
if
(
EmprtShelfList
.
Count
<=
0
)
{
InOutStoreLog
(
"出库完成,料架【"
+
LastShelfData
+
"】没有剩余位置,送出料架"
);
isNeedSend
=
true
;
}
else
if
(
serverShelfData
!=
null
)
{
if
(
serverShelfData
.
packageEmpty
<=
0
)
{
InOutStoreLog
(
"出库完成,料架【"
+
LastShelfData
+
"】没有位置,packageEmpty="
+
serverShelfData
.
packageEmpty
+
",送出料架"
);
isNeedSend
=
true
;
}
else
if
((
serverShelfData
.
cutPackageTask
+
serverShelfData
.
packageTask
)
<=
0
)
{
InOutStoreLog
(
"出库完成,料架【"
+
LastShelfData
+
"】没有出库任务,cutPackageTask="
+
serverShelfData
.
cutPackageTask
+
",packageTask="
+
serverShelfData
.
packageTask
+
",送出料架"
);
isNeedSend
=
true
;
}
}
if
(
isNeedSend
)
{
StartShelfOut
();
}
...
...
source/DeviceLibrary/ACPackingStore/EnteryDoorBean.cs
查看文件 @
7073b28
...
...
@@ -103,7 +103,11 @@ namespace OnlineStore.DeviceLibrary
public
bool
StartOpen
(
StoreMoveInfo
moveInfo
)
{
return
false
;
bool
UseDoor
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
UseDoor
).
Equals
(
1
);
if
(!
UseDoor
)
{
return
false
;
}
if
(
moveInfo
!=
null
)
{
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
EntranceDoor_Open
,
IO_VALUE
.
HIGH
));
...
...
@@ -114,7 +118,11 @@ namespace OnlineStore.DeviceLibrary
}
public
bool
StartClose
(
StoreMoveInfo
moveInfo
)
{
return
false
;
bool
UseDoor
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
UseDoor
).
Equals
(
1
);
if
(!
UseDoor
)
{
return
false
;
}
if
(
moveInfo
!=
null
)
{
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
EntranceDoor_Close
,
IO_VALUE
.
HIGH
));
...
...
source/DeviceLibrary/ACPackingStore/StoreManager.cs
查看文件 @
7073b28
...
...
@@ -17,17 +17,18 @@ namespace OnlineStore.DeviceLibrary
/// 当前出入库的模式
/// </summary>
public
static
int
CurrInOutType
=
0
;
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
static
PackingStoreBean
Store
=
null
;
public
static
Store_Config
Config
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
AllConfigMap
=
null
;
public
static
Dictionary
<
int
,
BaseConfig
>
AllConfigMap
=
null
;
private
static
bool
isInit
=
false
;
public
static
bool
IsConnectServer
=
!
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
).
Equals
(
""
);
public
StoreManager
()
{
}
#
region
配置文件加载更新
public
static
void
CheckEnum
(
Type
type
)
{
if
(
type
.
IsEnum
)
...
...
@@ -37,7 +38,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(
valueList
.
Contains
(
item
))
{
LogUtil
.
error
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码,即将 退出程序!"
);
LogUtil
.
error
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码,即将 退出程序!"
);
MessageBox
.
Show
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码,即将 退出程序!"
);
Application
.
Exit
();
break
;
...
...
@@ -143,12 +144,12 @@ namespace OnlineStore.DeviceLibrary
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary>
/// <param name="kTK_LA_Store_Config"></param>
public
static
bool
UpdateBoxConfig
(
AC_BOX_Config
storeConfig
)
public
static
bool
UpdateBoxConfig
(
AC_BOX_Config
storeConfig
)
{
try
{
//位置配置到文件中
string
appPath
=
Application
.
StartupPath
;
string
appPath
=
Application
.
StartupPath
;
string
configFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
BOX_ConfigPath
);
if
(!
Directory
.
Exists
(
configFile
))
{
...
...
@@ -170,8 +171,14 @@ namespace OnlineStore.DeviceLibrary
catch
(
Exception
ex
)
{
LOGGER
.
Error
(
"出错:"
,
ex
);
}
return
false
;
}
return
false
;
}
#
endregion
#
region
位置加载
public
static
bool
LoadInoutParam
(
InOutParam
param
,
bool
needCheckShelf
,
AC_BOX_Bean
box
)
{
if
(
param
==
null
)
...
...
@@ -218,7 +225,7 @@ namespace OnlineStore.DeviceLibrary
p
.
UpDown_P12
=
box
.
Config
.
UpDownAxis_P12
;
p
.
ComPress_P2
=
box
.
Config
.
GetComP2
(
position
.
BagHigh
).
TargetComP2
();
p
.
ComPress_P3
=
p
.
ComPress_P2
+
box
.
Config
.
CompAxis_P3_P2_Value
;
p
.
ComPress_P3
=
p
.
ComPress_P2
+
box
.
Config
.
CompAxis_P3_P2_Value
;
p
.
InOut_P3
=
position
.
InoutAxis_P3
;
p
.
Middle_P2
=
position
.
MiddleAxis_P2
;
p
.
UpDown_P3
=
position
.
UpdownAxis_IH_P3
;
...
...
@@ -239,8 +246,11 @@ namespace OnlineStore.DeviceLibrary
}
return
true
;
}
private
static
string
api_communication
=
"service/store/communication"
;
//流水线状态通信接口
private
static
string
api_nextFeeder
=
"service/store/nextFeeder"
;
// 出库站位列表切换接口
#
endregion
private
static
string
api_communication
=
"service/store/communication"
;
//流水线状态通信接口
public
static
string
GetPostApi
(
string
host
)
{
if
(
host
==
""
)
...
...
@@ -257,21 +267,122 @@ namespace OnlineStore.DeviceLibrary
}
return
host
+
api_communication
;
}
p
ublic
static
string
GetNextFeederApi
(
string
host
)
p
rivate
static
string
GetAddr
(
string
addr
,
Dictionary
<
string
,
string
>
paramsMap
)
{
if
(
host
==
""
)
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
if
(
server
.
EndsWith
(
"/"
))
{
host
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
server
=
server
.
Substring
(
0
,
server
.
Length
-
1
);
}
if
(!
host
.
StartsWith
(
"http://"
))
string
path
=
server
+
addr
.
Trim
()
+
"?"
;
foreach
(
string
paramName
in
paramsMap
.
Keys
)
{
host
=
"http://"
+
host
;
string
par
=
System
.
Web
.
HttpUtility
.
UrlEncode
(
paramsMap
[
paramName
],
System
.
Text
.
Encoding
.
UTF8
);
path
+=
paramName
+
"="
+
par
+
"&"
;
}
if
(!
host
.
EndsWith
(
"/"
))
path
=
path
.
Substring
(
0
,
path
.
Length
-
1
);
return
path
;
}
/// <summary>
/// 3 放入料架(A,B,C,D)后调用,根据返回值决定当前料架是否放满,以及后续是否还有任务
// 地址: /rest/api/qisda/device/putShelfFinished
/// </summary>
private
static
string
Addr_putShelfFinished
=
"/rest/api/qisda/device/putShelfFinished"
;
public
static
string
PutShelfFinished
(
string
deviceName
,
string
barcode
,
string
rfid
,
string
rfidPosId
,
out
ShelfData
shelfData
)
{
string
msg
=
""
;
shelfData
=
null
;
try
{
host
=
host
+
"/"
;
Dictionary
<
string
,
string
>
paramMap
=
new
Dictionary
<
string
,
string
>();
paramMap
.
Add
(
"barcode"
,
barcode
);
// 参数: barcode=料盘的条码
paramMap
.
Add
(
"rfid"
,
rfid
);
// rfid = 料架的RFID信息
paramMap
.
Add
(
"rfidLoc"
,
rfidPosId
);
// rfidLoc=料架的架位信息
// paramMap.Add("robotIndex", "0"); // robotIndex = 机器人编号(非机器人放置时不传此参数), IP为51的机器人为1, 52的机器人为2, 53的机器人为3
string
server
=
GetAddr
(
Addr_putShelfFinished
,
paramMap
);
string
resultStr
=
HttpHelper
.
Post
(
server
,
""
);
LogUtil
.
info
(
"PutShelfFinished 【"
+
server
+
"】【"
+
resultStr
+
"】"
);
// 返回: {"code": 0, "msg":"ok", "data":{"rfid":"xxx","smallEmpty":0,"bigEmpty":0, "packageEmpty":0,"cutPackageTask":0,"packageTask":10,"cutTask":10, "smallTask":5, "bigTask":5}
ServerData
serverResult
=
JsonHelper
.
DeserializeJsonToObject
<
ServerData
>(
resultStr
);
if
(
serverResult
==
null
)
{
return
msg
=
deviceName
+
"PutShelfFinished【 "
+
barcode
+
"】【"
+
rfid
+
"】【"
+
rfidPosId
+
"】没有收到服务器反馈"
;
}
else
if
(
serverResult
.
code
.
Equals
(
0
).
Equals
(
false
))
{
return
msg
=
deviceName
+
" PutShelfFinished【 "
+
barcode
+
"】【"
+
rfid
+
"】【"
+
rfidPosId
+
"】 :"
+
serverResult
.
msg
;
}
if
(
String
.
IsNullOrEmpty
(
serverResult
.
data
).
Equals
(
false
))
{
shelfData
=
JsonHelper
.
DeserializeJsonToObject
<
ShelfData
>(
serverResult
.
data
);
}
}
return
host
+
api_nextFeeder
;
catch
(
Exception
ex
)
{
LogUtil
.
error
(
deviceName
+
" "
+
ex
.
ToString
());
}
return
""
;
}
}
public
class
ServerData
{
//{"code":0,"msg":"ok","data":"7"}
//返回: {"code": 0, "msg":"ok", "data":{"rfid":"xxx","smallEmpty":0,"bigEmpty":0, "packageEmpty":0,"cutPackageTask":0,"packageTask":10,"cutTask":10, "smallTask":5, "bigTask":5}
public
int
code
{
get
;
set
;
}
public
string
msg
{
get
;
set
;
}
public
string
data
{
get
;
set
;
}
}
public
class
ShelfData
{
/// <summary>
/// rfid: 当前料架的RFID
/// </summary>
public
string
rfid
{
get
;
set
;
}
/// <summary>
/// packageEmpty: 当前料架还可放置的包装料的数量(C料架和A料架有值, 其他料架为0)
/// </summary>
public
int
packageEmpty
{
get
;
set
;
}
/// <summary>
/// smallEmpty: 当前料架还可放置的小料盘(7x8)的数量(D料架, 其他料架为0)
/// </summary>
public
int
smallEmpty
{
get
;
set
;
}
/// <summary>
/// bigEmpty:当前料架还可放置的大料盘的数量(C料架, 其他料架为0)
/// </summary>
public
int
bigEmpty
{
get
;
set
;
}
/// <summary>
/// cutPackageTask:还有多少盘分盘的包装料任务(放到A料架上, 转运到分盘区)
/// </summary>
public
int
cutPackageTask
{
get
;
set
;
}
/// <summary>
/// packageTask:还有多少盘包装料任务(放到A料架上, 并转运到包装线, 最终到C料架)
/// </summary>
public
int
packageTask
{
get
;
set
;
}
/// <summary>
/// cutTask: 还有多少盘分盘料任务(放置到料串B上, 转运到分盘区)
/// </summary>
public
int
cutTask
{
get
;
set
;
}
/// <summary>
/// smallTask: 还有多少盘小料任务(放置到双层线的D料架上)
/// </summary>
public
int
smallTask
{
get
;
set
;
}
/// <summary>
/// bigTask: 还有多少盘大料任务(放置到C料架上)
/// </summary>
public
int
bigTask
{
get
;
set
;
}
// rfid: 当前料架的RFID
// packageEmpty: 当前料架还可放置的包装料的数量(C料架和A料架有值, 其他料架为0)
// smallEmpty: 当前料架还可放置的小料盘(7x8)的数量(D料架, 其他料架为0)
// bigEmpty:当前料架还可放置的大料盘的数量(C料架, 其他料架为0)
// cutPackageTask:还有多少盘分盘的包装料任务(放到A料架上, 转运到分盘区)
// packageTask:还有多少盘包装料任务(放到A料架上, 并转运到包装线, 最终到C料架)
// cutTask: 还有多少盘分盘料任务(放置到料串B上, 转运到分盘区)
// smallTask: 还有多少盘小料任务(放置到双层线的D料架上)
// bigTask: 还有多少盘大料任务(放置到C料架上)
}
}
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
7073b28
...
...
@@ -59,6 +59,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
...
...
source/DeviceLibrary/device/RFID/RFIDManager.cs
查看文件 @
7073b28
...
...
@@ -102,7 +102,7 @@ namespace OnlineStore.DeviceLibrary
}
public
string
ToStr
()
{
return
"
["
+
RFType
+
"],["
+
Num
+
"]
"
;
return
"
"
+
RFType
+
""
+
Num
.
ToString
().
PadLeft
(
2
,
'0'
)
+
"
"
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论