Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Biz.Samples.V4.5
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Kivii.Biz.Samples.V4.5
Commits
06383cf9
Commit
06383cf9
authored
May 23, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持Rfid的Tid记录
parent
6339b929
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
2 deletions
+135
-2
Configs.cs
Src/Configs.cs
+1
-0
RfidBound.cs
Src/Entities/RfidBound.cs
+24
-0
Kivii.Biz.Samples.V4.5.csproj
Src/Kivii.Biz.Samples.V4.5.csproj
+2
-0
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
SampleExtension.cs
Src/SampleExtension.cs
+14
-0
RestfulRfidBound.cs
Src/Transforms/RestfulRfidBound.cs
+25
-0
RestfulSample.cs
Src/Transforms/RestfulSample.cs
+67
-0
No files found.
Src/Configs.cs
View file @
06383cf9
...
...
@@ -11,6 +11,7 @@ namespace Kivii.Samples
public
const
string
TableNameSample
=
"SMPL_Samples"
;
public
const
string
TableNameLocation
=
"SMPL_Locations"
;
public
const
string
TableNameRoute
=
"SMPL_Routes"
;
public
const
string
TableNameRfidBound
=
"SMPL_RfidBounds"
;
//public const string TableNameSource = "SMPL_Sources";
}
}
Src/Entities/RfidBound.cs
0 → 100644
View file @
06383cf9
using
Kivii.DataAnnotations
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Kivii.Samples.Entities
{
[
Api
(
Description
=
"Rfid绑定"
)]
[
Alias
(
Configs
.
TableNameRfidBound
)]
public
class
RfidBound
:
EntityWithMetadata
,
IEntityInAssemblyDb
{
[
ApiMember
(
Description
=
"Tid"
)]
[
Required
,
Unique
]
[
StringLength
(
500
)]
public
string
Tid
{
get
;
set
;
}
[
ApiMember
(
Description
=
"Epc"
)]
[
StringLength
(
500
)]
public
string
Epc
{
get
;
set
;
}
}
}
Src/Kivii.Biz.Samples.V4.5.csproj
View file @
06383cf9
...
...
@@ -54,12 +54,14 @@
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Configs.cs"
/>
<Compile
Include=
"Entities\RfidBound.cs"
/>
<Compile
Include=
"Entities\Sample.cs"
/>
<Compile
Include=
"Entities\Location.cs"
/>
<Compile
Include=
"Entities\Route.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"SampleExtension.cs"
/>
<Compile
Include=
"Transforms\RestfulLocation.cs"
/>
<Compile
Include=
"Transforms\RestfulRfidBound.cs"
/>
<Compile
Include=
"Transforms\RestfulRoute.cs"
/>
<Compile
Include=
"Transforms\RestfulSample.cs"
/>
</ItemGroup>
...
...
Src/Properties/AssemblyInfo.cs
View file @
06383cf9
...
...
@@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.5
18
0")]
[assembly: AssemblyFileVersion("5.4.2023.5
18
0")]
[assembly: AssemblyVersion("5.4.2023.5
23
0")]
[assembly: AssemblyFileVersion("5.4.2023.5
23
0")]
Src/SampleExtension.cs
View file @
06383cf9
...
...
@@ -684,5 +684,19 @@ namespace Kivii.Samples
sample
.
CurrentPackage
=
rtns
;
return
rtns
;
}
public
static
Guid
GetKvidByTid
(
this
string
tid
)
{
//tid.ThrowIfNullOrEmpty("请传入Tid");
if
(
tid
.
IsNullOrEmpty
())
return
Guid
.
Empty
;
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
RfidBound
>();
var
rfid
=
conn
.
Single
<
RfidBound
>(
o
=>
o
.
Tid
==
tid
);
if
(
rfid
==
null
)
return
Guid
.
Empty
;
//rfid.ThrowIfNull("未找到当前的Rfid信息!");
if
(
rfid
.
Epc
.
IsNullOrEmpty
())
return
Guid
.
Empty
;
//rfid.Epc.ThrowIfNullOrEmpty("当前Rfid未绑定样品信息!");
if
(!
Guid
.
TryParse
(
rfid
.
Epc
,
out
var
rtns
))
return
Guid
.
Empty
;
return
rtns
;
}
}
}
Src/Transforms/RestfulRfidBound.cs
0 → 100644
View file @
06383cf9
using
Kivii.Samples.Entities
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Kivii.Samples.Transforms
{
public
class
RfidBoundCreate
:
RestfulCreate
<
RfidBound
>
{
}
public
class
RfidBoundQuery
:
RestfulQuery
<
RfidBound
>
{
}
public
class
RfidBoundRead
:
RestfulRead
<
RfidBound
>
{
}
public
class
RfidBoundDelete
:
RestfulDelete
<
RfidBound
>
{
}
}
Src/Transforms/RestfulSample.cs
View file @
06383cf9
...
...
@@ -233,6 +233,73 @@ namespace Kivii.Samples.Transforms
}
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
[
Api
(
Description
=
"打包样查找"
)]
public
class
SamplePrePackaging
:
RestfulExecution
<
Sample
>
{
public
Guid
OwnerKvid
{
get
;
set
;
}
//要打包的样品的所属信息
public
string
BizId
{
get
;
set
;
}
//传入样品的业务BizId或BiziKvid或者对应Rfid的Tid号 结合OwnerKvid查找对应的样品,包含查询子样品
public
Guid
BizKvid
{
get
;
set
;
}
//三者不能都为空
public
string
Tid
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
if
(
OwnerKvid
==
Guid
.
Empty
)
OwnerKvid
=
KiviiContext
.
CurrentMember
.
DepartmentKvid
;
if
(
BizId
.
IsNullOrEmpty
()
&&
Tid
.
IsNullOrEmpty
())
throw
new
Exception
(
"请传入要查询的样品业务信息!"
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Sample
>();
Guid
sampleRootKvid
=
Guid
.
Empty
;
if
(!
Tid
.
IsNullOrEmpty
())
{
var
tidKvid
=
Tid
.
GetKvidByTid
();
if
(
tidKvid
!=
Guid
.
Empty
)
{
var
queryRootSample
=
conn
.
From
<
Sample
>();
queryRootSample
.
Where
(
o
=>
o
.
BizKvid
==
tidKvid
);
var
rootSample
=
conn
.
Single
(
queryRootSample
);
if
(
rootSample
!=
null
)
{
sampleRootKvid
=
rootSample
.
RootKvid
;
BizId
=
rootSample
.
BizId
;
}
}
}
if
(
sampleRootKvid
==
Guid
.
Empty
)
{
if
(
BizKvid
!=
Guid
.
Empty
)
{
var
querySampleRootKvid
=
conn
.
From
<
Sample
>();
querySampleRootKvid
.
Where
(
o
=>
o
.
BizKvid
==
BizKvid
);
querySampleRootKvid
.
Select
(
o
=>
o
.
RootKvid
);
sampleRootKvid
=
conn
.
Single
<
Guid
>(
querySampleRootKvid
);
}
else
if
(!
BizId
.
IsNullOrEmpty
())
{
var
querySampleRootKvid
=
conn
.
From
<
Sample
>();
querySampleRootKvid
.
Where
(
o
=>
o
.
BizId
==
BizId
);
querySampleRootKvid
.
Select
(
o
=>
o
.
RootKvid
);
sampleRootKvid
=
conn
.
Single
<
Guid
>(
querySampleRootKvid
);
}
}
if
(
sampleRootKvid
==
Guid
.
Empty
)
throw
new
Exception
(
"未找到指定样品信息!"
);
var
rtns
=
new
RestfulExecutionResponse
<
Sample
>();
rtns
.
Results
=
new
List
<
Sample
>();
var
querySample
=
conn
.
From
<
Sample
>();
querySample
.
Where
(
o
=>
o
.
OwnerKvid
==
OwnerKvid
&&
o
.
RootKvid
==
sampleRootKvid
&&
o
.
BizId
==
BizId
&&
o
.
Type
==
SampleType
.
Node
);
//只查子样品
var
sample
=
conn
.
Single
(
querySample
);
if
(
sample
!=
null
)
rtns
.
Results
.
Add
(
sample
);
return
rtns
;
}
}
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
[
Api
(
Description
=
"样品打包"
)]
public
class
SamplePackaging
:
RestfulExecution
<
Sample
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment