Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_local_platform
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_local_platform
Commits
0481217c
Commit
0481217c
authored
Jan 09, 2024
by
Seniorious
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2dc38498
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
127 行增加
和
10 行删除
+127
-10
BaseInfoController.cs
WebApiNET6-master/APIs/Controllers/BaseInfoController.cs
+43
-7
EpcConvert.cs
WebApiNET6-master/Common/EpcConvert.cs
+84
-3
没有找到文件。
WebApiNET6-master/APIs/Controllers/BaseInfoController.cs
View file @
0481217c
...
@@ -768,6 +768,10 @@ namespace APIs.Controllers
...
@@ -768,6 +768,10 @@ namespace APIs.Controllers
var
policeName
=
string
.
IsNullOrEmpty
(
req
.
policeId
)
?
""
:
(
await
_policeInfoService
.
QueryOne
(
s
=>
s
.
id
.
Equals
(
req
.
policeId
)))?.
name
;
var
policeName
=
string
.
IsNullOrEmpty
(
req
.
policeId
)
?
""
:
(
await
_policeInfoService
.
QueryOne
(
s
=>
s
.
id
.
Equals
(
req
.
policeId
)))?.
name
;
var
orgInfo
=
await
_thisInfoService
.
QueryOne
(
s
=>
true
);
var
orgInfo
=
await
_thisInfoService
.
QueryOne
(
s
=>
true
);
var
warrantyList
=
(
await
_viewWarrantyWarnService
.
Query
()).
Select
(
s
=>
s
.
epc
).
ToList
();
//超期提醒
Dictionary
<
string
,
int
>
warrantyDic
=
new
Dictionary
<
string
,
int
>();
foreach
(
var
epc
in
epcList
)
foreach
(
var
epc
in
epcList
)
{
{
var
epc_info
=
EpcConvert
.
EpcAnlysing
(
EpcConvert
.
ToHexByte
(
epc
));
var
epc_info
=
EpcConvert
.
EpcAnlysing
(
EpcConvert
.
ToHexByte
(
epc
));
...
@@ -840,6 +844,18 @@ namespace APIs.Controllers
...
@@ -840,6 +844,18 @@ namespace APIs.Controllers
updateTime
=
DateTime
.
Now
,
updateTime
=
DateTime
.
Now
,
});
});
if
(
warrantyList
!=
null
&&
warrantyList
.
Contains
(
epc
))
{
string
thisKey
=
$"
{
mysize
.
id
}
||
{
mytype
?.
name
}
(
{
mysize
.
name
}
)"
;
if
(
warrantyDic
.
TryGetValue
(
thisKey
,
out
int
va
))
{
warrantyDic
[
thisKey
]
+=
1
;
}
else
{
warrantyDic
.
Add
(
thisKey
,
1
);
}
}
}
}
else
else
{
{
...
@@ -883,15 +899,35 @@ namespace APIs.Controllers
...
@@ -883,15 +899,35 @@ namespace APIs.Controllers
var
rs
=
await
_logService
.
AddChannelLog
(
myOrder
,
summary
,
newEquList
);
var
rs
=
await
_logService
.
AddChannelLog
(
myOrder
,
summary
,
newEquList
);
return
rs
?
new
ApiResult
if
(
rs
)
{
{
code
=
ResultCode
.
OPERATE_SUCCESS
.
Code
,
string
msg
=
$"
{(
req
.
state
==
0
?
"出库"
:
"入库"
)}
成功
{
summary
.
number
}
件"
;
msg
=
ResultCode
.
OPERATE_SUCCESS
.
Msg
if
(
warrantyDic
.
Any
())
}:
new
ApiResult
{
msg
+=
",即将超期或已超期:"
;
foreach
(
var
item
in
warrantyDic
)
{
var
name
=
item
.
Key
.
Split
(
new
string
[]
{
"||"
},
StringSplitOptions
.
None
).
Skip
(
1
).
FirstOrDefault
();
msg
+=
$"
{
name
}{
item
.
Value
}
件,"
;
};
msg
=
msg
.
Substring
(
0
,
msg
.
Length
-
1
);
}
return
new
ApiResult
{
code
=
ResultCode
.
OPERATE_SUCCESS
.
Code
,
msg
=
msg
};
}
else
{
{
code
=
ResultCode
.
OPERATE_FAILED
.
Code
,
return
new
ApiResult
msg
=
ResultCode
.
OPERATE_FAILED
.
Msg
{
};
code
=
ResultCode
.
OPERATE_FAILED
.
Code
,
msg
=
ResultCode
.
OPERATE_FAILED
.
Msg
};
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
WebApiNET6-master/Common/EpcConvert.cs
View file @
0481217c
...
@@ -31,7 +31,8 @@ namespace Common
...
@@ -31,7 +31,8 @@ namespace Common
public
ulong
TimeSpan
{
get
;
set
;
}
//当前日期时间戳,精确到毫秒
public
ulong
TimeSpan
{
get
;
set
;
}
//当前日期时间戳,精确到毫秒
public
byte
MachineNum
{
get
;
set
;
}
//服务器识别码(4bits),用于区分测试服务器与正式服务器生成的数据,实际1b就够了,其他3b做保留
public
byte
MachineNum
{
get
;
set
;
}
//服务器识别码(4bits),用于区分测试服务器与正式服务器生成的数据,实际1b就够了,其他3b做保留
/*---------以下为警用装备3.0添加参数-----------*/
/*---------以下为警用装备3.0添加参数-----------*/
public
byte
EType
{
get
;
set
;
}
//1单标签 2双标签 3三标签(兼容2.0标签 2.0解析输出0)
public
byte
EType
;
//1单标签 2双标签 3三标签(兼容2.0标签 2.0解析输出0)
public
byte
EProperty
;
// 资产类型:0固定资产 1非固定资产(仅限3.0标签)
}
}
public
static
class
EpcConvert
public
static
class
EpcConvert
...
@@ -154,6 +155,69 @@ namespace Common
...
@@ -154,6 +155,69 @@ namespace Common
}
}
/// <summary>
/// <summary>
/// 生成3.0EPC
/// </summary>
/// <param name="epc"></param>
/// <returns></returns>
public
static
byte
[]
Epc3Gen
(
Analyzingepc
epc
)
{
byte
[]
buf
=
new
byte
[
40
];
int
pos
=
0
;
SetData
(
ref
buf
,
pos
,
8
,
epc
.
Header
);
pos
+=
8
;
SetData
(
ref
buf
,
pos
,
6
,
epc
.
IssuerId
);
pos
+=
6
;
SetData
(
ref
buf
,
pos
,
54
,
OrganizationCodeTo6Bin
(
epc
.
OrganizationCode
.
ToUpper
()));
pos
+=
54
;
SetData
(
ref
buf
,
pos
,
4
,
epc
.
WzdmLen
);
pos
+=
4
;
var
wzlen
=
((
epc
.
WzdmLen
-
1
)
%
8
)
*
8
;
SetData
(
ref
buf
,
pos
,
wzlen
,
epc
.
Wzdm
);
// 物资代码暂时定义最长为64bits
pos
+=
wzlen
;
SetData
(
ref
buf
,
pos
,
8
,
epc
.
Hxdm
);
// 物资代码暂时定义最长为64bits
pos
+=
8
;
SetData
(
ref
buf
,
pos
,
4
,
epc
.
SerialLen
);
pos
+=
4
;
/*----------------2.0版本字段-------------*/
SetData
(
ref
buf
,
pos
,
8
,
epc
.
Ver
);
pos
+=
8
;
SetData
(
ref
buf
,
pos
,
24
,
epc
.
ProductionDate
);
pos
+=
24
;
SetData
(
ref
buf
,
pos
,
6
,
epc
.
ExpiryDate
);
pos
+=
6
;
SetData
(
ref
buf
,
pos
,
2
,
epc
.
ExpiryDateUnit
);
pos
+=
2
;
SetData
(
ref
buf
,
pos
,
48
,
epc
.
TimeSpan
);
pos
+=
48
;
SetData
(
ref
buf
,
pos
,
12
,
epc
.
NoInBox
);
pos
+=
12
;
/*----------------警用装备3.0字段-------------*/
SetData
(
ref
buf
,
pos
,
4
,
epc
.
EProperty
);
pos
+=
4
;
SetData
(
ref
buf
,
pos
,
4
,
epc
.
EType
);
pos
+=
4
;
// 双字节对齐, 剩余保留区
if
(
pos
%
16
!=
0
)
{
pos
+=
16
-
pos
%
16
;
}
// 数据体长度
var
len
=
pos
/
8
;
var
crc
=
Crc16
(
buf
,
len
);
SetData
(
ref
buf
,
pos
,
16
,
crc
);
byte
[]
rtn
=
new
byte
[
len
+
2
];
Array
.
Copy
(
buf
,
rtn
,
len
+
2
);
return
rtn
;
}
/// <summary>
/// 生成EPC
/// 生成EPC
/// </summary>
/// </summary>
/// <param name="epc"></param>
/// <param name="epc"></param>
...
@@ -270,6 +334,23 @@ namespace Common
...
@@ -270,6 +334,23 @@ namespace Common
rtn
.
EType
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
rtn
.
EType
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
pos
+=
4
;
pos
+=
4
;
}
}
else
if
(
rtn
.
Ver
==
0x03
)
{
rtn
.
ProductionDate
=
(
byte
)
GetData
(
epc
,
pos
,
24
);
pos
+=
24
;
rtn
.
ExpiryDate
=
(
byte
)
GetData
(
epc
,
pos
,
6
);
pos
+=
6
;
rtn
.
ExpiryDateUnit
=
(
byte
)
GetData
(
epc
,
pos
,
2
);
pos
+=
2
;
rtn
.
TimeSpan
=
(
byte
)
GetData
(
epc
,
pos
,
48
);
pos
+=
48
;
rtn
.
NoInBox
=
(
byte
)
GetData
(
epc
,
pos
,
12
);
pos
+=
12
;
rtn
.
EProperty
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
pos
+=
4
;
rtn
.
EType
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
pos
+=
4
;
}
else
else
{
{
rtn
.
TagType
=
(
byte
)
GetData
(
epc
,
pos
,
8
);
rtn
.
TagType
=
(
byte
)
GetData
(
epc
,
pos
,
8
);
...
@@ -340,14 +421,14 @@ namespace Common
...
@@ -340,14 +421,14 @@ namespace Common
pos
+=
48
;
pos
+=
48
;
rtn
.
NoInBox
=
(
UInt16
)
GetData
(
epc
,
pos
,
12
);
rtn
.
NoInBox
=
(
UInt16
)
GetData
(
epc
,
pos
,
12
);
pos
+=
12
;
pos
+=
12
;
rtn
.
MachineNum
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
rtn
.
EProperty
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
pos
+=
4
;
pos
+=
4
;
rtn
.
EType
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
rtn
.
EType
=
(
byte
)
GetData
(
epc
,
pos
,
4
);
pos
+=
4
;
pos
+=
4
;
rtn
.
EType
=
1
;
rtn
.
EType
=
1
;
string
baseEpc
=
Hex16ByteToHex16String
(
EpcConvert
.
Epc
2
Gen
(
rtn
)).
Replace
(
" "
,
""
);
string
baseEpc
=
Hex16ByteToHex16String
(
EpcConvert
.
Epc
3
Gen
(
rtn
)).
Replace
(
" "
,
""
);
return
baseEpc
;
return
baseEpc
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论