Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.Invoices.Etax
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.Invoices.Etax
Commits
ef41ff00
Commit
ef41ff00
authored
Apr 04, 2024
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
b52ba8df
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
268 additions
and
62 deletions
+268
-62
Configs.cs
Src/Configs.cs
+1
-0
FrmMain.Designer.cs
Src/FrmMain.Designer.cs
+87
-61
FrmMain.cs
Src/FrmMain.cs
+157
-1
Kivii.Client.Invoices.Etax.V4.0.csproj
Src/Kivii.Client.Invoices.Etax.V4.0.csproj
+1
-0
Request.cs
Src/Request.cs
+22
-0
No files found.
Src/Configs.cs
View file @
ef41ff00
...
@@ -8,5 +8,6 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -8,5 +8,6 @@ namespace Kivii.Client.Invoices.Etax
internal
class
Configs
internal
class
Configs
{
{
public
const
string
TableUiSetting
=
"ui_settings"
;
public
const
string
TableUiSetting
=
"ui_settings"
;
public
const
string
RouteInvoiceQuery
=
"/Restful/Kivii.Finances.Entities.Invoice/Query"
;
}
}
}
}
Src/FrmMain.Designer.cs
View file @
ef41ff00
...
@@ -29,23 +29,27 @@
...
@@ -29,23 +29,27 @@
private
void
InitializeComponent
()
private
void
InitializeComponent
()
{
{
this
.
plConfigs
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
plConfigs
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
rtbMessage
=
new
System
.
Windows
.
Forms
.
RichTextBox
();
this
.
btnLogout
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLogin
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSelectFileFolder
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
tbFilePath
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblInsert
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblUrl
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblUrl
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblUser
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblUser
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblPassword
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblPassword
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
tbxPassword
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxPassword
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxServiceUrl
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxServiceUrl
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxUserName
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbxUserName
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btnSelectFileFolder
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
rtbMessage
=
new
System
.
Windows
.
Forms
.
RichTextBox
();
this
.
tbFilePath
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btnStartTimer
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
lblInsert
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnStopTimer
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLogout
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnLogin
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
plConfigs
.
SuspendLayout
();
this
.
plConfigs
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// plConfigs
// plConfigs
//
//
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnStopTimer
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnStartTimer
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnLogout
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnLogout
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnLogin
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnLogin
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnSelectFileFolder
);
this
.
plConfigs
.
Controls
.
Add
(
this
.
btnSelectFileFolder
);
...
@@ -60,17 +64,61 @@
...
@@ -60,17 +64,61 @@
this
.
plConfigs
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
plConfigs
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
plConfigs
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
plConfigs
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
plConfigs
.
Name
=
"plConfigs"
;
this
.
plConfigs
.
Name
=
"plConfigs"
;
this
.
plConfigs
.
Size
=
new
System
.
Drawing
.
Size
(
588
,
1
4
7
);
this
.
plConfigs
.
Size
=
new
System
.
Drawing
.
Size
(
588
,
1
6
7
);
this
.
plConfigs
.
TabIndex
=
0
;
this
.
plConfigs
.
TabIndex
=
0
;
//
//
//
rtbMessage
//
btnLogout
//
//
this
.
rtbMessage
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
btnLogout
.
Enabled
=
false
;
this
.
rtbMessage
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
147
);
this
.
btnLogout
.
Location
=
new
System
.
Drawing
.
Point
(
466
,
89
);
this
.
rtbMessage
.
Name
=
"rtbMessage"
;
this
.
btnLogout
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
rtbMessage
.
Size
=
new
System
.
Drawing
.
Size
(
588
,
697
);
this
.
btnLogout
.
Name
=
"btnLogout"
;
this
.
rtbMessage
.
TabIndex
=
1
;
this
.
btnLogout
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
34
);
this
.
rtbMessage
.
Text
=
""
;
this
.
btnLogout
.
TabIndex
=
27
;
this
.
btnLogout
.
Text
=
"退出"
;
this
.
btnLogout
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogout
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLogout_Click
);
//
// btnLogin
//
this
.
btnLogin
.
Location
=
new
System
.
Drawing
.
Point
(
466
,
13
);
this
.
btnLogin
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btnLogin
.
Name
=
"btnLogin"
;
this
.
btnLogin
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
70
);
this
.
btnLogin
.
TabIndex
=
26
;
this
.
btnLogin
.
Text
=
"登录"
;
this
.
btnLogin
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogin
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLogin_Click
);
//
// btnSelectFileFolder
//
this
.
btnSelectFileFolder
.
Location
=
new
System
.
Drawing
.
Point
(
398
,
90
);
this
.
btnSelectFileFolder
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btnSelectFileFolder
.
Name
=
"btnSelectFileFolder"
;
this
.
btnSelectFileFolder
.
Size
=
new
System
.
Drawing
.
Size
(
60
,
32
);
this
.
btnSelectFileFolder
.
TabIndex
=
25
;
this
.
btnSelectFileFolder
.
Text
=
"..."
;
this
.
btnSelectFileFolder
.
UseVisualStyleBackColor
=
true
;
this
.
btnSelectFileFolder
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectFileFolder_Click
);
//
// tbFilePath
//
this
.
tbFilePath
.
Location
=
new
System
.
Drawing
.
Point
(
103
,
94
);
this
.
tbFilePath
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
tbFilePath
.
Name
=
"tbFilePath"
;
this
.
tbFilePath
.
ReadOnly
=
true
;
this
.
tbFilePath
.
Size
=
new
System
.
Drawing
.
Size
(
287
,
28
);
this
.
tbFilePath
.
TabIndex
=
24
;
//
// lblInsert
//
this
.
lblInsert
.
AutoSize
=
true
;
this
.
lblInsert
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
97
);
this
.
lblInsert
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
lblInsert
.
Name
=
"lblInsert"
;
this
.
lblInsert
.
Size
=
new
System
.
Drawing
.
Size
(
89
,
18
);
this
.
lblInsert
.
TabIndex
=
23
;
this
.
lblInsert
.
Text
=
"读取路径:"
;
//
//
// lblUrl
// lblUrl
//
//
...
@@ -128,58 +176,34 @@
...
@@ -128,58 +176,34 @@
this
.
tbxUserName
.
Size
=
new
System
.
Drawing
.
Size
(
104
,
28
);
this
.
tbxUserName
.
Size
=
new
System
.
Drawing
.
Size
(
104
,
28
);
this
.
tbxUserName
.
TabIndex
=
17
;
this
.
tbxUserName
.
TabIndex
=
17
;
//
//
// btnSelectFileFolder
// rtbMessage
//
this
.
btnSelectFileFolder
.
Location
=
new
System
.
Drawing
.
Point
(
398
,
90
);
this
.
btnSelectFileFolder
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btnSelectFileFolder
.
Name
=
"btnSelectFileFolder"
;
this
.
btnSelectFileFolder
.
Size
=
new
System
.
Drawing
.
Size
(
60
,
32
);
this
.
btnSelectFileFolder
.
TabIndex
=
25
;
this
.
btnSelectFileFolder
.
Text
=
"..."
;
this
.
btnSelectFileFolder
.
UseVisualStyleBackColor
=
true
;
this
.
btnSelectFileFolder
.
Click
+=
new
System
.
EventHandler
(
this
.
btnSelectFileFolder_Click
);
//
// tbFilePath
//
this
.
tbFilePath
.
Location
=
new
System
.
Drawing
.
Point
(
103
,
94
);
this
.
tbFilePath
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
tbFilePath
.
Name
=
"tbFilePath"
;
this
.
tbFilePath
.
ReadOnly
=
true
;
this
.
tbFilePath
.
Size
=
new
System
.
Drawing
.
Size
(
287
,
28
);
this
.
tbFilePath
.
TabIndex
=
24
;
//
// lblInsert
//
//
this
.
lblInsert
.
AutoSize
=
true
;
this
.
rtbMessage
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
lblInsert
.
Location
=
new
System
.
Drawing
.
Point
(
13
,
97
);
this
.
rtbMessage
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
167
);
this
.
lblInsert
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
0
,
4
,
0
);
this
.
rtbMessage
.
Name
=
"rtbMessage"
;
this
.
lblInsert
.
Name
=
"lblInsert"
;
this
.
rtbMessage
.
Size
=
new
System
.
Drawing
.
Size
(
588
,
677
);
this
.
lblInsert
.
Size
=
new
System
.
Drawing
.
Size
(
89
,
18
);
this
.
rtbMessage
.
TabIndex
=
1
;
this
.
lblInsert
.
TabIndex
=
23
;
this
.
rtbMessage
.
Text
=
""
;
this
.
lblInsert
.
Text
=
"读取路径:"
;
//
//
// btn
Logout
// btn
StartTimer
//
//
this
.
btnLogout
.
Enabled
=
false
;
this
.
btnStartTimer
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
129
);
this
.
btnLogout
.
Location
=
new
System
.
Drawing
.
Point
(
466
,
89
);
this
.
btnStartTimer
.
Name
=
"btnStartTimer"
;
this
.
btnLogout
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btnStartTimer
.
Size
=
new
System
.
Drawing
.
Size
(
282
,
32
);
this
.
btnLogout
.
Name
=
"btnLogout"
;
this
.
btnStartTimer
.
TabIndex
=
28
;
this
.
btnLogout
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
34
);
this
.
btnStartTimer
.
Text
=
"开始读取"
;
this
.
btnLogout
.
TabIndex
=
27
;
this
.
btnStartTimer
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogout
.
Text
=
"退出"
;
this
.
btnStartTimer
.
Click
+=
new
System
.
EventHandler
(
this
.
btnStartTimer_Click
);
this
.
btnLogout
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogout
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLogout_Click
);
//
//
// btn
Login
// btn
StopTimer
//
//
this
.
btnLogin
.
Location
=
new
System
.
Drawing
.
Point
(
466
,
13
);
this
.
btnStopTimer
.
Location
=
new
System
.
Drawing
.
Point
(
296
,
129
);
this
.
btnLogin
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
);
this
.
btnStopTimer
.
Name
=
"btnStopTimer"
;
this
.
btnLogin
.
Name
=
"btnLogin"
;
this
.
btnStopTimer
.
Size
=
new
System
.
Drawing
.
Size
(
282
,
32
);
this
.
btnLogin
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
70
);
this
.
btnStopTimer
.
TabIndex
=
29
;
this
.
btnLogin
.
TabIndex
=
26
;
this
.
btnStopTimer
.
Text
=
"暂停读取"
;
this
.
btnLogin
.
Text
=
"登录"
;
this
.
btnStopTimer
.
UseVisualStyleBackColor
=
true
;
this
.
btnLogin
.
UseVisualStyleBackColor
=
true
;
this
.
btnStopTimer
.
Click
+=
new
System
.
EventHandler
(
this
.
btnStopTimer_Click
);
this
.
btnLogin
.
Click
+=
new
System
.
EventHandler
(
this
.
btnLogin_Click
);
//
//
// FrmMain
// FrmMain
//
//
...
@@ -213,6 +237,8 @@
...
@@ -213,6 +237,8 @@
private
System
.
Windows
.
Forms
.
TextBox
tbxUserName
;
private
System
.
Windows
.
Forms
.
TextBox
tbxUserName
;
private
System
.
Windows
.
Forms
.
Button
btnLogout
;
private
System
.
Windows
.
Forms
.
Button
btnLogout
;
private
System
.
Windows
.
Forms
.
Button
btnLogin
;
private
System
.
Windows
.
Forms
.
Button
btnLogin
;
private
System
.
Windows
.
Forms
.
Button
btnStartTimer
;
private
System
.
Windows
.
Forms
.
Button
btnStopTimer
;
}
}
}
}
Src/FrmMain.cs
View file @
ef41ff00
...
@@ -4,9 +4,13 @@ using System.Collections.Generic;
...
@@ -4,9 +4,13 @@ using System.Collections.Generic;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Data
;
using
System.Drawing
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
static
System
.
Windows
.
Forms
.
AxHost
;
using
Timer
=
System
.
Windows
.
Forms
.
Timer
;
namespace
Kivii.Client.Invoices.Etax
namespace
Kivii.Client.Invoices.Etax
{
{
...
@@ -14,6 +18,8 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -14,6 +18,8 @@ namespace Kivii.Client.Invoices.Etax
{
{
private
JsonServiceClient
_client
=
null
;
private
JsonServiceClient
_client
=
null
;
private
Timer
_timer
=
null
;
public
FrmMain
()
public
FrmMain
()
{
{
InitializeComponent
();
InitializeComponent
();
...
@@ -80,6 +86,8 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -80,6 +86,8 @@ namespace Kivii.Client.Invoices.Etax
private
void
FrmMain_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmMain_Load
(
object
sender
,
EventArgs
e
)
{
{
btnStartTimer
.
Enabled
=
true
;
btnStopTimer
.
Enabled
=
!
btnStartTimer
.
Enabled
;
loadDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
,
tbFilePath
);
loadDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
,
tbFilePath
);
}
}
...
@@ -107,8 +115,10 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -107,8 +115,10 @@ namespace Kivii.Client.Invoices.Etax
tbxUserName
.
Enabled
=
btnLogin
.
Enabled
;
tbxUserName
.
Enabled
=
btnLogin
.
Enabled
;
tbxPassword
.
Enabled
=
btnLogin
.
Enabled
;
tbxPassword
.
Enabled
=
btnLogin
.
Enabled
;
btnSelectFileFolder
.
Enabled
=
btnLogin
.
Enabled
;
btnSelectFileFolder
.
Enabled
=
btnLogin
.
Enabled
;
setDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
,
tbFilePath
);
setDefault
(
tbxServiceUrl
,
tbxUserName
,
tbxPassword
,
tbFilePath
);
outputMessage
(
$"登录成功:
{
resp
.
FullName
}
"
);
outputMessage
(
$"登录成功:
{
resp
.
FullName
}
"
);
Thread
.
Sleep
(
100
);
timerStart
();
},
true
);
},
true
);
task
.
Error
(
err
=>
task
.
Error
(
err
=>
{
{
...
@@ -145,6 +155,8 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -145,6 +155,8 @@ namespace Kivii.Client.Invoices.Etax
outputMessage
(
$"退出成功"
);
outputMessage
(
$"退出成功"
);
_client
.
Dispose
();
_client
.
Dispose
();
_client
=
null
;
_client
=
null
;
Thread
.
Sleep
(
100
);
timerStop
();
});
});
task
.
Error
(
err
=>
task
.
Error
(
err
=>
{
{
...
@@ -160,5 +172,149 @@ namespace Kivii.Client.Invoices.Etax
...
@@ -160,5 +172,149 @@ namespace Kivii.Client.Invoices.Etax
tbFilePath
.
Text
=
fbd
.
SelectedPath
;
tbFilePath
.
Text
=
fbd
.
SelectedPath
;
setDefault
(
tbFilePath
);
setDefault
(
tbFilePath
);
}
}
private
void
timerStart
()
{
if
(
_client
==
null
)
{
MessageBox
.
Show
(
"请先登录!"
);
return
;
}
if
(
tbFilePath
.
Text
.
IsNullOrEmpty
())
{
MessageBox
.
Show
(
"请先设置读取路径!"
);
return
;
}
if
(
_timer
==
null
)
{
_timer
=
new
Timer
();
_timer
.
Interval
=
3
*
1000
;
_timer
.
Tick
+=
_timer_Tick
;
}
_timer
.
Start
();
btnStartTimer
.
Enabled
=
false
;
btnStopTimer
.
Enabled
=
true
;
outputMessage
(
"定时器已启动"
);
}
private
void
timerStop
()
{
if
(
_timer
!=
null
)
_timer
.
Stop
();
_timer
=
null
;
btnStartTimer
.
Enabled
=
true
;
btnStopTimer
.
Enabled
=
false
;
outputMessage
(
"定时器已停止"
);
}
private
void
_timer_Tick
(
object
sender
,
EventArgs
e
)
{
try
{
_timer
.
Stop
();
readFilePath
();
}
catch
(
Exception
ex
)
{
outputMessage
(
$"定时器错误:
{
ex
.
Message
}
"
);
}
finally
{
if
(
_timer
!=
null
)
_timer
.
Start
();
}
}
private
void
readFilePath
()
{
if
(
InvokeRequired
)
{
this
.
Invoke
(
new
Action
(
readFilePath
));
return
;
}
#
region
文件夹路径设置
if
(
tbFilePath
.
Text
.
IsNullOrEmpty
())
{
outputMessage
(
"未设置文件读取路径"
);
timerStop
();
return
;
}
var
path
=
tbFilePath
.
Text
;
var
uploadedPath
=
$"
{
path
}
\\uploaded"
;
var
errorPath
=
$"
{
path
}
\\error"
;
if
(!
Directory
.
Exists
(
path
))
{
Directory
.
CreateDirectory
(
path
);
outputMessage
(
$"自动设置路径:
{
path
}
"
);
}
if
(!
Directory
.
Exists
(
uploadedPath
))
{
Directory
.
CreateDirectory
(
uploadedPath
);
outputMessage
(
$"自动设置路径:
{
uploadedPath
}
"
);
}
if
(!
Directory
.
Exists
(
errorPath
))
{
Directory
.
CreateDirectory
(
errorPath
);
outputMessage
(
$"自动设置路径:
{
errorPath
}
"
);
}
#
endregion
var
pdfPaths
=
Directory
.
GetFiles
(
path
,
"*.pdf"
);
//if (pdfPaths.Length > 0) outputMessage($"找到pdf文件:{pdfPaths.Length}个");
var
ofdPaths
=
Directory
.
GetFiles
(
path
,
"*.ofd"
);
//if (ofdPaths.Length > 0) outputMessage($"找到ofd文件:{ofdPaths.Length}个");
List
<
string
>
filePaths
=
new
List
<
string
>();
filePaths
.
AddRange
(
pdfPaths
);
filePaths
.
AddRange
(
ofdPaths
);
if
(
filePaths
.
Count
>
0
)
outputMessage
(
$"找到文件:
{
filePaths
.
Count
}
个"
);
if
(!
filePaths
.
IsNullOrEmpty
())
{
foreach
(
var
filePath
in
filePaths
)
{
var
file
=
new
DirectoryInfo
(
filePath
);
var
split
=
file
.
Name
.
Split
(
'_'
);
if
(
split
.
Length
<
2
)
{
var
mvPath
=
$"
{
errorPath
}
\\
{
file
.
Name
}
"
;
fileMove
(
file
.
FullName
,
mvPath
);
outputMessage
(
$"文件名:
{
file
.
Name
}
格式不正确,无法从中获取发票号,此文件已移动到目录:
{
errorPath
}
"
);
}
var
serialNumber
=
split
[
1
];
var
request
=
new
RequestInvoice
();
request
.
OffsetKvid
=
Guid
.
Empty
;
request
.
ParentKvid
=
Guid
.
Empty
;
request
.
SerialNumber
=
serialNumber
;
var
resp
=
_client
.
Post
(
request
);
if
(
resp
!=
null
)
{
if
(
resp
.
Results
.
IsNullOrEmpty
())
{
}
}
}
}
}
private
void
btnStartTimer_Click
(
object
sender
,
EventArgs
e
)
{
timerStart
();
}
private
void
btnStopTimer_Click
(
object
sender
,
EventArgs
e
)
{
timerStop
();
}
private
void
fileMove
(
string
sourcePath
,
string
destinationPath
)
{
if
(
File
.
Exists
(
destinationPath
))
{
File
.
Delete
(
destinationPath
);
}
if
(
File
.
Exists
(
sourcePath
))
{
File
.
Move
(
sourcePath
,
destinationPath
);
}
}
}
}
}
}
Src/Kivii.Client.Invoices.Etax.V4.0.csproj
View file @
ef41ff00
...
@@ -65,6 +65,7 @@
...
@@ -65,6 +65,7 @@
</Compile>
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Request.cs"
/>
<Compile
Include=
"UiSetting.cs"
/>
<Compile
Include=
"UiSetting.cs"
/>
<EmbeddedResource
Include=
"FrmMain.resx"
>
<EmbeddedResource
Include=
"FrmMain.resx"
>
<DependentUpon>
FrmMain.cs
</DependentUpon>
<DependentUpon>
FrmMain.cs
</DependentUpon>
...
...
Src/Request.cs
0 → 100644
View file @
ef41ff00
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Kivii.Client.Invoices.Etax
{
public
class
Invoice
{
public
Guid
Kvid
{
get
;
set
;
}
public
string
SerialNumber
{
get
;
set
;
}
}
[
Route
(
Configs
.
RouteInvoiceQuery
)]
public
class
RequestInvoice
:
IReturn
<
RestfulQueryResponse
<
Invoice
>>
{
public
Guid
OffsetKvid
{
get
;
set
;
}
public
Guid
ParentKvid
{
get
;
set
;
}
public
string
SerialNumber
{
get
;
set
;
}
}
}
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