Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a9171799
由
LN
编写于
2020-06-23 10:44:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
超时改为3秒,入库验证增加超时处理。出库增加信号检测。
1 个父辈
41b47a48
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
103 行增加
和
151 行删除
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/Common/util/HttpHelper.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/store/StoreStep.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
a917179
此文件的差异被折叠,
点击展开。
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
a917179
...
@@ -38,28 +38,21 @@ namespace OnlineStore.ACSingleStore
...
@@ -38,28 +38,21 @@ namespace OnlineStore.ACSingleStore
private
void
FrmTest_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmTest_Load
(
object
sender
,
EventArgs
e
)
{
{
string
version
=
GetVersion
(
true
);
string
version
=
GetVersion
(
true
);
LogUtil
.
logBox
=
this
.
richTextBox1
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
LoadStore
();
LoadStore
();
chbDebug
.
Checked
=
store
.
IsDebug
;
chbDebug
.
Checked
=
store
.
IsDebug
;
this
.
ShowInTaskbar
=
true
;
this
.
ShowInTaskbar
=
true
;
this
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
App_Title
)
+
"_"
+
store
.
StoreID
;
this
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
App_Title
)
+
"_"
+
store
.
StoreID
;
groupBox3
.
Text
=
"设备["
+
store
.
CID
+
"]状态"
;
groupBox3
.
Text
=
"设备["
+
store
.
CID
+
"]状态"
;
notifyIcon1
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
App_Title
);
notifyIcon1
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
App_Title
);
//cmbHomeType.SelectedIndex = 1;
//cmbHomeType.SelectedIndex = 1;
HideForm
();
HideForm
();
this
.
Opacity
=
1
;
this
.
Opacity
=
1
;
txtTempPort
.
Text
=
store
.
Config
.
Humiture_Port
;
txtTempPort
.
Text
=
store
.
Config
.
Humiture_Port
;
if
(
HumitureController
.
HumitureControllerType
.
Equals
(
1
))
{
groupHistory
.
Visible
=
true
;
}
else
{
groupHistory
.
Visible
=
false
;
}
LoadOk
=
true
;
LoadOk
=
true
;
}
}
private
void
LoadStore
()
private
void
LoadStore
()
...
@@ -180,7 +173,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -180,7 +173,7 @@ namespace OnlineStore.ACSingleStore
LoadOk
=
true
;
LoadOk
=
true
;
}
}
lblTemp
.
Text
=
store
.
currTempStr
;
lblTemp
.
Text
=
store
.
currTempStr
;
lblMoveEquipInfo
.
Text
=
"移栽状态:"
+(
LineConnect
.
CanStartOut
()
?
"可出库"
:
"不可出库"
)+
" "
+
LineConnect
.
LastUpdateTime
.
ToLongTimeString
()+
""
;
lblMoveEquipInfo
.
Text
=
"移栽状态:"
+
(
LineConnect
.
CanStartOut
()
?
"可出库"
:
"不可出库"
)
+
" "
+
LineConnect
.
LastUpdateTime
.
ToLongTimeString
()
+
""
;
//忙碌状态不读取状态
//忙碌状态不读取状态
if
(!
store
.
storeRunStatus
.
Equals
(
StoreRunStatus
.
Busy
))
if
(!
store
.
storeRunStatus
.
Equals
(
StoreRunStatus
.
Busy
))
{
{
...
@@ -195,7 +188,10 @@ namespace OnlineStore.ACSingleStore
...
@@ -195,7 +188,10 @@ namespace OnlineStore.ACSingleStore
}
}
lblThisSta
.
Text
=
store
.
GetRunStr
();
lblThisSta
.
Text
=
store
.
GetRunStr
();
if
(
store
.
OutCheckAlarm
())
{
btnConOut
.
Visible
=
true
;
}
//复位按钮状态显示
//复位按钮状态显示
if
(
btnSotreReset
.
Enabled
==
false
)
if
(
btnSotreReset
.
Enabled
==
false
)
{
{
...
@@ -225,22 +221,12 @@ namespace OnlineStore.ACSingleStore
...
@@ -225,22 +221,12 @@ namespace OnlineStore.ACSingleStore
}
}
lblWarnMsg
.
Text
=
store
.
WarnMsg
;
lblWarnMsg
.
Text
=
store
.
WarnMsg
;
//if (store.Config.IsHasDoorLimit.Equals(1))
//{
// if (IOManager.IOValue(IO_Type.Door_LimitSingle).Equals(IO_VALUE.LOW))
// {
// lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关";
// }
//}
//如果不在出入库中,且叉子上有信号,需要提示检查叉子
//如果不在出入库中,且叉子上有信号,需要提示检查叉子
if
(
store
.
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
IOManager
.
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
store
.
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
IOManager
.
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 叉子料盘检测有料,请检查"
;
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 叉子料盘检测有料,请检查"
;
}
}
//if (IOManager.IOValue(IO_Type.DoorLimit).Equals(IO_VALUE.LOW))
//{
// lblWarnMsg.Text = lblWarnMsg.Text + " 无门禁信号,请检查";
//}
if
(
store
.
TempOrHumidityIsAlarm
)
if
(
store
.
TempOrHumidityIsAlarm
)
{
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 温湿度报警["
+
store
.
TempAlarmTime
.
ToLongTimeString
()
+
"]"
;
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 温湿度报警["
+
store
.
TempAlarmTime
.
ToLongTimeString
()
+
"]"
;
...
@@ -292,6 +278,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -292,6 +278,7 @@ namespace OnlineStore.ACSingleStore
lblThisSta
.
Text
=
"等待启动"
;
lblThisSta
.
Text
=
"等待启动"
;
lblWarnMsg
.
Text
=
""
;
lblWarnMsg
.
Text
=
""
;
btnStartAuTo
.
Text
=
"开始自动出入库"
;
btnStartAuTo
.
Text
=
"开始自动出入库"
;
btnConOut
.
Visible
=
false
;
}
}
}
}
...
@@ -314,7 +301,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -314,7 +301,7 @@ namespace OnlineStore.ACSingleStore
ReadA
(
store
.
Config
.
Comp_Axis
,
lblActual4
,
lblTargetP4
,
txt4Target
,
axis_4_Alarm
);
ReadA
(
store
.
Config
.
Comp_Axis
,
lblActual4
,
lblTargetP4
,
txt4Target
,
axis_4_Alarm
);
}
}
private
void
ReadA
(
ConfigMoveAxis
axis
,
TextBox
lblActual
,
TextBox
lblTarget
,
TextBox
lblT
,
IOStatusControl
sta
)
private
void
ReadA
(
ConfigMoveAxis
axis
,
TextBox
lblActual
,
TextBox
lblTarget
,
TextBox
lblT
,
IOStatusControl
sta
)
{
{
string
portName
=
GetPortName
();
string
portName
=
GetPortName
();
int
SlvAddr
=
GetSlaveAddr
();
int
SlvAddr
=
GetSlaveAddr
();
...
@@ -372,7 +359,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -372,7 +359,7 @@ namespace OnlineStore.ACSingleStore
{
{
string
selectPositionNum
=
cmbPosition
.
Text
;
string
selectPositionNum
=
cmbPosition
.
Text
;
LineMoveP
ktk
=
LoadPostion
();
LineMoveP
ktk
=
LoadPostion
();
store
.
StartOutStoreMove
(
new
InOutParam
(
new
InOutPosInfo
(
""
,
selectPositionNum
),
ktk
));
store
.
StartOutStoreMove
(
new
InOutParam
(
new
InOutPosInfo
(
""
,
selectPositionNum
),
ktk
));
}
}
else
else
{
{
...
@@ -386,7 +373,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -386,7 +373,7 @@ namespace OnlineStore.ACSingleStore
{
{
string
selectPositionNum
=
cmbPosition
.
Text
;
string
selectPositionNum
=
cmbPosition
.
Text
;
LineMoveP
ktk
=
LoadPostion
();
LineMoveP
ktk
=
LoadPostion
();
store
.
StartInStoreMove
(
new
InOutParam
(
new
InOutPosInfo
(
""
,
selectPositionNum
),
ktk
));
store
.
StartInStoreMove
(
new
InOutParam
(
new
InOutPosInfo
(
""
,
selectPositionNum
),
ktk
));
}
}
else
else
{
{
...
@@ -503,20 +490,20 @@ namespace OnlineStore.ACSingleStore
...
@@ -503,20 +490,20 @@ namespace OnlineStore.ACSingleStore
// MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
// return;
//}
//}
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
&&
(
store
.
InOutAxisCanMove
().
Equals
(
false
)))
{
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
return
;
}
}
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
else
if
(
store
.
Config
.
Middle_Axis
.
IsSameAxis
(
portName
,
SlvAddr
)
||
store
.
Config
.
UpDown_Axis
.
IsSameAxis
(
portName
,
SlvAddr
))
{
{
if
(!
InOutIsIsP1
())
if
(!
InOutIsIsP1
())
{
{
return
;
return
;
}
}
}
}
LogUtil
.
info
(
"点击【绝对运动】,端口号【"
+
portName
+
"】地址【"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
LogUtil
.
info
(
"点击【绝对运动】,端口号【"
+
portName
+
"】地址【"
+
SlvAddr
+
"】位置【"
+
position
+
"】速度【"
+
speed
+
"】"
);
ACServerManager
.
AbsMove
(
portName
,
SlvAddr
,
position
,
speed
);
ACServerManager
.
AbsMove
(
portName
,
SlvAddr
,
position
,
speed
);
}
}
private
void
btnAxisVMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAxisVMove_Click
(
object
sender
,
EventArgs
e
)
{
{
...
@@ -713,7 +700,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -713,7 +700,7 @@ namespace OnlineStore.ACSingleStore
{
{
return
true
;
return
true
;
}
}
MessageBox
.
Show
(
"叉子不在待机位,请先将叉子退回待机位("
+
InOutDefaultPosition
+
")"
,
"警告(叉子在待机位时,才能移动升降轴和旋转轴) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
MessageBox
.
Show
(
"叉子不在待机位,请先将叉子退回待机位("
+
InOutDefaultPosition
+
")"
,
"警告(叉子在待机位时,才能移动升降轴和旋转轴) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
return
false
;
return
false
;
}
}
private
void
btnCloseAxis_Click
(
object
sender
,
EventArgs
e
)
private
void
btnCloseAxis_Click
(
object
sender
,
EventArgs
e
)
...
@@ -973,7 +960,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -973,7 +960,7 @@ namespace OnlineStore.ACSingleStore
private
void
料仓运转
ONToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
private
void
料仓运转
ONToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
{
this
.
Enabled
=
false
;
this
.
Enabled
=
false
;
store
.
RunAxis
(
false
);
store
.
RunAxis
(
false
);
this
.
Enabled
=
true
;
this
.
Enabled
=
true
;
LogUtil
.
info
(
"料仓运转ON完成"
);
LogUtil
.
info
(
"料仓运转ON完成"
);
}
}
...
@@ -1124,9 +1111,9 @@ namespace OnlineStore.ACSingleStore
...
@@ -1124,9 +1111,9 @@ namespace OnlineStore.ACSingleStore
this
.
ShowInTaskbar
=
true
;
this
.
ShowInTaskbar
=
true
;
DebugStatus
(
false
);
DebugStatus
(
false
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"显示界面出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"显示界面出错:"
+
ex
.
ToString
());
}
}
}
}
private
void
ExitApp
()
private
void
ExitApp
()
...
@@ -1159,7 +1146,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -1159,7 +1146,7 @@ namespace OnlineStore.ACSingleStore
}
}
private
void
toolStripMenuItem1_Click
(
object
sender
,
EventArgs
e
)
private
void
toolStripMenuItem1_Click
(
object
sender
,
EventArgs
e
)
{
{
DialogResult
result
=
MessageBox
.
Show
(
"是否确定退出?"
,
"提示"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
DialogResult
result
=
MessageBox
.
Show
(
"是否确定退出?"
,
"提示"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
if
(
result
.
Equals
(
DialogResult
.
Yes
))
if
(
result
.
Equals
(
DialogResult
.
Yes
))
{
{
ExitApp
();
ExitApp
();
...
@@ -1183,7 +1170,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -1183,7 +1170,7 @@ namespace OnlineStore.ACSingleStore
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
{
DialogResult
result
=
MessageBox
.
Show
(
"是否确定退出?"
,
"提示"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
DialogResult
result
=
MessageBox
.
Show
(
"是否确定退出?"
,
"提示"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
);
if
(
result
.
Equals
(
DialogResult
.
Yes
))
if
(
result
.
Equals
(
DialogResult
.
Yes
))
{
{
ExitApp
();
ExitApp
();
...
@@ -1255,27 +1242,8 @@ namespace OnlineStore.ACSingleStore
...
@@ -1255,27 +1242,8 @@ namespace OnlineStore.ACSingleStore
}
}
}
}
private
void
btnSelHistory_Click
(
object
sender
,
EventArgs
e
)
{
int
count
=
HumitureController
.
QueryHistoryCount
();
txtHistoryCount
.
Text
=
count
.
ToString
();
int
cuCount
=
HumitureController
.
QueryCurrCount
();
txtCurrCount
.
Text
=
cuCount
.
ToString
();
List
<
object
>
data
=
HumitureController
.
QueryHistory
();
if
(
data
.
Count
>=
3
)
{
txtHistoryTemp
.
Text
=
data
[
0
].
ToString
();
txtHistoryHum
.
Text
=
data
[
1
].
ToString
();
txtHistoryTime
.
Text
=
data
[
2
].
ToString
();
}
}
private
void
btnCloseDoor_Click
(
object
sender
,
EventArgs
e
)
private
void
btnCloseDoor_Click
(
object
sender
,
EventArgs
e
)
{
{
//IOManager.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
//IOManager.IOMove(IO_Type.Door_Down, IO_VALUE.HIGH);
StoreManager
.
Store
.
CloseDoor
(
false
);
StoreManager
.
Store
.
CloseDoor
(
false
);
}
}
...
@@ -1340,7 +1308,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -1340,7 +1308,7 @@ namespace OnlineStore.ACSingleStore
DialogResult
result
=
MessageBox
.
Show
(
"是否切换到正常工作状态?"
,
"是否确认切换"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
,
MessageBoxDefaultButton
.
Button1
);
DialogResult
result
=
MessageBox
.
Show
(
"是否切换到正常工作状态?"
,
"是否确认切换"
,
MessageBoxButtons
.
YesNo
,
MessageBoxIcon
.
Question
,
MessageBoxDefaultButton
.
Button1
);
if
(
result
.
Equals
(
DialogResult
.
Yes
))
if
(
result
.
Equals
(
DialogResult
.
Yes
))
{
{
store
.
IsDebug
=
false
;
store
.
IsDebug
=
false
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
IsInDebug
,
0
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
IsInDebug
,
0
);
LogUtil
.
info
(
"用户切换到正常工作状态 "
);
LogUtil
.
info
(
"用户切换到正常工作状态 "
);
}
}
...
@@ -1390,5 +1358,11 @@ namespace OnlineStore.ACSingleStore
...
@@ -1390,5 +1358,11 @@ namespace OnlineStore.ACSingleStore
{
{
LogUtil
.
UpdateLogbox
();
LogUtil
.
UpdateLogbox
();
}
}
private
void
btnConOut_Click
(
object
sender
,
EventArgs
e
)
{
btnConOut
.
Visible
=
false
;
store
.
ContinueOut
();
}
}
}
}
}
source/Common/util/HttpHelper.cs
查看文件 @
a917179
...
@@ -19,67 +19,29 @@ namespace OnlineStore.Common
...
@@ -19,67 +19,29 @@ namespace OnlineStore.Common
public
class
HttpHelper
public
class
HttpHelper
{
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
static
string
Post
(
string
url
,
string
paramData
)
{
return
Post
(
url
,
paramData
,
Encoding
.
UTF8
);
}
//public static bool PingURLIP(string url, int ms = 100)
//{
// string[] urlArray = url.Split('/');
// if (urlArray.Length > 3)
// {
// string ip = urlArray[2];
// Ping pingSender = new Ping();
public
static
Operation
Post
(
string
url
,
Operation
operation
,
out
bool
isTimeOut
)
// PingReply reply = pingSender.Send(ip, ms);//第一个参数为ip地址,第二个参数为ping的时间
// if (reply.Status == IPStatus.Success)
// {
// //通
// return true;
// }
// else
// {
// //不通
// return false;
// }
// }
// return true;
//}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="operation"></param>
/// <param name="simulate">是否模拟服务器返回结果</param>
/// <returns></returns>
public
static
Operation
Post
(
string
url
,
Operation
operation
,
bool
simulate
)
{
{
isTimeOut
=
false
;
try
try
{
//如果Op=0或者Op=5,先拼Ip,不通不发送
{
//if (operation.op < 0 || operation.op.Equals(5))
//if (simulate)
//{
//{//模拟服务器返回
// if (PingURLIP(url, 100).Equals(false))
// operation.status = 200;
// {
// operation.data.Clear();
// return null;
// operation.data.Add("posId", "A001");
// string pos = "D100-111#D102-222#D104-333";
// operation.data.Add("pos", pos);
// if (operation.op == 1 || operation.op == 2)
// {//入库或出库
// string json = JsonHelper.SerializeObject(operation);
// LogUtil.error(LOGGER, "模拟HTTP服务器返回出库入库信息:" + json);
// return operation;
// }
// }
//}
//}
if
(
simulate
)
//else
{
//模拟服务器返回
//{
operation
.
status
=
200
;
operation
.
data
.
Clear
();
operation
.
data
.
Add
(
"posId"
,
"A001"
);
string
pos
=
"D100-111#D102-222#D104-333"
;
operation
.
data
.
Add
(
"pos"
,
pos
);
if
(
operation
.
op
==
1
||
operation
.
op
==
2
)
{
//入库或出库
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
LogUtil
.
error
(
LOGGER
,
"模拟HTTP服务器返回出库入库信息:"
+
json
);
return
operation
;
}
}
else
{
string
json
=
""
;
string
json
=
""
;
try
try
{
{
...
@@ -89,7 +51,8 @@ namespace OnlineStore.Common
...
@@ -89,7 +51,8 @@ namespace OnlineStore.Common
{
{
LogUtil
.
error
(
"JsonHelper.SerializeObject(operation) 出错【operation.op="
+
operation
.
op
+
"】"
+
ex
);
LogUtil
.
error
(
"JsonHelper.SerializeObject(operation) 出错【operation.op="
+
operation
.
op
+
"】"
+
ex
);
}
}
string
result
=
Post
(
url
,
json
);
string
result
=
Post
(
url
,
json
,
Encoding
.
UTF8
,
out
isTimeOut
);
if
(!
string
.
IsNullOrEmpty
(
result
))
if
(!
string
.
IsNullOrEmpty
(
result
))
{
{
try
try
...
@@ -101,7 +64,7 @@ namespace OnlineStore.Common
...
@@ -101,7 +64,7 @@ namespace OnlineStore.Common
LogUtil
.
error
(
"JsonHelper.DeserializeJsonToObject 出错【result="
+
result
+
"】"
+
ex
);
LogUtil
.
error
(
"JsonHelper.DeserializeJsonToObject 出错【result="
+
result
+
"】"
+
ex
);
}
}
}
}
}
//
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -110,12 +73,9 @@ namespace OnlineStore.Common
...
@@ -110,12 +73,9 @@ namespace OnlineStore.Common
return
null
;
return
null
;
}
}
private
static
int
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Server_Log_Open
);
private
static
int
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Server_Log_Open
);
public
static
string
Post
(
string
url
,
string
paramData
,
Encoding
encoding
)
public
static
string
Post
(
string
url
,
string
paramData
,
Encoding
encoding
,
out
bool
IsTimeOut
)
{
{
//if (PingURLIP(url, 100).Equals(false))
IsTimeOut
=
false
;
//{
// return null;
//}
if
(
isLog
==
1
)
if
(
isLog
==
1
)
{
{
LOGGER
.
Info
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
LOGGER
.
Info
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
...
@@ -134,7 +94,7 @@ namespace OnlineStore.Common
...
@@ -134,7 +94,7 @@ namespace OnlineStore.Common
try
try
{
{
var
wc
=
new
MyWebClient
(
10
000
);
var
wc
=
new
MyWebClient
(
3
000
);
if
(
string
.
IsNullOrEmpty
(
wc
.
Headers
[
"Content-Type"
]))
if
(
string
.
IsNullOrEmpty
(
wc
.
Headers
[
"Content-Type"
]))
wc
.
Headers
.
Add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
wc
.
Headers
.
Add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
wc
.
Encoding
=
encoding
;
wc
.
Encoding
=
encoding
;
...
@@ -142,6 +102,11 @@ namespace OnlineStore.Common
...
@@ -142,6 +102,11 @@ namespace OnlineStore.Common
result
=
wc
.
UploadString
(
url
,
"POST"
,
paramData
);
result
=
wc
.
UploadString
(
url
,
"POST"
,
paramData
);
//LogUtil.info(result);
//LogUtil.info(result);
}
}
catch
(
WebException
ex
)
{
IsTimeOut
=
true
;
LogUtil
.
error
(
LOGGER
,
"POST WebException :"
+
ex
.
ToString
(),
101
);
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
LogUtil
.
error
(
LOGGER
,
"POST ERROR:"
+
e
.
ToString
(),
1
);
LogUtil
.
error
(
LOGGER
,
"POST ERROR:"
+
e
.
ToString
(),
1
);
...
@@ -157,30 +122,30 @@ namespace OnlineStore.Common
...
@@ -157,30 +122,30 @@ namespace OnlineStore.Common
return
result
;
return
result
;
}
}
public
static
string
Get
(
string
url
)
//
public static string Get(string url)
{
//
{
return
Get
(
url
,
Encoding
.
UTF8
);
//
return Get(url, Encoding.UTF8);
}
//
}
public
static
string
Get
(
string
url
,
Encoding
encoding
)
//
public static string Get(string url, Encoding encoding)
{
//
{
try
//
try
{
//
{
LogUtil
.
info
(
LOGGER
,
"HTTP GET FROM: "
+
url
);
//
LogUtil.info(LOGGER, "HTTP GET FROM: " + url);
var
wc
=
new
WebClient
{
Encoding
=
encoding
};
//
var wc = new WebClient { Encoding = encoding };
var
readStream
=
wc
.
OpenRead
(
url
);
//
var readStream = wc.OpenRead(url);
using
(
var
sr
=
new
StreamReader
(
readStream
,
encoding
))
//
using (var sr = new StreamReader(readStream, encoding))
{
//
{
var
result
=
sr
.
ReadToEnd
();
//
var result = sr.ReadToEnd();
LogUtil
.
info
(
LOGGER
,
"receive << "
+
result
);
//
LogUtil.info(LOGGER, "receive << " + result);
return
result
;
//
return result;
}
//
}
}
//
}
catch
(
Exception
e
)
//
catch (Exception e)
{
//
{
LogUtil
.
error
(
LOGGER
,
"HTTP GET ERROR:"
+
e
.
Message
,
2
);
//
LogUtil.error(LOGGER, "HTTP GET ERROR:" + e.Message, 2);
}
//
}
return
""
;
//
return "";
}
//
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
a917179
...
@@ -1253,15 +1253,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1253,15 +1253,21 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
logName
+
" 设备未启动,验证失败"
);
LogUtil
.
info
(
LOGGER
,
logName
+
" 设备未启动,验证失败"
);
return
false
;
return
false
;
}
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
debug
(
LOGGER
,
logName
+
"发送给服务器验证入库PosID"
);
//发送扫码内容到服务器进行入库操作
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
StoreID
.
ToString
()
},
{
"rfid"
,
rfid
}
};
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
StoreID
.
ToString
()
},
{
"rfid"
,
rfid
}
};
operation
.
data
.
Add
(
"inPos"
,
posId
);
operation
.
data
.
Add
(
"inPos"
,
posId
);
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
bool
timeOut
=
false
;
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
out
timeOut
);
if
(
timeOut
)
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 第"
+
i
+
"次发送超时 "
);
continue
;
}
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
...
@@ -1278,6 +1284,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1278,6 +1284,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
logName
+
" 成功"
);
LogUtil
.
info
(
LOGGER
,
logName
+
" 成功"
);
return
true
;
return
true
;
}
}
break
;
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -1621,7 +1629,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1621,7 +1629,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
LOGGER
,
StoreName
+
"没有湿度预警范围,需要从服务器获取,发送OP="
+
lineOperation
.
op
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"没有湿度预警范围,需要从服务器获取,发送OP="
+
lineOperation
.
op
);
}
}
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
lineOperation
,
false
);
bool
isTimeout
=
false
;
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
lineOperation
,
out
isTimeout
);
//发送状态信息到服务器
//发送状态信息到服务器
if
(
resultOperation
==
null
||
(
resultOperation
.
op
<=
0
))
if
(
resultOperation
==
null
||
(
resultOperation
.
op
<=
0
))
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
a917179
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/store/StoreStep.cs
查看文件 @
a917179
...
@@ -256,13 +256,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -256,13 +256,17 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// </summary>
SO_25_InoutToP1
,
SO_25_InoutToP1
,
/// <summary>
/// <summary>
/// 料仓出库,检测料仓门口信号
/// </summary>
SO_26_CheckTray
,
/// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary>
/// </summary>
SO_2
6
_GoBack
,
SO_2
7
_GoBack
,
/// <summary>
/// <summary>
/// 等待拿走物品
/// 等待拿走物品
/// </summary>
/// </summary>
SO_2
7
_WaitTake
,
SO_2
8
_WaitTake
,
#
endregion
#
endregion
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论