Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.OfficeSample
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.Client.OfficeSample
Commits
02f8cb74
Commit
02f8cb74
authored
Sep 18, 2019
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c45803e7
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
801 additions
and
72 deletions
+801
-72
Contract.cs
Kivii.Client.OfficeSample/Entitis/Contract.cs
+556
-0
Form1.Designer.cs
Kivii.Client.OfficeSample/Form1.Designer.cs
+0
-47
Form1.cs
Kivii.Client.OfficeSample/Form1.cs
+0
-19
FrmMain.Designer.cs
Kivii.Client.OfficeSample/FrmMain.Designer.cs
+166
-0
FrmMain.cs
Kivii.Client.OfficeSample/FrmMain.cs
+66
-0
FrmMain.resx
Kivii.Client.OfficeSample/FrmMain.resx
+0
-0
Kivii.Client.OfficeSample.csproj
Kivii.Client.OfficeSample/Kivii.Client.OfficeSample.csproj
+10
-5
Program.cs
Kivii.Client.OfficeSample/Program.cs
+1
-1
packages.config
Kivii.Client.OfficeSample/packages.config
+2
-0
No files found.
Kivii.Client.OfficeSample/Entitis/Contract.cs
0 → 100644
View file @
02f8cb74
using
Kivii
;
using
Kivii.DataAnnotations
;
using
System
;
namespace
Kivii.Client.OfficeSample.Entities
{
public
class
Contract
:
EntityWithMetadata
,
IEntityIgnoreCreateTable
{
public
bool
IsSelected
{
get
;
set
;
}
public
bool
IsPrinted
{
get
;
set
;
}
/// <summary>
/// 报告编号
/// 组成方式:组织代码(JST)-[检验分类][协议类型(J=监督,W=委托)]
/// </summary>
public
string
ReportId
{
get
;
set
;
}
/// <summary>
/// 检验分类
/// F(纺织品检测)、X(纤维检测)、Y(羊毛局),T(淘宝)...
/// </summary>
public
string
Category
{
get
;
set
;
}
/// <summary>
/// 报告类型
/// 委托报告(FW,XW...),省局(FJ),工商(FJ)
/// </summary>
public
string
Type
{
get
;
set
;
}
/// <summary>
/// 检验类型
/// 例如:委托送样、委托抽样、比对...
/// </summary>
public
string
TypeName
{
get
;
set
;
}
/// <summary>
/// 系统流水号
/// 组成:{yyyy}{00001}
/// </summary>
public
int
SerialNumber
{
get
;
set
;
}
/// <summary>
/// 大客户特殊编码
/// </summary>
public
string
CustomSuffixId
{
get
;
set
;
}
/// <summary>
/// 报告的进度
/// 1->委托受理、2->任务分派、3->项目检验、4->报告编制、
/// 5->报告审核、6->报告签发、7->报告打印、8->报告归档
/// </summary>
public
int
Flow
{
get
;
set
;
}
/// <summary>
/// 打回标识
/// 每次打回时记录下打回前报告的进度
/// </summary>
public
int
FlowCallBack
{
get
;
set
;
}
#
region
委托
(
或受检
)
单位相关
/// <summary>
/// 委托单位Kvid
/// 可以为空 Guid.Empty
/// </summary>
public
Guid
CustomerOrgKvid
{
get
;
set
;
}
/// <summary>
/// 委托单位名称(在监督中叫受检单位)
/// </summary>
public
string
CustomerOrgName
{
get
;
set
;
}
/// <summary>
/// 委托单位联系人Kvid
/// </summary>
public
Guid
CustomerContactKvid
{
get
;
set
;
}
/// <summary>
/// 委托单位联系人姓名
/// </summary>
public
string
CustomerContactName
{
get
;
set
;
}
/// <summary>
/// 委托单位联系人电话
/// </summary>
public
string
CustomerContactMobile
{
get
;
set
;
}
/// <summary>
/// 委托单位联系地址
/// </summary>
public
string
CustomerContactAddress
{
get
;
set
;
}
#
endregion
#
region
生产单位相关
/// <summary>
/// 生产单位Kvid
/// </summary>
public
Guid
ProductOrgKvid
{
get
;
set
;
}
/// <summary>
/// 生产单位名称
/// </summary>
public
string
ProductOrgName
{
get
;
set
;
}
/// <summary>
/// 生产单位联系人Kvid
/// </summary>
public
Guid
ProductContactKvid
{
get
;
set
;
}
/// <summary>
/// 生产单位联系人姓名
/// </summary>
public
string
ProductContactName
{
get
;
set
;
}
/// <summary>
/// 生产单位联系人手机
/// </summary>
public
string
ProductContactMobile
{
get
;
set
;
}
/// <summary>
/// 生产单位联系地址
/// </summary>
public
string
ProductContactAddress
{
get
;
set
;
}
#
endregion
#
region
检验任务相关信息,检验依据,检验项目,检验要求
/// <summary>
/// 检验依据
/// </summary>
public
string
StandardOverView
{
get
;
set
;
}
/// <summary>
/// 检测项目
/// </summary>
public
string
DetectionOverView
{
get
;
set
;
}
/// <summary>
/// 检验要求:判定、数据
/// </summary>
public
bool
CheckType
{
get
;
set
;
}
/// <summary>
/// 产品质量综合判定
/// </summary>
public
string
ProductJudgement
{
get
;
set
;
}
#
endregion
#
region
样品相关
/// <summary>
/// 样品名称
/// </summary>
public
string
ProductName
{
get
;
set
;
}
/// <summary>
/// 样品品牌
/// </summary>
public
string
ProductBrand
{
get
;
set
;
}
/// <summary>
/// 样品规格型号
/// </summary>
public
string
ProductModel
{
get
;
set
;
}
/// <summary>
/// 样品数量
/// </summary>
public
string
ProductCount
{
get
;
set
;
}
/// <summary>
/// 样品等级
/// </summary>
public
string
ProductGrade
{
get
;
set
;
}
/// <summary>
/// 安全类别
/// </summary>
public
string
ProductSafetyGrade
{
get
;
set
;
}
#
endregion
/// <summary>
/// 委托日期:默认为当天日期
/// </summary>
public
DateTime
?
DealDate
{
get
;
set
;
}
/// <summary>
/// 委托下达日期
/// </summary>
public
DateTime
?
ReleaseDate
{
get
;
set
;
}
/// <summary>
/// 完成日期(前台选择)
/// </summary>
public
DateTime
?
DeadDate
{
get
;
set
;
}
/// <summary>
/// 任务分派日期
/// </summary>
public
DateTime
?
TaskStartDate
{
get
;
set
;
}
/// <summary>
/// 检验开始日期(为委托的下达日期)
/// </summary>
public
DateTime
?
TestStartDate
{
get
;
set
;
}
/// <summary>
/// 检验结束日期
/// 默认为编制时的当天日期
/// </summary>
public
DateTime
?
TestEndDate
{
get
;
set
;
}
/// <summary>
/// 淘宝翻单日期
/// </summary>
public
DateTime
?
FDDate
{
get
;
set
;
}
#
region
报告编制,审核,签发人员信息及签发日期
/// <summary>
/// 主检人
/// </summary>
public
string
TasksManagerName
{
get
;
set
;
}
/// <summary>
/// 主检人Kvid
/// </summary>
public
Guid
TasksManagerKvid
{
get
;
set
;
}
/// <summary>
/// 编制人Kvid
/// </summary>
public
Guid
ReportPreparersKvid
{
get
;
set
;
}
/// <summary>
/// 编制人姓名
/// </summary>
public
string
ReportPreparersName
{
get
;
set
;
}
/// <summary>
/// 审核人Kvid
/// </summary>
public
Guid
ReportReviewerKvid
{
get
;
set
;
}
/// <summary>
/// 审核人姓名
/// </summary>
public
string
ReportReviewerName
{
get
;
set
;
}
/// <summary>
/// 签发人Kvid
/// </summary>
public
Guid
ReportIssuerKvid
{
get
;
set
;
}
/// <summary>
/// 签发人姓名
/// </summary>
public
string
ReportIssuerName
{
get
;
set
;
}
/// <summary>
/// 签发日期
/// </summary>
public
DateTime
?
ReportIssueDate
{
get
;
set
;
}
#
endregion
#
region
报告模板及格式份数
/// <summary>
/// 报告格式
/// </summary>
public
string
ReportFormat
{
get
;
set
;
}
/// <summary>
/// 报告份数
/// </summary>
public
int
ReportCount
{
get
;
set
;
}
/// <summary>
/// 报告是否显示生产单位
/// </summary>
public
bool
ReportShowProductOrg
{
get
;
set
;
}
#
endregion
#
region
费用相关信息
/// <summary>
/// 应收检测项目费用(标准项目收费总和,不打折,不加急)
/// 在项目发生变化后,修改本费用
/// </summary>
[
Ignore
]
public
decimal
TasksFee
{
get
{
decimal
rtns
=
0
;
try
{
rtns
=
decimal
.
Parse
(
this
[
"TasksFee"
]);
}
catch
{
}
return
rtns
;
}
set
{
this
[
"TasksFee"
]
=
value
.
ToString
();
}
}
/// <summary>
/// 实收检测项目费用(标准项目打折后的收费总和,打折,不加急)
/// </summary>
[
Ignore
]
public
decimal
TasksDisCountFee
{
get
{
decimal
rtns
=
0
;
try
{
rtns
=
decimal
.
Parse
(
this
[
"TasksDisCountFee"
]);
}
catch
{
}
return
rtns
;
}
set
{
this
[
"TasksDisCountFee"
]
=
value
.
ToString
();
}
}
/// <summary>
/// 应收费,标准项目的定价*加急费率,统计工作量的费用
/// </summary>
public
decimal
Fee
{
get
{
return
TasksFee
*
UrgentRate
;
}
set
{
}
}
/// <summary>
/// 套餐费,如果此属性有值使用本值
/// </summary>
[
Ignore
]
public
decimal
PackageFee
{
get
{
decimal
rtns
=
0
;
try
{
rtns
=
decimal
.
Parse
(
this
[
"PackageFee"
]);
}
catch
{
}
return
rtns
;
}
set
{
this
[
"PackageFee"
]
=
value
.
ToString
();
}
}
/// <summary>
/// 加急系数
/// </summary>
[
Ignore
]
public
decimal
UrgentRate
{
get
{
decimal
rtns
=
1
;
try
{
rtns
=
decimal
.
Parse
(
this
[
"UrgentRate"
]);
}
catch
{
}
if
(
rtns
==
0
)
rtns
=
1
;
return
rtns
;
}
set
{
this
[
"UrgentRate"
]
=
value
.
ToString
();
}
}
/// <summary>
/// 实收检测项目费用:关联到客户协议,按照协议规定所生成的折后费
/// </summary>
public
decimal
RealFee
{
get
{
decimal
rtns
=
TasksDisCountFee
;
if
(
PackageFee
>
0
)
rtns
=
PackageFee
;
rtns
*=
UrgentRate
;
return
rtns
;
}
set
{
}
}
/// <summary>
/// 服务费用,报告份数费,等其它服务类费用总和
/// </summary>
public
decimal
ServiceFee
{
get
;
set
;
}
/// <summary>
/// 决算费用:总计和客户的结算费用
/// </summary>
public
decimal
TotalFee
{
get
{
return
RealFee
+
ServiceFee
;
}
set
{
}
}
/// <summary>
/// 已缴检测费:即费用结算时所缴纳的实际费用
/// </summary>
public
decimal
PaidFee
{
get
;
set
;
}
/// <summary>
/// 收款登记号
/// </summary>
public
Guid
CashCheckInKvid
{
get
;
set
;
}
/// <summary>
/// 执行的协议Kvid
/// </summary>
public
Guid
AgreementKvid
{
get
;
set
;
}
/// <summary>
/// 执行的协议名称
/// </summary>
public
string
AgreementName
{
get
;
set
;
}
#
endregion
#
region
受理人信息
/// <summary>
/// 受理人Kvid
/// </summary>
public
Guid
OperatorKvid
{
get
;
set
;
}
/// <summary>
/// 受理人姓名
/// </summary>
public
string
OperatorName
{
get
;
set
;
}
#
endregion
/// <summary>
/// 计划编号
/// </summary>
public
string
PlanNumber
{
get
;
set
;
}
/// <summary>
/// 网上受理订单编号
/// </summary>
public
string
OrderID
{
get
;
set
;
}
#
region
下面的三个属性本来是扩展字段,现用实体字段来表示
/// <summary>
/// 批号货号
/// </summary>
public
string
BatchNumber
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 随附文件
/// </summary>
public
string
AttachedDocument
{
get
;
set
;
}
#
endregion
/// <summary>
/// 发票登记号
/// 在费用结算的时候,需要将登记的发票号存储到报告中去
/// </summary>
public
string
InvoiceNumber
{
get
;
set
;
}
/// <summary>
/// 本次余款
/// 本次账号余款的总额/当前报告的个数=本次余额
/// </summary>
public
decimal
TheBalance
{
get
;
set
;
}
/// <summary>
/// 发票备注
/// </summary>
public
string
InvoiceRemark
{
get
;
set
;
}
/// <summary>
/// 更改报告费
/// </summary>
public
decimal
ChangeFee
{
get
;
set
;
}
/// <summary>
/// 价格类型:分为原价(用:Fee标识)和旧价(用:FeeEx标识)
/// </summary>
public
string
FeeType
{
get
;
set
;
}
/// <summary>
/// 费用核查:核查过得报告打“√”作为标记
/// </summary>
public
int
FeeCheck
{
get
;
set
;
}
/// <summary>
/// 是否作废
/// </summary>
public
bool
IsObsolete
{
set
;
get
;
}
/// <summary>
/// 生成类型
/// </summary>
public
string
GenerateType
{
set
;
get
;
}
/// <summary>
/// 生成序列
/// </summary>
public
int
GenerateNumber
{
set
;
get
;
}
/// <summary>
/// 更改受理日期
/// </summary>
public
DateTime
?
RequiredDealDate
{
set
;
get
;
}
/// <summary>
/// 更改要求完成日期
/// </summary>
public
DateTime
?
RequiredDeadDate
{
set
;
get
;
}
/// <summary>
/// 更改经办人
/// </summary>
public
string
ChangeOperatorName
{
set
;
get
;
}
}
[
Route
(
"/Restful/Jst.Lims.Entities.Contract/Query"
)]
internal
class
ContractQuery
:
RestfulQuery
<
Contract
>,
IReturn
<
RestfulQueryResponse
<
Contract
>>
{
public
string
ReportId
{
get
;
set
;
}
}
}
\ No newline at end of file
Kivii.Client.OfficeSample/Form1.Designer.cs
deleted
100644 → 0
View file @
c45803e7
namespace
Kivii.Client.OfficeSample
{
partial
class
Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private
void
InitializeComponent
()
{
this
.
SuspendLayout
();
//
// Form1
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
791
,
468
);
this
.
Name
=
"Form1"
;
this
.
Text
=
"Form1"
;
this
.
ResumeLayout
(
false
);
}
#
endregion
}
}
Kivii.Client.OfficeSample/Form1.cs
deleted
100644 → 0
View file @
c45803e7
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
namespace
Kivii.Client.OfficeSample
{
public
partial
class
Form1
:
Form
{
public
Form1
()
{
InitializeComponent
();
}
}
}
Kivii.Client.OfficeSample/FrmMain.Designer.cs
0 → 100644
View file @
02f8cb74
namespace
Kivii.Client.OfficeSample
{
partial
class
FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private
void
InitializeComponent
()
{
this
.
btnGetReport
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
tbxReportId
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
tbxServiceUrl
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
pgResult
=
new
System
.
Windows
.
Forms
.
PropertyGrid
();
this
.
btnGenerateXlsx
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
tbxTemplateFileName
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btnSelectTemplateFile
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
SuspendLayout
();
//
// btnGetReport
//
this
.
btnGetReport
.
Location
=
new
System
.
Drawing
.
Point
(
256
,
72
);
this
.
btnGetReport
.
Name
=
"btnGetReport"
;
this
.
btnGetReport
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
btnGetReport
.
TabIndex
=
0
;
this
.
btnGetReport
.
Text
=
"获取"
;
this
.
btnGetReport
.
UseVisualStyleBackColor
=
true
;
this
.
btnGetReport
.
Click
+=
new
System
.
EventHandler
(
this
.
btnGetReport_Click
);
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
41
,
77
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
41
,
12
);
this
.
label1
.
TabIndex
=
1
;
this
.
label1
.
Text
=
"报告号"
;
//
// tbxReportId
//
this
.
tbxReportId
.
Location
=
new
System
.
Drawing
.
Point
(
88
,
74
);
this
.
tbxReportId
.
Name
=
"tbxReportId"
;
this
.
tbxReportId
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
tbxReportId
.
TabIndex
=
2
;
//
// label2
//
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
18
,
47
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
65
,
12
);
this
.
label2
.
TabIndex
=
1
;
this
.
label2
.
Text
=
"服务器地址"
;
//
// tbxServiceUrl
//
this
.
tbxServiceUrl
.
Location
=
new
System
.
Drawing
.
Point
(
88
,
44
);
this
.
tbxServiceUrl
.
Name
=
"tbxServiceUrl"
;
this
.
tbxServiceUrl
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
tbxServiceUrl
.
TabIndex
=
2
;
this
.
tbxServiceUrl
.
Text
=
"http://k5.jst-gov.com"
;
//
// pgResult
//
this
.
pgResult
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Right
;
this
.
pgResult
.
Location
=
new
System
.
Drawing
.
Point
(
619
,
0
);
this
.
pgResult
.
Name
=
"pgResult"
;
this
.
pgResult
.
Size
=
new
System
.
Drawing
.
Size
(
285
,
541
);
this
.
pgResult
.
TabIndex
=
3
;
//
// btnGenerateXlsx
//
this
.
btnGenerateXlsx
.
Location
=
new
System
.
Drawing
.
Point
(
29
,
187
);
this
.
btnGenerateXlsx
.
Name
=
"btnGenerateXlsx"
;
this
.
btnGenerateXlsx
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
23
);
this
.
btnGenerateXlsx
.
TabIndex
=
0
;
this
.
btnGenerateXlsx
.
Text
=
"生成Xlsx文件"
;
this
.
btnGenerateXlsx
.
UseVisualStyleBackColor
=
true
;
this
.
btnGenerateXlsx
.
Click
+=
new
System
.
EventHandler
(
this
.
btnGenerateXlsx_Click
);
//
// label3
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
18
,
146
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
53
,
12
);
this
.
label3
.
TabIndex
=
1
;
this
.
label3
.
Text
=
"选择模板"
;
//
// tbxTemplateFileName
//
this
.
tbxTemplateFileName
.
Location
=
new
System
.
Drawing
.
Point
(
88
,
143
);
this
.
tbxTemplateFileName
.
Name
=
"tbxTemplateFileName"
;
this
.
tbxTemplateFileName
.
Size
=
new
System
.
Drawing
.
Size
(
162
,
21
);
this
.
tbxTemplateFileName
.
TabIndex
=
2
;
//
// btnSelectTemplateFile
//
this
.
btnSelectTemplateFile
.
Location
=
new
System
.
Drawing
.
Point
(
256
,
141
);
this
.
btnSelectTemplateFile
.
Name
=
"btnSelectTemplateFile"
;
this
.
btnSelectTemplateFile
.
Size
=
new
System
.
Drawing
.
Size
(
50
,
23
);
this
.
btnSelectTemplateFile
.
TabIndex
=
0
;
this
.
btnSelectTemplateFile
.
Text
=
"..."
;
this
.
btnSelectTemplateFile
.
UseVisualStyleBackColor
=
true
;
this
.
btnSelectTemplateFile
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectTemplateFile_Click
);
//
// FrmMain
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
904
,
541
);
this
.
Controls
.
Add
(
this
.
pgResult
);
this
.
Controls
.
Add
(
this
.
tbxServiceUrl
);
this
.
Controls
.
Add
(
this
.
tbxTemplateFileName
);
this
.
Controls
.
Add
(
this
.
tbxReportId
);
this
.
Controls
.
Add
(
this
.
label2
);
this
.
Controls
.
Add
(
this
.
label3
);
this
.
Controls
.
Add
(
this
.
btnSelectTemplateFile
);
this
.
Controls
.
Add
(
this
.
btnGenerateXlsx
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
btnGetReport
);
this
.
Name
=
"FrmMain"
;
this
.
Text
=
"Office测试"
;
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
#
endregion
private
System
.
Windows
.
Forms
.
Button
btnGetReport
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
TextBox
tbxReportId
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
TextBox
tbxServiceUrl
;
private
System
.
Windows
.
Forms
.
PropertyGrid
pgResult
;
private
System
.
Windows
.
Forms
.
Button
btnGenerateXlsx
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
TextBox
tbxTemplateFileName
;
private
System
.
Windows
.
Forms
.
Button
btnSelectTemplateFile
;
}
}
Kivii.Client.OfficeSample/FrmMain.cs
0 → 100644
View file @
02f8cb74
using
Kivii.Client.OfficeSample.Entities
;
using
Kivii.Office.OpenXml.Templates
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
namespace
Kivii.Client.OfficeSample
{
public
partial
class
FrmMain
:
Form
{
private
Contract
_contract
=
null
;
public
FrmMain
()
{
InitializeComponent
();
}
private
void
btnGetReport_Click
(
object
sender
,
EventArgs
e
)
{
JsonServiceClient
client
=
new
JsonServiceClient
(
tbxServiceUrl
.
Text
);
var
query
=
new
ContractQuery
();
query
.
ReportId
=
tbxReportId
.
Text
;
var
results
=
client
.
Get
(
query
);
if
(
results
.
Results
.
Count
<
1
)
{
MessageBox
.
Show
(
"未查询到报告"
);
return
;
}
_contract
=
results
.
Results
[
0
];
//显示各个属性值
pgResult
.
SelectedObject
=
_contract
;
}
private
void
btnSelectTemplateFile_Click
(
object
sender
,
EventArgs
e
)
{
OpenFileDialog
ofd
=
new
OpenFileDialog
();
ofd
.
Filter
=
"Excel模板文件|*.xlsx"
;
if
(
ofd
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
tbxTemplateFileName
.
Text
=
ofd
.
FileName
;
}
private
void
btnGenerateXlsx_Click
(
object
sender
,
EventArgs
e
)
{
//先获取要保存的文件名称
SaveFileDialog
sfd
=
new
SaveFileDialog
();
sfd
.
Filter
=
"Excel文件|*.xlsx"
;
if
(
sfd
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
var
saveFileName
=
sfd
.
FileName
;
//创建个模板引擎
var
template
=
new
TemplateExcel
();
template
.
Open
(
tbxTemplateFileName
.
Text
);
//打开模板文件
template
.
Bind
(
"contract"
,
_contract
);
//将数据绑定到模板中,注意contract在模板中这是这个变量名了
template
.
Fill
();
//填充模板
template
.
SaveAs
(
saveFileName
);
//最后另存当前的文件
}
}
}
Kivii.Client.OfficeSample/F
orm1
.resx
→
Kivii.Client.OfficeSample/F
rmMain
.resx
View file @
02f8cb74
File moved
Kivii.Client.OfficeSample/Kivii.Client.OfficeSample.csproj
View file @
02f8cb74
...
...
@@ -32,6 +32,10 @@
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Kivii.Common.V4.0, Version=5.4.2019.8201, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Kivii.Common.5.4.2019.8201\lib\net40\Kivii.Common.V4.0.dll
</HintPath>
<Private>
True
</Private>
</Reference>
<Reference
Include=
"Kivii.Office.OpenXml.V4.0, Version=5.4.2019.9100, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Kivii.Office.OpenXml.5.4.2019.9100\lib\net40\Kivii.Office.OpenXml.V4.0.dll
</HintPath>
<Private>
True
</Private>
...
...
@@ -48,16 +52,17 @@
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Form1.cs"
>
<Compile
Include=
"Entitis\Contract.cs"
/>
<Compile
Include=
"FrmMain.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"F
orm1
.Designer.cs"
>
<DependentUpon>
F
orm1
.cs
</DependentUpon>
<Compile
Include=
"F
rmMain
.Designer.cs"
>
<DependentUpon>
F
rmMain
.cs
</DependentUpon>
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<EmbeddedResource
Include=
"F
orm1
.resx"
>
<DependentUpon>
F
orm1
.cs
</DependentUpon>
<EmbeddedResource
Include=
"F
rmMain
.resx"
>
<DependentUpon>
F
rmMain
.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
...
...
Kivii.Client.OfficeSample/Program.cs
View file @
02f8cb74
...
...
@@ -15,7 +15,7 @@ namespace Kivii.Client.OfficeSample
{
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
Run
(
new
F
orm1
());
Application
.
Run
(
new
F
rmMain
());
}
}
}
Kivii.Client.OfficeSample/packages.config
View file @
02f8cb74
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Kivii.Common"
version
=
"5.4.2019.8201"
targetFramework
=
"net40"
/>
<
package
id
=
"Kivii.Office.OpenXml"
version
=
"5.4.2019.9100"
targetFramework
=
"net40"
/>
</
packages
>
\ No newline at end of file
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