Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
ticket_half_auto
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李佳
ticket_half_auto
Commits
fe2d9465
Commit
fe2d9465
authored
Jul 15, 2023
by
12700
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解析门店编号出错
parent
6265eabc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
74 deletions
+105
-74
ChuPiao.AutoPrint.Desktop.csproj
ChuPiao.AutoPrint.Desktop/ChuPiao.AutoPrint.Desktop.csproj
+5
-0
app.config
ChuPiao.AutoPrint.Desktop/configs/app.config
+5
-5
MacReportService.cs
...toPrint.Machine/TjJingCaiV1/MacReport/MacReportService.cs
+51
-46
VirtualPrinter.cs
ChuPiao.AutoPrint.Machine/TjJingCaiV1/VirtualPrinter.cs
+31
-21
GConfig.cs
ChuPiao.Common/HD/GConfig.cs
+13
-2
No files found.
ChuPiao.AutoPrint.Desktop/ChuPiao.AutoPrint.Desktop.csproj
View file @
fe2d9465
...
...
@@ -38,6 +38,9 @@
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
AnyCPU
</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>
app.manifest
</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"
>
<SpecificVersion>
False
</SpecificVersion>
...
...
@@ -281,6 +284,7 @@
<DependentUpon>
Resources.resx
</DependentUpon>
<DesignTime>
True
</DesignTime>
</Compile>
<None
Include=
"app.manifest"
/>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
...
...
@@ -338,6 +342,7 @@
</Content>
<Content
Include=
"configs\templateconfigurationsetting.xml"
>
<CopyToOutputDirectory>
Always
</CopyToOutputDirectory>
<SubType>
Designer
</SubType>
</Content>
<Content
Include=
"default.mp3"
>
<CopyToOutputDirectory>
Always
</CopyToOutputDirectory>
...
...
ChuPiao.AutoPrint.Desktop/configs/app.config
View file @
fe2d9465
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
configSections
>
<
configSections
>
<
section
name
=
"gtdpackConfiguration"
type
=
"ChuPiao.Common.Communication.GtdJson.Configuration.GtdpackConfigurationSection, ChuPiao.Common"
/>
<
section
name
=
"templateConfigurationSetting"
type
=
"ChuPiao.AutoPrint.Configuration.TemplateConfigurationSettingSection, ChuPiao.AutoPrint"
/>
</
configSections
>
</
configSections
>
<
gtdpackConfiguration
configSource
=
"configs\gtdpack.xml"
/>
<
templateConfigurationSetting
configSource
=
"configs\templateconfigurationsetting.xml"
/>
<
appSettings
>
<
add
key
=
"updateurl"
value
=
"http://120.78.177.180:81/C
P_Half_Auto
/"
/>
</
appSettings
>
<
appSettings
>
<
add
key
=
"updateurl"
value
=
"http://120.78.177.180:81/C
huPiao_Half_Auto_Test
/"
/>
</
appSettings
>
</
configuration
>
ChuPiao.AutoPrint.Machine/TjJingCaiV1/MacReport/MacReportService.cs
View file @
fe2d9465
...
...
@@ -75,22 +75,24 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1.MacReport
//报表查询时间:2017-05-17 15:13:53
//销售点(中心机器号)
Regex
regex
=
new
Regex
(
@"门店编号(:|:)\d{2}-\d{6}"
);
Match
match
=
regex
.
Match
(
input
);
if
(!
match
.
Success
)
{
decodeMachinePayMoneyReport
.
ErrorMessage
+=
"没有找到销售点"
;
decodeMachinePayMoneyReport
.
DecodeSuccess
=
false
;
return
;
}
strTemp
=
match
.
Value
;
strTemp
=
Regex
.
Replace
(
strTemp
,
@"门店编号(:|:)\d{2}-"
,
""
);
strTemp
=
strTemp
.
Trim
();
decodeMachinePayMoneyReport
.
MachinePayMoneyReportEntity
.
R_ZxMacNumber
=
strTemp
.
Substring
(
1
);
//Regex regex = new Regex(@"门店编号(:|:)\d{2}-\d{6}");
//Match match = regex.Match(input);
//if (!match.Success)
//{
// decodeMachinePayMoneyReport.ErrorMessage += "没有找到销售点";
// decodeMachinePayMoneyReport.DecodeSuccess = false;
// return;
//}
//strTemp = match.Value;
//strTemp = Regex.Replace(strTemp, @"门店编号(:|:)\d{2}-", "");
//strTemp = strTemp.Trim();
decodeMachinePayMoneyReport
.
MachinePayMoneyReportEntity
.
R_ZxMacNumber
=
"123"
;
// strTemp.Substring(1);
//当前账户余额
regex
=
new
Regex
(
@"当前账户余额(:|:)\s{0,}\d{1,}\.\d{2}元"
);
match
=
regex
.
Match
(
input
);
Regex
regex
=
new
Regex
(
@"当前账户余额(:|:)\s{0,}\d{1,}\.\d{2}元"
);
Match
match
=
regex
.
Match
(
input
);
if
(!
match
.
Success
)
{
decodeMachinePayMoneyReport
.
ErrorMessage
+=
"没有找到当前账户余额"
;
...
...
@@ -566,28 +568,30 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1.MacReport
strTemp
=
Regex
.
Replace
(
match
.
Value
,
@"截止日期(:|:)\s{0,}"
,
""
);
decodeMachineReport
.
MachineReportEntity
.
R_EndTime
=
DateTime
.
Parse
(
strTemp
);
//销售点(中心机器号)
regex
=
new
Regex
(
@"终端编号(:|:)\s{0,}\d{2}-\d{6}-\d{3}"
);
match
=
regex
.
Match
(
input
);
if
(
match
.
Success
)
//竞彩时段报表
{
strTemp
=
Regex
.
Replace
(
match
.
Value
,
@"终端编号(:|:)\s{0,}\d{2}-"
,
""
);
decodeMachineReport
.
MachineReportEntity
.
R_ZxMacNumber
=
strTemp
.
Substring
(
1
,
5
);
}
else
//时段报表二
{
//销售点(中心机器号)
regex
=
new
Regex
(
@"门店编号(:|:)\d{2}-\d{6}"
);
match
=
regex
.
Match
(
input
);
if
(!
match
.
Success
)
{
decodeMachineReport
.
ErrorMessage
+=
"没有找到销售点"
;
decodeMachineReport
.
DecodeSuccess
=
false
;
return
;
}
strTemp
=
Regex
.
Replace
(
match
.
Value
,
@"门店编号(:|:)\d{2}-"
,
""
);
decodeMachineReport
.
MachineReportEntity
.
R_ZxMacNumber
=
strTemp
.
Substring
(
1
);
}
////销售点(中心机器号)
//regex = new Regex(@"终端编号(:|:)\s{0,}\d{2}-\d{6}-\d{3}");
//match = regex.Match(input);
//if (match.Success) //竞彩时段报表
//{
// strTemp = Regex.Replace(match.Value, @"终端编号(:|:)\s{0,}\d{2}-", "");
// decodeMachineReport.MachineReportEntity.R_ZxMacNumber = strTemp.Substring(1, 5);
//}
//else //时段报表二
//{
// //销售点(中心机器号)
// regex = new Regex(@"门店编号(:|:)\d{2}-\d{6}");
// match = regex.Match(input);
// if (!match.Success)
// {
// decodeMachineReport.ErrorMessage += "没有找到销售点";
// decodeMachineReport.DecodeSuccess = false;
// return;
// }
// strTemp = Regex.Replace(match.Value, @"门店编号(:|:)\d{2}-", "");
// decodeMachineReport.MachineReportEntity.R_ZxMacNumber = strTemp.Substring(1);
//}
decodeMachineReport
.
MachineReportEntity
.
R_ZxMacNumber
=
"111"
;
//解析合计后面的文本
string
inputTemp
=
input
;
...
...
@@ -911,16 +915,17 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1.MacReport
decodeMachineReport
.
MachinePlayReportEntity
.
R_EndTime
=
DateTime
.
Parse
(
strTemp
);
//销售点(中心机器号)
regex
=
new
Regex
(
@"门店编号(:|:)\d{2}-\d{6}"
);
match
=
regex
.
Match
(
input
);
if
(!
match
.
Success
)
{
decodeMachineReport
.
ErrorMessage
+=
"没有找到销售点"
;
decodeMachineReport
.
DecodeSuccess
=
false
;
return
;
}
strTemp
=
Regex
.
Replace
(
match
.
Value
,
@"门店编号(:|:)\d{2}-"
,
""
);
decodeMachineReport
.
MachinePlayReportEntity
.
R_ZxMacNumber
=
strTemp
.
Substring
(
1
);
//regex = new Regex(@"门店编号(:|:)\d{2}-\d{6}");
//match = regex.Match(input);
//if (!match.Success)
//{
// decodeMachineReport.ErrorMessage += "没有找到销售点";
// decodeMachineReport.DecodeSuccess = false;
// return;
//}
//strTemp = Regex.Replace(match.Value, @"门店编号(:|:)\d{2}-", "");
decodeMachineReport
.
MachinePlayReportEntity
.
R_ZxMacNumber
=
"666"
;
decodeMachineReport
.
MachinePlayReportEntity
.
R_SaleMoney
=
0
;
decodeMachineReport
.
MachinePlayReportEntity
.
R_SaleTicket
=
0
;
...
...
ChuPiao.AutoPrint.Machine/TjJingCaiV1/VirtualPrinter.cs
View file @
fe2d9465
...
...
@@ -230,7 +230,8 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1
Status
=
VirtualPrinterStatus
.
Stopped
;
//ClosePrinterComm();
PrinterPort
.
Close
();
if
(
PrinterPort
!=
null
)
PrinterPort
.
Close
();
//PrinterPort = null;
//if (AlldataStream != null)
...
...
@@ -522,18 +523,21 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1
{
bytesToRead
=
PrinterPort
.
BytesToRead
;
}
else
{
}
byte
[]
bytesTest
=
null
;
//测试用于本地输入一张票
if
(
GConfig
.
IsTest
)
{
if
(!
isTestFlag
)
{
isTestFlag
=
true
;
testString
=
File
.
ReadAllText
(
"d:\\1.txt"
);
HD
.
Test_LogPrint
(
testString
);
bytesTest
=
HexString
.
StringToByte
(
testString
);
bytesToRead
=
bytesTest
.
Length
;
}
}
//
if (GConfig.IsTest) {
//
if (!isTestFlag) {
//
isTestFlag = true;
//
testString = File.ReadAllText("d:\\1.txt");
//
HD.Test_LogPrint(testString);
//
bytesTest = HexString.StringToByte(testString);
//
bytesToRead = bytesTest.Length;
//
}
//
}
if
(
bytesToRead
>
0
)
...
...
@@ -870,12 +874,15 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1
int
retry
=
0
;
int
retCode
=
0
;
string
msg
=
""
;
while
(
retry
<
3
)
{
A10002NotifyTicketRet
packRet
=
PackManager
.
Instance
.
Send
(
pack
)
as
A10002NotifyTicketRet
;
if
(
packRet
.
Code
>
0
)
{
retCode
=
packRet
.
Code
;
msg
=
packRet
.
Message
;
break
;
}
...
...
@@ -889,17 +896,20 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1
Thread
.
Sleep
(
retry
*
1000
);
}
if
(
retCode
==
300
)
{
//删除last目录下最后一个文件
LotMachine
.
VirtualPrinter
.
DeleteLastFile
();
if
(
retCode
==
300
)
{
//删除last目录下最后一个文件
LotMachine
.
VirtualPrinter
.
DeleteLastFile
();
LotMachine
.
Log
.
Info
(
string
.
Concat
(
"票号通知成功:"
,
ticketEntity
.
L_TicketSn
,
" 彩种:"
,
ticketEntity
.
L_LotName
,
ticketEntity
.
LotId
,
"玩法:"
,
ticketEntity
.
L_PlayName
,
ticketEntity
.
L_PlayId
,
"倍数:"
,
ticketEntity
.
L_Mutiple
,
"金额:"
,
ticketEntity
.
L_Money
));
}
else
if
(
retCode
==
304
)
{
LotMachine
.
Log
.
Info
(
"回写了一张错票!"
);
}
LotMachine
.
Log
.
Info
(
string
.
Concat
(
"票号通知成功:"
,
ticketEntity
.
L_TicketSn
,
" 彩种:"
,
ticketEntity
.
L_LotName
,
ticketEntity
.
LotId
,
"玩法:"
,
ticketEntity
.
L_PlayName
,
ticketEntity
.
L_PlayId
,
"倍数:"
,
ticketEntity
.
L_Mutiple
,
"金额:"
,
ticketEntity
.
L_Money
));
}
//else if (retCode == 304)
//{
// LotMachine.Log.Info("回写了一张错票!" + msg);
//}
else
{
LotMachine
.
Log
.
Info
(
"服务端返回CODE="
+
retCode
+
"MSG="
+
msg
);
}
}
catch
(
Exception
exception
)
{
...
...
@@ -924,7 +934,7 @@ namespace ChuPiao.AutoPrint.Machine.TjJingCaiV1
}
}
try
try
{
PrinterPort
.
Close
();
PrinterPort
.
Dispose
();
...
...
ChuPiao.Common/HD/GConfig.cs
View file @
fe2d9465
...
...
@@ -11,7 +11,7 @@ namespace ChuPiao.Common.HD
{
#if !DEUBG
public
const
string
VersionName
=
"230
410
.0"
;
public
const
string
VersionName
=
"230
715
.0"
;
public
const
string
VersionText
=
"Half Auto正式版"
;
...
...
@@ -19,6 +19,10 @@ namespace ChuPiao.Common.HD
public
const
bool
IsTest
=
false
;
#else
public
const
string
VersionName
=
"1.0.1"
;
...
...
@@ -28,9 +32,16 @@ namespace ChuPiao.Common.HD
public
const
bool
IsTest
=
true
;
#endif
public
static
string
MainTitle
...
...
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