Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Third.Scjgj
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.Scjgj
Commits
4b1207bb
Commit
4b1207bb
authored
Jun 24, 2024
by
Neo Turing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
babb4f2a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
301 additions
and
20 deletions
+301
-20
Configs.cs
Src/Configs.cs
+12
-1
OtherEntity.cs
Src/Entities/OtherEntity.cs
+0
-0
Plan.cs
Src/Entities/Plan.cs
+23
-9
Extensions.cs
Src/Extensions.cs
+242
-6
Kivii.Third.Scjgj.V4.5.csproj
Src/Kivii.Third.Scjgj.V4.5.csproj
+2
-1
RestfulPlan.cs
Src/RestfulPlan.cs
+22
-3
No files found.
Src/Configs.cs
View file @
4b1207bb
...
@@ -8,8 +8,19 @@ namespace Kivii.Third.Scjgj
...
@@ -8,8 +8,19 @@ namespace Kivii.Third.Scjgj
{
{
internal
class
Configs
internal
class
Configs
{
{
public
const
string
TableNamePlan
=
"PM_PLAN"
;
public
const
string
TableNamePlan
=
"PM_PLAN"
;
public
const
string
TableNamePlanDetail
=
"PM_PLAN_SUB"
;
public
const
string
TableNamePlanDetail
=
"PM_PLAN_SUB"
;
public
const
string
TableNameCary
=
"PM_CARY"
;
public
const
string
TableNameProduceUnit
=
"PM_PRODUCE_UNIT"
;
public
const
string
TableNameExecUint
=
"PM_EXEC_UINT"
;
public
const
string
TableNameEcPlatform
=
"PM_EC_PLATFORM"
;
public
const
string
TableNameOther
=
"PM_OTHER"
;
public
const
string
TableNameLive
=
"PM_LIVE"
;
public
const
string
TableNameBigData
=
"CORE_BIG_DATA"
;
public
const
string
TableNamePlanUp
=
"PM_PLAN_UP"
;
public
const
string
TableNameTaskSource
=
"PM_TASK_SOURCE"
;
public
const
string
ConnectionString
=
"Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;"
;
public
const
string
ConnectionProviderName
=
"Oracle"
;
}
}
}
}
Src/Entities/OtherEntity.cs
0 → 100644
View file @
4b1207bb
This diff is collapsed.
Click to expand it.
Src/Plan.cs
→
Src/
Entities/
Plan.cs
View file @
4b1207bb
using
Kivii.DataAnnotations
;
using
Kivii.DataAnnotations
;
using
Kivii.Funq
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
...
@@ -32,7 +33,7 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -32,7 +33,7 @@ namespace Kivii.Third.Scjgj.Entities
///// 任务状态(1.未下达 2.已下达 3.已领取 4.已完成 0.已撤回 5.已上传)
///// 任务状态(1.未下达 2.已下达 3.已领取 4.已完成 0.已撤回 5.已上传)
/// </summary>
/// </summary>
[
Alias
(
"PLAN_STATE"
)]
[
Alias
(
"PLAN_STATE"
)]
public
new
int
Status
{
get
;
set
;
}
public
new
int
Status
{
get
;
set
;
}
#
endregion
#
endregion
/// <summary>
/// <summary>
...
@@ -320,11 +321,11 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -320,11 +321,11 @@ namespace Kivii.Third.Scjgj.Entities
[
Alias
(
"CREATEDATE"
)]
[
Alias
(
"CREATEDATE"
)]
public
new
DateTime
CreateTime
{
get
;
set
;
}
public
new
DateTime
CreateTime
{
get
;
set
;
}
[
Ignore
]
[
Ignore
]
public
new
DateTime
UpdateTime
{
get
;
set
;
}
public
new
DateTime
UpdateTime
{
get
;
set
;
}
//[Ignore]
//[Ignore]
/// 抽检任务状态 0:抽样人员待上传 1:抽样人员已上传 2:抽样信息上传照片未上传 3:抽样信息上传照片已上传 4:已提交(提交省公司) 5:提交审批 6:审批通过 7:驳回 8:无效 9:删除
/// 抽检任务状态 0:抽样人员待上传 1:抽样人员已上传 2:抽样信息上传照片未上传 3:抽样信息上传照片已上传 4:已提交(提交省公司) 5:提交审批 6:审批通过 7:驳回 8:无效 9:删除
[
Alias
(
"STATE"
)]
[
Alias
(
"STATE"
)]
public
new
int
Status
{
get
;
set
;
}
public
new
int
Status
{
get
;
set
;
}
#
endregion
#
endregion
/// <summary>
/// <summary>
...
@@ -371,13 +372,18 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -371,13 +372,18 @@ namespace Kivii.Third.Scjgj.Entities
/// <summary>
/// <summary>
/// 受检单位编号
/// 受检单位编号
/// </summary>
/// </summary>
public
int
CARY_ID
{
get
;
set
;
}
public
int
?
CARY_ID
{
get
;
set
;
}
[
Ignore
]
public
Cary
Cary
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 生产单位编号
/// 生产单位编号
/// </summary>
/// </summary>
public
int
PRO_ID
{
get
;
set
;
}
public
int
?
PRO_ID
{
get
;
set
;
}
[
Ignore
]
public
ProduceUnit
ProduceUnit
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 受检产品编号
/// 受检产品编号
/// </summary>
/// </summary>
...
@@ -458,7 +464,10 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -458,7 +464,10 @@ namespace Kivii.Third.Scjgj.Entities
/// <summary>
/// <summary>
/// 抽样单位编号
/// 抽样单位编号
/// </summary>
/// </summary>
public
int
EXEC_ID
{
get
;
set
;
}
public
int
?
EXEC_ID
{
get
;
set
;
}
[
Ignore
]
public
ExecUint
ExecUint
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 备注
/// 备注
...
@@ -570,7 +579,10 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -570,7 +579,10 @@ namespace Kivii.Third.Scjgj.Entities
/// <summary>
/// <summary>
/// 电商平台编号
/// 电商平台编号
/// </summary>
/// </summary>
public
int
EC_ID
{
get
;
set
;
}
public
int
?
EC_ID
{
get
;
set
;
}
[
Ignore
]
public
EcPlatform
EcPlatform
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 发票号
/// 发票号
...
@@ -928,7 +940,10 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -928,7 +940,10 @@ namespace Kivii.Third.Scjgj.Entities
/// <summary>
/// <summary>
/// 其他来源单位编码
/// 其他来源单位编码
/// </summary>
/// </summary>
public
int
OTHER_ID
{
get
;
set
;
}
public
int
?
OTHER_ID
{
get
;
set
;
}
[
Ignore
]
public
Other
Other
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 批次数据同步状态
/// 批次数据同步状态
...
@@ -989,5 +1004,4 @@ namespace Kivii.Third.Scjgj.Entities
...
@@ -989,5 +1004,4 @@ namespace Kivii.Third.Scjgj.Entities
[
StringLength
(
30
)]
[
StringLength
(
30
)]
public
string
IMG_111_GROUP_ID
{
get
;
set
;
}
public
string
IMG_111_GROUP_ID
{
get
;
set
;
}
}
}
}
}
Src/Extensions.cs
View file @
4b1207bb
using
Kivii.Lims.Entities
;
using
Kivii.Funq
;
using
Kivii.Lims.Entities
;
using
Kivii.Linq
;
using
Kivii.Third.Scjgj.Entities
;
using
Kivii.Third.Scjgj.Entities
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -10,14 +13,247 @@ namespace Kivii.Third.Scjgj
...
@@ -10,14 +13,247 @@ namespace Kivii.Third.Scjgj
{
{
internal
static
class
Extensions
internal
static
class
Extensions
{
{
internal
static
Report
ConvertTo
(
this
PlanDetail
item
)
internal
static
PlanDetail
ConvertTo
(
this
PlanDetail
item
,
IDbConnection
conn
=
null
)
{
{
Report
rtns
=
new
Report
();
PlanDetail
rtns
=
new
PlanDetail
();
rtns
.
Metadata
=
new
Dictionary
<
string
,
string
>();
bool
connDispose
=
false
;
rtns
.
Metadata
[
"SamplingOrderID"
]
=
$"
{
item
.
PLAN_CODE
}{
item
.
LOT_NUM
}
"
;
if
(
conn
==
null
)
rtns
.
SampleSourceBatchNumber
=
item
.
PLAN_CODE
;
{
connDispose
=
true
;
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
"Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;"
,
"Oracle"
);
conn
=
factory
.
OpenDbConnection
();
}
switch
(
item
.
CHECK_STATE
)
{
case
"1"
:
rtns
=
item
.
ConvertToNormal
(
conn
);
break
;
case
"2"
:
rtns
=
item
.
ConvertToReject
(
conn
);
break
;
case
"3"
:
rtns
=
item
.
ConvertToUnable
(
conn
);
break
;
case
"4"
:
rtns
=
item
.
ConvertToFinished
(
conn
);
break
;
case
"5"
:
rtns
=
item
.
ConvertToMarket
(
conn
);
break
;
case
"6"
:
rtns
=
item
.
ConvertToOther
(
conn
);
break
;
case
null
:
rtns
=
item
.
ConvertToCommerce
(
conn
);
break
;
default
:
break
;
}
if
(
connDispose
)
{
conn
.
Dispose
();
}
return
rtns
;
return
rtns
;
}
}
/// <summary>
/// 正常抽样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToNormal
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
if
(
item
.
CARY_ID
!=
null
)
{
item
.
Cary
=
GetCaryById
(
conn
,
item
.
CARY_ID
);
}
if
(
item
.
PRO_ID
!=
null
)
{
item
.
ProduceUnit
=
GetProduceUnitById
(
conn
,
item
.
PRO_ID
);
}
if
(
item
.
EXEC_ID
!=
null
)
{
item
.
ExecUint
=
GetExecUintById
(
conn
,
item
.
EXEC_ID
);
}
return
item
;
}
/// <summary>
/// 拒绝采样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToReject
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
return
item
;
}
/// <summary>
/// 无法抽样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToUnable
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
return
item
;
}
/// <summary>
/// 成品油抽样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToFinished
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
return
item
;
}
/// <summary>
/// 市场抽样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToMarket
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
if
(
item
.
CARY_ID
!=
null
)
{
item
.
Cary
=
GetCaryById
(
conn
,
item
.
CARY_ID
);
}
if
(
item
.
EXEC_ID
!=
null
)
{
item
.
ExecUint
=
GetExecUintById
(
conn
,
item
.
EXEC_ID
);
}
if
(
item
.
PRO_ID
!=
null
)
{
item
.
ProduceUnit
=
GetProduceUnitById
(
conn
,
item
.
PRO_ID
);
}
return
item
;
}
/// <summary>
/// 其他抽样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToOther
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
if
(
item
.
CARY_ID
!=
null
)
{
item
.
Cary
=
GetCaryById
(
conn
,
item
.
CARY_ID
);
}
if
(
item
.
EXEC_ID
!=
null
)
{
item
.
ExecUint
=
GetExecUintById
(
conn
,
item
.
EXEC_ID
);
}
if
(
item
.
OTHER_ID
!=
null
)
{
item
.
Other
=
GetOtherById
(
conn
,
item
.
OTHER_ID
);
}
return
item
;
}
/// <summary>
/// 电商买样
/// </summary>
/// <param name="item"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal
static
PlanDetail
ConvertToCommerce
(
this
PlanDetail
item
,
IDbConnection
conn
)
{
if
(
item
.
CARY_ID
!=
null
)
{
item
.
Cary
=
GetCaryById
(
conn
,
item
.
CARY_ID
);
}
if
(
item
.
EXEC_ID
!=
null
)
{
item
.
ExecUint
=
GetExecUintById
(
conn
,
item
.
EXEC_ID
);
}
if
(
item
.
EC_ID
!=
null
)
{
item
.
EcPlatform
=
GetEcPlatformById
(
conn
,
item
.
EC_ID
);
}
if
(
item
.
PRO_ID
!=
null
)
{
item
.
ProduceUnit
=
GetProduceUnitById
(
conn
,
item
.
PRO_ID
);
}
return
item
;
}
/// <summary>
/// 受检单位信息
/// </summary>
/// <param name="conn"></param>
/// <param name="caryId"></param>
/// <returns></returns>
internal
static
Cary
GetCaryById
(
IDbConnection
conn
,
int
?
caryId
)
{
if
(
caryId
==
null
)
return
null
;
var
query
=
conn
.
From
<
Cary
>();
query
.
Where
(
o
=>
o
.
ID
==
caryId
);
return
conn
.
Single
(
query
);
}
/// <summary>
/// 生产单位信息
/// </summary>
/// <param name="conn"></param>
/// <param name="proId"></param>
/// <returns></returns>
internal
static
ProduceUnit
GetProduceUnitById
(
IDbConnection
conn
,
int
?
proId
)
{
if
(
proId
==
null
)
return
null
;
var
query
=
conn
.
From
<
ProduceUnit
>();
query
.
Where
(
o
=>
o
.
ID
==
proId
);
return
conn
.
Single
(
query
);
}
/// <summary>
/// 抽样机构信息
/// </summary>
/// <param name="conn"></param>
/// <param name="execId"></param>
/// <returns></returns>
internal
static
ExecUint
GetExecUintById
(
IDbConnection
conn
,
int
?
execId
)
{
if
(
execId
==
null
)
return
null
;
var
query
=
conn
.
From
<
ExecUint
>();
query
.
Where
(
o
=>
o
.
ID
==
execId
);
return
conn
.
Single
(
query
);
}
/// <summary>
/// 电商单位信息
/// </summary>
/// <param name="conn"></param>
/// <param name="ecId"></param>
/// <returns></returns>
internal
static
EcPlatform
GetEcPlatformById
(
IDbConnection
conn
,
int
?
ecId
)
{
if
(
ecId
==
null
)
return
null
;
var
query
=
conn
.
From
<
EcPlatform
>();
query
.
Where
(
o
=>
o
.
EC_ID
==
ecId
);
return
conn
.
Single
(
query
);
}
/// <summary>
/// 其他来源单位信息
/// </summary>
/// <param name="conn"></param>
/// <param name="otherId"></param>
/// <returns></returns>
internal
static
Other
GetOtherById
(
IDbConnection
conn
,
int
?
otherId
)
{
if
(
otherId
==
null
)
return
null
;
var
query
=
conn
.
From
<
Other
>();
query
.
Where
(
o
=>
o
.
ID
==
otherId
);
return
conn
.
Single
(
query
);
}
}
}
}
}
Src/Kivii.Third.Scjgj.V4.5.csproj
View file @
4b1207bb
...
@@ -54,8 +54,9 @@
...
@@ -54,8 +54,9 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile
Include=
"Configs.cs"
/>
<Compile
Include=
"Configs.cs"
/>
<Compile
Include=
"Entities\OtherEntity.cs"
/>
<Compile
Include=
"Extensions.cs"
/>
<Compile
Include=
"Extensions.cs"
/>
<Compile
Include=
"Plan.cs"
/>
<Compile
Include=
"
Entities\
Plan.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"RestfulPlan.cs"
/>
<Compile
Include=
"RestfulPlan.cs"
/>
</ItemGroup>
</ItemGroup>
...
...
Src/RestfulPlan.cs
View file @
4b1207bb
...
@@ -26,7 +26,7 @@ namespace Kivii.Third.Scjgj
...
@@ -26,7 +26,7 @@ namespace Kivii.Third.Scjgj
{
{
var
rtns
=
new
RestfulQueryResponse
<
Plan
>();
var
rtns
=
new
RestfulQueryResponse
<
Plan
>();
rtns
.
Results
=
new
List
<
Plan
>();
rtns
.
Results
=
new
List
<
Plan
>();
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
"Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;"
,
"Oracle"
);
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
Configs
.
ConnectionString
,
Configs
.
ConnectionProviderName
);
using
(
var
conn
=
factory
.
OpenDbConnection
())
using
(
var
conn
=
factory
.
OpenDbConnection
())
{
{
try
try
...
@@ -86,7 +86,7 @@ namespace Kivii.Third.Scjgj
...
@@ -86,7 +86,7 @@ namespace Kivii.Third.Scjgj
{
{
var
rtns
=
new
RestfulQueryResponse
<
PlanDetail
>();
var
rtns
=
new
RestfulQueryResponse
<
PlanDetail
>();
rtns
.
Results
=
new
List
<
PlanDetail
>();
rtns
.
Results
=
new
List
<
PlanDetail
>();
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
"Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;"
,
"Oracle"
);
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
Configs
.
ConnectionString
,
Configs
.
ConnectionProviderName
);
using
(
var
conn
=
factory
.
OpenDbConnection
())
using
(
var
conn
=
factory
.
OpenDbConnection
())
{
{
try
try
...
@@ -134,7 +134,26 @@ namespace Kivii.Third.Scjgj
...
@@ -134,7 +134,26 @@ namespace Kivii.Third.Scjgj
{
{
BatchNumber
.
ThrowIfNullOrEmpty
(
"请传入计划编号"
);
BatchNumber
.
ThrowIfNullOrEmpty
(
"请传入计划编号"
);
PlanNumber
.
ThrowIfNullOrEmpty
(
"请传入批次号"
);
PlanNumber
.
ThrowIfNullOrEmpty
(
"请传入批次号"
);
return
base
.
OnExecution
(
req
,
res
);
var
rtns
=
new
RestfulQueryResponse
<
PlanDetail
>();
rtns
.
Results
=
new
List
<
PlanDetail
>();
var
factory
=
Kivii
.
Linq
.
LinqUtils
.
GetLinqConnectionFactory
(
Configs
.
ConnectionString
,
Configs
.
ConnectionProviderName
);
using
(
var
conn
=
factory
.
OpenDbConnection
())
{
try
{
var
query
=
conn
.
From
<
PlanDetail
>();
query
.
Where
(
o
=>
o
.
PLAN_CODE
==
BatchNumber
&&
o
.
LOT_NUM
==
PlanNumber
);
var
planDetail
=
conn
.
Single
(
query
);
var
result
=
planDetail
.
ConvertTo
(
conn
);
rtns
.
Results
.
Add
(
result
);
}
catch
(
Exception
ex
)
{
throw
ex
;
}
}
return
rtns
;
}
}
}
}
}
}
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