Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Third.Chinaerdos.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.Third.Chinaerdos.V4.5
Commits
23a1dbe4
Commit
23a1dbe4
authored
Oct 22, 2024
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
52c920ee
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
31 deletions
+119
-31
Erdos.cs
Src/Entities/Erdos.cs
+1
-1
ErdosBase.cs
Src/Entities/ErdosBase.cs
+52
-1
OrderExtension.cs
Src/Extensions/OrderExtension.cs
+61
-3
Kivii.Third.Chinaerdos.V4.5.csproj
Src/Kivii.Third.Chinaerdos.V4.5.csproj
+0
-1
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
OrderRequest.cs
Src/Requests/OrderRequest.cs
+3
-1
RestfulErdos.cs
Src/RestfulErdos.cs
+0
-22
No files found.
Src/Entities/Erdos.cs
View file @
23a1dbe4
...
...
@@ -83,7 +83,7 @@ namespace Kivii.Third.Chinaerdos.Entities
/// 付款单位名称
/// </summary>
[
ApiMember
(
Description
=
"付款单位名称"
)]
public
DateTime
PAYER_ORG_NAME
{
get
;
set
;
}
public
string
PAYER_ORG_NAME
{
get
;
set
;
}
/// <summary>
/// 付款单位地址
...
...
Src/Entities/ErdosBase.cs
View file @
23a1dbe4
...
...
@@ -18,7 +18,58 @@ namespace Kivii.Third.Chinaerdos.Entities
public
Report
OnInstanceThirdReport
(
Guid
ThirdReportOrderKvid
)
{
return
new
Report
();
//return null;
if
(
ThirdReportOrderKvid
==
Guid
.
Empty
)
return
null
;
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
ThirdReportOrder
>();
var
third
=
conn
.
SingleById
<
ThirdReportOrder
>(
ThirdReportOrderKvid
);
if
(
third
==
null
)
return
null
;
if
(
third
.
ThirdType
!=
typeof
(
ErdosOrder
).
FullName
)
return
null
;
if
(
third
.
Metadata
==
null
)
return
null
;
var
order
=
third
.
Metadata
.
DicToObject
();
var
rtns
=
new
Report
();
rtns
.
BizId
=
third
.
SerialNumber
;
rtns
.
BizKvid
=
third
.
Kvid
;
rtns
.
BizType
=
typeof
(
ThirdReportOrder
).
FullName
;
//rtns.ReportId = $"{order.BRAND_DISPLAY}{DateTime.Now:yyyyMMddHHmmss}";
//contract.OrderID = semir.DOC_NO;
//report.Type = "B";
rtns
.
TypeEx
=
"W"
;
rtns
.
TypeName
=
"委托送样"
;
//rtns.Category = "SE";
rtns
.
DemanderName
=
order
.
APPLY_ORG_NAME
;
rtns
.
DemanderContactName
=
order
.
CONTACT_PERSON
;
rtns
.
DemanderContactNumber
=
order
.
CONTACT_PHONE
;
rtns
.
DemanderContactAddress
=
order
.
APPLY_ORG_ADDRESS
;
rtns
.
SampleManufacturerName
=
order
.
RELATED_VENDOR_DESC
;
//rtns.SampleManufacturerContactName = order.PAYER_CONTACT_PERSON;
//rtns.SampleManufacturerContactNumber = order.PAYER_CONTACT_PHONE;
//rtns.SampleManufacturerAddress = order.PAYER_ORG_ADDRESS;
rtns
.
PayerName
=
order
.
PAYER_ORG_NAME
;
rtns
.
SampleName
=
order
.
SAMPLE_NAME
;
rtns
.
SampleBrand
=
order
.
BRAND_DISPLAY
;
rtns
.
SampleGradeSafety
=
order
.
CHECK_LEVEL_DISPLAY
;
rtns
.
SampleGrade
=
order
.
SAMPLE_GRADE_DISPLAY
;
rtns
.
SampleBatchNumber
=
order
.
MAT_CODE
;
rtns
.
Metadata
=
new
Dictionary
<
string
,
string
>();
rtns
.
Metadata
[
"PayerContactAddress"
]
=
order
.
PAYER_ORG_ADDRESS
;
rtns
.
Metadata
[
"SampleDescriptionEx"
]
=
order
.
MAT_F1_DISPLAY
;
rtns
.
Remark
=
order
.
REMARK
;
var
details
=
new
List
<
string
>();
foreach
(
var
detail
in
order
.
ITEMS
)
{
details
.
Add
(
$"
{
detail
.
ITEM_NAME
}
(
{
detail
.
ITEM_STANDARD
}
)"
);
}
var
tasks
=
string
.
Join
(
"、"
,
details
.
ToArray
());
rtns
.
Metadata
.
Add
(
"ERemark"
,
tasks
);
return
rtns
;
}
public
object
OnPullThirdReport
()
...
...
Src/Extensions/OrderExtension.cs
View file @
23a1dbe4
...
...
@@ -6,9 +6,11 @@ using Kivii.Third.Chinaerdos.Requests;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Globalization
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
Kivii.Third.Chinaerdos.Extensions
...
...
@@ -96,11 +98,11 @@ namespace Kivii.Third.Chinaerdos.Extensions
}
}
internal
static
OrderResponse
RejectOrder
(
this
JsonHttpClient
_client
,
string
apptoken
,
string
appsecret
,
string
orderNo
)
internal
static
OrderResponse
RejectOrder
(
JsonHttpClient
_client
,
string
orderNo
,
string
apptoken
=
null
,
string
appsecret
=
null
)
{
(
_client
==
null
).
ThrowIfTrue
(
"RejectOrder:请传入_client"
);
(
apptoken
.
IsNullOrEmpty
())
.
ThrowIfTrue
(
"RejectOrder:请传入apptoken"
);
(
appsecret
.
IsNullOrEmpty
())
.
ThrowIfTrue
(
"RejectOrder:请传入appsecret"
);
if
(
apptoken
.
IsNullOrEmpty
())
apptoken
=
Configs
.
_token
;
//
.ThrowIfTrue("RejectOrder:请传入apptoken");
if
(
appsecret
.
IsNullOrEmpty
())
appsecret
=
Configs
.
_secret
;
//
.ThrowIfTrue("RejectOrder:请传入appsecret");
(
orderNo
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"RejectOrder:请传入orderNo"
);
//var client = new JsonServiceClient(baseUrl);
...
...
@@ -377,5 +379,61 @@ namespace Kivii.Third.Chinaerdos.Extensions
}
return
sign
.
ToString
().
ToUpper
();
}
/// <summary>
/// 字典类型转化为对象
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
public
static
ErdosOrder
DicToObject
(
this
Dictionary
<
string
,
string
>
dic
)
{
var
md
=
new
ErdosOrder
();
CultureInfo
cultureInfo
=
Thread
.
CurrentThread
.
CurrentCulture
;
TextInfo
textInfo
=
cultureInfo
.
TextInfo
;
foreach
(
var
d
in
dic
)
{
var
filed
=
textInfo
.
ToTitleCase
(
d
.
Key
);
try
{
var
value
=
d
.
Value
;
var
property
=
md
.
GetType
().
GetProperty
(
filed
);
if
(
property
==
null
)
continue
;
if
(!
property
.
PropertyType
.
IsGenericType
)
{
switch
(
property
.
Name
)
{
case
"ITEMS"
:
property
.
SetValue
(
md
,
JsonSerializer
.
DeserializeFromString
<
List
<
ErdosOrderDetail
>>(
value
),
null
);
break
;
default
:
property
.
SetValue
(
md
,
string
.
IsNullOrEmpty
(
value
)
?
null
:
Convert
.
ChangeType
(
value
,
property
.
PropertyType
),
null
);
break
;
}
}
else
{
Type
genericTypeDefinition
=
property
.
PropertyType
.
GetGenericTypeDefinition
();
switch
(
property
.
Name
)
{
case
"ITEMS"
:
property
.
SetValue
(
md
,
JsonSerializer
.
DeserializeFromString
<
List
<
ErdosOrderDetail
>>(
value
),
null
);
break
;
default
:
//泛型Nullable<>
if
(
genericTypeDefinition
==
typeof
(
Nullable
<>))
{
property
.
SetValue
(
md
,
string
.
IsNullOrEmpty
(
value
)
?
null
:
Convert
.
ChangeType
(
value
,
Nullable
.
GetUnderlyingType
(
property
.
PropertyType
)),
null
);
}
break
;
}
}
}
catch
(
Exception
ex
)
{
throw
ex
;
}
}
return
md
;
}
}
}
Src/Kivii.Third.Chinaerdos.V4.5.csproj
View file @
23a1dbe4
...
...
@@ -58,7 +58,6 @@
<Compile
Include=
"Jobs\OrderJob.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Requests\OrderRequest.cs"
/>
<Compile
Include=
"RestfulErdos.cs"
/>
</ItemGroup>
<ItemGroup
/>
<ItemGroup>
...
...
Src/Properties/AssemblyInfo.cs
View file @
23a1dbe4
...
...
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.102
1
0")]
[assembly: AssemblyFileVersion("5.4.2024.102
1
0")]
[assembly: AssemblyVersion("5.4.2024.102
2
0")]
[assembly: AssemblyFileVersion("5.4.2024.102
2
0")]
Src/Requests/OrderRequest.cs
View file @
23a1dbe4
using
Kivii.Third.Chinaerdos.Entities
;
using
Kivii.Linq
;
using
Kivii.Third.Chinaerdos.Entities
;
using
Kivii.Third.Chinaerdos.Extensions
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
Src/RestfulErdos.cs
deleted
100644 → 0
View file @
52c920ee
using
Kivii.Third.Chinaerdos.Entities
;
using
Kivii.Third.Chinaerdos.Extensions
;
using
Kivii.Web
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Kivii.Third.Chinaerdos
{
public
class
ErdosRegect
:
RestfulExecution
<
ErdosOrder
>
{
public
string
SerialNumber
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
var
client
=
new
JsonHttpClient
(
Configs
.
_defaultUrl
);
client
.
RejectOrder
(
Configs
.
_token
,
Configs
.
_secret
,
SerialNumber
);
return
base
.
OnExecution
(
req
,
res
);
}
}
}
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