Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1053_CycleLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit bc154b7d
由
刘韬
编写于
2023-03-10 09:06:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
40e19609
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
208 行增加
和
56 行删除
Common/Common.csproj
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/IOManager.cs
DeviceLibrary/DeviceLibrary/RobotMoveHelper.cs
DeviceLibrary/VirtuallyStore/VLog.cs
DeviceLibrary/VirtuallyStore/VStore.cs
DeviceLibrary/packages.config
DeviceLibrary/theMachine/DeviceBase.cs
DeviceLibrary/theMachine/RobotManage.cs
DeviceLibrary/theMachine/sub/MI.cs
LoadCVSLibrary/LoadCSVLibrary.csproj
LoadCVSLibrary/app.config
RemoteSheardObject/Class1.cs
RemoteSheardObject/EquipMsgData.cs
RemoteSheardObject/MyWebClient.cs
RemoteSheardObject/NgMsgData.cs
RemoteSheardObject/RemoteSheardObject.csproj
RemoteSheardObject/TheLine.cs
RemoteSheardObject/packages.config
TheMachine/App.config
TheMachine/Form1.cs
TheMachine/Properties/Resources.Designer.cs
TheMachine/TheMachine.csproj
TheMachine/device/Other/MycronicControl.cs
Common/Common.csproj
查看文件 @
bc154b7
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>MyCommon</AssemblyName>
<AssemblyName>MyCommon</AssemblyName>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<TargetFrameworkProfile />
</PropertyGroup>
</PropertyGroup>
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
bc154b7
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeviceLibrary</RootNamespace>
<RootNamespace>DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName>
<AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<TargetFrameworkProfile />
...
...
DeviceLibrary/DeviceLibrary/IOManager.cs
查看文件 @
bc154b7
...
@@ -4,6 +4,7 @@ using OnlineStore.DeviceLibrary.IO;
...
@@ -4,6 +4,7 @@ using OnlineStore.DeviceLibrary.IO;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
...
@@ -26,6 +27,18 @@ namespace DeviceLibrary
...
@@ -26,6 +27,18 @@ namespace DeviceLibrary
{
{
ConfigIO
configIo
=
StoreManager
.
Config
.
DOList
[
device
][
ioType
];
ConfigIO
configIo
=
StoreManager
.
Config
.
DOList
[
device
][
ioType
];
instance
.
WriteSingleDO
(
configIo
.
DeviceName
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
instance
.
WriteSingleDO
(
configIo
.
DeviceName
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
if
(
configIo
.
GetIOAddr
()
==
9
||
configIo
.
GetIOAddr
()
==
12
)
{
LogUtil
.
info
(
$
"{configIo.GetIOAddr()}=={ioValue},device={device},ioType={ioType}"
);
StackTrace
stackTrace
=
new
StackTrace
();
for
(
int
i
=
0
;
i
<
stackTrace
.
FrameCount
;
i
++)
{
StackFrame
stackFrame
=
stackTrace
.
GetFrame
(
i
);
string
fileName
=
stackFrame
.
GetFileName
();
int
lineNumber
=
stackFrame
.
GetFileLineNumber
();
LogUtil
.
info
(
$
"Function {stackFrame.GetMethod().Name} called from {fileName}, line {lineNumber}"
);
}
}
//Thread.Sleep(60);
//Thread.Sleep(60);
}
}
else
else
...
...
DeviceLibrary/DeviceLibrary/RobotMoveHelper.cs
查看文件 @
bc154b7
using
OnlineStore
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
RemoteSheardObject
;
using
Robot.UR
;
using
Robot.UR
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -15,8 +16,10 @@ namespace DeviceLibrary
...
@@ -15,8 +16,10 @@ namespace DeviceLibrary
int
lastMoveCmd
=
0
;
int
lastMoveCmd
=
0
;
URRobotControl
robot
;
URRobotControl
robot
;
System
.
Timers
.
Timer
RobotCheck
;
System
.
Timers
.
Timer
RobotCheck
;
public
RobotHelper
(
URRobotControl
_robot
)
{
string
Robotname
;
public
RobotHelper
(
URRobotControl
_robot
,
string
robotname
)
{
robot
=
_robot
;
robot
=
_robot
;
Robotname
=
robotname
;
RobotCheck
=
new
System
.
Timers
.
Timer
(
5000
);
RobotCheck
=
new
System
.
Timers
.
Timer
(
5000
);
RobotCheck
.
Elapsed
+=
RobotCheck_Elapsed
;
RobotCheck
.
Elapsed
+=
RobotCheck_Elapsed
;
...
@@ -60,6 +63,23 @@ namespace DeviceLibrary
...
@@ -60,6 +63,23 @@ namespace DeviceLibrary
}
}
else
else
RobotStatus
=
true
;
RobotStatus
=
true
;
uploadStatus
();
}
void
uploadStatus
()
{
EquipMsgData
equipMsg
=
new
EquipMsgData
();
equipMsg
.
msgList
=
new
List
<
EquipMessage
>();
equipMsg
.
status
=
RobotStatus
?
1
:
2
;
if
(!
RobotStatus
)
{
equipMsg
.
msgList
.
Add
(
new
EquipMessage
()
{
msg
=
crc
.
GetString
(
"Res0058"
,
"机器人当前不可用"
),
type
=
EquipMessage
.
ConvertType
(
MsgLevel
.
alarm
.
ToString
())
});
}
equipMsg
.
equipName
=
Robotname
;
TheLine
.
UploadStatus
(
equipMsg
);
}
}
public
void
Move
(
MoveInfo
moveInfo
,
int
movecmd
)
{
public
void
Move
(
MoveInfo
moveInfo
,
int
movecmd
)
{
if
(
moveInfo
!=
null
)
if
(
moveInfo
!=
null
)
...
...
DeviceLibrary/VirtuallyStore/VLog.cs
查看文件 @
bc154b7
...
@@ -19,6 +19,8 @@ namespace DeviceLibrary
...
@@ -19,6 +19,8 @@ namespace DeviceLibrary
public
void
Info
(
string
txt
)
{
public
void
Info
(
string
txt
)
{
if
(
String
.
Compare
(
lastinfo
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
if
(
String
.
Compare
(
lastinfo
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
return
;
lastinfo
=
txt
;
if
(
Prefix
!=
""
)
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
txt
=
$
"[{Prefix}] "
+
txt
;
...
@@ -29,6 +31,8 @@ namespace DeviceLibrary
...
@@ -29,6 +31,8 @@ namespace DeviceLibrary
{
{
if
(
String
.
Compare
(
lasterr
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
if
(
String
.
Compare
(
lasterr
,
txt
,
StringComparison
.
Ordinal
)
==
0
)
return
;
return
;
lasterr
=
txt
;
if
(
Prefix
!=
""
)
if
(
Prefix
!=
""
)
txt
=
$
"[{Prefix}] "
+
txt
;
txt
=
$
"[{Prefix}] "
+
txt
;
log
.
Error
(
txt
);
log
.
Error
(
txt
);
...
...
DeviceLibrary/VirtuallyStore/VStore.cs
查看文件 @
bc154b7
...
@@ -103,6 +103,8 @@ namespace DeviceLibrary
...
@@ -103,6 +103,8 @@ namespace DeviceLibrary
else
if
((
DateTime
.
Now
-
LastStatusTime
).
TotalSeconds
>
30
)
else
if
((
DateTime
.
Now
-
LastStatusTime
).
TotalSeconds
>
30
)
{
{
TerminalError
=
true
;
TerminalError
=
true
;
if
(
InStoreJobInfo
!=
null
)
CurrentTerminalReelID
=
InStoreJobInfo
.
WareNum
;
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreReady
)
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreReady
)
{
{
VLog
.
Error
(
$
"入库超时出错,没有执行入库过程,RTStoreStatus={RTStoreStatus}:"
+
InStoreJobInfo
?.
ToStr
());
VLog
.
Error
(
$
"入库超时出错,没有执行入库过程,RTStoreStatus={RTStoreStatus}:"
+
InStoreJobInfo
?.
ToStr
());
...
@@ -256,7 +258,7 @@ namespace DeviceLibrary
...
@@ -256,7 +258,7 @@ namespace DeviceLibrary
}
}
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreError
)
if
(
RTStoreStatus
==
RTStoreStatus
.
InStoreError
)
{
{
return
crc
.
GetString
(
"Res0069"
,
"入库出错,物料NG"
);
return
crc
.
GetString
(
"Res0069"
,
"入库出错,物料NG"
)
+
" Barcode:"
+
InStoreJobInfo
?.
WareNum
;
}
}
return
crc
.
GetString
(
"Res0070"
,
"空闲中"
);
return
crc
.
GetString
(
"Res0070"
,
"空闲中"
);
}
}
...
...
DeviceLibrary/packages.config
查看文件 @
bc154b7
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
<
packages
>
<
packages
>
<
package
id
=
"Fleck"
version
=
"1.2.0"
targetFramework
=
"net461"
/>
<
package
id
=
"Fleck"
version
=
"1.2.0"
targetFramework
=
"net461"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net461"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net461"
/>
<
package
id
=
"System.ValueTuple"
version
=
"4.5.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.ValueTuple"
version
=
"4.5.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
</
packages
>
</
packages
>
\ No newline at end of file
\ No newline at end of file
DeviceLibrary/theMachine/DeviceBase.cs
查看文件 @
bc154b7
...
@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
...
@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using
RemoteSheardObject
;
using
RemoteSheardObject
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
...
@@ -37,10 +38,10 @@ namespace DeviceLibrary
...
@@ -37,10 +38,10 @@ namespace DeviceLibrary
equipMsg
.
msgList
.
Add
(
new
EquipMessage
()
equipMsg
.
msgList
.
Add
(
new
EquipMessage
()
{
{
msg
=
ml
.
msgtxt
,
msg
=
ml
.
msgtxt
,
status
=
ml
.
msgLevel
==
MsgLevel
.
alarm
?
1
:
0
type
=
EquipMessage
.
ConvertType
(
ml
.
msgLevel
.
ToString
())
});
});
if
(
ml
.
msgLevel
==
MsgLevel
.
alarm
)
if
(
ml
.
msgLevel
==
MsgLevel
.
alarm
)
equipMsg
.
status
=
1
;
equipMsg
.
status
=
2
;
});
});
equipMsg
.
equipName
=
GroupName
;
equipMsg
.
equipName
=
GroupName
;
TheLine
.
UploadStatus
(
equipMsg
);
TheLine
.
UploadStatus
(
equipMsg
);
...
@@ -253,13 +254,6 @@ namespace DeviceLibrary
...
@@ -253,13 +254,6 @@ namespace DeviceLibrary
StopMove
(
true
);
StopMove
(
true
);
//storeStatus = StoreStatus.SuddenStop;
//storeStatus = StoreStatus.SuddenStop;
}
}
//else if (_alarmType.Equals(AlarmType.NoAirCheck))
//{
// //isNoAirCheck = true;
// LogUtil.error(Name + " 未检测到气压信号 ,停止运动, 打开报警灯 ");
// StopMove(true);
// //storeStatus = StoreStatus.SuddenStop;
//}
}
}
internal
bool
NoAlarm
()
internal
bool
NoAlarm
()
{
{
...
@@ -290,14 +284,41 @@ namespace DeviceLibrary
...
@@ -290,14 +284,41 @@ namespace DeviceLibrary
public
IO_VALUE
IOValue
(
string
ioType
)
=>
IOManager
.
IOValue
(
ioType
,
GroupName
);
public
IO_VALUE
IOValue
(
string
ioType
)
=>
IOManager
.
IOValue
(
ioType
,
GroupName
);
public
void
IOMove
(
string
IoType
,
IO_VALUE
value
,
int
msTime
=
0
)
public
void
IOMove
(
string
IoType
,
IO_VALUE
value
,
int
msTime
=
0
)
{
{
if
(
msTime
<=
0
)
if
(
msTime
<=
0
)
{
{
IOManager
.
IOMove
(
IoType
,
value
,
GroupName
);
IOManager
.
IOMove
(
IoType
,
value
,
GroupName
);
//if (IoType == "Ls_A_BufStop_Fwd" || IoType == "Ls_B_BufStop_Fwd")
//{
// LogUtil.info($"{IoType}=={value},device={GroupName},msTime={msTime}");
// StackTrace stackTrace = new StackTrace();
// for (int i = 0; i < stackTrace.FrameCount; i++)
// {
// StackFrame stackFrame = stackTrace.GetFrame(i);
// string fileName = stackFrame.GetFileName();
// int lineNumber = stackFrame.GetFileLineNumber();
// LogUtil.info($"-Function {stackFrame.GetMethod().Name} called from {fileName}, line {lineNumber}");
// }
//}
}
}
else
else
{
{
Task
.
Run
(()
=>
Task
.
Run
(()
=>
{
{
//if (IoType == "Ls_A_BufStop_Fwd" || IoType == "Ls_B_BufStop_Fwd")
//{
// LogUtil.info($"Task {IoType}=={value},device={GroupName},msTime={msTime}");
// StackTrace stackTrace = new StackTrace();
// for (int i = 0; i < stackTrace.FrameCount; i++)
// {
// StackFrame stackFrame = stackTrace.GetFrame(i);
// string fileName = stackFrame.GetFileName();
// int lineNumber = stackFrame.GetFileLineNumber();
// LogUtil.info($"Task -Function {stackFrame.GetMethod().Name} called from {fileName}, line {lineNumber}");
// }
//}
IOManager
.
IOMove
(
IoType
,
value
,
GroupName
);
IOManager
.
IOMove
(
IoType
,
value
,
GroupName
);
Thread
.
Sleep
(
msTime
);
Thread
.
Sleep
(
msTime
);
IO_VALUE
tValue
=
value
.
Equals
(
IO_VALUE
.
HIGH
)
?
IO_VALUE
.
LOW
:
IO_VALUE
.
HIGH
;
IO_VALUE
tValue
=
value
.
Equals
(
IO_VALUE
.
HIGH
)
?
IO_VALUE
.
LOW
:
IO_VALUE
.
HIGH
;
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
bc154b7
...
@@ -137,6 +137,7 @@ namespace DeviceLibrary
...
@@ -137,6 +137,7 @@ namespace DeviceLibrary
if
(!
IsConfigMode
)
if
(!
IsConfigMode
)
return
;
return
;
}
}
LogUtil
.
info
(
"开始启动设备线程"
);
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Start
));
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Start
));
mainThread
.
Start
();
mainThread
.
Start
();
VStoreCollection
.
Start
();
VStoreCollection
.
Start
();
...
...
DeviceLibrary/theMachine/sub/MI.cs
查看文件 @
bc154b7
...
@@ -46,16 +46,19 @@ namespace DeviceLibrary
...
@@ -46,16 +46,19 @@ namespace DeviceLibrary
Msg
=
new
MsgService
(
GroupName
+
"-T"
);
Msg
=
new
MsgService
(
GroupName
+
"-T"
);
MoveInfo
=
new
MoveInfo
(
GroupName
+
"-T"
);
MoveInfo
=
new
MoveInfo
(
GroupName
+
"-T"
);
RoboMoveInfo
=
new
MoveInfo
(
GroupName
+
"-Robo"
);
RoboMoveInfo
=
new
MoveInfo
(
GroupName
+
"-Robo"
);
string
robotname
=
""
;
if
(
device
.
GroupName
==
"AMH-MI1"
)
if
(
device
.
GroupName
==
"AMH-MI1"
)
{
{
Robot
=
RobotManage
.
Robot_MI1
;
Robot
=
RobotManage
.
Robot_MI1
;
robotname
=
"R1"
;
}
}
else
else
{
{
Robot
=
RobotManage
.
Robot_MI2
;
Robot
=
RobotManage
.
Robot_MI2
;
POS_Start
=
"MI2"
;
POS_Start
=
"MI2"
;
robotname
=
"R2"
;
}
}
robotHelper
=
new
RobotHelper
(
Robot
);
robotHelper
=
new
RobotHelper
(
Robot
,
robotname
);
Comp
=
AxisBean
.
List
[
DeviceGroup
.
GroupName
][
0
];
Comp
=
AxisBean
.
List
[
DeviceGroup
.
GroupName
][
0
];
//Rotate = AxisBean.List[DeviceGroup.GroupName][1];
//Rotate = AxisBean.List[DeviceGroup.GroupName][1];
BufferSlotsManger
=
new
BufferSlotsManger
(
POS_Start
);
BufferSlotsManger
=
new
BufferSlotsManger
(
POS_Start
);
...
@@ -236,7 +239,7 @@ namespace DeviceLibrary
...
@@ -236,7 +239,7 @@ namespace DeviceLibrary
}
}
else
else
{
{
MoveInfo
.
log
(
"没有找到,在等待出库的料仓
"
);
MoveInfo
.
log
(
"没有找到,在等待出库的料仓
SN:"
+
InStoreError
.
CurrentTerminalReelID
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
TrayStop
.
DeviceList
[
GroupName
].
TrayRelease
();
TrayStop
.
DeviceList
[
GroupName
].
TrayRelease
();
return
;
return
;
...
...
LoadCVSLibrary/LoadCSVLibrary.csproj
查看文件 @
bc154b7
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<TargetFrameworkProfile />
</PropertyGroup>
</PropertyGroup>
...
...
LoadCVSLibrary/app.config
查看文件 @
bc154b7
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
6.1
"
/></
startup
></
configuration
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
8
"
/></
startup
></
configuration
>
RemoteSheardObject/Class1.cs
查看文件 @
bc154b7
using
CodeLibrary
;
using
CodeLibrary
;
using
RemoteSheardObject
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
...
@@ -207,14 +208,18 @@ public class ReelParam
...
@@ -207,14 +208,18 @@ public class ReelParam
}
}
}
}
bool
islog
=
false
;
bool
islog
=
false
;
public
void
logresult
()
/// <summary>
/// NG口位置,1=左侧,2=右侧
/// </summary>
/// <param name="NgPos"></param>
public
void
logresult
(
int
NgPos
=
0
)
{
{
if
(!
islog
)
if
(!
islog
)
{
{
islog
=
true
;
islog
=
true
;
var
datetime
=
DateTime
.
Now
;
var
datetime
=
DateTime
.
Now
;
string
countfile
=
$
"\\Logs\\NGLOG_{datetime:yyyyMMdd}.csv"
;
string
countfile
=
$
"
.
\\Logs\\NGLOG_{datetime:yyyyMMdd}.csv"
;
Directory
.
CreateDirectory
(
"\\Logs\\"
);
Directory
.
CreateDirectory
(
"
.
\\Logs\\"
);
if
(!
File
.
Exists
(
countfile
))
if
(!
File
.
Exists
(
countfile
))
{
{
StreamWriter
sw1
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
StreamWriter
sw1
=
new
StreamWriter
(
countfile
,
true
,
Encoding
.
GetEncoding
(
"GB2312"
));
...
@@ -234,6 +239,15 @@ public class ReelParam
...
@@ -234,6 +239,15 @@ public class ReelParam
sw
.
Dispose
();
sw
.
Dispose
();
}
}
catch
{
}
catch
{
}
Task
.
Run
(()=>
{
NgMsgData
ngMsgData
=
new
NgMsgData
();
ngMsgData
.
ngPos
=
NgPos
;
ngMsgData
.
ngMsg
=
NgMsg
;
ngMsgData
.
barcode
=
WareCode
;
ngMsgData
.
type
=
"1"
;
ngMsgData
.
mType
=
""
;
TheLine
.
uploadNgReel
(
ngMsgData
);
});
}
}
}
}
}
}
...
...
RemoteSheardObject/EquipMsgData.cs
查看文件 @
bc154b7
...
@@ -13,14 +13,34 @@ namespace RemoteSheardObject
...
@@ -13,14 +13,34 @@ namespace RemoteSheardObject
public
string
equipName
{
get
;
set
;
}
public
string
equipName
{
get
;
set
;
}
public
int
ngCount
{
get
;
set
;
}
public
int
ngCount
{
get
;
set
;
}
public
List
<
EquipMessage
>
msgList
{
get
;
set
;
}
public
List
<
EquipMessage
>
msgList
{
get
;
set
;
}
/// <summary>
/// 1.正常, 2.报警, 3.入库中, 4.出库中, 5,满料穿
/// </summary>
public
int
status
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
int
p1status
{
get
;
set
;
}
public
int
p2status
{
get
;
set
;
}
}
}
public
class
EquipMessage
public
class
EquipMessage
{
{
public
string
msg
{
get
;
set
;
}
public
string
msg
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
//public int status { get; set; }
/**
* 消息类型,info,warning,error
*/
public
string
type
;
public
static
string
ConvertType
(
string
msglevel
)
{
switch
(
msglevel
)
{
case
"info"
:
return
"info"
;
case
"warning"
:
return
"warning"
;
case
"alarm"
:
return
"error"
;
}
return
"info"
;
}
}
}
...
...
RemoteSheardObject/MyWebClient.cs
查看文件 @
bc154b7
...
@@ -52,7 +52,7 @@ namespace RemoteSheardObject
...
@@ -52,7 +52,7 @@ namespace RemoteSheardObject
}
}
public
class
HttpHelper
public
class
HttpHelper
{
{
static
ILog
Log
=
LogManager
.
GetLogger
(
"
HTTP
"
);
static
ILog
Log
=
LogManager
.
GetLogger
(
"
RollingLogFileAppender
"
);
public
static
bool
PingURLIP
(
string
url
,
int
ms
=
100
)
public
static
bool
PingURLIP
(
string
url
,
int
ms
=
100
)
{
{
string
[]
urlArray
=
url
.
Split
(
'/'
);
string
[]
urlArray
=
url
.
Split
(
'/'
);
...
@@ -146,10 +146,11 @@ namespace RemoteSheardObject
...
@@ -146,10 +146,11 @@ namespace RemoteSheardObject
public
static
T2
Post
<
T1
,
T2
>(
string
url
,
T1
jsonobject
,
int
timeout
=
5000
,
bool
printlog
=
false
)
public
static
T2
Post
<
T1
,
T2
>(
string
url
,
T1
jsonobject
,
int
timeout
=
5000
,
bool
printlog
=
false
)
{
{
string
json
=
""
;
string
json
=
""
;
string
result
=
""
;
try
try
{
{
json
=
JsonConvert
.
SerializeObject
(
jsonobject
);
json
=
JsonConvert
.
SerializeObject
(
jsonobject
);
string
result
=
Post
(
url
,
json
,
timeout
);
result
=
Post
(
url
,
json
,
timeout
);
T2
op
=
JsonConvert
.
DeserializeObject
<
T2
>(
result
);
T2
op
=
JsonConvert
.
DeserializeObject
<
T2
>(
result
);
if
(
printlog
)
if
(
printlog
)
{
{
...
@@ -159,7 +160,7 @@ namespace RemoteSheardObject
...
@@ -159,7 +160,7 @@ namespace RemoteSheardObject
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
Log
.
Error
(
"Post 出错【"
+
json
+
"】:"
+
ex
);
Log
.
Error
(
"Post 出错【"
+
json
+
"】:
result:"
+
result
+
"\r\n
"
+
ex
);
}
}
return
default
;
return
default
;
}
}
...
...
RemoteSheardObject/NgMsgData.cs
0 → 100644
查看文件 @
bc154b7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
RemoteSheardObject
{
public
class
NgMsgData
{
// NG口位置,1=左侧,2=右侧
public
int
ngPos
=
0
;
// 物料类型:pizzaBox,pcb,tray,reel
public
string
mType
;
// 条码
public
string
barcode
;
// 库位号
public
string
posName
;
// 出入库类型,1=入库,2=出库
public
string
type
;
// NG原因
public
string
ngMsg
;
}
}
RemoteSheardObject/RemoteSheardObject.csproj
查看文件 @
bc154b7
...
@@ -9,9 +9,10 @@
...
@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RemoteSheardObject</RootNamespace>
<RootNamespace>RemoteSheardObject</RootNamespace>
<AssemblyName>RemoteSheardObject</AssemblyName>
<AssemblyName>RemoteSheardObject</AssemblyName>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
...
@@ -91,6 +92,7 @@
...
@@ -91,6 +92,7 @@
<Compile Include="MyWebClient.cs">
<Compile Include="MyWebClient.cs">
<SubType>Component</SubType>
<SubType>Component</SubType>
</Compile>
</Compile>
<Compile Include="NgMsgData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="RemoteClient.cs" />
<Compile Include="SLog.cs" />
<Compile Include="SLog.cs" />
...
...
RemoteSheardObject/TheLine.cs
查看文件 @
bc154b7
...
@@ -56,7 +56,7 @@ namespace RemoteSheardObject
...
@@ -56,7 +56,7 @@ namespace RemoteSheardObject
foreach
(
var
k
in
taskdata
.
Keys
.
ToArray
())
foreach
(
var
k
in
taskdata
.
Keys
.
ToArray
())
{
{
if
(
result
.
data
.
ContainsKey
(
k
+
"_out"
))
if
(
result
.
data
.
ContainsKey
(
k
+
"_out"
))
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
+
"_out"
]);
taskdata
[
k
]
=
int
.
Parse
(
result
.
data
[
k
+
"_out"
]
.
ToString
()
);
}
}
return
taskdata
;
return
taskdata
;
}
}
...
@@ -102,6 +102,25 @@ namespace RemoteSheardObject
...
@@ -102,6 +102,25 @@ namespace RemoteSheardObject
string
url
=
CombineUrl
(
Config
.
Get
(
"Device_Server_Address"
),
"/rest/micron/device/updateStatus"
);
string
url
=
CombineUrl
(
Config
.
Get
(
"Device_Server_Address"
),
"/rest/micron/device/updateStatus"
);
var
resultStr
=
HttpHelper
.
Post
<
EquipMsgData
,
ResultData
>(
url
,
equipMsgData
);
var
resultStr
=
HttpHelper
.
Post
<
EquipMsgData
,
ResultData
>(
url
,
equipMsgData
);
}
}
public
static
void
uploadNgReel
(
NgMsgData
ngMsgData
)
{
string
url
=
CombineUrl
(
Config
.
Get
(
"Device_Server_Address"
),
"/rest/micron/device/uploadNgReel"
);
var
resultStr
=
HttpHelper
.
Post
<
NgMsgData
,
ResultData
>(
url
,
ngMsgData
,
5000
,
true
);
}
/// <summary>
/// NG口位置,1=左侧,2=右侧
/// </summary>
/// <param name="ngPos"></param>
public
static
void
ClearNgPos
(
int
ngPos
)
{
var
postData
=
new
Dictionary
<
string
,
string
>()
{
{
"ngMsgData"
,
ngPos
.
ToString
()
}
};
string
url
=
CombineUrl
(
Config
.
Get
(
"Device_Server_Address"
),
"/rest/micron/device/clearNgPos"
);
var
resultStr
=
SubmitPostData
(
url
,
postData
);
}
public
class
ResultData
public
class
ResultData
{
{
//{"code":0,"msg":"ok","data":"7"}
//{"code":0,"msg":"ok","data":"7"}
...
@@ -109,7 +128,7 @@ namespace RemoteSheardObject
...
@@ -109,7 +128,7 @@ namespace RemoteSheardObject
public
string
msg
{
get
;
set
;
}
public
string
msg
{
get
;
set
;
}
public
Dictionary
<
string
,
string
>
data
{
get
;
set
;
}
public
Dictionary
<
string
,
object
>
data
{
get
;
set
;
}
}
}
public
static
string
SubmitPostData
(
string
url
,
Dictionary
<
string
,
string
>
postData
)
public
static
string
SubmitPostData
(
string
url
,
Dictionary
<
string
,
string
>
postData
)
{
{
...
...
RemoteSheardObject/packages.config
查看文件 @
bc154b7
...
@@ -3,17 +3,17 @@
...
@@ -3,17 +3,17 @@
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net461"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net461"
/>
<
package
id
=
"SuperSocket.ClientEngine.Core"
version
=
"0.10.0"
targetFramework
=
"net461"
/>
<
package
id
=
"SuperSocket.ClientEngine.Core"
version
=
"0.10.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Collections.Specialized"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Collections.Specialized"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Linq"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Linq"
version
=
"4.3.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.Net.NameResolution"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Net.NameResolution"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Net.Security"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Net.Security"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Net.Sockets"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Net.Sockets"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Runtime.Extensions"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Runtime.Extensions"
version
=
"4.3.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.Runtime.InteropServices"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Runtime.InteropServices"
version
=
"4.3.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.Security.Cryptography.Algorithms"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.Algorithms"
version
=
"4.3.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.Security.Cryptography.Encoding"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.Encoding"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.Primitives"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.Primitives"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.X509Certificates"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Security.Cryptography.X509Certificates"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Text.RegularExpressions"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Text.RegularExpressions"
version
=
"4.3.0"
targetFramework
=
"net461"
requireReinstallation
=
"true"
/>
<
package
id
=
"System.Threading"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Threading"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Threading.Timer"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"System.Threading.Timer"
version
=
"4.3.0"
targetFramework
=
"net461"
/>
<
package
id
=
"WebSocket4Net"
version
=
"0.15.2"
targetFramework
=
"net461"
/>
<
package
id
=
"WebSocket4Net"
version
=
"0.15.2"
targetFramework
=
"net461"
/>
...
...
TheMachine/App.config
查看文件 @
bc154b7
...
@@ -199,7 +199,7 @@
...
@@ -199,7 +199,7 @@
</
root
>-->
</
root
>-->
</
log4net
>
</
log4net
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
6.1
"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.
8
"
/>
</
startup
>
</
startup
>
<
runtime
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
...
...
TheMachine/Form1.cs
查看文件 @
bc154b7
...
@@ -360,29 +360,32 @@ namespace TheMachine
...
@@ -360,29 +360,32 @@ namespace TheMachine
private
void
btn_run_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_run_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(!
RobotManage
.
isRunning
)
lock
(
this
)
{
{
if
(!
RobotManage
.
isRunning
)
{
LogUtil
.
info
(
"用户按下启动:"
+
sender
.
ToString
());
LogUtil
.
info
(
"用户按下启动:"
+
sender
.
ToString
());
RobotManage
.
Start
();
RobotManage
.
Start
();
userpause
=
false
;
userpause
=
false
;
if
(
RobotManage
.
isRunning
)
if
(
RobotManage
.
isRunning
)
{
btn_stop
.
Enabled
=
true
;
RobotManage_UserPauseSet
(
this
,
false
);
//(sender as Button).Text = "暂停运行";
}
}
else
if
(!
userpause
)
{
{
btn_stop
.
Enabled
=
true
;
userpause
=
true
;
RobotManage_UserPauseSet
(
this
,
false
);
RobotManage
.
UserPause
(
userpause
);
//(sender as Button).Text = "暂停运行";
}
else
if
(
userpause
)
{
userpause
=
false
;
RobotManage
.
UserPause
(
userpause
);
}
}
}
else
if
(!
userpause
)
{
userpause
=
true
;
RobotManage
.
UserPause
(
userpause
);
}
else
if
(
userpause
)
{
userpause
=
false
;
RobotManage
.
UserPause
(
userpause
);
}
}
}
}
private
void
RobotManage_UserPauseSet
(
object
sender
,
bool
e
)
private
void
RobotManage_UserPauseSet
(
object
sender
,
bool
e
)
...
...
TheMachine/Properties/Resources.Designer.cs
查看文件 @
bc154b7
...
@@ -19,7 +19,7 @@ namespace TheMachine.Properties {
...
@@ -19,7 +19,7 @@ namespace TheMachine.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
// (以 /str 作为命令选项),或重新生成 VS 项目。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
6
.0.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"1
7
.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
internal
class
Resources
{
...
...
TheMachine/TheMachine.csproj
查看文件 @
bc154b7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>TheMachine</RootNamespace>
<RootNamespace>TheMachine</RootNamespace>
<AssemblyName>MT</AssemblyName>
<AssemblyName>MT</AssemblyName>
<TargetFrameworkVersion>v4.
6.1
</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.
8
</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
<Deterministic>false</Deterministic>
...
...
TheMachine/device/Other/MycronicControl.cs
查看文件 @
bc154b7
...
@@ -76,7 +76,7 @@ namespace TheMachine.device.Other
...
@@ -76,7 +76,7 @@ namespace TheMachine.device.Other
stateView
.
Items
.
Clear
();
stateView
.
Items
.
Clear
();
foreach
(
var
store
in
VStoreCollection
.
VStoreList
.
Values
.
ToList
())
{
foreach
(
var
store
in
VStoreCollection
.
VStoreList
.
Values
.
ToList
())
{
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
TowerList
.
List
[
store
.
CID
].
TowerName
+
"-"
+
store
.
CID
,
store
.
RTStoreStatus
.
ToString
(),
store
.
GetStateStr
()
});
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
TowerList
.
List
[
store
.
CID
].
PosID
+
"-"
+
store
.
CID
,
store
.
RTStoreStatus
.
ToString
(),
store
.
GetStateStr
()
});
stateView
.
Items
.
Add
(
lvi
);
stateView
.
Items
.
Add
(
lvi
);
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论