Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSquareStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e6be5cee
由
LN
编写于
2020-09-18 17:09:29 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加日志打印,入库bug修改
1 个父辈
50681474
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
113 行增加
和
108 行删除
source/ACSquareStore/App.config
source/Common/util/HttpHelper.cs
source/DeviceLibrary/acSquareStore/Square_BoxBean.cs
source/DeviceLibrary/store/InOutParam.cs
source/ACSquareStore/App.config
查看文件 @
e6be5ce
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
<
add
key
=
"UseTrayCheck"
value
=
"0"
/>
<
add
key
=
"UseTrayCheck"
value
=
"0"
/>
<!--是否调试状态-->
<!--是否调试状态-->
<
add
key
=
"IsInDebug"
value
=
"1"
/>
<
add
key
=
"IsInDebug"
value
=
"1"
/>
<
add
key
=
"Server_Log_Open"
value
=
"1"
/>
</
appSettings
>
</
appSettings
>
<
log4net
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
source/Common/util/HttpHelper.cs
查看文件 @
e6be5ce
...
@@ -72,6 +72,10 @@ namespace OnlineStore.Common
...
@@ -72,6 +72,10 @@ namespace OnlineStore.Common
LOGGER
.
Error
(
"JsonHelper.DeserializeJsonToObject 出错【result="
+
result
+
"】"
+
ex
);
LOGGER
.
Error
(
"JsonHelper.DeserializeJsonToObject 出错【result="
+
result
+
"】"
+
ex
);
}
}
}
}
if
(
isLog
==
1
)
{
LOGGER
.
Info
(
"Post【"
+
url
+
"】【"
+
json
+
"】收到【"
+
result
+
"】"
);
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -83,10 +87,10 @@ namespace OnlineStore.Common
...
@@ -83,10 +87,10 @@ namespace OnlineStore.Common
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
)
{
{
if
(
isLog
==
1
)
//
if (isLog == 1)
{
//
{
LOGGER
.
Info
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
//
LOGGER.Info("给服务器发送数据【" + paramData + "】 ");
}
//
}
if
(
paramData
!=
"null"
&&
paramData
!=
null
)
if
(
paramData
!=
"null"
&&
paramData
!=
null
)
{
{
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
...
@@ -119,7 +123,7 @@ namespace OnlineStore.Common
...
@@ -119,7 +123,7 @@ namespace OnlineStore.Common
}
}
if
(
isLog
==
1
)
if
(
isLog
==
1
)
{
{
LOGGER
.
Info
(
"
收到服务器数据
【"
+
result
+
"】"
);
LOGGER
.
Info
(
"
Post【"
+
url
+
"】【"
+
paramData
+
"】收到
【"
+
result
+
"】"
);
}
}
return
result
;
return
result
;
}
}
...
...
source/DeviceLibrary/acSquareStore/Square_BoxBean.cs
查看文件 @
e6be5ce
...
@@ -464,36 +464,36 @@ namespace OnlineStore.DeviceLibrary
...
@@ -464,36 +464,36 @@ namespace OnlineStore.DeviceLibrary
}
}
return
""
;
return
""
;
}
}
public
void
OpenDoor
(
int
type
=
1
,
StoreMoveInfo
moveInfo
=
null
)
//
public void OpenDoor(int type=1,StoreMoveInfo moveInfo=null)
{
//
{
if
(
type
.
Equals
(
1
))
//
if (type.Equals(1))
{
//
{
}
//
}
else
//
else
{
//
{
}
//
}
if
(
moveInfo
!=
null
)
//
if (moveInfo != null)
{
//
{
}
//
}
}
//
}
public
void
CloseDoor
(
int
type
=
1
,
StoreMoveInfo
moveInfo
=
null
)
//
public void CloseDoor(int type = 1, StoreMoveInfo moveInfo=null)
{
//
{
if
(
type
.
Equals
(
1
))
//
if (type.Equals(1))
{
//
{
}
//
}
else
//
else
{
//
{
}
//
}
if
(
moveInfo
!=
null
)
//
if (moveInfo != null)
{
//
{
}
//
}
}
//
}
/// <summary>
/// <summary>
/// 原点返回处理
/// 原点返回处理
...
@@ -1188,10 +1188,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1188,10 +1188,10 @@ namespace OnlineStore.DeviceLibrary
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if
(
CanStarInOut
())
if
(
CanStarInOut
())
{
{
InOutParam
param
=
new
InOutParam
(
inoutInfo
);
StartInStoreMove
(
param
);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
//如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】开始入库!"
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 收到服务器入库命令:【"
+
inoutInfo
.
ToStr
()
+
"】开始入库!"
);
InOutParam
param
=
new
InOutParam
(
inoutInfo
);
StartInStoreMove
(
param
);
}
}
else
else
{
{
...
@@ -1202,88 +1202,88 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1202,88 +1202,88 @@ namespace OnlineStore.DeviceLibrary
}
}
public
bool
ReviceLineCheckInStoreCMD
(
string
posId
,
string
plateH
,
string
plateW
,
string
message
)
//public bool ReviceLineCheckInStoreCMD(string posId, string plateH, string plateW, string message)
{
//{
string
logName
=
"入库库位验证【 "
+
message
+
"】【"
+
posId
+
"】:"
;
// string logName = "入库库位验证【 " + message + "】【" + posId + "】:";
try
// try
{
// {
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
LogUtil
.
info
(
LOGGER
,
logName
+
" 设备未启动,验证失败"
);
return
false
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
debug
(
LOGGER
,
logName
+
"发送给服务器验证入库PosID"
);
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
StoreID
.
ToString
()
}
};
operation
.
data
.
Add
(
"inPos"
,
posId
);
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
info
(
LOGGER
,
logName
+
" 没有收到服务器反馈 "
);
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogUtil
.
info
(
LOGGER
,
logName
+
"服务器反馈 :"
+
resultOperation
.
msg
);
}
// if (storeRunStatus.Equals(StoreRunStatus.Wait))
else
if
(
resultOperation
.
op
.
Equals
(
1
))
// {
{
// LogUtil.info(LOGGER, logName+ " 设备未启动,验证失败");
LogUtil
.
info
(
LOGGER
,
logName
+
" 成功"
);
// return false;
return
true
;
// }
}
// // CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
}
// LogUtil.debug(LOGGER, logName+"发送给服务器验证入库PosID");
catch
(
Exception
ex
)
// //发送扫码内容到服务器进行入库操作
{
// Operation operation = getLineBoxStatus();
LogUtil
.
info
(
LOGGER
,
logName
+
" 出错:"
+
ex
.
ToString
());
// operation.op = 1;
// operation.data = new Dictionary<string, string>() { { "code", message }, { "boxId", StoreID.ToString() } };
// operation.data.Add("inPos", posId);
// string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
// Operation resultOperation = HttpHelper.Post(StoreManager.GetPostApi(server), operation, false);
// if (resultOperation == null)
// {
// // CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
// LogUtil.info(LOGGER, logName + " 没有收到服务器反馈 ");
// }
// else if (!string.IsNullOrEmpty(resultOperation.msg))
// {
// //如果有提示消息,直接显示提示
// LogUtil.info(LOGGER, logName + "服务器反馈 :" + resultOperation.msg);
}
// }
return
false
;
// else if (resultOperation.op.Equals(1))
}
public
void
ReviceLineInStoreCMD
(
string
posId
,
string
plateH
,
string
plateW
,
string
message
)
{
string
logName
=
"流水线入库命令【 "
+
message
+
"】【"
+
posId
+
"】:"
;
//if (!LineConnect.WaitInStoreList.Contains(posId))
//{
// LogUtil.error(logName + "库位未验证通过,重新验证库位");
// bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message);
// if (!result)
// {
// {
// return;
// LogUtil.info(LOGGER, logName + " 成功");
// return true;
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.info(LOGGER, logName + " 出错:" + ex.ToString());
// }
// return false;
//}
//}
//else
//public void ReviceLineInStoreCMD(string posId, string plateH, string plateW, string message)
//{
//{
// LineConnect.WaitInStoreList.Remove(posId);
// string logName = "流水线入库命令【 " + message + "】【" + posId + "】:";
// //if (!LineConnect.WaitInStoreList.Contains(posId))
// //{
// // LogUtil.error(logName + "库位未验证通过,重新验证库位");
// // bool result = ReviceLineCheckInStoreCMD(posId, plateH, plateW, message);
// // if (!result)
// // {
// // return;
// // }
// //}
// //else
// //{
// // LineConnect.WaitInStoreList.Remove(posId);
// //}
// //根据发送的posId获取位置列表
// ACSquareSPosition position = CSVPositionReader<ACSquareSPosition>.GetPositon(posId);
// if (position == null)
// { //出入库没有找到服务器发送的库位,需要打印日志方便查询原因
// WarnMsg = "入库未找到库位:二维码【" + message + "】库位【" + posId + "】 ";
// LogUtil.error(logName + "未找到库位");
// // LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
// return;
// }
// //TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
// if (CanStarInOut())
// {
// InOutParam param = new InOutParam(new InOutPosInfo( message, posId, plateH, plateW));
// LogUtil.info(logName + " 开始入库!");
// StartInStoreMove(param);
// //如果当前正在出入库中,需要记录下来,等待空闲时执行
// }
// else
// {
// LogUtil.info(logName + " 正在忙碌中,无法入库!");
// }
//}
//}
//根据发送的posId获取位置列表
ACSquareSPosition
position
=
CSVPositionReader
<
ACSquareSPosition
>.
GetPositon
(
posId
);
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
"入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】 "
;
LogUtil
.
error
(
logName
+
"未找到库位"
);
// LogUtil.info(LOGGER, "收到流水线入库:入库未找到库位:二维码【" + message + "】库位【" + posId + "】");
return
;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if
(
CanStarInOut
())
{
InOutParam
param
=
new
InOutParam
(
new
InOutPosInfo
(
message
,
posId
,
plateH
,
plateW
));
LogUtil
.
info
(
logName
+
" 开始入库!"
);
StartInStoreMove
(
param
);
//如果当前正在出入库中,需要记录下来,等待空闲时执行
}
else
{
LogUtil
.
info
(
logName
+
" 正在忙碌中,无法入库!"
);
}
}
#
endregion
#
endregion
...
...
source/DeviceLibrary/store/InOutParam.cs
查看文件 @
e6be5ce
...
@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
this
.
PosId
=
posId
;
this
.
PosId
=
posId
;
this
.
PlateW
=
platew
;
this
.
PlateW
=
platew
;
this
.
PlateH
=
plateh
;
this
.
PlateH
=
plateh
;
this
.
ShelfType
=
shelftype
;
}
}
/// <summary>
/// <summary>
...
@@ -116,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -116,7 +116,7 @@ namespace OnlineStore.DeviceLibrary
{
{
inType
=
"左侧"
;
inType
=
"左侧"
;
}
}
else
else
if
(
ShelfType
.
Equals
(
2
))
{
{
inType
=
"右侧"
;
inType
=
"右侧"
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论