6/14 초기화
261
.gitignore
vendored
Normal file
|
@ -0,0 +1,261 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
61
Agent/Database/Activator.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : Database 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// 프로젝트 로드의 주진입점을 정의합니다.
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_DATABASE.DATABASE_MSSQL:
|
||||
{
|
||||
Cosmos.Database.DatabaseMssql agentClass = new Cosmos.Database.DatabaseMssql();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_DATABASE.DATABASE_ORACLE:
|
||||
{
|
||||
//Cosmos.Database.DatabaseOracle agentClass = new Cosmos.Database.DatabaseOracle();
|
||||
//retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
80
Agent/Database/Database.csproj
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{057CA9DA-C2C8-4873-B914-92E115F94659}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Database</RootNamespace>
|
||||
<AssemblyName>Agent.Database</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\BIN\Agent.Database.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="DatabaseMssql.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.Database.dll .\Agent.Database.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.Database.dll .\IC\Agent.Database.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
132
Agent/Database/DatabaseMssql.cs
Normal file
|
@ -0,0 +1,132 @@
|
|||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : MSSQL DB 관련 처리
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Database
|
||||
{
|
||||
public class DatabaseMssql : IDatabaseSQL
|
||||
{
|
||||
private SqlDB sqlDb = null;
|
||||
|
||||
public bool Begin()
|
||||
{
|
||||
return sqlDb.DBBeginTransaction();
|
||||
}
|
||||
|
||||
public bool Commit()
|
||||
{
|
||||
return sqlDb.DBTransactionCommit();
|
||||
}
|
||||
|
||||
public bool Rollback()
|
||||
{
|
||||
return sqlDb.DBTransactionRollback();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
sqlDb.DBClose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL DataTable를 이용한 Select
|
||||
/// <para>return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음</para>
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <param name="outDtReturn"></param>
|
||||
/// <returns></returns>
|
||||
public int DBSelect(string sQuery, out DataTable outDtReturn)
|
||||
{
|
||||
int iReturn = -9;
|
||||
DataTable dtReturn = null;
|
||||
|
||||
string strCommand = sQuery;
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
//System.Diagnostics.Debug.Print("SQL=" + sQuery);
|
||||
iReturn = sqlDb.DBDataTableSelect(strCommand, sqlCommandType, (SqlParameter[])null, out dtReturn);
|
||||
|
||||
outDtReturn = dtReturn;
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string sQuery)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string[] sQuery)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string[] sQuery, bool bStandAlone)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null, bStandAlone);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MSSQL Database Conntction String
|
||||
/// </summary>
|
||||
/// <param name="pDataSource"></param>
|
||||
/// <param name="pInitialCatalog"></param>
|
||||
/// <param name="pUID"></param>
|
||||
/// <param name="pPassword"></param>
|
||||
public bool SetDBConnectionString(string pDataSource, string pInitialCatalog, string pUID, string pPassword)
|
||||
{
|
||||
bool bReturn = false;
|
||||
|
||||
if(sqlDb != null)
|
||||
{
|
||||
if (sqlDb.IsDBOpen()) sqlDb.DBClose();
|
||||
}
|
||||
|
||||
sqlDb = new SqlDB(pDataSource, pInitialCatalog, pUID, pPassword);
|
||||
|
||||
bReturn = sqlDb.IsDBOpen();
|
||||
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
Agent/Database/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("Database")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Database")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("dab8af19-a211-4c3f-87a1-79b22ffca956")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
56
Agent/InterfaceOutside/Activator.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : TranInterfaceOutside 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// 프로젝트 로드의 주진입점을 정의합니다.
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_TranInterfaceOutside.TIFO_MAIN:
|
||||
{
|
||||
Cosmos.TranInterfaceOutside.TranInterfaceOutside agentClass = new Cosmos.TranInterfaceOutside.TranInterfaceOutside();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
181
Agent/InterfaceOutside/NetworkFtp.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Data;
|
||||
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : FTP 다운로드
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.TranInterfaceOutside
|
||||
{
|
||||
public class NetworkFtp : INetworkFTP
|
||||
{
|
||||
private readonly string LOCAL_DOWN_PATH = BaseCom.NxRootPath + @"DOWN\"; //Download File Location (다운로드 파일위치)
|
||||
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// POS Status Value (POS 상태값)
|
||||
/// </summary>
|
||||
private PosStatus m_cPosStatus = null;
|
||||
|
||||
private FTP m_ClsFtp;
|
||||
|
||||
public NetworkFtp()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP 서버에 Connect
|
||||
/// </summary>
|
||||
/// <param name="sServer"></param>
|
||||
/// <param name="sUserId"></param>
|
||||
/// <param name="sPassword"></param>
|
||||
/// <param name="iTimeOutSeconds"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <returns>0 : 정상접속, -1:시간초과, -2:로그인 실패, -3:서버접속 실패, -4:지원하지 않는 시스템</returns>
|
||||
public int Connect(string sServer, string sUserId, string sPassword, int iTimeOutSeconds, int iPort)
|
||||
{
|
||||
int nReturn = -9;
|
||||
|
||||
try
|
||||
{
|
||||
m_ClsFtp = new FTP((iPort == 0) ? sServer : sServer + ":" + iPort, sUserId, sPassword);
|
||||
|
||||
if (m_ClsFtp != null) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
|
||||
////m_ClsFtp = new ClsFtp(sServer, sUserId, sPassword, iTimeOutSeconds, iPort);
|
||||
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// //MessageBox.Show("FTP Server Connect Error !!! [" + nReturn.ToString() + "]");
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Connect()", e.Message);
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상종료, -1:Not Connected, -2:Binary Mode set failed, -3: failed local file Create, -4:socket 에러, -5:remote file 없슴, -6:정상수신실패, -7: 파일사이즈 틀림</returns>
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
string sMsg = "";
|
||||
return Download(sSvrDirectory, sLocalDirectory, sFileNm, ref sMsg, sFtpMode);
|
||||
}
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, ref string sMsg, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (CmUtil.RightH(sLocalDirectory, 1) != "\\") sLocalDirectory += "\\";
|
||||
|
||||
if (Directory.Exists(sLocalDirectory) == false) Directory.CreateDirectory(sLocalDirectory);
|
||||
|
||||
bRet = m_ClsFtp.Download(sSvrDirectory + sFileNm, sLocalDirectory + sFileNm, ref sMsg, sFtpMode);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Download(sLocalDirectory, sFileNm, true);
|
||||
////if (nReturn < 0 && File.Exists(BaseCom.NxDownPath + sFileNm + ".ftp") == true)
|
||||
////{
|
||||
//// File.Delete(BaseCom.NxDownPath + sFileNm + ".ftp");
|
||||
////}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Download()", e.Message);
|
||||
|
||||
sMsg = sFileNm + " " + e.Message;
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP서버와의 연결을 종료
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
//m_ClsFtp.Close();
|
||||
//m_ClsFtp.cleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 정해진 디렉토리에 정해진 파일을 업로드
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상완료, -1:Not Connected, -2: data socket create error, -3: file write 실패, -4:socket error, -5: 정상처리 실패(서버)</returns>
|
||||
public int Upload(string sSvrDirectory, string sLocalDirectory, string sFileNm)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
bRet = m_ClsFtp.Upload(sLocalDirectory + sFileNm, sSvrDirectory + sFileNm);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Upload(sLocalDirectory, sFileNm, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Upload()", e.Message);
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
return nReturn;
|
||||
}
|
||||
}
|
||||
}
|
36
Agent/InterfaceOutside/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("TranInterfaceOutside")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TranInterfaceOutside")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("21f97fce-451b-4bfd-922a-565e98bf87c6")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
1979
Agent/InterfaceOutside/TranInterfaceOutside.cs
Normal file
85
Agent/InterfaceOutside/TranInterfaceOutside.csproj
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7BA1E882-7E84-4A09-AE93-0447624BB13E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.TranInterfaceOutside</RootNamespace>
|
||||
<AssemblyName>Agent.TranInterfaceOutside</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider">
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime.Serialization.Formatters.Soap" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="NetworkFtp.cs" />
|
||||
<Compile Include="TranInterfaceOutside.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.TranInterfaceOutside.dll .\Agent.TranInterfaceOutside.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.TranInterfaceOutside.dll .\IC\Agent.TranInterfaceOutside.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
56
Agent/KDS/Activator.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : KDS 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// 프로젝트 로드의 주진입점을 정의합니다.
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_KDS.KDS_MAIN:
|
||||
{
|
||||
Cosmos.KDS.KDSMain agentClass = new Cosmos.KDS.KDSMain();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
45
Agent/KDS/Common.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.KDS
|
||||
{
|
||||
public class KDSItem
|
||||
{
|
||||
public string sOrderType;
|
||||
public string sFloorCd;
|
||||
public string sTableNo;
|
||||
public string sKtchSysCd;
|
||||
public int nSeq;
|
||||
public string sCmpCd;
|
||||
public string sBrandCd;
|
||||
public string sStorCd;
|
||||
public string sPosNo;
|
||||
public string sTradeNo;
|
||||
public string sSaleDt;
|
||||
public string sPosType;
|
||||
public string sItemCd;
|
||||
public string sItemDiv;
|
||||
public string sItemNm;
|
||||
public int nQty;
|
||||
public string sPackDiv;
|
||||
public string sSetMenuCd;
|
||||
public string sOrdTime;
|
||||
public string sCancelDiv;
|
||||
public string sOrgBillPosNo;
|
||||
public string sOrgBillDt;
|
||||
public string sOrgBillNo;
|
||||
public string sKtchSysUseDiv;
|
||||
public string sKtchKdsIp;
|
||||
public string sKtchKdsPort;
|
||||
public string sErrorCd;
|
||||
public string sSendYn;
|
||||
public string sResendYn;
|
||||
public string sFiller1;
|
||||
public string sFiller2;
|
||||
public string sFiller3;
|
||||
public string sFiller4;
|
||||
public string sFiller5;
|
||||
}
|
||||
}
|
89
Agent/KDS/KDS.csproj
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DF8A2088-9F76-47DE-9B50-7AA93FE359A4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.KDS</RootNamespace>
|
||||
<AssemblyName>Agent.KDS</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider">
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="Common.cs" />
|
||||
<Compile Include="KDSMain.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.KDS.dll .\Agent.KDS.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.KDS.dll .\IC\Agent.KDS.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
1145
Agent/KDS/KDSMain.cs
Normal file
36
Agent/KDS/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("KDS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("KDS")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("cca78233-98fd-4127-8d4a-4f468cedfe3f")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
57
Agent/KPS/Activator.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : KPS 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Define main entrance point of project load. (프로젝트 로드의 주진입점을 정의합니다.)
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_KPS.KPS_MAIN:
|
||||
{
|
||||
Cosmos.KPS.KPSMain agentClass = new Cosmos.KPS.KPSMain();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
595
Agent/KPS/Common.cs
Normal file
|
@ -0,0 +1,595 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
/// <summary>
|
||||
/// Kitchen Device Status
|
||||
/// </summary>
|
||||
public class KTCH_SYS_STATUS
|
||||
{
|
||||
public string sSubShopCd;
|
||||
public string sKtchSysCd;
|
||||
public int nErrorCd;
|
||||
}
|
||||
|
||||
public class KPSItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 연습모드구분 0:일반, 1:연습모드
|
||||
/// </summary>
|
||||
public string sTrainMode;
|
||||
|
||||
public string sOrderType;
|
||||
public string sFloorCd;
|
||||
public string sTableNo;
|
||||
public string sSubShopCd; // Add, 2017.02.06
|
||||
public string sKtchSysCd;
|
||||
public int nSeq;
|
||||
public string sOrderNo;
|
||||
public string sPosType;
|
||||
public string sItemCd;
|
||||
public string sItemNm;
|
||||
/// <summary>
|
||||
/// 상품구분(0:일반, 1:세트, 2:세트자식, 3:부가상품, 4:세트할인, 5:상품권(추가))
|
||||
/// </summary>
|
||||
public string sItemDiv;
|
||||
public int nQty;
|
||||
public string sPackDiv;
|
||||
public string sSetMenuCd;
|
||||
public string sOrdTime;
|
||||
public string sCancelDiv;
|
||||
/// <summary>
|
||||
/// 0:정상 1:재전송
|
||||
/// </summary>
|
||||
public string sResendYn;
|
||||
public string sKtchSysUseDiv;
|
||||
public int nKpsComPort;
|
||||
public int nKpsComBaudrate;
|
||||
public string sKpsOposName;
|
||||
public string sKpsIp;
|
||||
public string sKpsPort;
|
||||
|
||||
/// <summary>
|
||||
/// 0:미전송 1:전송
|
||||
/// 7:영수증프린터출력(주방프린터와 영수증프린터가 동일장치)
|
||||
/// 8:영수증프린터출력(주방출력오류)
|
||||
/// </summary>
|
||||
public string sSendYn;
|
||||
/// <summary>
|
||||
/// 0000 : 정상
|
||||
///
|
||||
/// </summary>
|
||||
public string sErrorCd;
|
||||
|
||||
//public string sKpsCdBackup1;
|
||||
//public string sKpsCdBackup2;
|
||||
//public string sKpsCdBackup3;
|
||||
//public string sKpsCdBackup4;
|
||||
//public string sKpsCdBackup5;
|
||||
//public string sKpsCdBackup6;
|
||||
|
||||
/// <summary>
|
||||
/// 반복출력 횟수
|
||||
/// </summary>
|
||||
public string sFiller1;
|
||||
/// <summary>
|
||||
/// 기타주문구분
|
||||
/// 1:후불일반판매, 2:해피오더
|
||||
/// </summary>
|
||||
public string sFiller2;
|
||||
/// <summary>
|
||||
/// 추가주문구분 (NEW,ADD,DEL)
|
||||
/// </summary>
|
||||
public string sFiller3;
|
||||
/// <summary>
|
||||
/// 부가메뉴구분 (SUBPRC_MENU_KEY_DIV)
|
||||
///
|
||||
/// </summary>
|
||||
public string sFiller4;
|
||||
public string sFiller5;
|
||||
|
||||
/// <summary>
|
||||
/// 수동출력일때 주방메모
|
||||
/// </summary>
|
||||
public string sKtchMemo = string.Empty;
|
||||
/// <summary>
|
||||
/// 상품메모
|
||||
/// </summary>
|
||||
public string sItemMemo = string.Empty;
|
||||
/// <summary>
|
||||
/// 주문담당자
|
||||
/// </summary>
|
||||
public string sOrdPicNm = string.Empty;
|
||||
/// <summary>
|
||||
/// 장치명
|
||||
/// </summary>
|
||||
public string sKtchSysNm = string.Empty; // Add, 2017.04.07
|
||||
/// <summary>
|
||||
/// 최종주문POS
|
||||
/// </summary>
|
||||
public string sOrdPosNo = string.Empty; // Add, 2017.04.10
|
||||
// 2017.09.06 레시피 추가
|
||||
/// <summary>
|
||||
/// 레시피
|
||||
/// </summary>
|
||||
public string sRecipe= string.Empty;
|
||||
|
||||
//#20180515 KPS 출력시 라벨프린터 출력 start
|
||||
/// <summary>
|
||||
/// 라벨프린터 출력여부(0:미전송, 1:전송)
|
||||
/// </summary>
|
||||
public string sLblSendYn = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 라벨프린터 총출력 해야 할 건수
|
||||
/// </summary>
|
||||
public int iTOTCNT = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 라벨프린터 QRCODE URL
|
||||
/// </summary>
|
||||
public string sQrcodeUrl = "";
|
||||
|
||||
/// <summary>
|
||||
/// 라벨프린터 QRCODE MSG
|
||||
/// </summary>
|
||||
public string sQrcodeMsg = "";
|
||||
|
||||
/// <summary>
|
||||
/// 라벨프린터 TOP MSG
|
||||
/// </summary>
|
||||
public string sTopMsg = "";
|
||||
|
||||
/// <summary>
|
||||
/// 라벨프린터 BTM MSG
|
||||
/// </summary>
|
||||
public string sBtmMsg = "";
|
||||
//#20180515 KPS 출력시 라벨프린터 출력 end
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Table Master
|
||||
/// </summary>
|
||||
public class TableMaster
|
||||
{
|
||||
public string sFloorCd;
|
||||
public string sTableNo;
|
||||
public string sTableNm;
|
||||
public string sTableDispDiv;
|
||||
}
|
||||
|
||||
//public class TABLE_DISP_FLAG
|
||||
//{
|
||||
// public const string TABLE_NO = "0"; // 테이블 번호
|
||||
// public const string TABLE_NAME = "1"; // 테이블 이름
|
||||
// public const string TABLE_NO_NAME = "2"; // 테이블 번호 + 이름
|
||||
//}
|
||||
|
||||
public class KPSOrderMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 연습모드구분 0:일반, 1:연습모드
|
||||
/// </summary>
|
||||
public string sTrainMode; // Add, 2017.03.03
|
||||
|
||||
public string sOrderType;
|
||||
public string sFloorCd;
|
||||
public string sTableNo;
|
||||
public int nSeq;
|
||||
public string sSubShopCd; // Add, 2017.02.06
|
||||
public string sKtchSysCd;
|
||||
public string sItemCd;
|
||||
public string sItemNm;
|
||||
public string sMsgId;
|
||||
public string sMsg1;
|
||||
public string sMsg2;
|
||||
public string sMsg3;
|
||||
public string sMsgRegTime;
|
||||
public string sKtchSysUseDiv;
|
||||
public int nKpsComPort;
|
||||
public int nKpsComBaudrate;
|
||||
public string sKpsOposName;
|
||||
public string sKpsIp;
|
||||
public string sKpsPort;
|
||||
public string sSendYn;
|
||||
public string sResendYn;
|
||||
public string sErrorCd;
|
||||
public int printCount = 1;
|
||||
|
||||
//public string sKpsCdBackup1;
|
||||
//public string sKpsCdBackup2;
|
||||
//public string sKpsCdBackup3;
|
||||
//public string sKpsCdBackup4;
|
||||
//public string sKpsCdBackup5;
|
||||
//public string sKpsCdBackup6;
|
||||
|
||||
public string sRegDate;
|
||||
/// <summary>
|
||||
/// 장치명
|
||||
/// </summary>
|
||||
public string sKtchSysNm = string.Empty; // Add, 2017.04.07
|
||||
/// <summary>
|
||||
/// 마지막주문POS
|
||||
/// </summary>
|
||||
public string sOrdPosNo = string.Empty; // Add, 2017.04.10
|
||||
}
|
||||
|
||||
public class OPOS
|
||||
{
|
||||
public const int CASH_SUE_DRAWERCLOSED = 0;
|
||||
public const int CASH_SUE_DRAWEROPEN = 1;
|
||||
public const int CHAN_STATUS_ASYNC = 91;
|
||||
public const int CHAN_STATUS_EMPTY = 11;
|
||||
public const int CHAN_STATUS_EMPTYOK = 13;
|
||||
public const int CHAN_STATUS_FULL = 21;
|
||||
public const int CHAN_STATUS_FULLOK = 23;
|
||||
public const int CHAN_STATUS_JAM = 31;
|
||||
public const int CHAN_STATUS_JAMOK = 32;
|
||||
public const int CHAN_STATUS_NEAREMPTY = 12;
|
||||
public const int CHAN_STATUS_NEARFULL = 22;
|
||||
public const int CHAN_STATUS_OK = 0;
|
||||
public const int COIN_STATUS_EMPTY = 2;
|
||||
public const int COIN_STATUS_JAM = 4;
|
||||
public const int COIN_STATUS_NEAREMPTY = 3;
|
||||
public const int COIN_STATUS_OK = 1;
|
||||
public const int DISP_CB_BLINKALL = 1;
|
||||
public const int DISP_CB_BLINKEACH = 2;
|
||||
public const int DISP_CB_NOBLINK = 0;
|
||||
public const int DISP_CCS_ALPHA = 1;
|
||||
public const int DISP_CCS_ASCII = 998;
|
||||
public const int DISP_CCS_KANA = 10;
|
||||
public const int DISP_CCS_KANJI = 11;
|
||||
public const int DISP_CCS_NUMERIC = 0;
|
||||
public const int DISP_CS_ASCII = 998;
|
||||
public const int DISP_CS_WINDOWS = 999;
|
||||
public const int DISP_DT_BLINK = 1;
|
||||
public const int DISP_DT_NORMAL = 0;
|
||||
public const int DISP_MF_PLACE = 1;
|
||||
public const int DISP_MF_WALK = 0;
|
||||
public const int DISP_MT_DOWN = 2;
|
||||
public const int DISP_MT_INIT = 5;
|
||||
public const int DISP_MT_LEFT = 3;
|
||||
public const int DISP_MT_NONE = 0;
|
||||
public const int DISP_MT_RIGHT = 4;
|
||||
public const int DISP_MT_UP = 1;
|
||||
public const int DISP_SD_BLINK = 2;
|
||||
public const int DISP_SD_OFF = 0;
|
||||
public const int DISP_SD_ON = 1;
|
||||
public const int DISP_ST_DOWN = 2;
|
||||
public const int DISP_ST_LEFT = 3;
|
||||
public const int DISP_ST_RIGHT = 4;
|
||||
public const int DISP_ST_UP = 1;
|
||||
public const int FPTR_AT_AMOUNT_DISCOUNT = 1;
|
||||
public const int FPTR_AT_AMOUNT_SURCHARGE = 2;
|
||||
public const int FPTR_AT_PERCENTAGE_DISCOUNT = 3;
|
||||
public const int FPTR_AT_PERCENTAGE_SURCHARGE = 4;
|
||||
public const int FPTR_CC_BRAZIL = 1;
|
||||
public const int FPTR_CC_GREECE = 2;
|
||||
public const int FPTR_CC_HUNGARY = 3;
|
||||
public const int FPTR_CC_ITALY = 4;
|
||||
public const int FPTR_CC_POLAND = 5;
|
||||
public const int FPTR_CC_TURKEY = 6;
|
||||
public const int FPTR_EL_BLOCKED = 4;
|
||||
public const int FPTR_EL_FATAL = 3;
|
||||
public const int FPTR_EL_NONE = 1;
|
||||
public const int FPTR_EL_RECOVERABLE = 2;
|
||||
public const int FPTR_GD_CURRENT_TOTAL = 1;
|
||||
public const int FPTR_GD_DAILY_TOTAL = 2;
|
||||
public const int FPTR_GD_FIRMWARE = 10;
|
||||
public const int FPTR_GD_GRAND_TOTAL = 8;
|
||||
public const int FPTR_GD_MID_VOID = 6;
|
||||
public const int FPTR_GD_NOT_PAID = 5;
|
||||
public const int FPTR_GD_PRINTER_ID = 9;
|
||||
public const int FPTR_GD_RECEIPT_NUMBER = 3;
|
||||
public const int FPTR_GD_REFUND = 4;
|
||||
public const int FPTR_GD_RESTART = 11;
|
||||
public const int FPTR_GD_Z_REPORT = 7;
|
||||
public const int FPTR_PS_FISCAL_DOCUMENT = 5;
|
||||
public const int FPTR_PS_FISCAL_RECEIPT = 2;
|
||||
public const int FPTR_PS_FISCAL_RECEIPT_ENDING = 4;
|
||||
public const int FPTR_PS_FISCAL_RECEIPT_TOTAL = 3;
|
||||
public const int FPTR_PS_FIXED_OUTPUT = 6;
|
||||
public const int FPTR_PS_ITEM_LIST = 7;
|
||||
public const int FPTR_PS_LOCKED = 8;
|
||||
public const int FPTR_PS_MONITOR = 1;
|
||||
public const int FPTR_PS_NONFISCAL = 9;
|
||||
public const int FPTR_PS_REPORT = 10;
|
||||
public const int FPTR_RT_DATE = 2;
|
||||
public const int FPTR_RT_ORDINAL = 1;
|
||||
public const int FPTR_S_JOURNAL = 1;
|
||||
public const int FPTR_S_RECEIPT = 2;
|
||||
public const int FPTR_S_SLIP = 4;
|
||||
public const int FPTR_SS_FULL_LENGTH = 1;
|
||||
public const int FPTR_SS_VALIDATION = 2;
|
||||
public const int FPTR_SUE_COVER_OK = 12;
|
||||
public const int FPTR_SUE_COVER_OPEN = 11;
|
||||
public const int FPTR_SUE_IDLE = 1001;
|
||||
public const int FPTR_SUE_JRN_EMPTY = 21;
|
||||
public const int FPTR_SUE_JRN_NEAREMPTY = 22;
|
||||
public const int FPTR_SUE_JRN_PAPEROK = 23;
|
||||
public const int FPTR_SUE_REC_EMPTY = 24;
|
||||
public const int FPTR_SUE_REC_NEAREMPTY = 25;
|
||||
public const int FPTR_SUE_REC_PAPEROK = 26;
|
||||
public const int FPTR_SUE_SLP_EMPTY = 27;
|
||||
public const int FPTR_SUE_SLP_NEAREMPTY = 28;
|
||||
public const int FPTR_SUE_SLP_PAPEROK = 29;
|
||||
public const int KBD_ET_DOWN = 1;
|
||||
public const int KBD_ET_DOWN_UP = 2;
|
||||
public const int KBD_KET_KEYDOWN = 1;
|
||||
public const int KBD_KET_KEYUP = 2;
|
||||
public const int LOCK_KP_ANY = 0;
|
||||
public const int LOCK_KP_LOCK = 1;
|
||||
public const int LOCK_KP_NORM = 2;
|
||||
public const int LOCK_KP_SUPR = 3;
|
||||
public const int MICR_CC_CANADA = 2;
|
||||
public const int MICR_CC_MEXICO = 3;
|
||||
public const int MICR_CC_UNKNOWN = 99;
|
||||
public const int MICR_CC_USA = 1;
|
||||
public const int MICR_CT_BUSINESS = 2;
|
||||
public const int MICR_CT_PERSONAL = 1;
|
||||
public const int MICR_CT_UNKNOWN = 99;
|
||||
public const int MSR_ERT_CARD = 0;
|
||||
public const int MSR_ERT_TRACK = 1;
|
||||
public const int MSR_TR_1 = 1;
|
||||
public const int MSR_TR_2 = 2;
|
||||
public const int MSR_TR_3 = 4;
|
||||
public const int OPOS_BC_DECIMAL = 2;
|
||||
public const int OPOS_BC_NIBBLE = 1;
|
||||
public const int OPOS_BC_NONE = 0;
|
||||
public const int OPOS_CH_EXTERNAL = 2;
|
||||
public const int OPOS_CH_INTERACTIVE = 3;
|
||||
public const int OPOS_CH_INTERNAL = 1;
|
||||
public const int OPOS_E_BUSY = 113;
|
||||
public const int OPOS_E_CLAIMED = 102;
|
||||
public const int OPOS_E_CLOSED = 101;
|
||||
public const int OPOS_E_DISABLED = 105;
|
||||
public const int OPOS_E_EXISTS = 110;
|
||||
public const int OPOS_E_EXTENDED = 114;
|
||||
public const int OPOS_E_FAILURE = 111;
|
||||
public const int OPOS_E_ILLEGAL = 106;
|
||||
public const int OPOS_E_NOEXIST = 109;
|
||||
public const int OPOS_E_NOHARDWARE = 107;
|
||||
public const int OPOS_E_NOSERVICE = 104;
|
||||
public const int OPOS_E_NOTCLAIMED = 103;
|
||||
public const int OPOS_E_OFFLINE = 108;
|
||||
public const int OPOS_E_TIMEOUT = 112;
|
||||
public const int OPOS_ECHAN_OVERDISPENSE = 201;
|
||||
public const int OPOS_EFPTR_BAD_DATE = 219;
|
||||
public const int OPOS_EFPTR_BAD_ITEM_AMOUNT = 214;
|
||||
public const int OPOS_EFPTR_BAD_ITEM_DESCRIPTION = 215;
|
||||
public const int OPOS_EFPTR_BAD_ITEM_QUANTITY = 213;
|
||||
public const int OPOS_EFPTR_BAD_PRICE = 218;
|
||||
public const int OPOS_EFPTR_BAD_VAT = 217;
|
||||
public const int OPOS_EFPTR_CLOCK_ERROR = 209;
|
||||
public const int OPOS_EFPTR_COVER_OPEN = 201;
|
||||
public const int OPOS_EFPTR_FISCAL_MEMORY_DISCONNECTED = 211;
|
||||
public const int OPOS_EFPTR_FISCAL_MEMORY_FULL = 210;
|
||||
public const int OPOS_EFPTR_FISCAL_TOTALS_ERROR = 212;
|
||||
public const int OPOS_EFPTR_JRN_EMPTY = 202;
|
||||
public const int OPOS_EFPTR_MISSING_DEVICES = 206;
|
||||
public const int OPOS_EFPTR_NEGATIVE_TOTAL = 220;
|
||||
public const int OPOS_EFPTR_REC_EMPTY = 203;
|
||||
public const int OPOS_EFPTR_RECEIPT_TOTAL_OVERFLOW = 216;
|
||||
public const int OPOS_EFPTR_SLP_EMPTY = 204;
|
||||
public const int OPOS_EFPTR_SLP_FORM = 205;
|
||||
public const int OPOS_EFPTR_TECHNICAL_ASSISTANCE = 208;
|
||||
public const int OPOS_EFPTR_WORD_NOT_ALLOWED = 221;
|
||||
public const int OPOS_EFPTR_WRONG_STATE = 207;
|
||||
public const int OPOS_EL_INPUT = 2;
|
||||
public const int OPOS_EL_INPUT_DATA = 3;
|
||||
public const int OPOS_EL_OUTPUT = 1;
|
||||
public const int OPOS_EMICR_CHECK = 202;
|
||||
public const int OPOS_EMICR_NOCHECK = 201;
|
||||
public const int OPOS_EMSR_END = 202;
|
||||
public const int OPOS_EMSR_LRC = 204;
|
||||
public const int OPOS_EMSR_PARITY = 203;
|
||||
public const int OPOS_EMSR_START = 201;
|
||||
public const int OPOS_EPTR_BADFORMAT = 207;
|
||||
public const int OPOS_EPTR_COVER_OPEN = 201;
|
||||
public const int OPOS_EPTR_JRN_EMPTY = 202;
|
||||
public const int OPOS_EPTR_REC_EMPTY = 203;
|
||||
public const int OPOS_EPTR_SLP_EMPTY = 204;
|
||||
public const int OPOS_EPTR_SLP_FORM = 205;
|
||||
public const int OPOS_EPTR_TOOBIG = 206;
|
||||
public const int OPOS_ER_CLEAR = 12;
|
||||
public const int OPOS_ER_CONTINUEINPUT = 13;
|
||||
public const int OPOS_ER_RETRY = 11;
|
||||
public const int OPOS_EROD_BADCLK = 201;
|
||||
public const int OPOS_EROD_NOBUFFERS = 204;
|
||||
public const int OPOS_EROD_NOCLOCKS = 202;
|
||||
public const int OPOS_EROD_NOREGION = 203;
|
||||
public const int OPOS_EROD_NOROOM = 205;
|
||||
public const int OPOS_ESCAL_OVERWEIGHT = 201;
|
||||
public const int OPOS_ETOT_NOROOM = 201;
|
||||
public const int OPOS_ETOT_VALIDATION = 202;
|
||||
public const int OPOS_FOREVER = -1;
|
||||
public const int OPOS_PN_DISABLED = 0;
|
||||
public const int OPOS_PN_ENABLED = 1;
|
||||
public const int OPOS_PR_ADVANCED = 2;
|
||||
public const int OPOS_PR_NONE = 0;
|
||||
public const int OPOS_PR_STANDARD = 1;
|
||||
public const int OPOS_PS_OFF = 2002;
|
||||
public const int OPOS_PS_OFF_OFFLINE = 2004;
|
||||
public const int OPOS_PS_OFFLINE = 2003;
|
||||
public const int OPOS_PS_ONLINE = 2001;
|
||||
public const int OPOS_PS_UNKNOWN = 2000;
|
||||
public const int OPOS_S_BUSY = 3;
|
||||
public const int OPOS_S_CLOSED = 1;
|
||||
public const int OPOS_S_ERROR = 4;
|
||||
public const int OPOS_S_IDLE = 2;
|
||||
public const int OPOS_SUCCESS = 0;
|
||||
public const int OPOS_SUE_POWER_OFF = 2002;
|
||||
public const int OPOS_SUE_POWER_OFF_OFFLINE = 2004;
|
||||
public const int OPOS_SUE_POWER_OFFLINE = 2003;
|
||||
public const int OPOS_SUE_POWER_ONLINE = 2001;
|
||||
public const int OPOSERR = 100;
|
||||
public const int OPOSERREXT = 200;
|
||||
public const int PPAD_CANCEL = 2;
|
||||
public const int PPAD_DISP_PINRESTRICTED = 2;
|
||||
public const int PPAD_DISP_RESTRICTEDLIST = 3;
|
||||
public const int PPAD_DISP_RESTRICTEDORDER = 4;
|
||||
public const int PPAD_DISP_UNRESTRICTED = 1;
|
||||
public const int PPAD_EFT_ABNORMAL = 2;
|
||||
public const int PPAD_EFT_NORMAL = 1;
|
||||
public const int PPAD_LANG_NONE = 1;
|
||||
public const int PPAD_LANG_ONE = 2;
|
||||
public const int PPAD_LANG_PINRESTRICTED = 3;
|
||||
public const int PPAD_LANG_UNRESTRICTED = 4;
|
||||
public const int PPAD_MSG_AMOUNTOK = 8;
|
||||
public const int PPAD_MSG_APPROVED = 5;
|
||||
public const int PPAD_MSG_CANCELED = 7;
|
||||
public const int PPAD_MSG_DECLINED = 6;
|
||||
public const int PPAD_MSG_ENTERPIN = 1;
|
||||
public const int PPAD_MSG_ENTERVALIDPIN = 3;
|
||||
public const int PPAD_MSG_IDLE = 10;
|
||||
public const int PPAD_MSG_INSERTCARD = 12;
|
||||
public const int PPAD_MSG_NOTREADY = 9;
|
||||
public const int PPAD_MSG_PLEASEWAIT = 2;
|
||||
public const int PPAD_MSG_RETRIESEXCEEDED = 4;
|
||||
public const int PPAD_MSG_SELECTCARDTYPE = 13;
|
||||
public const int PPAD_MSG_SLIDE_CARD = 11;
|
||||
public const int PPAD_SUCCESS = 1;
|
||||
public const int PPAD_TRANS_ADMIN = 5;
|
||||
public const int PPAD_TRANS_CREDIT = 2;
|
||||
public const int PPAD_TRANS_DEBIT = 1;
|
||||
public const int PPAD_TRANS_INQ = 3;
|
||||
public const int PPAD_TRANS_RECONCILE = 4;
|
||||
public const int PTR_BC_CENTER = -2;
|
||||
public const int PTR_BC_LEFT = -1;
|
||||
public const int PTR_BC_RIGHT = -3;
|
||||
public const int PTR_BC_TEXT_ABOVE = -12;
|
||||
public const int PTR_BC_TEXT_BELOW = -13;
|
||||
public const int PTR_BC_TEXT_NONE = -11;
|
||||
public const int PTR_BCS_Codabar = 107;
|
||||
public const int PTR_BCS_Code128 = 110;
|
||||
public const int PTR_BCS_Code39 = 108;
|
||||
public const int PTR_BCS_Code93 = 109;
|
||||
public const int PTR_BCS_EAN128 = 120;
|
||||
public const int PTR_BCS_EAN13 = 104;
|
||||
public const int PTR_BCS_EAN13_S = 119;
|
||||
public const int PTR_BCS_EAN8 = 103;
|
||||
public const int PTR_BCS_EAN8_S = 118;
|
||||
public const int PTR_BCS_ITF = 106;
|
||||
public const int PTR_BCS_JAN13 = 104;
|
||||
public const int PTR_BCS_JAN8 = 103;
|
||||
public const int PTR_BCS_MAXICODE = 202;
|
||||
public const int PTR_BCS_OCRA = 121;
|
||||
public const int PTR_BCS_OCRB = 122;
|
||||
public const int PTR_BCS_OTHER = 501;
|
||||
public const int PTR_BCS_PDF417 = 201;
|
||||
public const int PTR_BCS_TF = 105;
|
||||
public const int PTR_BCS_UPCA = 101;
|
||||
public const int PTR_BCS_UPCA_S = 111;
|
||||
public const int PTR_BCS_UPCD1 = 113;
|
||||
public const int PTR_BCS_UPCD2 = 114;
|
||||
public const int PTR_BCS_UPCD3 = 115;
|
||||
public const int PTR_BCS_UPCD4 = 116;
|
||||
public const int PTR_BCS_UPCD5 = 117;
|
||||
public const int PTR_BCS_UPCE = 102;
|
||||
public const int PTR_BCS_UPCE_S = 112;
|
||||
public const int PTR_BM_ASIS = -11;
|
||||
public const int PTR_BM_CENTER = -2;
|
||||
public const int PTR_BM_LEFT = -1;
|
||||
public const int PTR_BM_RIGHT = -3;
|
||||
public const int PTR_CCS_ALPHA = 1;
|
||||
public const int PTR_CCS_ASCII = 998;
|
||||
public const int PTR_CCS_KANA = 10;
|
||||
public const int PTR_CCS_KANJI = 11;
|
||||
public const int PTR_CP_FULLCUT = 100;
|
||||
public const int PTR_CS_ASCII = 998;
|
||||
public const int PTR_CS_WINDOWS = 999;
|
||||
public const int PTR_EL_FATAL = 3;
|
||||
public const int PTR_EL_NONE = 1;
|
||||
public const int PTR_EL_RECOVERABLE = 2;
|
||||
public const int PTR_L_BOTTOM = 2;
|
||||
public const int PTR_L_TOP = 1;
|
||||
public const int PTR_MM_DOTS = 1;
|
||||
public const int PTR_MM_ENGLISH = 3;
|
||||
public const int PTR_MM_METRIC = 4;
|
||||
public const int PTR_MM_TWIPS = 2;
|
||||
public const char PTR_RP_LEFT90 = 'f';
|
||||
public const char PTR_RP_NORMAL = '';
|
||||
public const char PTR_RP_RIGHT90 = 'e';
|
||||
public const char PTR_RP_ROTATE180 = 'g';
|
||||
public const int PTR_S_JOURNAL = 1;
|
||||
public const int PTR_S_RECEIPT = 2;
|
||||
public const int PTR_S_SLIP = 4;
|
||||
public const int PTR_SUE_COVER_OK = 12;
|
||||
public const int PTR_SUE_COVER_OPEN = 11;
|
||||
public const int PTR_SUE_IDLE = 1001;
|
||||
public const int PTR_SUE_JRN_EMPTY = 21;
|
||||
public const int PTR_SUE_JRN_NEAREMPTY = 22;
|
||||
public const int PTR_SUE_JRN_PAPEROK = 23;
|
||||
public const int PTR_SUE_REC_EMPTY = 24;
|
||||
public const int PTR_SUE_REC_NEAREMPTY = 25;
|
||||
public const int PTR_SUE_REC_PAPEROK = 26;
|
||||
public const int PTR_SUE_SLP_EMPTY = 27;
|
||||
public const int PTR_SUE_SLP_NEAREMPTY = 28;
|
||||
public const int PTR_SUE_SLP_PAPEROK = 29;
|
||||
public const int PTR_TP_NORMAL = 12;
|
||||
public const int PTR_TP_TRANSACTION = 11;
|
||||
public const int ROD_BDR_DOUBLE = 2;
|
||||
public const int ROD_BDR_SINGLE = 1;
|
||||
public const int ROD_BDR_SOLID = 3;
|
||||
public const int ROD_CLK_MOVE = 4;
|
||||
public const int ROD_CLK_PAUSE = 2;
|
||||
public const int ROD_CLK_RESUME = 3;
|
||||
public const int ROD_CLK_START = 1;
|
||||
public const int ROD_CLK_STOP = 5;
|
||||
public const int ROD_CRS_BLOCK = 3;
|
||||
public const int ROD_CRS_BLOCK_BLINK = 4;
|
||||
public const int ROD_CRS_LINE = 1;
|
||||
public const int ROD_CRS_LINE_BLINK = 2;
|
||||
public const int ROD_CRS_OFF = 5;
|
||||
public const int ROD_CS_ASCII = 998;
|
||||
public const int ROD_CS_WINDOWS = 999;
|
||||
public const char ROD_DE_TOUCH_DOWN = '';
|
||||
public const char ROD_DE_TOUCH_MOVE = '';
|
||||
public const char ROD_DE_TOUCH_UP = '';
|
||||
public const int ROD_TD_NORMAL = 12;
|
||||
public const int ROD_TD_TRANSACTION = 11;
|
||||
public const int ROD_UA_BLINK_OFF = 7;
|
||||
public const int ROD_UA_BLINK_ON = 6;
|
||||
public const int ROD_UA_INTENSITY_OFF = 3;
|
||||
public const int ROD_UA_INTENSITY_ON = 2;
|
||||
public const int ROD_UA_REVERSE_OFF = 5;
|
||||
public const int ROD_UA_REVERSE_ON = 4;
|
||||
public const int ROD_UA_SET = 1;
|
||||
public const int SCAL_WU_GRAM = 1;
|
||||
public const int SCAL_WU_KILOGRAM = 2;
|
||||
public const int SCAL_WU_OUNCE = 3;
|
||||
public const int SCAL_WU_POUND = 4;
|
||||
public const int SCAN_SDT_Codabar = 107;
|
||||
public const int SCAN_SDT_Code128 = 110;
|
||||
public const int SCAN_SDT_Code39 = 108;
|
||||
public const int SCAN_SDT_Code93 = 109;
|
||||
public const int SCAN_SDT_EAN128 = 120;
|
||||
public const int SCAN_SDT_EAN13 = 104;
|
||||
public const int SCAN_SDT_EAN13_S = 119;
|
||||
public const int SCAN_SDT_EAN8 = 103;
|
||||
public const int SCAN_SDT_EAN8_S = 118;
|
||||
public const int SCAN_SDT_ITF = 106;
|
||||
public const int SCAN_SDT_JAN13 = 104;
|
||||
public const int SCAN_SDT_JAN8 = 103;
|
||||
public const int SCAN_SDT_MAXICODE = 202;
|
||||
public const int SCAN_SDT_OCRA = 121;
|
||||
public const int SCAN_SDT_OCRB = 122;
|
||||
public const int SCAN_SDT_OTHER = 501;
|
||||
public const int SCAN_SDT_PDF417 = 201;
|
||||
public const int SCAN_SDT_TF = 105;
|
||||
public const int SCAN_SDT_UNKNOWN = 0;
|
||||
public const int SCAN_SDT_UPCA = 101;
|
||||
public const int SCAN_SDT_UPCA_S = 111;
|
||||
public const int SCAN_SDT_UPCD1 = 113;
|
||||
public const int SCAN_SDT_UPCD2 = 114;
|
||||
public const int SCAN_SDT_UPCD3 = 115;
|
||||
public const int SCAN_SDT_UPCD4 = 116;
|
||||
public const int SCAN_SDT_UPCD5 = 117;
|
||||
public const int SCAN_SDT_UPCE = 102;
|
||||
public const int SCAN_SDT_UPCE_S = 112;
|
||||
}
|
||||
}
|
122
Agent/KPS/KPS.csproj
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5D91CC0D-EB29-405A-BF21-3C52ADA8CC76}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.KPS</RootNamespace>
|
||||
<AssemblyName>Agent.KPS</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider">
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="Common.cs" />
|
||||
<Compile Include="frmKPS.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmKPS.Designer.cs">
|
||||
<DependentUpon>frmKPS.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="KPSMain.cs" />
|
||||
<Compile Include="LabelPrinter.cs" />
|
||||
<Compile Include="LANPrint.cs" />
|
||||
<Compile Include="OPOSPrint.cs" />
|
||||
<Compile Include="PrinterCommand.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SerialPrint.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="frmKPS.resx">
|
||||
<DependentUpon>frmKPS.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="AxOposPOSPrinter_CCO">
|
||||
<Guid>{CCB90150-B81E-11D2-AB74-0040054C3719}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>aximp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
<COMReference Include="OposPOSPrinter_CCO">
|
||||
<Guid>{CCB90150-B81E-11D2-AB74-0040054C3719}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.KPS.dll .\Agent.KPS.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.KPS.dll .\IC\Agent.KPS.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
3986
Agent/KPS/KPSMain.cs
Normal file
548
Agent/KPS/LANPrint.cs
Normal file
|
@ -0,0 +1,548 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.BaseFrame;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
class LANPrint
|
||||
{
|
||||
PrinterCommand prtCmd = new PrinterCommand();
|
||||
|
||||
private TcpSocket m_cKtchSocket = null;
|
||||
|
||||
#region Printer OPEN / CLOSE
|
||||
public int OpenDevice(string sIp, int iPort)
|
||||
{
|
||||
int iRet = UserCom.NG;
|
||||
try
|
||||
{
|
||||
// PING 테스트로 프린터 가능여부 확인(2017.05.30)
|
||||
if (CmUtil.PingTest(sIp) == false)
|
||||
{
|
||||
if (CmUtil.PingTest(sIp) == false) return iRet;
|
||||
}
|
||||
|
||||
m_cKtchSocket = new TcpSocket(sIp, iPort, 5000);
|
||||
|
||||
if(m_cKtchSocket == null)
|
||||
{
|
||||
return -9;
|
||||
}
|
||||
|
||||
// 주방프린터 접속 3회 시도
|
||||
for(int nLoop = 0;nLoop < 1;nLoop++)
|
||||
{
|
||||
try
|
||||
{
|
||||
iRet = m_cKtchSocket.Connect(-1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"KPS Exception Error=" + ex.Message);
|
||||
m_cKtchSocket.Close();
|
||||
continue;
|
||||
}
|
||||
// 접속 실패
|
||||
if (iRet != UserCom.OK)
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"KPS(Ethernet) Connect Error");
|
||||
m_cKtchSocket.Close();
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
// Cover Check
|
||||
iRet = PrinterStatusCheckByLan("CHK1");
|
||||
if (iRet != UserCom.OK)
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"KPS(Ethernet) Cover Check Error");
|
||||
m_cKtchSocket.Close();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Paper Check
|
||||
iRet = PrinterStatusCheckByLan("CHK2");
|
||||
if (iRet != UserCom.OK)
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"KPS(Ethernet) Paper Check Error");
|
||||
m_cKtchSocket.Close();
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
return -99;
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseDevice()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(m_cKtchSocket != null)
|
||||
{
|
||||
m_cKtchSocket.Close();
|
||||
m_cKtchSocket = null;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Status Check
|
||||
public int PrinterStatusCheckByLan(string sType)
|
||||
{
|
||||
int iRet = 0;
|
||||
string sRet = string.Empty;
|
||||
|
||||
byte[] recvData = null;
|
||||
|
||||
try
|
||||
{
|
||||
#region Printer CHK1
|
||||
if (sType == "CHK1")
|
||||
{
|
||||
iRet = m_cKtchSocket.SendReceiveFoodPrintData(PosConst.ESCP_COMMAND.TRANSMIT_OFFLINE_STATUS, ref recvData, 5000);
|
||||
|
||||
if (recvData != null)
|
||||
{
|
||||
if (recvData[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
||||
{
|
||||
iRet = UserCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"COVER Opened");
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Printer CHK2
|
||||
if (sType == "CHK2")
|
||||
{
|
||||
iRet = m_cKtchSocket.SendReceiveFoodPrintData(PosConst.ESCP_COMMAND.TRANSMIT_CONTINUOUS_PAPER_DETECTOR_STATUS, ref recvData, 5000);
|
||||
|
||||
if (recvData != null)
|
||||
{
|
||||
if (recvData[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
||||
{
|
||||
iRet = UserCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
string sRecvData = Encoding.Default.GetString(recvData);
|
||||
|
||||
string NEAR_END = Encoding.Default.GetString(new byte[] { 0x1E });
|
||||
string NOT_PRESENT = Encoding.Default.GetString(new byte[] { 0x72 });
|
||||
|
||||
string sErrMsg = string.Empty;
|
||||
if (sRecvData == NEAR_END)
|
||||
{
|
||||
iRet = UserCom.OK;
|
||||
sErrMsg = "PAPER_NEAR_END";
|
||||
}
|
||||
else if (sRecvData == NOT_PRESENT) sErrMsg = "PAPER_NOT_PRESENT";
|
||||
else sErrMsg = "ETC_ERROR";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
sErrMsg);
|
||||
}
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"StatusCheck Failed");
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Cut Paper
|
||||
public bool CutPaper(int LineFeedCnt)
|
||||
{
|
||||
long nRet = -1;
|
||||
try
|
||||
{
|
||||
for(int i = 0;i < LineFeedCnt;i++)
|
||||
{
|
||||
nRet = m_cKtchSocket.SendFoodPrintData(Encoding.Default.GetBytes("\r\n"));
|
||||
}
|
||||
|
||||
if(m_cKtchSocket.SendFoodPrintData(PosConst.ESCP_COMMAND.PAPER_CUT) == BaseCom.OK)
|
||||
{
|
||||
nRet = m_cKtchSocket.SendFoodPrintData(Encoding.Default.GetBytes("\r\n"));
|
||||
}
|
||||
|
||||
// BEEP 커맨더 전송(2017.05.30)
|
||||
byte[] bytBEEP = new byte[] { 0x1B, 0x70, 0x01, 0x20, 0x80 };
|
||||
m_cKtchSocket.SendFoodPrintData(bytBEEP);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Cut Paper Exception");
|
||||
}
|
||||
return nRet == BaseCom.OK ? true : false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 문자열 출력
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, PrinterCommand.TextBold eBold, PrinterCommand.TextUnderLine eTextUnderLine, PrinterCommand.TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
bool bRet = false;
|
||||
string sCmdctrlTmp = "";
|
||||
|
||||
try
|
||||
{
|
||||
// 확대 Command를 설정
|
||||
sCmdctrlTmp = GetCharactersizeCmd(eVerticalSize, eHorizontalSize);
|
||||
|
||||
// UnerLine
|
||||
sCmdctrlTmp += GetUnderLineCmd(eTextUnderLine);
|
||||
|
||||
// Bold
|
||||
sCmdctrlTmp += GetBoldCmd(eBold);
|
||||
|
||||
// 정렬
|
||||
sCmdctrlTmp += GetAlignment(eAlignment);
|
||||
|
||||
// Reverse
|
||||
sCmdctrlTmp += GetReverseCmd(eTextReverseMode);
|
||||
|
||||
// 출력
|
||||
byte[] byteCmdctrl = Encoding.Default.GetBytes(sCmdctrlTmp);
|
||||
if (m_cKtchSocket.SendFoodPrintData(byteCmdctrl) != BaseCom.OK) bRet = false; // Command 전송
|
||||
|
||||
byte[] byteData = Encoding.Default.GetBytes(sValue);
|
||||
if (m_cKtchSocket.SendFoodPrintData(byteData) != BaseCom.OK) bRet = false; // 출력 Data 전송
|
||||
|
||||
if (bLineFeed == true && m_cKtchSocket.SendFoodPrintData(Encoding.Default.GetBytes("\n")) != BaseCom.OK) bRet = false;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, PrinterCommand.TextBold eBold, PrinterCommand.TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, eVerticalSize, eHorizontalSize, eBold, eTextUnderLine, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, eVerticalSize, eHorizontalSize, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextBold eBold, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, eBold, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, eTextUnderLine, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, eTextReverseMode, bLineFeed);
|
||||
}
|
||||
|
||||
private string GetCharactersizeCmd(PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize)
|
||||
{
|
||||
string sRet = "";
|
||||
|
||||
try
|
||||
{
|
||||
int Hvalue = 0;
|
||||
int Vvalue = 0;
|
||||
|
||||
switch(eVerticalSize)
|
||||
{
|
||||
case PrinterCommand.CharactersizeV.V_1: Vvalue = 0; break;
|
||||
case PrinterCommand.CharactersizeV.V_2: Vvalue = 1; break;
|
||||
case PrinterCommand.CharactersizeV.V_3: Vvalue = 2; break;
|
||||
case PrinterCommand.CharactersizeV.V_4: Vvalue = 3; break;
|
||||
case PrinterCommand.CharactersizeV.V_5: Vvalue = 4; break;
|
||||
case PrinterCommand.CharactersizeV.V_6: Vvalue = 5; break;
|
||||
case PrinterCommand.CharactersizeV.V_7: Vvalue = 6; break;
|
||||
case PrinterCommand.CharactersizeV.V_8: Vvalue = 7; break;
|
||||
default: Vvalue = 0; break;
|
||||
}
|
||||
|
||||
switch(eHorizontalSize)
|
||||
{
|
||||
case PrinterCommand.CharactersizeH.H_1: Hvalue = 16 * 0; break;
|
||||
case PrinterCommand.CharactersizeH.H_2: Hvalue = 16 * 1; break;
|
||||
case PrinterCommand.CharactersizeH.H_3: Hvalue = 16 * 2; break;
|
||||
case PrinterCommand.CharactersizeH.H_4: Hvalue = 16 * 3; break;
|
||||
case PrinterCommand.CharactersizeH.H_5: Hvalue = 16 * 4; break;
|
||||
case PrinterCommand.CharactersizeH.H_6: Hvalue = 16 * 5; break;
|
||||
case PrinterCommand.CharactersizeH.H_7: Hvalue = 16 * 6; break;
|
||||
case PrinterCommand.CharactersizeH.H_8: Hvalue = 16 * 7; break;
|
||||
default: Hvalue = 16 * 0; break;
|
||||
}
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_VHMAG) + Convert.ToChar(Vvalue + Hvalue).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 진한 문자(Bold)
|
||||
/// </summary>
|
||||
/// <param name="eBold"></param>
|
||||
/// <returns></returns>
|
||||
private string GetBoldCmd(PrinterCommand.TextBold eBold)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch(eBold)
|
||||
{
|
||||
case PrinterCommand.TextBold.Nomal: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_OFF); break;
|
||||
case PrinterCommand.TextBold.Bold: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_ON); break;
|
||||
default: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_OFF); break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// UnderLine
|
||||
/// </summary>
|
||||
/// <param name="eUnderLine"></param>
|
||||
/// <param name="nDot"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUnderLineCmd(PrinterCommand.TextUnderLine eUnderLine, int nDot)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
if(eUnderLine == PrinterCommand.TextUnderLine.UnderLine)
|
||||
{
|
||||
if(nDot == 2)
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEON1DOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEON2DOT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEOFF);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// UnderLine Text
|
||||
/// </summary>
|
||||
/// <param name="eUnderLine"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUnderLineCmd(PrinterCommand.TextUnderLine eUnderLine)
|
||||
{
|
||||
return GetUnderLineCmd(eUnderLine, 1);
|
||||
}
|
||||
/// <summary>
|
||||
/// 반전 텍스트
|
||||
/// </summary>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <returns></returns>
|
||||
private string GetReverseCmd(PrinterCommand.TextReverseMode eTextReverseMode)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch(eTextReverseMode)
|
||||
{
|
||||
case PrinterCommand.TextReverseMode.ReverseMode: sRet = Encoding.Default.GetString(prtCmd.ESC_REVERSE_MODE_ON); break;
|
||||
default: sRet = Encoding.Default.GetString(prtCmd.ESC_REVERSE_MODE_OFF); break;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 정렬 Command를 가져온다.
|
||||
/// </summary>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <returns></returns>
|
||||
private string GetAlignment(PrinterCommand.Alignment eAlignment)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch(eAlignment)
|
||||
{
|
||||
case PrinterCommand.Alignment.Center:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_CENTER);
|
||||
break;
|
||||
case PrinterCommand.Alignment.Right:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_RIGHT);
|
||||
break;
|
||||
case PrinterCommand.Alignment.Left:
|
||||
default:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
385
Agent/KPS/LabelPrinter.cs
Normal file
|
@ -0,0 +1,385 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
public class LabelPrinter
|
||||
{
|
||||
#region 클래스 변수 선언
|
||||
private static SerialPort m_cSerialPort = null;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자
|
||||
public LabelPrinter()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion 생성자
|
||||
|
||||
#region OPEN / CLOSE 처리 함수
|
||||
public bool OpenLabelPrinter(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
if (m_cSerialPort != null)
|
||||
{
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Open 함수 Input Output 버퍼 삭제 (주석처리)
|
||||
// 추가
|
||||
if (m_cSerialPort.IsOpen != true) // 시리얼포트 오픈 실패
|
||||
{
|
||||
m_cSerialPort.Open(); // 시리얼포트 오픈
|
||||
}
|
||||
//m_cSerialPort.DiscardOutBuffer();
|
||||
//m_cSerialPort.DiscardInBuffer();
|
||||
//UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
// System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
// "▶▶ [Open InOut Buffer Clear]");
|
||||
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
return bRet;
|
||||
}
|
||||
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
m_cSerialPort = new SerialPort();
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT ERROR");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_cSerialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
|
||||
m_cSerialPort.PinChanged += new SerialPinChangedEventHandler(serialPort_PinChanged);
|
||||
m_cSerialPort.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort_ErrorReceived);
|
||||
|
||||
m_cSerialPort.NewLine = "\r\n";
|
||||
m_cSerialPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
|
||||
m_cSerialPort.WriteBufferSize = 1024 * 1024;
|
||||
m_cSerialPort.PortName = sSerialPort;
|
||||
m_cSerialPort.BaudRate = (int)lBaudrate;
|
||||
m_cSerialPort.DataBits = 8;
|
||||
m_cSerialPort.StopBits = StopBits.One;
|
||||
m_cSerialPort.Parity = Parity.None;
|
||||
m_cSerialPort.Handshake = Handshake.None;
|
||||
m_cSerialPort.ReadTimeout = 500;
|
||||
m_cSerialPort.WriteTimeout = 2000;
|
||||
|
||||
m_cSerialPort.Open();
|
||||
if(m_cSerialPort.IsOpen == false)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT OPEN ERROR");
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]" + bRet);
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool CloseLabelPrinter()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_cSerialPort == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Close 함수 Input Output 버퍼 삭제
|
||||
// 추가
|
||||
m_cSerialPort.DiscardOutBuffer();
|
||||
m_cSerialPort.DiscardInBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
m_cSerialPort.Close();
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (기존)
|
||||
//m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE] Close InOut Buffer Clear :" + bRet);
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (변경)
|
||||
m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion OPEN / CLOSE 처리 함수
|
||||
|
||||
#region SerialPort 이벤트
|
||||
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort serialPort = (SerialPort)sender;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] bytRecvBuf = new byte[serialPort.BytesToRead];
|
||||
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - DataReceived 시리얼 포트 null check
|
||||
// 기존
|
||||
//serialPort.Read(bytRecvBuf, 0, bytRecvBuf.Length);
|
||||
// 변경
|
||||
if (serialPort != null && serialPort.IsOpen == true) // 시리얼포트 객체 및 오픈 확인
|
||||
{
|
||||
serialPort.Read(bytRecvBuf, 0, bytRecvBuf.Length);
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [RECV] " + Encoding.UTF8.GetString(bytRecvBuf));
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
}
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void serialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion SerialPort 이벤트
|
||||
|
||||
#region 출력 함수
|
||||
/// <summary>
|
||||
/// 중량 출력
|
||||
/// </summary>
|
||||
/// <param name="sContent">상품명 : 중량g</param>
|
||||
/// <param name="iWeight">중량</param>
|
||||
/// <param name="sDateTime">YYYY-MM-DD HH:MM:SS</param>
|
||||
/// <param name="sStoreNm">점포명</param>
|
||||
public void PrintLabelInfoPrintWeightInfo(string sContent, string sDateTime, string sStoreNm)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "NASC 949\r\n" // intermec 한글폰트 설정
|
||||
, "PRPOS 0,150\r\n"
|
||||
, "PRTXT \"" + sContent + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + sDateTime + "\"\r\n"
|
||||
, "PRPOS 0,70\r\n"
|
||||
, "PRTXT \"" + sStoreNm + "\"\r\n"
|
||||
, "PRPOS 0,30\r\n"
|
||||
, "PRTXT \"배달은 해피오더 / 1670-3131\"\r\n" //#10856_[BR] 저울 중량 라벨프린터 양식 변경_hs
|
||||
, "PF\r\n" };
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintWeightInfo(string sContent, string sFlavour1, string sFlavour2, string sOrdDateTime, string sPckDateTime)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
|
||||
try
|
||||
{
|
||||
// EX)
|
||||
// 패밀리 / 980g (5516)
|
||||
// 플레이버1/플레이버2/플레이버3
|
||||
// 플레이버4/플레이버5/플레이버6
|
||||
//
|
||||
// 주문 YYYY-MM-DD HH시MM분
|
||||
// 포장 YYYY-MM-DD HH시MM분
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "NASC 949\r\n"
|
||||
, "PRPOS 0,190\r\n"
|
||||
, "PRTXT \"" + sContent + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 0,150\r\n"
|
||||
, "PRTXT \"" + sFlavour1 + "\"\r\n"
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + sFlavour2 + "\"\r\n"
|
||||
, "PRPOS 0,50\r\n"
|
||||
, "PRTXT \"" + sOrdDateTime + "\"\r\n"
|
||||
, "PRPOS 0,10\r\n"
|
||||
, "PRTXT \"" + sPckDateTime + "\"\r\n"
|
||||
, "PF\r\n" };
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 출력 함수
|
||||
|
||||
//#20180515 KPS 출력시 라벨프린터 출력 start
|
||||
#region KPS 출력시 라벨프린터 출력 함수
|
||||
/// <summary>
|
||||
/// 중량 출력KPS 출력시 라벨프린터 출력
|
||||
/// </summary>
|
||||
/// <param name="sContent">출력데이터</param>
|
||||
public void PrintLabelInfo(string sContent)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
|
||||
try
|
||||
{
|
||||
sCommands = new string[] { sContent };
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 출력 함수
|
||||
//#20180515 KPS 출력시 라벨프린터 출력 end
|
||||
|
||||
#region 명령어 전송 함수
|
||||
/// <summary>
|
||||
/// 시리얼포트에 명령어를 전송
|
||||
/// </summary>
|
||||
/// <param name="sCommands"></param>
|
||||
private void WriteCommand(string[] sCommands)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(string cmd in sCommands)
|
||||
{
|
||||
m_cSerialPort.Write(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 명령어 전송 함수
|
||||
}
|
||||
}
|
333
Agent/KPS/OPOSPrint.cs
Normal file
|
@ -0,0 +1,333 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
class OPOSPrint
|
||||
{
|
||||
#region 위치
|
||||
public enum Position
|
||||
{
|
||||
Top,
|
||||
Buttom,
|
||||
TopAndButtom
|
||||
}
|
||||
public enum Alignment
|
||||
{
|
||||
Center,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Character size/Filter
|
||||
/// <summary>
|
||||
/// Character size horizontal [넓이 배율 1~8]
|
||||
/// </summary>
|
||||
public enum CharactersizeH
|
||||
{
|
||||
H_1,
|
||||
H_2,
|
||||
H_3,
|
||||
H_4,
|
||||
H_5,
|
||||
H_6,
|
||||
H_7,
|
||||
H_8
|
||||
}
|
||||
/// <summary>
|
||||
/// Character size vertical [높이 배율 1~8]
|
||||
/// </summary>
|
||||
public enum CharactersizeV
|
||||
{
|
||||
V_1,
|
||||
V_2,
|
||||
V_3,
|
||||
V_4,
|
||||
V_5,
|
||||
V_6,
|
||||
V_7,
|
||||
V_8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bold 체 여부
|
||||
/// </summary>
|
||||
public enum TextBold
|
||||
{
|
||||
Nomal,
|
||||
Bold
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 밑줄(UnderLine)
|
||||
/// </summary>
|
||||
public enum TextUnderLine
|
||||
{
|
||||
Nomal,
|
||||
UnderLine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 반전 Text 효과
|
||||
/// </summary>
|
||||
public enum TextReverseMode
|
||||
{
|
||||
Nomal,
|
||||
ReverseMode
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OposPrint
|
||||
/// <summary>
|
||||
/// Text Print
|
||||
/// 문자열을 출력 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="eVerticalSize">세로확대(1배~8배)</param>
|
||||
/// <param name="eHorizontalSize">가로확대(1배~8배)</param>
|
||||
/// <param name="bBold">굵은글씨(BOLD)</param>
|
||||
/// <param name="bUnderLine">밑줄(UnderLine)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, TextBold eBold, TextUnderLine eTextUnderLine, TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
bool bRet = false;
|
||||
string sCmdctrlTmp = "";
|
||||
|
||||
string ESC = String.Format("{0}", (char)27);
|
||||
string SP = String.Format("{0}", (char)20);
|
||||
//string ESC_CUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|P";
|
||||
//string ESC_FEEDCUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|fP";
|
||||
string ESC_CUT = ESC + "|50P";
|
||||
string ESC_FEEDCUT = ESC + "|100fP";
|
||||
|
||||
string ESC_BITMAP1 = ESC + "|1B";
|
||||
string ESC_BITMAP2 = ESC + "|2B";
|
||||
string ESC_TOPLOGO = ESC + "|tL";
|
||||
string ESC_BTMLOGO = ESC + "|bL";
|
||||
string ESC_LINEFEED = ESC + "|lF";
|
||||
string ESC_FEED = ESC + "|uF";
|
||||
//string ESC_BOLD = ESC + "|bC";
|
||||
//string ESC_NOT_BOLD = ESC + "|!bC";
|
||||
string ESC_UNDERLINE = ESC + "|uC";
|
||||
string ESC_COLOR = ESC + "|rC";
|
||||
//string ESC_REVERSE = ESC + "|rvC";
|
||||
//string ESC_NOT_REVERSE = ESC + "|!rvC";
|
||||
string ESC_1MAG = ESC + "|1C";
|
||||
string ESC_2MAG = ESC + "|4C";
|
||||
string ESC_HMAG = ESC + "|2C";
|
||||
string ESC_VMAG = ESC + "|3C";
|
||||
|
||||
string ESC_H1MAG = ESC + "|1hC";
|
||||
string ESC_V1MAG = ESC + "|1vC";
|
||||
string ESC_H2MAG = ESC + "|2hC";
|
||||
string ESC_V2MAG = ESC + "|2vC";
|
||||
string ESC_H3MAG = ESC + "|3hC";
|
||||
string ESC_V3MAG = ESC + "|3vC";
|
||||
string ESC_H4MAG = ESC + "|4hC";
|
||||
string ESC_V4MAG = ESC + "|4vC";
|
||||
string ESC_H5MAG = ESC + "|5hC";
|
||||
string ESC_V5MAG = ESC + "|5vC";
|
||||
string ESC_H6MAG = ESC + "|6hC";
|
||||
string ESC_V6MAG = ESC + "|6vC";
|
||||
string ESC_H7MAG = ESC + "|7hC";
|
||||
string ESC_V7MAG = ESC + "|7vC";
|
||||
string ESC_H8MAG = ESC + "|8hC";
|
||||
string ESC_V8MAG = ESC + "|8vC";
|
||||
string ESC_CENTER = ESC + "|cA";
|
||||
string ESC_RIGHT = ESC + "|rA";
|
||||
string ESC_NORMAL = ESC + "|N";
|
||||
|
||||
|
||||
sCmdctrlTmp = "";
|
||||
|
||||
//정렬
|
||||
switch (eAlignment)
|
||||
{
|
||||
case Alignment.Center: sCmdctrlTmp += ESC_CENTER; break;
|
||||
case Alignment.Right: sCmdctrlTmp += ESC_RIGHT; break;
|
||||
case Alignment.Left: sCmdctrlTmp += ESC_NORMAL; break;
|
||||
}
|
||||
|
||||
//확대 Command를 설정.
|
||||
//sCmdctrlTmp = GetCharactersizeCmd(eVerticalSize, eHorizontalSize);
|
||||
|
||||
switch (eVerticalSize)
|
||||
{
|
||||
case CharactersizeV.V_2: sCmdctrlTmp += ESC_V2MAG; break;
|
||||
case CharactersizeV.V_3: sCmdctrlTmp += ESC_V3MAG; break;
|
||||
case CharactersizeV.V_4: sCmdctrlTmp += ESC_V3MAG; break;
|
||||
case CharactersizeV.V_5: sCmdctrlTmp += ESC_V4MAG; break;
|
||||
case CharactersizeV.V_6: sCmdctrlTmp += ESC_V5MAG; break;
|
||||
case CharactersizeV.V_7: sCmdctrlTmp += ESC_V7MAG; break;
|
||||
case CharactersizeV.V_8: sCmdctrlTmp += ESC_V8MAG; break;
|
||||
default: sCmdctrlTmp += ESC_V1MAG; break;
|
||||
}
|
||||
switch (eHorizontalSize)
|
||||
{
|
||||
case CharactersizeH.H_2: sCmdctrlTmp += ESC_H2MAG; break;
|
||||
case CharactersizeH.H_3: sCmdctrlTmp += ESC_H3MAG; break;
|
||||
case CharactersizeH.H_4: sCmdctrlTmp += ESC_H3MAG; break;
|
||||
case CharactersizeH.H_5: sCmdctrlTmp += ESC_H4MAG; break;
|
||||
case CharactersizeH.H_6: sCmdctrlTmp += ESC_H5MAG; break;
|
||||
case CharactersizeH.H_7: sCmdctrlTmp += ESC_H7MAG; break;
|
||||
case CharactersizeH.H_8: sCmdctrlTmp += ESC_H8MAG; break;
|
||||
default: sCmdctrlTmp += ESC_H1MAG; break;
|
||||
}
|
||||
|
||||
//UnderLine
|
||||
if (eTextUnderLine == TextUnderLine.UnderLine)
|
||||
sCmdctrlTmp += ESC_UNDERLINE;
|
||||
|
||||
//Bold
|
||||
//if (TextBold.Bold == eBold)
|
||||
// sCmdctrlTmp += ESC_BOLD;
|
||||
//else
|
||||
// sCmdctrlTmp += ESC_NOT_BOLD;
|
||||
|
||||
//Reverse
|
||||
//if (TextReverseMode.ReverseMode == eTextReverseMode)
|
||||
// sCmdctrlTmp += ESC_REVERSE;
|
||||
//else
|
||||
// sCmdctrlTmp += ESC_NOT_REVERSE;
|
||||
|
||||
if (sValue != "")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (bLineFeed == true)
|
||||
{
|
||||
sValue = sCmdctrlTmp + sValue + "\r\n";
|
||||
}
|
||||
|
||||
//출력
|
||||
int nRet = pOPOSPrint.PrintNormal(OPOS.PTR_S_RECEIPT, sValue);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Text Print
|
||||
/// 문자열을 출력 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="eVerticalSize">세로확대(1배~8배)</param>
|
||||
/// <param name="eHorizontalSize">가로확대(1배~8배)</param>
|
||||
/// <param name="bBold">굵은글씨(BOLD)</param>
|
||||
/// <param name="bUnderLine">밑줄(UnderLine)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, TextBold eBold, TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, eAlignment, eVerticalSize, eHorizontalSize, eBold, eTextUnderLine, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, Alignment.Left, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="eVerticalSize">세로확대(1배~8배)</param>
|
||||
/// <param name="eHorizontalSize">가로확대(1배~8배)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, CharactersizeV eVerticalSize, CharactersizeH eHorizontalSize, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, eAlignment, eVerticalSize, eHorizontalSize, TextBold.Nomal, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// 진한문자열을 출력 할 수 있습니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="bBold">굵은글씨(BOLD)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextBold eBold, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, eBold, TextUnderLine.Nomal, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// 진한문자열을 출력 할 수 있습니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="bBold">굵은글씨(BOLD)</param>
|
||||
/// <param name="bLineFeed">LineFeed 여부</param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, eAlignment, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, eTextUnderLine, TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// 역상 출력을 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력 할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="eTextReverseMode">반전출력 모드 설정(Reverse Mode)</param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public static bool OposTextPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue, Alignment eAlignment, TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
return OposTextPrint(pOPOSPrint, sValue, Alignment.Left, CharactersizeV.V_1, CharactersizeH.H_1, TextBold.Nomal, TextUnderLine.Nomal, eTextReverseMode, bLineFeed);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 문자열을 출력 합니다.
|
||||
/// 역상 출력을 합니다.
|
||||
/// </summary>
|
||||
/// <param name="sValue">출력 할 문자</param>
|
||||
/// <param name="eAlignment">정렬(Left, Center, Right)</param>
|
||||
/// <param name="eTextReverseMode">반전출력 모드 설정(Reverse Mode)</param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public static bool OposBarPrint(AxOposPOSPrinter_CCO.AxOPOSPOSPrinter pOPOSPrint, string sValue)
|
||||
{
|
||||
int nStat = 0;
|
||||
|
||||
if (sValue.Length % 2 == 0)
|
||||
{
|
||||
nStat = pOPOSPrint.PrintBarCode(OPOS.PTR_S_RECEIPT, sValue, OPOS.PTR_BCS_ITF, 50, 368, OPOS.PTR_BC_CENTER, OPOS.PTR_BC_TEXT_BELOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
nStat = pOPOSPrint.PrintBarCode(OPOS.PTR_S_RECEIPT, "0" + sValue, OPOS.PTR_BCS_ITF, 50, 368, OPOS.PTR_BC_CENTER, OPOS.PTR_BC_TEXT_BELOW);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
878
Agent/KPS/PrinterCommand.cs
Normal file
|
@ -0,0 +1,878 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
[Serializable]
|
||||
public class PrinterCommand
|
||||
{
|
||||
#region 위치
|
||||
public enum Position
|
||||
{
|
||||
Top,
|
||||
Buttom,
|
||||
TopAndButtom,
|
||||
None
|
||||
}
|
||||
public enum Alignment
|
||||
{
|
||||
Center,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Character size/Filter
|
||||
/// <summary>
|
||||
/// Character size horizontal [넓이 배율 1~8]
|
||||
/// </summary>
|
||||
public enum CharactersizeH
|
||||
{
|
||||
H_1,
|
||||
H_2,
|
||||
H_3,
|
||||
H_4,
|
||||
H_5,
|
||||
H_6,
|
||||
H_7,
|
||||
H_8
|
||||
}
|
||||
/// <summary>
|
||||
/// Character size vertical [높이 배율 1~8]
|
||||
/// </summary>
|
||||
public enum CharactersizeV
|
||||
{
|
||||
V_1,
|
||||
V_2,
|
||||
V_3,
|
||||
V_4,
|
||||
V_5,
|
||||
V_6,
|
||||
V_7,
|
||||
V_8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bold 체 여부
|
||||
/// </summary>
|
||||
public enum TextBold
|
||||
{
|
||||
Nomal,
|
||||
Bold
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 밑줄(UnderLine)
|
||||
/// </summary>
|
||||
public enum TextUnderLine
|
||||
{
|
||||
Nomal,
|
||||
UnderLine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 반전 Text 효과
|
||||
/// </summary>
|
||||
public enum TextReverseMode
|
||||
{
|
||||
Nomal,
|
||||
ReverseMode
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Barcode Type
|
||||
/// <summary>
|
||||
/// Print Barcode
|
||||
/// 1Dh, 6BH, m, d1, ...dk, 00H [0 ≤ m ≤ 6, 32 ≤ k ≤ 126, 1 ≤ k ≤ 255]
|
||||
/// 1Dh, 6BH, m, n, d1, ...dn [65 ≤ m ≤ 73, 1 ≤ n ≤ 255, 0 ≤ d ≤ 127]
|
||||
/// </summary>
|
||||
public enum BarcodeType : int
|
||||
{
|
||||
UPC_A = 0, //m = 0, 65,
|
||||
UPC_E = 1, //m = 1, 66
|
||||
EAN13_KAN13 = 2, //m = 2, 67
|
||||
EAN8_KAN8 = 3, //m = 3, 68
|
||||
COE39 = 4, //m = 4, 69
|
||||
ITF = 5, //m = 5, 70
|
||||
CODEBAR = 6, //m = 6, 71
|
||||
CODE93 = 72, //m = 72
|
||||
CODE128 = 73 //m = 73
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Error Code
|
||||
public const int PRT_SUCCESS = 0;
|
||||
#endregion
|
||||
|
||||
#region "StatusUpdateEvent" Event: "Data" Parameter Constants
|
||||
public const int PTR_SUE_COVER_OPEN = 11;
|
||||
public const int PTR_SUE_COVER_OK = 12;
|
||||
public const int PTR_SUE_JRN_EMPTY = 21;
|
||||
public const int PTR_SUE_JRN_NEAREMPTY = 22;
|
||||
public const int PTR_SUE_JRN_PAPEROK = 23;
|
||||
public const int PTR_SUE_REC_EMPTY = 24;
|
||||
public const int PTR_SUE_REC_NEAREMPTY = 25;
|
||||
public const int PTR_SUE_REC_PAPEROK = 26;
|
||||
public const int PTR_SUE_SLP_EMPTY = 27;
|
||||
public const int PTR_SUE_SLP_NEAREMPTY = 28;
|
||||
public const int PTR_SUE_SLP_PAPEROK = 29;
|
||||
public const int PTR_SUE_JRN_CARTRIDGE_EMPTY = 41;
|
||||
public const int PTR_SUE_JRN_CARTRIDGE_NEAREMPTY = 42;
|
||||
public const int PTR_SUE_JRN_HEAD_CLEANING = 43;
|
||||
public const int PTR_SUE_JRN_CARTRIDGE_OK = 44;
|
||||
public const int PTR_SUE_REC_CARTRIDGE_EMPTY = 45;
|
||||
public const int PTR_SUE_REC_CARTRIDGE_NEAREMPTY = 46;
|
||||
public const int PTR_SUE_REC_HEAD_CLEANING = 47;
|
||||
public const int PTR_SUE_REC_CARTRIDGE_OK = 48;
|
||||
public const int PTR_Sue_Slp_CARTRIDGE_EMPTY = 49;
|
||||
public const int PTR_Sue_Slp_CARTRIDGE_NEAREMPTY = 50;
|
||||
public const int PTR_SUE_SLP_HEAD_CLEANING = 51;
|
||||
public const int PTR_SUE_SLP_CARTRIDGE_OK = 52;
|
||||
|
||||
public const int PTR_SUE_IDLE = 1001;
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
public byte ESC = 0x1B;
|
||||
public byte SP = 0x14;
|
||||
|
||||
public byte ESC_CR = 0x0D;
|
||||
public byte ESC_LF = 0x0A;
|
||||
public byte ESC_FF = 0xFF;
|
||||
|
||||
public byte[] ESC_INITPRINTER = { 0x1B, 0x40 }; //Printer 초기화
|
||||
|
||||
//1BH, 74H, n n=1(Katakana)
|
||||
//1BH, 52H, n n=0(USA), n=8(Japan), n=13(korea) 'Select an international characer set
|
||||
//1CH, 43H, n n=0,48 JIS code system , n=1,49 Shift JIS code system.
|
||||
public byte[] ESC_LANGE = { 0x1B, 0x74, 0x01,
|
||||
0x1B, 0x52, 0x08,
|
||||
0x1C, 0x43, 0x01,
|
||||
0x1C, 0x26 };
|
||||
|
||||
/// <summary>
|
||||
/// Buffer clear
|
||||
/// [10H, 14H, 08H, d1......d7]
|
||||
/// [d1=1, d2=3, d3=20, d4=1, d5=6, d6=2, d7=8]
|
||||
/// </summary>
|
||||
public byte[] ESC_BUFFERCLEAR = { 0x10, 0x14, 0x08, 0x01, 0x03, 0x14, 0x01, 0x06, 0x02, 0x08 };
|
||||
#endregion
|
||||
|
||||
#region Request Status (상태 전송)
|
||||
public byte[] ESC_REQ_SUATUS_PAPER_SENSOR = { 0x1D, 0x72, 0x01 }; //용지 센서 상태를 송신합니다
|
||||
public byte[] ESC_REQ_SUATUS_PAPER_SENSOR1 = { 0x1D, 0x72, 0x31 }; //용지 센서 상태를 송신합니다
|
||||
|
||||
public byte[] ESC_REQ_SUATUS_DRAW_CON = { 0x1D, 0x72, 0x02 }; //캐쉬 드로어 커넥터 상태를 송신 합니다.
|
||||
public byte[] ESC_REQ_SUATUS_DRAW_CON1 = { 0x1D, 0x72, 0x32 }; //캐쉬 드로어 커넥터 상태를 송신 합니다.
|
||||
|
||||
//public byte[] ESC_REQ_SUATUS_PAPER_SENSOR2 = { 0x1B, 0x63, 0x33 }; //용지 센서 상태를 송신합니다
|
||||
#endregion
|
||||
|
||||
#region BarCode Commad
|
||||
//Select printing position for HRI character
|
||||
/// <summary>
|
||||
/// HRI Print 안함
|
||||
/// </summary>
|
||||
public byte[] ESC_HRI_NOTPRINT = { 0x1D, 0x48, 0x00 };
|
||||
/// <summary>
|
||||
/// Barcode 상단에 HRI Print
|
||||
/// </summary>
|
||||
public byte[] ESC_HRI_TOPPRINT = { 0x1D, 0x48, 0x01 };
|
||||
/// <summary>
|
||||
/// Barcode 아래에 HRI Print
|
||||
/// </summary>
|
||||
public byte[] ESC_HRI_BELOWPRINT = { 0x1D, 0x48, 0x02 };
|
||||
/// <summary>
|
||||
/// Barcode 위,아래에 HRI Print
|
||||
/// </summary>
|
||||
public byte[] ESC_HRI_TOPANDBELOWPRINT = { 0x1D, 0x48, 0x03 };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Alignment
|
||||
public byte[] ESC_CENTER = { 0x1B, 0x61, 0x01 }; // CENTER 정렬
|
||||
public byte[] ESC_RIGHT = { 0x1B, 0x61, 0x02 }; // 오른쪽 정렬
|
||||
public byte[] ESC_LEFT = { 0x1B, 0x61, 0x00 }; // 왼쪽 정렬
|
||||
#endregion
|
||||
|
||||
#region Text
|
||||
|
||||
public byte[] ESC_NORMAL = { 0x1B, 0x21, 0x00, 0x1C, 0x21, 0x00 }; //보통문자
|
||||
|
||||
#region Select print mode
|
||||
// [Format] 1BH, 21H, n
|
||||
// [Valid limits] 0<=n<=255
|
||||
// [Initial value] n=0
|
||||
//┌──┬────────────┬────────────────────┐
|
||||
//│ │ │ Value │
|
||||
//│Bit │ Function ├─────────┬──────────┤
|
||||
//│ │ │ 0 │ 1 │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 0 │Character font │Font A is selected│Font B/C is selected│
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 1 │To be defined │ -- │ -- │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 2 │To be defined │ -- │ -- │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 3 │Emphasized printing │ Candel │ Specify │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 4 │Double character height │ Candel │ Specify │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 5 │Double character width │ Candel │ Specify │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 6 │To be defined │ -- │ -- │
|
||||
//├──┼────────────┼─────────┼──────────┤
|
||||
//│ 7 │Underline │ Candel │ Specify │
|
||||
//└──┴────────────┴─────────┴──────────┘
|
||||
|
||||
|
||||
public byte[] ESC_FontA = { 0x1B, 0x21, 0x00 }; // Font A 인쇄
|
||||
public byte[] ESC_FontBC = { 0x1B, 0x21, 0x01 }; // Font B/C 인쇄
|
||||
|
||||
public byte[] ESC_DOUBLE = { 0x1B, 0x21, 0x30, 0x1C, 0x57, 0x01 }; // 가로세로 2배 확대
|
||||
public byte[] ESC_DBLHEIGH = { 0x1B, 0x21, 0x10, 0x1C, 0x21, 0x08 }; // 세로 2배 확대
|
||||
public byte[] ESC_DBLWIDTH = { 0x1B, 0x21, 0x20, 0x1C, 0x21, 0x04 }; // 가로 2배 확대 ESC + "|2hC"
|
||||
|
||||
public byte[] ESC_UNDERLINE = { 0x1B, 0x21, 0x80 }; // UnderLine ESC + "|uC"
|
||||
public byte[] ESC_UNDERLINEON1DOT = { 0x1B, 0x2D, 0x01 }; // UnderLine Mode On 1Dot
|
||||
public byte[] ESC_UNDERLINEON2DOT = { 0x1B, 0x2D, 0x02 }; // UnderLine Mode On 2Dot
|
||||
public byte[] ESC_UNDERLINEOFF = { 0x1B, 0x2D, 0x00 }; // UnderLine Mode Off
|
||||
#endregion
|
||||
|
||||
#region Set Character size
|
||||
public byte[] ESC_VHMAG = { 0x1D, 0x21 }; // 배율확대확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H1MAG = { 0x1D, 0x21, 0x00 }; // 가로 1배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V1MAG = { 0x1D, 0x21, 0x00 }; // 세로 1배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H2Y2MAG = { 0x1D, 0x21, 0x11 }; // 가로/세로 2배 확대
|
||||
public byte[] ESC_H2MAG = { 0x1D, 0x21, 0x10 }; // 가로 2배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V2MAG = { 0x1D, 0x21, 0x01 }; // 세로 2배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H3MAG = { 0x1D, 0x21, 0x20 }; // 가로 3배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V3MAG = { 0x1D, 0x21, 0x02 }; // 세로 3배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H4MAG = { 0x1D, 0x21, 0x30 }; // 가로 4배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V4MAG = { 0x1D, 0x21, 0x03 }; // 세로 4배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H5MAG = { 0x1D, 0x21, 0x40 }; // 가로 5배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V5MAG = { 0x1D, 0x21, 0x04 }; // 세로 5배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H6MAG = { 0x1D, 0x21, 0x50 }; // 가로 6배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V6MAG = { 0x1D, 0x21, 0x05 }; // 세로 6배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H7MAG = { 0x1D, 0x21, 0x60 }; // 가로 7배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V7MAG = { 0x1D, 0x21, 0x06 }; // 세로 7배확대 인쇄(FontSize)
|
||||
|
||||
public byte[] ESC_H8MAG = { 0x1D, 0x21, 0x70 }; // 가로 8배확대 인쇄(FontSize)
|
||||
public byte[] ESC_V8MAG = { 0x1D, 0x21, 0x07 }; // 세로 8배확대 인쇄(FontSize)
|
||||
#endregion
|
||||
|
||||
#region Set Bold On/Off
|
||||
public byte[] ESC_BOLD_ON = { 0x1B, 0x45, 0x01 }; // 진하게 인쇄선언
|
||||
public byte[] ESC_BOLD_OFF = { 0x1B, 0x45, 0x00 }; // 진하게 인쇄선언해제
|
||||
public byte[] ESC_BOLD = { 0x1B, 0x21, 0x08 }; //'진하게 ESC + "|bC"
|
||||
#endregion
|
||||
|
||||
#region Set Reverse Mode On/Off
|
||||
/// <summary>
|
||||
/// On Reverse Mode
|
||||
/// </summary>
|
||||
public byte[] ESC_REVERSE_MODE_ON = { 0x1D, 0x42, 0x01 };//ESC + "|rvC"
|
||||
/// <summary>
|
||||
/// Off Revers Mode
|
||||
/// </summary>
|
||||
public byte[] ESC_REVERSE_MODE_OFF = { 0x1D, 0x42, 0x00 };//ESC + "|!rvC"
|
||||
#endregion
|
||||
|
||||
/*
|
||||
'ESC_CUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|P"
|
||||
ESC_CUT = ESC + "|50P"
|
||||
'ESC_FEEDCUT = Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + Chr(&HA) + ESC + "|fP"
|
||||
ESC_FEEDCUT = ESC + "|100fP"
|
||||
|
||||
|
||||
ESC_BITMAP1 = ESC + "|1B"
|
||||
ESC_BITMAP2 = ESC + "|2B"
|
||||
ESC_TOPLOGO = ESC + "|tL"
|
||||
ESC_BTMLOGO = ESC + "|bL"
|
||||
ESC_LINEFEED = ESC + "|lF"
|
||||
ESC_FEED = ESC + "|uF"
|
||||
|
||||
ESC_NOT_BOLD = ESC + "|!bC"
|
||||
ESC_COLOR = ESC + "|rC"
|
||||
|
||||
ESC_1MAG = ESC + "|1C"
|
||||
ESC_2MAG = ESC + "|4C"
|
||||
ESC_HMAG = ESC + "|2C"
|
||||
ESC_VMAG = ESC + "|3C"
|
||||
ESC_CENTER = ESC + "|cA"
|
||||
ESC_RIGHT = ESC + "|rA"
|
||||
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cut paper
|
||||
[Browsable(false), Category("Exception"),
|
||||
Description("Cutting Command"),
|
||||
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[AmbientValue("")]
|
||||
public byte[] ESC_CUT = { 0x1D, 0x56, 0x31 }; //Convert.ToByte(49) };
|
||||
public byte[] ESC_FULLCUT = { 0x1B, 0x69 };
|
||||
public byte[] ESC_PARTCUT = { 0x1B, 0x6D };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paper sensor to outpu paper out signals
|
||||
//용지부족/용지없음 Sensor
|
||||
public byte[] ESC_PAPERSENSOR_OFF = { 0x1B, 0x63, 0x33, 0x00 };
|
||||
public byte[] ESC_PAPERSENSOR_ON = { 0x1B, 0x63, 0x33, 0x0F };
|
||||
#endregion
|
||||
|
||||
#region Paper sensor to stop printing
|
||||
/// <summary>
|
||||
/// Paper near end detector Valid
|
||||
/// </summary>
|
||||
public byte[] ESC_PAPER_NEAREND_0N = { 0x1B, 0x63, 0x34, 0x01 };
|
||||
/// <summary>
|
||||
/// Paper near end detector InValid
|
||||
/// </summary>
|
||||
public byte[] ESC_PAPER_NEAREND_0FF = { 0x1B, 0x63, 0x34, 0x01 };
|
||||
#endregion
|
||||
|
||||
#region Real-time status transmission
|
||||
public byte[] ESC_TRANS_STATUS = { 0x10, 0x04, 0x01 };
|
||||
/// <summary>
|
||||
/// Cover 상태 체크 명령어
|
||||
/// </summary>
|
||||
public byte[] ESC_TRANS_OFFLINE = { 0x10, 0x04, 0x02 };
|
||||
public byte[] ESC_TRANS_ERR_STUS = { 0x10, 0x04, 0x03 };
|
||||
/// <summary>
|
||||
/// Paper 상태 체크 명령어
|
||||
/// </summary>
|
||||
public byte[] ESC_TRANS_CONTI_STATUS = { 0x10, 0x04, 0x04 };
|
||||
#endregion
|
||||
|
||||
#region Enable/disable automatic status back
|
||||
public byte[] ESC_STATUSBACK = { 0x1d, 0x61, 0xCF };
|
||||
#endregion
|
||||
|
||||
#region Select peripheral device
|
||||
public byte[] ESC_DEVICE_PRT = { 0x1B, 0x3D, 0x01 };
|
||||
#endregion
|
||||
|
||||
#region Open CashDrawer
|
||||
public byte[] cmd_OpenCashDraerBox = { 0x1B, 0x70, 0x30 };
|
||||
#endregion
|
||||
|
||||
#region Print Type
|
||||
public enum PRT_CMD
|
||||
{
|
||||
NONE, //미지원 형식
|
||||
PRT_IMG, //Image
|
||||
PRT_BAR, //바코드
|
||||
PRT_CUT, //CUT
|
||||
PRT_NOR, //일반 문자
|
||||
PRT_BLD, //진하게
|
||||
PRT_VER, //세로확대
|
||||
PRT_HOR, //가로확대
|
||||
PRT_BIG, //가로/세로확대
|
||||
PRT_CNT, //가로확대+가운데 정렬
|
||||
PRT_JNL, //저널데이터
|
||||
PRT_DRW, //돈통열림
|
||||
ERROR //Error
|
||||
}
|
||||
|
||||
public string PRT_IMG = "[IMG]"; //Image
|
||||
public string PRT_BAR = "[BAR]"; //바코드
|
||||
public string PRT_CUT = "[CUT]"; //CUT
|
||||
public string PRT_NOR = "[NOR]"; //일반 문자
|
||||
public string PRT_BLD = "[BLD]"; //진하게
|
||||
public string PRT_VER = "[VER]"; //세로확대
|
||||
public string PRT_HOR = "[HOR]"; //가로확대
|
||||
public string PRT_BIG = "[BIG]"; //가로/세로확대
|
||||
public string PRT_CNT = "[CNT]"; //가로확대+가운데 정렬
|
||||
public string PRT_JNL = "[JNL]"; //저널데이터
|
||||
public string PRT_DRW = "[DRW]"; //돈통열림
|
||||
#endregion
|
||||
|
||||
#region 상태체크
|
||||
/// <summary>
|
||||
/// 상태체크(Paper, Drawer 상태 )
|
||||
/// Drawer 상태는 상태체크가 가능한 돈통에 한함.
|
||||
/// </summary>
|
||||
public enum CHK_PRT_STATUS
|
||||
{
|
||||
CHK_PAPER,
|
||||
CHK_DRAWER
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Printer Status Information
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PrinterInformation
|
||||
{
|
||||
#region Printer Event
|
||||
private bool[,] Infomation = new bool[8 * 4, 2];
|
||||
private enum eStatusInfo : int
|
||||
{
|
||||
//Event First Byte
|
||||
/// <summary>
|
||||
/// State of the drawer kick connector pin 3 [false:Low, true: High]
|
||||
/// </summary>
|
||||
DrwKickLH = 7 - 2,
|
||||
/// <summary>
|
||||
/// Online.offline [false: Online, true: Offline]
|
||||
/// </summary>
|
||||
OnOffLine = 7 - 3,
|
||||
/// <summary>
|
||||
/// Cover state [false:Closed, true : Open]
|
||||
/// </summary>
|
||||
Coverstate = 7 - 5,
|
||||
/// <summary>
|
||||
/// Paper feed by paper feed switch [false:Stopped, true : Operation]
|
||||
/// </summary>
|
||||
feedswitch = 7 - 6,
|
||||
|
||||
//Event Second Byte(error information)
|
||||
/// <summary>
|
||||
/// Macro executing [false:Not execute, true : execute]
|
||||
/// </summary>
|
||||
MacroExecuting = 8 + 7 - 0,
|
||||
/// <summary>
|
||||
/// Panel switch[false:Off, true:On]
|
||||
/// </summary>
|
||||
Panelswitch = 8 + 7 - 1,
|
||||
/// <summary>
|
||||
/// Mechanical error(cover Open, Cutter Jam) [false:No, true: Yes]
|
||||
/// </summary>
|
||||
MechanicalErr = 8 * 7 - 2,
|
||||
/// <summary>
|
||||
/// Cutter jam [false:No, true: Yes]
|
||||
/// </summary>
|
||||
CutterJam = 8 * 7 - 3,
|
||||
/// <summary>
|
||||
/// Unrecoverable error[false:No, true:Yes]
|
||||
/// </summary>
|
||||
UnrecoverableErr = 8 + 7 - 5,
|
||||
/// <summary>
|
||||
/// Auto-recoverrable error detected [false:No, true:Yes]
|
||||
/// </summary>
|
||||
AutoRecoverableErr = 8 + 7 - 6,
|
||||
|
||||
//Third byte(paper detector information)
|
||||
/// <summary>
|
||||
/// Roll Paper Near end detecter[false:Paper present, true Nopaper]
|
||||
/// </summary>
|
||||
PaperNearEnd_1 = 16 + 7 - 0,
|
||||
/// <summary>
|
||||
/// Roll Paper Near end detecter[false:Paper present, true Nopaper]
|
||||
/// </summary>
|
||||
PaperNearEnd_2 = 16 + 7 - 0,
|
||||
/// <summary>
|
||||
/// Roll Paper end detecter[false:Paper present, true Nopaper]
|
||||
/// </summary>
|
||||
PaperEnd_1 = 16 + 7 - 2,
|
||||
/// <summary>
|
||||
/// Roll Paper end detecter[false:Paper present, true Nopaper]
|
||||
/// </summary>
|
||||
PaperEnd_2 = 16 + 7 - 3,
|
||||
|
||||
//Fourth byte (paper detector information)
|
||||
/// <summary>
|
||||
/// F/W down load Fail[false: Not Fail, true: Fail]
|
||||
/// </summary>
|
||||
FWdownLoadFail = 24 + 7 - 5
|
||||
}
|
||||
public enum eSetStatusType : int
|
||||
{
|
||||
/// <summary>
|
||||
/// PRINTER STATUS[First Byte]
|
||||
/// </summary>
|
||||
PRT_PRINTERINFOMATION,
|
||||
/// <summary>
|
||||
/// ERROR INFOMATION[Second Byte]
|
||||
/// </summary>
|
||||
PRT_ERRINFOMATION,
|
||||
/// <summary>
|
||||
/// Paper Status[Third Byte]
|
||||
/// </summary>
|
||||
PRT_PAPERINFOMATION,
|
||||
/// <summary>
|
||||
/// Firm Ware[Fourth Byte]
|
||||
/// </summary>
|
||||
PRT_FIRMWAREDOWN
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region All Set
|
||||
public void SetAllData(char[] szData)
|
||||
{
|
||||
char[] szEvt = szData;
|
||||
|
||||
//string bitStringFirst = str2bitstr(szData[0].ToString(), 1);
|
||||
//string bitStringSecond = str2bitstr(szData[1].ToString(), 1);
|
||||
//string bitStringThird = str2bitstr(szData[2].ToString(), 1);
|
||||
//string bitStringFourth = str2bitstr(szData[3].ToString(), 1);
|
||||
//string sBitInfo = bitStringFirst + bitStringSecond + bitStringThird + bitStringFourth;
|
||||
|
||||
string sBitInfo = "";
|
||||
sBitInfo = str2bitstr(szData[0].ToString(), 1);
|
||||
sBitInfo += str2bitstr(szData[1].ToString(), 1);
|
||||
sBitInfo += str2bitstr(szData[2].ToString(), 1);
|
||||
sBitInfo += str2bitstr(szData[3].ToString(), 1);
|
||||
|
||||
|
||||
string sValue = "";
|
||||
for (int nRow = 0; nRow < Infomation.GetLength(0); nRow++)
|
||||
{
|
||||
sValue = sBitInfo.Substring(nRow, 1);
|
||||
|
||||
Infomation[nRow, 1] = Infomation[nRow, 0] == (sValue == "1" ? true : false) ? false : true;
|
||||
Infomation[nRow, 0] = sValue == "1" ? true : false;
|
||||
}
|
||||
|
||||
//bool DrawerKick = Infomation[eStatusInfo.DrwKickLH];
|
||||
}
|
||||
public char[] GetAllData()
|
||||
{
|
||||
string sRet = "";
|
||||
string szTemp = "";
|
||||
|
||||
for (int nRow = 0; nRow < Infomation.Length; nRow++)
|
||||
{
|
||||
szTemp += Infomation[nRow, 1] == true ? "1" : "0";
|
||||
}
|
||||
return sRet.ToCharArray();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Printer Status First/Second/Third/Fourth Byte Set
|
||||
public void SetPrintStatus(eSetStatusType eType, char szData)
|
||||
{
|
||||
string sBitInfo = str2bitstr(szData.ToString(), 1);
|
||||
|
||||
int nStart = 0;
|
||||
switch (eType)
|
||||
{
|
||||
case eSetStatusType.PRT_PRINTERINFOMATION: nStart = 0; break;
|
||||
case eSetStatusType.PRT_ERRINFOMATION: nStart = 8; break;
|
||||
case eSetStatusType.PRT_PAPERINFOMATION: nStart = 16; break;
|
||||
case eSetStatusType.PRT_FIRMWAREDOWN: nStart = 24; break;
|
||||
default: return;
|
||||
}
|
||||
string sValue = "";
|
||||
for (int nRow = 0; nRow < 8; nRow++)
|
||||
{
|
||||
sValue = sBitInfo.Substring(nRow, 1);
|
||||
|
||||
Infomation[nStart + nRow, 1] = Infomation[nStart + nRow, 0] == (sValue == "1" ? true : false) ? false : true;
|
||||
Infomation[nStart + nRow, 0] = sValue == "1" ? true : false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region First Byte(Printer Infomation)
|
||||
/// <summary>
|
||||
/// [Printer Status Infomation]
|
||||
/// State of the drawer kick connector pin3
|
||||
/// FALSE: Low, TRUE : High
|
||||
/// </summary>
|
||||
public bool IsDrawerKickLoHi { get { return Infomation[(int)eStatusInfo.DrwKickLH, 0]; } set { Infomation[(int)eStatusInfo.DrwKickLH, 0] = value; } }
|
||||
public bool IsDrawerKickLoHiChange { get { bool bRet = Infomation[(int)eStatusInfo.DrwKickLH, 1]; Infomation[(int)eStatusInfo.DrwKickLH, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.DrwKickLH, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Printer Status Infomation]
|
||||
/// OnLine / OffLine
|
||||
/// FALSE : OnLine, TRUE ; OffLine
|
||||
/// </summary>
|
||||
public bool IsOffLine { get { return Infomation[(int)eStatusInfo.OnOffLine, 0]; } set { Infomation[(int)eStatusInfo.OnOffLine, 0] = value; } }
|
||||
public bool IsOffLineChange { get { bool bRet = Infomation[(int)eStatusInfo.OnOffLine, 1]; Infomation[(int)eStatusInfo.OnOffLine, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.OnOffLine, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Printer Status Infomation]
|
||||
/// Cover Open
|
||||
/// FALSE : Closed, TRUE : Open
|
||||
/// </summary>
|
||||
public bool IsCoverOpen { get { return Infomation[(int)eStatusInfo.Coverstate, 0]; } set { Infomation[(int)eStatusInfo.Coverstate, 0] = value; } }
|
||||
public bool IsCoverOpenChange { get { bool bRet = Infomation[(int)eStatusInfo.Coverstate, 1]; Infomation[(int)eStatusInfo.Coverstate, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.Coverstate, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Printer Status Infomation]
|
||||
/// Feed Switch
|
||||
/// FALSE : stop, TRUE : operating
|
||||
/// </summary>
|
||||
public bool Isfeedswitch { get { return Infomation[(int)eStatusInfo.feedswitch, 0]; } set { Infomation[(int)eStatusInfo.feedswitch, 0] = value; } }
|
||||
public bool IsfeedswitchChange { get { bool bRet = Infomation[(int)eStatusInfo.feedswitch, 1]; Infomation[(int)eStatusInfo.feedswitch, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.feedswitch, 1] = value; } }
|
||||
#endregion
|
||||
|
||||
#region Second Byte(error information)
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// IsMacroExecuting
|
||||
/// FALSE : Not Excuting, TRUE : Excuting
|
||||
/// </summary>
|
||||
public bool IsMacroExecuting { get { return Infomation[(int)eStatusInfo.MacroExecuting, 0]; } set { Infomation[(int)eStatusInfo.MacroExecuting, 0] = value; } }
|
||||
public bool IsMacroExecutingChange { get { bool bRet = Infomation[(int)eStatusInfo.MacroExecuting, 1]; Infomation[(int)eStatusInfo.MacroExecuting, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.MacroExecuting, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// Panel switch
|
||||
/// FALSE : OFF, TRUE : ON
|
||||
/// </summary>
|
||||
public bool IsPanelswitch { get { return Infomation[(int)eStatusInfo.Panelswitch, 0]; } set { Infomation[(int)eStatusInfo.Panelswitch, 0] = value; } }
|
||||
public bool IsPanelswitchChange { get { bool bRet = Infomation[(int)eStatusInfo.Panelswitch, 1]; Infomation[(int)eStatusInfo.Panelswitch, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.Panelswitch, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// Mechanical Error
|
||||
/// (Cover oen, Cutter jam)
|
||||
/// FALSE : No, TRUE : Yes
|
||||
/// </summary>
|
||||
public bool IsMechanicalError { get { return Infomation[(int)eStatusInfo.MechanicalErr, 0]; } set { Infomation[(int)eStatusInfo.MechanicalErr, 0] = value; } }
|
||||
public bool IsMechanicalErrorChange { get { bool bRet = Infomation[(int)eStatusInfo.MechanicalErr, 1]; Infomation[(int)eStatusInfo.MechanicalErr, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.MechanicalErr, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// Cutter jam
|
||||
/// FALSE : No, TRUE : Yes
|
||||
/// </summary>
|
||||
public bool IsCutterJam { get { return Infomation[(int)eStatusInfo.CutterJam, 0]; } set { Infomation[(int)eStatusInfo.CutterJam, 0] = value; } }
|
||||
public bool IsCutterJamChange { get { bool bRet = Infomation[(int)eStatusInfo.CutterJam, 1]; Infomation[(int)eStatusInfo.CutterJam, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.CutterJam, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// Unrecoverable Error
|
||||
/// FALSE : No, TRUE : Yes
|
||||
/// </summary>
|
||||
public bool IsUnrecoverableErr { get { return Infomation[(int)eStatusInfo.UnrecoverableErr, 0]; } set { Infomation[(int)eStatusInfo.UnrecoverableErr, 0] = value; } }
|
||||
public bool IsUnrecoverableErrChange { get { bool bRet = Infomation[(int)eStatusInfo.UnrecoverableErr, 1]; Infomation[(int)eStatusInfo.UnrecoverableErr, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.UnrecoverableErr, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [Error Information]
|
||||
/// Auto-Recoverable Error detected
|
||||
/// FALSE : No, TRUE : Yes
|
||||
/// </summary>
|
||||
public bool IsAutoRecoverableErr { get { return Infomation[(int)eStatusInfo.AutoRecoverableErr, 0]; } set { Infomation[(int)eStatusInfo.AutoRecoverableErr, 0] = value; } }
|
||||
public bool IsAutoRecoverableErrChange { get { bool bRet = Infomation[(int)eStatusInfo.AutoRecoverableErr, 1]; Infomation[(int)eStatusInfo.AutoRecoverableErr, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.AutoRecoverableErr, 1] = value; } }
|
||||
#endregion
|
||||
|
||||
#region Third byte(paper detector information)
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper near end detector
|
||||
/// FALSE : Paper present , TRUE : No paper
|
||||
/// </summary>
|
||||
private bool IsPaperNearEnd_1 { get { return Infomation[(int)eStatusInfo.PaperNearEnd_1, 0]; } set { Infomation[(int)eStatusInfo.PaperNearEnd_1, 0] = value; } }
|
||||
private bool IsPaperNearEnd_1Change { get { bool bRet = Infomation[(int)eStatusInfo.PaperNearEnd_1, 1]; Infomation[(int)eStatusInfo.PaperNearEnd_1, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.PaperNearEnd_1, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper near end detector
|
||||
/// FALSE : Paper present , TRUE : No paper
|
||||
/// </summary>
|
||||
private bool IsPaperNearEnd_2 { get { return Infomation[(int)eStatusInfo.PaperNearEnd_2, 0]; } set { Infomation[(int)eStatusInfo.PaperNearEnd_2, 0] = value; } }
|
||||
private bool IsPaperNearEnd_2Change { get { bool bRet = Infomation[(int)eStatusInfo.PaperNearEnd_2, 1]; Infomation[(int)eStatusInfo.PaperNearEnd_2, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.PaperNearEnd_2, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper near end detector
|
||||
/// FALSE : Paper present , TRUE : No paper
|
||||
/// </summary>
|
||||
public bool IsPaperNearEnd { get { if (IsPaperNearEnd_1 && IsPaperNearEnd_2)return true; else return false; } set { IsPaperNearEnd_1 = value; IsPaperNearEnd_2 = value; } }
|
||||
public bool IsPaperNearEndChange { get { if (IsPaperNearEnd_1Change && IsPaperNearEnd_2Change)return true; else return false; } set { IsPaperNearEnd_1Change = value; IsPaperNearEnd_2Change = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper end detector
|
||||
/// FALSE : Paper present , TRUE : No paper
|
||||
/// </summary>
|
||||
private bool IsPaperEnd_1 { get { return Infomation[(int)eStatusInfo.PaperEnd_1, 0]; } set { Infomation[(int)eStatusInfo.PaperEnd_1, 0] = value; } }
|
||||
private bool IsPaperEnd_1Change { get { bool bRet = Infomation[(int)eStatusInfo.PaperEnd_1, 1]; Infomation[(int)eStatusInfo.PaperEnd_1, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.PaperEnd_1, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper end detector
|
||||
/// FALSE : Paper present, TRUE : No paper
|
||||
/// </summary>
|
||||
private bool IsPaperEnd_2 { get { return Infomation[(int)eStatusInfo.PaperEnd_2, 0]; } set { Infomation[(int)eStatusInfo.PaperEnd_2, 0] = value; } }
|
||||
private bool IsPaperEnd_2Change { get { bool bRet = Infomation[(int)eStatusInfo.PaperEnd_2, 1]; Infomation[(int)eStatusInfo.PaperEnd_2, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.PaperEnd_2, 1] = value; } }
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// Roll paper end detector
|
||||
/// FALSE : Paper present, TRUE : No paper
|
||||
/// </summary>
|
||||
public bool IsPaperEnd { get { if (IsPaperEnd_1 && IsPaperEnd_2) return true; else return false; } set { IsPaperEnd_1 = value; IsPaperEnd_2 = value; } }
|
||||
public bool IsPaperEndChange { get { if (IsPaperEnd_1Change && IsPaperEnd_2Change) return true; else return false; } set { IsPaperEnd_1Change = value; IsPaperEnd_2Change = value; } }
|
||||
#endregion
|
||||
|
||||
#region Fourth byte (paper detector information)
|
||||
/// <summary>
|
||||
/// [paper detector information]
|
||||
/// paper detector information
|
||||
/// FW down load Fail
|
||||
/// FALSE : Not Fail, TRUE : Fail
|
||||
/// </summary>
|
||||
public bool IsFWdownLoadFail { get { return Infomation[(int)eStatusInfo.FWdownLoadFail, 0]; } set { Infomation[(int)eStatusInfo.FWdownLoadFail, 0] = value; } }
|
||||
public bool IsFWdownLoadFailChange { get { bool bRet = Infomation[(int)eStatusInfo.FWdownLoadFail, 1]; Infomation[(int)eStatusInfo.FWdownLoadFail, 1] = false; return bRet; } set { Infomation[(int)eStatusInfo.FWdownLoadFail, 1] = value; } }
|
||||
#endregion
|
||||
|
||||
#region 형변환
|
||||
private long chararry2Hexstr(char[] src, int st, out string dest)
|
||||
{
|
||||
long nRet = 0;
|
||||
char[] temp = null;
|
||||
|
||||
dest = "";
|
||||
|
||||
if (src.Length < 1)
|
||||
return 0;
|
||||
|
||||
temp = new char[src.Length - st];
|
||||
for (int i = 0; i < src.Length - st; i++)
|
||||
{
|
||||
temp[i] = src[i + st];
|
||||
string tt = src[i + st].ToString();
|
||||
dest += String.Format("{0:X}", tt);
|
||||
}
|
||||
//temp.CopyTo(src, st);
|
||||
|
||||
//bit
|
||||
//string sbit = int.Parse("0100", System.Globalization.NumberStyles.AllowHexSpecifier) & (2 ^ 0);
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
// String To Hex
|
||||
private int string2Hex(string src)
|
||||
{
|
||||
return int.Parse(src, System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
public string string2Hexstr(string src)
|
||||
{
|
||||
string sRet = "";
|
||||
char[] values = src.ToCharArray();
|
||||
foreach (char letter in values)
|
||||
{
|
||||
uint value = Convert.ToUInt32(letter);
|
||||
string hexstr = string.Format("{0:X2}", value);
|
||||
sRet += hexstr;
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
// Hex To String
|
||||
private string Hex2string(int number)
|
||||
{
|
||||
return Convert.ToString(number, 16).ToUpper().PadLeft(2, '0');
|
||||
}
|
||||
// Byte[] To UInt32
|
||||
private UInt32 Byte2UInt32SmallEndian(byte[] src, int i)
|
||||
{
|
||||
return Convert.ToUInt32(src[i] + (src[i + 1] << 8) + (src[i + 2] << 16) + (src[i + 3] << 24));
|
||||
}
|
||||
// Byte[] To UInt32
|
||||
private UInt32 Byte2UInt32BigEndian(byte[] src, int i)
|
||||
{
|
||||
return Convert.ToUInt32(src[i + 3] + (src[i + 2] << 8) + (src[i + 1] << 16) + (src[i] << 24));
|
||||
}
|
||||
|
||||
//UInt32 To Byte[] Small-Endian
|
||||
private void Uint322Byte(byte[] dstByte, UInt32 srcuint, int start)
|
||||
{
|
||||
dstByte[3 + start] = (byte)((srcuint & 0xff000000) >> 24);
|
||||
dstByte[2 + start] = (byte)((srcuint & 0x00ff0000) >> 16);
|
||||
dstByte[1 + start] = (byte)((srcuint & 0x0000ff00) >> 8);
|
||||
dstByte[0 + start] = (byte)((srcuint & 0x000000ff));
|
||||
}
|
||||
//UInt32 To Byte[] Big-Endian
|
||||
private void UInt32ToByteBif(byte[] dstByte, UInt32 srcuint, int start)
|
||||
{
|
||||
dstByte[0 + start] = (byte)((srcuint & 0xff000000) >> 24);
|
||||
dstByte[1 + start] = (byte)((srcuint & 0x00ff0000) >> 16);
|
||||
dstByte[2 + start] = (byte)((srcuint & 0x0000ff00) >> 8);
|
||||
dstByte[3 + start] = (byte)((srcuint & 0x000000ff));
|
||||
}
|
||||
|
||||
//byte[] To string
|
||||
public String Byte2string(byte[] src)
|
||||
{
|
||||
//string sRet = Encoding.Default.GetString(src);
|
||||
return Encoding.Default.GetString(src);// UnicodeEncoding.ASCII.GetString(src);
|
||||
}
|
||||
public String Byte2string(byte[] src, int index, int size)
|
||||
{
|
||||
string sRet = "";
|
||||
char sz;
|
||||
for (int i = index; i < src.Length; i++)
|
||||
{
|
||||
sz = Convert.ToChar(src[i]);
|
||||
sRet += sz.ToString();
|
||||
}
|
||||
return sRet;// UnicodeEncoding.ASCII.GetString(src, index, size);
|
||||
}
|
||||
|
||||
//string To Byte[]
|
||||
public Byte[] string2byte(String src)
|
||||
{
|
||||
return Encoding.Default.GetBytes(src); //UnicodeEncoding.ASCII.GetBytes(src);
|
||||
}
|
||||
//string To Byte[]
|
||||
public int string2byte(String src, int sindex, int slength, byte[] dst, int bindex)
|
||||
{
|
||||
return UnicodeEncoding.ASCII.GetBytes(src, sindex, slength, dst, bindex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 문자열을 byte[]으로 변환
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] ConvertToByteArrayFromString(string str)
|
||||
{
|
||||
byte[] temp = Encoding.Default.GetBytes(str);
|
||||
|
||||
if (temp.Length % 16 != 0)
|
||||
{
|
||||
byte[] temp2 = new byte[((temp.Length / 16) + 1) * 16];
|
||||
Buffer.BlockCopy(temp, 0, temp2, 0, temp.Length);
|
||||
return temp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] hex2Byte(string hex)
|
||||
{
|
||||
byte[] bytes = new byte[hex.Length / 2];
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
bytes[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new ArgumentException("hex is not a valid hex number!", "hex");
|
||||
}
|
||||
} return bytes;
|
||||
}
|
||||
|
||||
public string str2bitstr(string sValue, int nByteLen)
|
||||
{
|
||||
//char bit;
|
||||
|
||||
string sRet = "";
|
||||
|
||||
string hexstr = string2Hexstr(sValue);
|
||||
long value = string2Hex(hexstr);
|
||||
sRet += Convert.ToString(value, 2).PadLeft(8, '0');
|
||||
|
||||
int d = Math.Abs((sRet.Length % 8) - 8);
|
||||
if (d != 8 && d != 0)
|
||||
sRet = sRet.PadLeft(d + sRet.Length, '0');
|
||||
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
36
Agent/KPS/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("KPS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("KPS")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("aff75872-6f40-425a-8ddc-1126ea9b3a9c")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
587
Agent/KPS/SerialPrint.cs
Normal file
|
@ -0,0 +1,587 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.BaseFrame;
|
||||
|
||||
namespace Cosmos.KPS
|
||||
{
|
||||
class SerialPrint
|
||||
{
|
||||
PrinterCommand prtCmd = new PrinterCommand();
|
||||
|
||||
private SerialPort ComPort;
|
||||
public bool IsPortOpened
|
||||
{
|
||||
get { if (ComPort == null) { return false; } else { return ComPort.IsOpen; } }
|
||||
}
|
||||
|
||||
#region Printer OPEN / CLOSE
|
||||
public int DeviceOpen(string sPortNum, int iBaudRate)
|
||||
{
|
||||
int iRet = UserCom.NG;
|
||||
try
|
||||
{
|
||||
if(ComPort == null)
|
||||
{
|
||||
ComPort = new SerialPort();
|
||||
|
||||
ComPort.DataReceived += new SerialDataReceivedEventHandler(ComPort_DataReceived);
|
||||
ComPort.PinChanged += new SerialPinChangedEventHandler(ComPort_PinChanged);
|
||||
ComPort.ErrorReceived += new SerialErrorReceivedEventHandler(ComPort_ErrorReceived);
|
||||
|
||||
ComPort.NewLine = "\r\n";
|
||||
ComPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
}
|
||||
|
||||
if (!IsPortOpened) DeviceClose();
|
||||
|
||||
ComPort.WriteBufferSize = 1024 * 1024;
|
||||
ComPort.PortName = sPortNum;
|
||||
ComPort.BaudRate = iBaudRate;
|
||||
ComPort.DataBits = 8;
|
||||
ComPort.StopBits = StopBits.One;
|
||||
ComPort.Parity = Parity.None;
|
||||
ComPort.Handshake = Handshake.RequestToSend;
|
||||
|
||||
ComPort.ReadTimeout = 500;
|
||||
ComPort.WriteTimeout = 2000;
|
||||
|
||||
ComPort.RtsEnable = true;
|
||||
ComPort.DtrEnable = true;
|
||||
|
||||
if(!ComPort.IsOpen)
|
||||
{
|
||||
ComPort.Open();
|
||||
}
|
||||
|
||||
iRet = ComPort.IsOpen == true ? UserCom.OK : UserCom.NG;
|
||||
|
||||
return iRet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
return -99;
|
||||
}
|
||||
}
|
||||
|
||||
public int DeviceClose()
|
||||
{
|
||||
int iRet = UserCom.NG;
|
||||
try
|
||||
{
|
||||
if(!IsPortOpened)
|
||||
{
|
||||
return UserCom.OK;
|
||||
}
|
||||
|
||||
ComPort.Close();
|
||||
if(IsPortOpened)
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
ComPort.Close();
|
||||
}
|
||||
|
||||
iRet = IsPortOpened == false ? UserCom.OK : UserCom.NG;
|
||||
|
||||
return iRet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_DEBUG,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
return -99;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Serial Port Event
|
||||
void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ComPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
void ComPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Status Check
|
||||
public int PrinterStatusCheckBySerial(string sType)
|
||||
{
|
||||
int iRet = UserCom.NG;
|
||||
string sResp = "";
|
||||
|
||||
try
|
||||
{
|
||||
#region Printer CHK1
|
||||
if(sType == "CHK1")
|
||||
{
|
||||
// 프린터 초기화
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.INITIALIZE_PRINTER);
|
||||
System.Threading.Thread.Sleep(50);
|
||||
|
||||
// Cover Check
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.TRANSMIT_OFFLINE_STATUS);
|
||||
System.Threading.Thread.Sleep(50);
|
||||
sResp = ComPort.ReadExisting();
|
||||
if(sResp.Length > 0)
|
||||
{
|
||||
byte[] respByte = Encoding.Default.GetBytes(sResp);
|
||||
if(respByte[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
||||
{
|
||||
iRet = UserCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"COVER Opened");
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Printer CHK2
|
||||
if(sType == "CHK2")
|
||||
{
|
||||
// 프린터 초기화
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.INITIALIZE_PRINTER);
|
||||
System.Threading.Thread.Sleep(50);
|
||||
|
||||
// Paper Check
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.TRANSMIT_CONTINUOUS_PAPER_DETECTOR_STATUS);
|
||||
System.Threading.Thread.Sleep(50);
|
||||
sResp = ComPort.ReadExisting();
|
||||
if(sResp.Length > 0)
|
||||
{
|
||||
byte[] respByte = Encoding.Default.GetBytes(sResp);
|
||||
if(respByte[0] == PosConst.ESCP_COMMAND.STATUS_OK[0])
|
||||
{
|
||||
iRet = UserCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = UserCom.NG;
|
||||
|
||||
String sRecvData = Encoding.Default.GetString(respByte);
|
||||
|
||||
string NEAR_END = Encoding.Default.GetString(new byte[] { 0x1E });
|
||||
string NOT_PRESENT = Encoding.Default.GetString(new byte[] { 0x72 });
|
||||
|
||||
string sErrMsg = "";
|
||||
if (sRecvData == NEAR_END) sErrMsg = "PAPER_NEAR_END";
|
||||
else if (sRecvData == NOT_PRESENT) sErrMsg = "PAPER_NOT_PRESENT";
|
||||
else sErrMsg = "ERC_ERROR";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
sErrMsg);
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"StatusCheck 실패");
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 공통 모듈
|
||||
private void TransmitCommand(byte[] aCmd)
|
||||
{
|
||||
if(IsPortOpened)
|
||||
{
|
||||
ComPort.Write(aCmd, 0, aCmd.Length);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Cut Paper
|
||||
public bool CutPaper(int LineFeedCnt)
|
||||
{
|
||||
long nRet = -1;
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < LineFeedCnt; i++)
|
||||
{
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.LINE_FEED);
|
||||
}
|
||||
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.PAPER_CUT);
|
||||
System.Threading.Thread.Sleep(10);
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.LINE_FEED);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Cut Paper Exception");
|
||||
}
|
||||
return nRet == BaseCom.OK ? true : false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 문자열 출력
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, PrinterCommand.TextBold eBold, PrinterCommand.TextUnderLine eTextUnderLine, PrinterCommand.TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
bool bRet = false;
|
||||
string sCmdctrlTmp = "";
|
||||
|
||||
try
|
||||
{
|
||||
// 확대 Command를 설정
|
||||
sCmdctrlTmp = GetCharactersizeCmd(eVerticalSize, eHorizontalSize);
|
||||
|
||||
// UnerLine
|
||||
sCmdctrlTmp += GetUnderLineCmd(eTextUnderLine);
|
||||
|
||||
// Bold
|
||||
sCmdctrlTmp += GetBoldCmd(eBold);
|
||||
|
||||
// 정렬
|
||||
sCmdctrlTmp += GetAlignment(eAlignment);
|
||||
|
||||
// Reverse
|
||||
sCmdctrlTmp += GetReverseCmd(eTextReverseMode);
|
||||
|
||||
// 출력
|
||||
byte[] byteCmdctrl = Encoding.Default.GetBytes(sCmdctrlTmp);
|
||||
TransmitCommand(byteCmdctrl); // Command 전송
|
||||
|
||||
byte[] byteData = Encoding.Default.GetBytes(sValue);
|
||||
TransmitCommand(byteData); // 출력 Data 전송
|
||||
|
||||
if(bLineFeed == true)
|
||||
{
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.LINE_FEED);
|
||||
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, PrinterCommand.TextBold eBold, PrinterCommand.TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, eVerticalSize, eHorizontalSize, eBold, eTextUnderLine, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eVerticalSize"></param>
|
||||
/// <param name="eHorizontalSize"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, eVerticalSize, eHorizontalSize, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eBold"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextBold eBold, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, eBold, PrinterCommand.TextUnderLine.Nomal, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eTextUnderLine"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextUnderLine eTextUnderLine, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, eAlignment, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, eTextUnderLine, PrinterCommand.TextReverseMode.Nomal, bLineFeed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Print Text
|
||||
/// </summary>
|
||||
/// <param name="sValue"></param>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <param name="bLineFeed"></param>
|
||||
/// <returns></returns>
|
||||
public bool TextPrint(string sValue, PrinterCommand.Alignment eAlignment, PrinterCommand.TextReverseMode eTextReverseMode, bool bLineFeed)
|
||||
{
|
||||
return TextPrint(sValue, PrinterCommand.Alignment.Left, PrinterCommand.CharactersizeV.V_1, PrinterCommand.CharactersizeH.H_1, PrinterCommand.TextBold.Nomal, PrinterCommand.TextUnderLine.Nomal, eTextReverseMode, bLineFeed);
|
||||
}
|
||||
|
||||
private string GetCharactersizeCmd(PrinterCommand.CharactersizeV eVerticalSize, PrinterCommand.CharactersizeH eHorizontalSize)
|
||||
{
|
||||
string sRet = "";
|
||||
|
||||
try
|
||||
{
|
||||
int Hvalue = 0;
|
||||
int Vvalue = 0;
|
||||
|
||||
switch (eVerticalSize)
|
||||
{
|
||||
case PrinterCommand.CharactersizeV.V_1: Vvalue = 0; break;
|
||||
case PrinterCommand.CharactersizeV.V_2: Vvalue = 1; break;
|
||||
case PrinterCommand.CharactersizeV.V_3: Vvalue = 2; break;
|
||||
case PrinterCommand.CharactersizeV.V_4: Vvalue = 3; break;
|
||||
case PrinterCommand.CharactersizeV.V_5: Vvalue = 4; break;
|
||||
case PrinterCommand.CharactersizeV.V_6: Vvalue = 5; break;
|
||||
case PrinterCommand.CharactersizeV.V_7: Vvalue = 6; break;
|
||||
case PrinterCommand.CharactersizeV.V_8: Vvalue = 7; break;
|
||||
default: Vvalue = 0; break;
|
||||
}
|
||||
|
||||
switch (eHorizontalSize)
|
||||
{
|
||||
case PrinterCommand.CharactersizeH.H_1: Hvalue = 16 * 0; break;
|
||||
case PrinterCommand.CharactersizeH.H_2: Hvalue = 16 * 1; break;
|
||||
case PrinterCommand.CharactersizeH.H_3: Hvalue = 16 * 2; break;
|
||||
case PrinterCommand.CharactersizeH.H_4: Hvalue = 16 * 3; break;
|
||||
case PrinterCommand.CharactersizeH.H_5: Hvalue = 16 * 4; break;
|
||||
case PrinterCommand.CharactersizeH.H_6: Hvalue = 16 * 5; break;
|
||||
case PrinterCommand.CharactersizeH.H_7: Hvalue = 16 * 6; break;
|
||||
case PrinterCommand.CharactersizeH.H_8: Hvalue = 16 * 7; break;
|
||||
default: Hvalue = 16 * 0; break;
|
||||
}
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_VHMAG) + Convert.ToChar(Vvalue + Hvalue).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 진한 문자(Bold)
|
||||
/// </summary>
|
||||
/// <param name="eBold"></param>
|
||||
/// <returns></returns>
|
||||
private string GetBoldCmd(PrinterCommand.TextBold eBold)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch (eBold)
|
||||
{
|
||||
case PrinterCommand.TextBold.Nomal: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_OFF); break;
|
||||
case PrinterCommand.TextBold.Bold: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_ON); break;
|
||||
default: sRet = Encoding.Default.GetString(prtCmd.ESC_BOLD_OFF); break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// UnderLine
|
||||
/// </summary>
|
||||
/// <param name="eUnderLine"></param>
|
||||
/// <param name="nDot"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUnderLineCmd(PrinterCommand.TextUnderLine eUnderLine, int nDot)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
if (eUnderLine == PrinterCommand.TextUnderLine.UnderLine)
|
||||
{
|
||||
if (nDot == 2)
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEON1DOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEON2DOT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_UNDERLINEOFF);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// UnderLine Text
|
||||
/// </summary>
|
||||
/// <param name="eUnderLine"></param>
|
||||
/// <returns></returns>
|
||||
private string GetUnderLineCmd(PrinterCommand.TextUnderLine eUnderLine)
|
||||
{
|
||||
return GetUnderLineCmd(eUnderLine, 1);
|
||||
}
|
||||
/// <summary>
|
||||
/// 반전 텍스트
|
||||
/// </summary>
|
||||
/// <param name="eTextReverseMode"></param>
|
||||
/// <returns></returns>
|
||||
private string GetReverseCmd(PrinterCommand.TextReverseMode eTextReverseMode)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch (eTextReverseMode)
|
||||
{
|
||||
case PrinterCommand.TextReverseMode.ReverseMode: sRet = Encoding.Default.GetString(prtCmd.ESC_REVERSE_MODE_ON); break;
|
||||
default: sRet = Encoding.Default.GetString(prtCmd.ESC_REVERSE_MODE_OFF); break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 정렬 Command를 가져온다.
|
||||
/// </summary>
|
||||
/// <param name="eAlignment"></param>
|
||||
/// <returns></returns>
|
||||
private string GetAlignment(PrinterCommand.Alignment eAlignment)
|
||||
{
|
||||
string sRet = "";
|
||||
try
|
||||
{
|
||||
switch (eAlignment)
|
||||
{
|
||||
case PrinterCommand.Alignment.Center:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_CENTER);
|
||||
break;
|
||||
case PrinterCommand.Alignment.Right:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_RIGHT);
|
||||
break;
|
||||
case PrinterCommand.Alignment.Left:
|
||||
default:
|
||||
sRet = Encoding.Default.GetString(prtCmd.ESC_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
64
Agent/KPS/frmKPS.Designer.cs
generated
Normal file
|
@ -0,0 +1,64 @@
|
|||
namespace Cosmos.KPS
|
||||
{
|
||||
partial class frmKPS
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmKPS));
|
||||
this.oposPrinter = new AxOposPOSPrinter_CCO.AxOPOSPOSPrinter();
|
||||
((System.ComponentModel.ISupportInitialize)(this.oposPrinter)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// oposPrinter
|
||||
//
|
||||
this.oposPrinter.Enabled = true;
|
||||
this.oposPrinter.Location = new System.Drawing.Point(30, 46);
|
||||
this.oposPrinter.Name = "oposPrinter";
|
||||
this.oposPrinter.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("oposPrinter.OcxState")));
|
||||
this.oposPrinter.Size = new System.Drawing.Size(129, 52);
|
||||
this.oposPrinter.TabIndex = 0;
|
||||
//
|
||||
// frmKPS
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.oposPrinter);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "frmKPS";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "frmKPS";
|
||||
((System.ComponentModel.ISupportInitialize)(this.oposPrinter)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AxOposPOSPrinter_CCO.AxOPOSPOSPrinter oposPrinter;
|
||||
}
|
||||
}
|
30
Agent/KPS/frmKPS.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
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 Cosmos.KPS
|
||||
{
|
||||
public partial class frmKPS : Form
|
||||
{
|
||||
public frmKPS()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
||||
//this.UpdateStyles();
|
||||
}
|
||||
|
||||
public AxOposPOSPrinter_CCO.AxOPOSPOSPrinter OposPrinter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.oposPrinter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
128
Agent/KPS/frmKPS.resx
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="oposPrinter.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAIQAAAAIB
|
||||
AAAAAQAAAAAAAAAAAAAAAAwAAAAACQAAVQ0AAGAFAAAL
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
57
Agent/MasterDown/Activator.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : MasterDown 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Define main entrance point of project load. (프로젝트 로드의 주진입점을 정의합니다.)
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_BACKGROUND_DOWN.BACKGROUND_DOWN_MAIN:
|
||||
{
|
||||
Cosmos.BackgroundDown.BackgroundDownMain agentClass = new Cosmos.BackgroundDown.BackgroundDownMain();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
110
Agent/MasterDown/BackgroundDown.csproj
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{791617B7-64DA-4743-B8F1-CA413607FC31}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.BackgroundDown</RootNamespace>
|
||||
<AssemblyName>Agent.BackgroundDown</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="BackgroundDownMain.cs" />
|
||||
<Compile Include="DatabaseMssql.cs" />
|
||||
<Compile Include="frmPosIrtMessage.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmPosIrtMessage.designer.cs">
|
||||
<DependentUpon>frmPosIrtMessage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NetworkFtp.cs" />
|
||||
<Compile Include="NetworkIRT.cs" />
|
||||
<Compile Include="NetworkJSON.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Svr2Tran.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="frmPosIrtMessage.resx">
|
||||
<DependentUpon>frmPosIrtMessage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.BackgroundDown.dll .\Agent.BackgroundDown.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.BackgroundDown.dll .\IC\Agent.BackgroundDown.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
2300
Agent/MasterDown/BackgroundDownMain.cs
Normal file
132
Agent/MasterDown/DatabaseMssql.cs
Normal file
|
@ -0,0 +1,132 @@
|
|||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : MSSQL DB 관련 처리
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
public class DatabaseMssql
|
||||
{
|
||||
private SqlDB sqlDb = null;
|
||||
|
||||
public bool Begin()
|
||||
{
|
||||
return sqlDb.DBBeginTransaction();
|
||||
}
|
||||
|
||||
public bool Commit()
|
||||
{
|
||||
return sqlDb.DBTransactionCommit();
|
||||
}
|
||||
|
||||
public bool Rollback()
|
||||
{
|
||||
return sqlDb.DBTransactionRollback();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
sqlDb.DBClose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL DataTable를 이용한 Select
|
||||
/// <para>return -> 1:OK, -1:Connection 정보 에러, -2:SQL 에러, -3:기타 에러, 0:Select 결과 없음</para>
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <param name="outDtReturn"></param>
|
||||
/// <returns></returns>
|
||||
public int DBSelect(string sQuery, out DataTable outDtReturn)
|
||||
{
|
||||
int iReturn = -9;
|
||||
DataTable dtReturn = null;
|
||||
|
||||
string strCommand = sQuery;
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
//System.Diagnostics.Debug.Print("SQL=" + sQuery);
|
||||
iReturn = sqlDb.DBDataTableSelect(strCommand, sqlCommandType, (SqlParameter[])null, out dtReturn);
|
||||
|
||||
outDtReturn = dtReturn;
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string sQuery)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string[] sQuery)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return -> 1:OK, -1:Connection 에러, -2:SQL 에러, -3:기타 에러, -4:적용된 Row 없음
|
||||
/// </summary>
|
||||
/// <param name="sQuery"></param>
|
||||
/// <returns></returns>
|
||||
public int DBExecuteNonQuery(string[] sQuery, bool bStandAlone)
|
||||
{
|
||||
int iReturn = 0;
|
||||
|
||||
CommandType sqlCommandType = CommandType.Text;
|
||||
|
||||
iReturn = sqlDb.DBExecuteNonQuery(sQuery, sqlCommandType, (SqlParameter[])null, bStandAlone);
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MSSQL Database Conntction String
|
||||
/// </summary>
|
||||
/// <param name="pDataSource"></param>
|
||||
/// <param name="pInitialCatalog"></param>
|
||||
/// <param name="pUID"></param>
|
||||
/// <param name="pPassword"></param>
|
||||
public bool SetDBConnectionString(string pDataSource, string pInitialCatalog, string pUID, string pPassword)
|
||||
{
|
||||
bool bReturn = false;
|
||||
|
||||
if(sqlDb != null)
|
||||
{
|
||||
if (sqlDb.IsDBOpen()) sqlDb.DBClose();
|
||||
}
|
||||
|
||||
sqlDb = new SqlDB(pDataSource, pInitialCatalog, pUID, pPassword);
|
||||
|
||||
bReturn = sqlDb.IsDBOpen();
|
||||
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
181
Agent/MasterDown/NetworkFtp.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Data;
|
||||
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : FTP 다운로드
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
public class NetworkFtp : INetworkFTP
|
||||
{
|
||||
private readonly string LOCAL_DOWN_PATH = BaseCom.NxRootPath + @"DOWN\"; //Download File Location (다운로드 파일위치)
|
||||
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// POS Status Value (POS 상태값)
|
||||
/// </summary>
|
||||
private PosStatus m_cPosStatus = null;
|
||||
|
||||
private FTP m_ClsFtp;
|
||||
|
||||
public NetworkFtp()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP 서버에 Connect
|
||||
/// </summary>
|
||||
/// <param name="sServer"></param>
|
||||
/// <param name="sUserId"></param>
|
||||
/// <param name="sPassword"></param>
|
||||
/// <param name="iTimeOutSeconds"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <returns>0 : 정상접속, -1:시간초과, -2:로그인 실패, -3:서버접속 실패, -4:지원하지 않는 시스템</returns>
|
||||
public int Connect(string sServer, string sUserId, string sPassword, int iTimeOutSeconds, int iPort)
|
||||
{
|
||||
int nReturn = -9;
|
||||
|
||||
try
|
||||
{
|
||||
m_ClsFtp = new FTP((iPort == 0) ? sServer : sServer + ":" + iPort, sUserId, sPassword);
|
||||
|
||||
if (m_ClsFtp != null) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
|
||||
////m_ClsFtp = new ClsFtp(sServer, sUserId, sPassword, iTimeOutSeconds, iPort);
|
||||
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// //MessageBox.Show("FTP Server Connect Error !!! [" + nReturn.ToString() + "]");
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Connect()", e.Message);
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상종료, -1:Not Connected, -2:Binary Mode set failed, -3: failed local file Create, -4:socket 에러, -5:remote file 없슴, -6:정상수신실패, -7: 파일사이즈 틀림</returns>
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
string sMsg = "";
|
||||
return Download(sSvrDirectory, sLocalDirectory, sFileNm, ref sMsg, sFtpMode);
|
||||
}
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, ref string sMsg, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (CmUtil.RightH(sLocalDirectory, 1) != "\\") sLocalDirectory += "\\";
|
||||
|
||||
if (Directory.Exists(sLocalDirectory) == false) Directory.CreateDirectory(sLocalDirectory);
|
||||
|
||||
bRet = m_ClsFtp.Download(sSvrDirectory + sFileNm, sLocalDirectory + sFileNm, ref sMsg, sFtpMode);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Download(sLocalDirectory, sFileNm, true);
|
||||
////if (nReturn < 0 && File.Exists(BaseCom.NxDownPath + sFileNm + ".ftp") == true)
|
||||
////{
|
||||
//// File.Delete(BaseCom.NxDownPath + sFileNm + ".ftp");
|
||||
////}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Download()", e.Message);
|
||||
|
||||
sMsg = sFileNm + " " + e.Message;
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP서버와의 연결을 종료
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
//m_ClsFtp.Close();
|
||||
//m_ClsFtp.cleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 정해진 디렉토리에 정해진 파일을 업로드
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상완료, -1:Not Connected, -2: data socket create error, -3: file write 실패, -4:socket error, -5: 정상처리 실패(서버)</returns>
|
||||
public int Upload(string sSvrDirectory, string sLocalDirectory, string sFileNm)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
bRet = m_ClsFtp.Upload(sLocalDirectory + sFileNm, sSvrDirectory + sFileNm);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Upload(sLocalDirectory, sFileNm, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Upload()", e.Message);
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
return nReturn;
|
||||
}
|
||||
}
|
||||
}
|
669
Agent/MasterDown/NetworkIRT.cs
Normal file
|
@ -0,0 +1,669 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : SC / HQ IRT Request (SC / 본부 IRT 요청)
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
public class NetworkIRT
|
||||
{
|
||||
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
private PosStatus m_cPosStatus; // 기본정보 참조
|
||||
private DeviceStatus m_cDevStatus; // 장비정보 참조
|
||||
|
||||
/// <summary>
|
||||
/// Sending Socket (전송 소켓)
|
||||
/// </summary>
|
||||
private static TcpSocket m_IrtSocket = null;
|
||||
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
private string m_ServerIp = "";
|
||||
|
||||
/// <summary>
|
||||
/// Port
|
||||
/// </summary>
|
||||
private int m_ServerPort = 0;
|
||||
|
||||
/// <summary>
|
||||
/// TimeOut
|
||||
/// </summary>
|
||||
private int m_ServerTimeout = 10000;
|
||||
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Constructor (생성자)
|
||||
/// </summary>
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
public NetworkIRT()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
||||
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; // POS 장치정보 (PDA)
|
||||
}
|
||||
|
||||
#region OnLine 상태체크
|
||||
/// <summary>
|
||||
/// Get network online status with Ping check. (Ping체크로 network Online상태를 취득한다,)
|
||||
/// </summary>
|
||||
/// <param name="pHostAddress">Ip address</param>
|
||||
/// <returns>True : online false : Offline</returns>
|
||||
private int CheckNetworkOnline(string pHostAddress)
|
||||
{
|
||||
//Ping Check (Ping 체크)
|
||||
Ping pingSender = new Ping();
|
||||
PingOptions optins = new PingOptions();
|
||||
optins.DontFragment = true;
|
||||
string data = "aaa";
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
int timeout = 120;
|
||||
PingReply reply = pingSender.Send(pHostAddress, timeout, buffer, optins);
|
||||
|
||||
if (reply.Status == IPStatus.Success)
|
||||
return UserCom.OK;
|
||||
else
|
||||
return UserCom.NG;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 암호화 편집
|
||||
/// <summary>
|
||||
/// 암호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="plainData">평문</param>
|
||||
/// <returns>암호문, 에러시 평문 리턴</returns>
|
||||
private byte[] EncryptData(byte[] plainData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, plainData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] byteEncryptData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "0") // "0" 평문
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[plainData.Length - nNowPos];
|
||||
|
||||
Array.Copy(plainData, nNowPos, tranBytes, 0, plainData.Length - nNowPos);
|
||||
|
||||
//암호화
|
||||
byteEncryptData = AES.DynamicKeyEncrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + byteEncryptData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "1"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
byte[] byteCommHeader = Encoding.UTF8.GetBytes(sChangedCommHeader);
|
||||
|
||||
editedAllData = new byte[iMsgLen];
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(byteEncryptData, 0, editedAllData, byteCommHeader.Length, byteEncryptData.Length);
|
||||
|
||||
return editedAllData;
|
||||
}
|
||||
else // "1" 암호문
|
||||
{
|
||||
return plainData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 복호화 편집
|
||||
/// <summary>
|
||||
/// 복호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="EncryptData"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] DecryptData(byte[] EncryptData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, EncryptData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] bytePlainData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "1") //복호화
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[EncryptData.Length - nNowPos];
|
||||
|
||||
Array.Copy(EncryptData, nNowPos, tranBytes, 0, tranBytes.Length);
|
||||
|
||||
//복호화
|
||||
bytePlainData = AES.DynamicKeyDecrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + bytePlainData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "0"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
|
||||
byte[] byteCommHeader = Encoding.Default.GetBytes(sChangedCommHeader);
|
||||
editedAllData = new byte[byteCommHeader.Length + bytePlainData.Length];
|
||||
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(bytePlainData, 0, editedAllData, byteCommHeader.Length, bytePlainData.Length);
|
||||
|
||||
return editedAllData;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return EncryptData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRT Send/Receive
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(byte[] pSendData, ref byte[] pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
byte[] rRecvData = null;
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = null;
|
||||
}
|
||||
m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(string pSendData, ref string pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
string rRecvData = "";
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = "";
|
||||
nStat = nRecvLen;
|
||||
}
|
||||
m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 암호화/복화화 전송
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sComm"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceive(string sIP, int iPort, int iTimeOut, string sComm, ref string sRecvData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
byte[] bEditedSendData = null;
|
||||
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
//암호화
|
||||
if (sComm.Length != 0)
|
||||
{
|
||||
//bEditedSendData = EncryptData(Encoding.Default.GetBytes(sComm));
|
||||
bEditedSendData = Encoding.Default.GetBytes(sComm);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sComm);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] SendData is Null");
|
||||
}
|
||||
|
||||
//SendReceive
|
||||
nStat = SendReceiveData(Encoding.Default.GetString(bEditedSendData, 0, bEditedSendData.Length), ref sReturn);
|
||||
|
||||
//복호화
|
||||
if (sReturn.Length != 0)
|
||||
{
|
||||
byte[] byteRecv = DecryptData(Encoding.Default.GetBytes(sReturn));
|
||||
sRecvData = Encoding.Default.GetString(byteRecv, 0, byteRecv.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] RecvData Is Null");
|
||||
}
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="comm"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceive(string sIP, int iPort, int iTimeOut, byte[] comm, ref byte[] sRecvData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
byte[] bEditedSendData = null;
|
||||
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
//암호화
|
||||
if (comm != null)
|
||||
{
|
||||
bEditedSendData = EncryptData(comm);
|
||||
|
||||
string sTmpLog = Encoding.Default.GetString(comm, 0, comm.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sTmpLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] SendData Is Null");
|
||||
}
|
||||
|
||||
//SendReceive
|
||||
nStat = SendReceiveData(bEditedSendData, ref sRecvData);
|
||||
|
||||
//복호화
|
||||
if (sRecvData != null)
|
||||
{
|
||||
byte[] sDecryptRecvData = DecryptData(sRecvData);
|
||||
|
||||
sRecvData = sDecryptRecvData;
|
||||
|
||||
string sTmpLog = Encoding.Default.GetString(sDecryptRecvData, 0, sDecryptRecvData.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sTmpLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] RecvData Is Null");
|
||||
}
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 전송 - 외부 VAN
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv - 외부 Van
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sSendData"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="sAckData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, int nRecvDataLen, string sAckData)
|
||||
{
|
||||
return IRTSendReceiveEx(sIP, iPort, iTimeOut, sSendData, ref sRecvData, nRecvDataLen, sAckData, false);
|
||||
}
|
||||
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, int nRecvDataLen, string sAckData, bool bErrorSkip)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
sRecvData = "";
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sSendData);
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + sSendData);
|
||||
nStat = m_IrtSocket.SendReceiveData(sSendData, ref sRecvData, m_ServerTimeout, nRecvDataLen, sAckData, bErrorSkip);
|
||||
System.Diagnostics.Debug.Print("응답=" + sRecvData);
|
||||
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveSEx()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="sAckData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen, byte[] sAckData)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.SendReceiveData(bSendData, ref bRecvData, m_ServerTimeout, nRecvDataLen, sAckData);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 전송 - 외부 VAN (전문길이 위치지정)
|
||||
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv - 외부 Van (길이 위치지정)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sSendData"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <param name="bFullSize"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="nRecvDataStartPosion"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveLen(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, bool bFullSize, int nRecvDataLen, int nRecvDataStartPosion)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
sRecvData = "";
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sSendData);
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + sSendData);
|
||||
nStat = m_IrtSocket.SendReceiveData(sSendData, ref sRecvData, m_ServerTimeout, bFullSize, nRecvDataLen, "", nRecvDataStartPosion, false );
|
||||
System.Diagnostics.Debug.Print("응답=" + sRecvData);
|
||||
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van (전문길이 위치지정)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="sAckData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveLen(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen, int nRecvDataStartPosion)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.SendReceiveData(bSendData, ref bRecvData, m_ServerTimeout, nRecvDataLen, null, nRecvDataStartPosion);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataLen()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT Byte로의 Send/Recv - 외부 Van (Bypass Byte)
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van (Bypass Byte)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <returns></returns>
|
||||
public int ByPassSendReceiveData(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
//bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.ByPassSendReceiveData(bSendData, nRecvDataLen, ref bRecvData, m_ServerTimeout);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataLen()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
581
Agent/MasterDown/NetworkJSON.cs
Normal file
|
@ -0,0 +1,581 @@
|
|||
//#define LOG_TRACE //@@ 2017.11.01;로그 확인시 사용;girak.kim
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : SC / HQ IRT Request (SC / 본부 IRT 요청)
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
public class NetworkJSON
|
||||
{
|
||||
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
private PosStatus m_cPosStatus; // 기본정보 참조
|
||||
private DeviceStatus m_cDevStatus; // 장비정보 참조
|
||||
|
||||
/// <summary>
|
||||
/// Sending Socket (전송 소켓)
|
||||
/// </summary>
|
||||
private static TcpSocket m_IrtSocket = null;
|
||||
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
private string m_ServerIp = "";
|
||||
|
||||
/// <summary>
|
||||
/// Port
|
||||
/// </summary>
|
||||
private int m_ServerPort = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Recv Timeout
|
||||
/// </summary>
|
||||
private int m_ServerTimeout = 5000;
|
||||
|
||||
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Constructor (생성자)
|
||||
/// </summary>
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
public NetworkJSON()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
||||
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; // POS 장치정보
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get network online status with Ping check. (Ping체크로 network Online상태를 취득한다,)
|
||||
/// </summary>
|
||||
/// <param name="pHostAddress">Ip address</param>
|
||||
/// <returns>True : online false : Offline</returns>
|
||||
private int CheckNetworkOnline(string pHostAddress)
|
||||
{
|
||||
//Ping Check (Ping 체크)
|
||||
Ping pingSender = new Ping();
|
||||
PingOptions optins = new PingOptions();
|
||||
optins.DontFragment = true;
|
||||
string data = "aaa";
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
int timeout = 120;
|
||||
PingReply reply = pingSender.Send(pHostAddress, timeout, buffer, optins);
|
||||
|
||||
if (reply.Status == IPStatus.Success)
|
||||
return UserCom.OK;
|
||||
else
|
||||
return UserCom.NG;
|
||||
}
|
||||
/*
|
||||
#region 암호화 편집
|
||||
/// <summary>
|
||||
/// 암호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="plainData">평문</param>
|
||||
/// <returns>암호문, 에러시 평문 리턴</returns>
|
||||
private byte[] EncryptData(byte[] plainData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, plainData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] byteEncryptData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "0") // "0" 평문
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[plainData.Length - nNowPos];
|
||||
|
||||
Array.Copy(plainData, nNowPos, tranBytes, 0, plainData.Length - nNowPos);
|
||||
|
||||
//암호화
|
||||
byteEncryptData = AES.DynamicKeyEncrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + byteEncryptData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "1"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
byte[] byteCommHeader = Encoding.Default.GetBytes(sChangedCommHeader);
|
||||
|
||||
editedAllData = new byte[iMsgLen];
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(byteEncryptData, 0, editedAllData, byteCommHeader.Length, byteEncryptData.Length);
|
||||
|
||||
return editedAllData;
|
||||
}
|
||||
else // "1" 암호문
|
||||
{
|
||||
return plainData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 복호화 편집
|
||||
/// <summary>
|
||||
/// 복호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="EncryptData"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] DecryptData(byte[] EncryptData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, EncryptData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] bytePlainData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "1") //복호화
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[EncryptData.Length - nNowPos];
|
||||
|
||||
Array.Copy(EncryptData, nNowPos, tranBytes, 0, tranBytes.Length);
|
||||
|
||||
//복호화
|
||||
bytePlainData = AES.DynamicKeyDecrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + bytePlainData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "0"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
|
||||
byte[] byteCommHeader = Encoding.Default.GetBytes(sChangedCommHeader);
|
||||
editedAllData = new byte[byteCommHeader.Length + bytePlainData.Length];
|
||||
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(bytePlainData, 0, editedAllData, byteCommHeader.Length, bytePlainData.Length);
|
||||
|
||||
return editedAllData;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return EncryptData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
*/
|
||||
/// <summary>
|
||||
/// POS 마스터 요청 시 사용하는 Connect 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int Connect(int iKeepTime = 5000)
|
||||
{
|
||||
int iReturn = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Delay time to close connection is 5 sec.
|
||||
iReturn = m_IrtSocket.Connect(iKeepTime);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.Connect()", e.ToString());
|
||||
}
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
m_IrtSocket.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(byte[] pSendData, ref byte[] pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
byte[] rRecvData = null;
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = null;
|
||||
}
|
||||
m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(string pSendData, ref string pRecvData, bool bIsDmbIf = false)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
string rRecvData = "";
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
//System.Diagnostics.Debug.Print("요청:" + pSendData);
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout, bIsDmbIf);
|
||||
//System.Diagnostics.Debug.Print("응답:" + rRecvData);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = "";
|
||||
nStat = nRecvLen;
|
||||
}
|
||||
m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
private int SendReceiveMstData(string pSendData, ref string pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
nRecvLen = m_IrtSocket.SendReceiveMstData(pSendData, ref pRecvData);
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
e.ToString());
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv
|
||||
/// (공통헤더의 전문길이 0으로 세팅해서 송신. 자동 계산)
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
public int IRTSendReceive(string sIP, int iPort, int iTimeOut, string sCommData, Hashtable htData, ref Hashtable htRecvData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
string sRecvCommHeader = string.Empty;
|
||||
string sRecvData = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
string sJsonSendData = "";
|
||||
string sJsonReceiveData = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
if (htData != null)
|
||||
{
|
||||
sJsonSendData = JsonConvert.SerializeObject(htData);
|
||||
|
||||
//sJsonSendData 암호화 처리 ...
|
||||
|
||||
Byte[] sBytTempBuff = Encoding.UTF8.GetBytes(sJsonSendData);
|
||||
string sDataLen = string.Format("{0:000000}", sBytTempBuff.Length);
|
||||
|
||||
sCommData = sDataLen + sCommData.Substring(TcpSocket.COMM_MSGLEN);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkJSON.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sCommData + sJsonSendData);
|
||||
}
|
||||
|
||||
//Send Receive
|
||||
nStat = SendReceiveData(sCommData + sJsonSendData, ref sJsonReceiveData);
|
||||
|
||||
if (sJsonReceiveData != null && sJsonReceiveData != "")
|
||||
{
|
||||
sRecvCommHeader = sJsonReceiveData.Substring(0, TcpSocket.COMM_HEAD_LEN);
|
||||
sRecvData = sJsonReceiveData.Substring(TcpSocket.COMM_HEAD_LEN);
|
||||
//sJsonReceiveData 복호화 처리 ...
|
||||
|
||||
htRecvData = JsonConvert.DeserializeObject<Hashtable>(sRecvData);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkJSON.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvCommHeader + sRecvData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.IRTSendReceive()", e.ToString());
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
/// <summary>
|
||||
/// 디지털메뉴보드 I/F용 send/receive
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sCommData"></param>
|
||||
/// <param name="htData"></param>
|
||||
/// <param name="sRecvedData"></param>
|
||||
/// <returns></returns>
|
||||
public int DmbIRTSendReceive(string sIP, int iPort, int iTimeOut, string sCommData, Hashtable htData, ref string sRecvedData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
string sRecvCommHeader = string.Empty;
|
||||
string sRecvData = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
string sJsonSendData = "";
|
||||
string sJsonReceiveData = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
if (htData != null)
|
||||
{
|
||||
sJsonSendData = JsonConvert.SerializeObject(htData);
|
||||
|
||||
//sJsonSendData 암호화 처리 ...
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkJSON.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sCommData + sJsonSendData);
|
||||
}
|
||||
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(sCommData + sJsonSendData);
|
||||
string sUTF8String = Encoding.UTF8.GetString(bytes);
|
||||
|
||||
//Send Receive
|
||||
//nStat = SendReceiveData(sCommData + sJsonSendData, ref sJsonReceiveData, true);
|
||||
nStat = SendReceiveData(sUTF8String, ref sJsonReceiveData, true);
|
||||
|
||||
if (sJsonReceiveData != null && sJsonReceiveData != "")
|
||||
{
|
||||
sRecvCommHeader = sJsonReceiveData.Substring(0, 60);
|
||||
sRecvData = sJsonReceiveData.Substring(60);
|
||||
|
||||
sRecvedData = sRecvCommHeader;
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkJSON.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvCommHeader + sRecvData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.IRTSendReceive()", e.ToString());
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 마스터 요청을 위한 string으로의 send/receive
|
||||
/// </summary>
|
||||
/// <param name="sIp"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sCommData"></param>
|
||||
/// <param name="htData"></param>
|
||||
/// <param name="sbRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int MstIRTSendReceive(string sIp, int iPort, int iTimeOut, string sCommData, Hashtable htData, ref StringBuilder sbRecvData)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
string sRecvCommHeader = string.Empty;
|
||||
string sRecvData = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
m_ServerIp = sIp;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
string sJsonSendData = string.Empty;
|
||||
string sJsonReceiveData = string.Empty;
|
||||
Hashtable htRecvData = null;
|
||||
|
||||
sbRecvData = new StringBuilder();
|
||||
|
||||
nStat = Connect(-1);
|
||||
|
||||
if(nStat == BaseCom.OK)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
sJsonSendData = JsonConvert.SerializeObject(htData);
|
||||
|
||||
//sJsonSendData 암호화 처리 ...
|
||||
|
||||
Byte[] sBytTempBuff = Encoding.UTF8.GetBytes(sJsonSendData);
|
||||
string sDataLen = string.Format("{0:000000}", sBytTempBuff.Length);
|
||||
|
||||
sCommData = sDataLen + sCommData.Substring(TcpSocket.COMM_MSGLEN);
|
||||
|
||||
// 마스터 송수신 로그 제거(20170520)
|
||||
//UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
// UserCom.WARNING_LEVEL,
|
||||
// System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
// CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sCommData + sJsonSendData);
|
||||
|
||||
#if(LOG_TRACE) ////@@ 로그 확인 용
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP, "Background NetJson SendData : ", System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + "," + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sCommData + sJsonSendData);
|
||||
#endif
|
||||
// 전문 송신
|
||||
nStat = SendReceiveMstData(sCommData + sJsonSendData, ref sJsonReceiveData);
|
||||
|
||||
#if(LOG_TRACE) ////@@ 로그 확인 용
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP, "Background NetJson RecvData : ", System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + "," + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sJsonReceiveData);
|
||||
#endif
|
||||
|
||||
if (nStat == BaseCom.OK)
|
||||
{
|
||||
// 마스터 송수신 로그 제거(20170520)
|
||||
//UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
// UserCom.WARNING_LEVEL,
|
||||
// System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
// CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sJsonReceiveData);
|
||||
|
||||
if (sJsonReceiveData != null && sJsonReceiveData != string.Empty)
|
||||
{
|
||||
sRecvCommHeader = sJsonReceiveData.Substring(0, TcpSocket.COMM_HEAD_LEN);
|
||||
sRecvData = sJsonReceiveData.Substring(TcpSocket.COMM_HEAD_LEN);
|
||||
|
||||
//sRecvData 복호화 처리 ...
|
||||
|
||||
htRecvData = JsonConvert.DeserializeObject<Hashtable>(sRecvData);
|
||||
|
||||
if (int.Parse(htRecvData[Column.IQ_POSMASTER_RSP.DATA.Count].ToString().Trim()) != 0)
|
||||
{
|
||||
// StringBuilder에 추가
|
||||
sbRecvData.Append(htRecvData[Column.IQ_POSMASTER_RSP.DATA.Data].ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
// 요청전문의 요청 코드 변경
|
||||
htData[Column.IQ_POSMASTER_REQ.DATA.ProcCd] = "1";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return BaseCom.NG1;
|
||||
}
|
||||
}
|
||||
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkJSON.MstIRTSendReceive()", e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
}
|
||||
}
|
36
Agent/MasterDown/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("MasterDown")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MasterDown")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("47a0e994-6a5c-41dd-b706-354c244b7380")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
436
Agent/MasterDown/Svr2Tran.cs
Normal file
|
@ -0,0 +1,436 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.BaseFrame;
|
||||
using System.Threading;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : 영수증 반품 / 서버 시간 조회 처리
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
class Svr2Tran
|
||||
{
|
||||
#region 변수 선언 및 생성자
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
|
||||
private NetworkJSON m_cNetJSONService;
|
||||
private DatabaseMssql m_cSqlDbService = null;
|
||||
Hashtable m_htRecvData = null; // 통신 수신 데이터 (JSON)
|
||||
private frmPosIrtMessage m_cfPosIrtMsg = null;
|
||||
|
||||
/// <summary>
|
||||
/// POS Status Value (POS 상태값)
|
||||
/// </summary>
|
||||
private PosStatus m_cPosStatus = null;
|
||||
|
||||
private bool m_bIRTComplete = false;
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public Svr2Tran()
|
||||
{
|
||||
SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
|
||||
m_cNetJSONService = new NetworkJSON();
|
||||
m_cSqlDbService = new DatabaseMssql();
|
||||
m_cfPosIrtMsg = new frmPosIrtMessage();
|
||||
|
||||
m_bIRTComplete = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 서버 시간 조회
|
||||
/// <summary>
|
||||
/// 서버 시간 조회
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ServerSysDateTime()
|
||||
{
|
||||
Hashtable htRecvData = new Hashtable();
|
||||
Hashtable htSendData = new Hashtable();
|
||||
|
||||
string sRet = UserCom.RST_ERR;
|
||||
string sGetDate = "";
|
||||
|
||||
try
|
||||
{
|
||||
// 서버 조회
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.SYSDATETIME);
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.RES_CD, "");
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.POS_HOUR, "");
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.REG_NO, "");
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.TRADE_NO, "");
|
||||
htSendData.Add(Column.IQ_SYSDATE_REQ.DATA.SYS_YMDHMS, "");
|
||||
|
||||
sRet = ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 5000, htSendData, ref htRecvData, false);
|
||||
if (sRet == UserCom.RST_OK)
|
||||
{
|
||||
if (htRecvData[Column.IQ_SYSDATE_REQ.DATA.RES_CD].ToString() == "00")
|
||||
{
|
||||
sGetDate = htRecvData[Column.IQ_SYSDATE_REQ.DATA.SYS_YMDHMS].ToString();
|
||||
|
||||
if (sGetDate.Trim().Length == 14) BsUtil.SetSystemDateTime(sGetDate);
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 프로그램 업데이트 목록 조회
|
||||
/// <summary>
|
||||
/// 프로그램 업데이트 목록 조회
|
||||
/// </summary>
|
||||
/// <param name="sKind"></param>
|
||||
/// <param name="sDownDiv"></param>
|
||||
/// <param name="aRecvData"></param>
|
||||
/// <param name="htRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public string PGMUpdate(string sKind, string sDownDiv, ref string[] aRecvData, ref Hashtable htRecvData)
|
||||
{
|
||||
Hashtable htSendData = new Hashtable();
|
||||
|
||||
string sRet = UserCom.RST_ERR;
|
||||
|
||||
try
|
||||
{
|
||||
// 서버 조회
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.PGMUPDATE);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_GROUP, CmUtil.MidH(sKind, 0, 2));
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_KIND, CmUtil.MidH(sKind, 2, 2));
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_APP_TY, "0");
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.FILE_YMDHMS, DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss"));
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_REQ.DATA.DOWN_DIV, sDownDiv);
|
||||
|
||||
sRet = ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
|
||||
if (sRet == UserCom.RST_OK)
|
||||
{
|
||||
if (htRecvData[Column.IQ_PGMUPDATE_RSP.DATA.RES_CD].ToString() == "00" || htRecvData[Column.IQ_PGMUPDATE_RSP.DATA.RES_CD].ToString() == "01")
|
||||
{
|
||||
// 00:정상, 01:데이터 없음
|
||||
aRecvData = htRecvData[Column.IQ_PGMUPDATE_RSP.DATA.VALUE].ToString().Split(new string[] { "#~" }, StringSplitOptions.None);
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
sRet = UserCom.RST_ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 파일 변경 완료 요청
|
||||
/// <summary>
|
||||
/// 파일 변경 완료 요청
|
||||
/// </summary>
|
||||
/// <param name="sKind"></param>
|
||||
/// <param name="sAppType"></param>
|
||||
/// <param name="sFileName"></param>
|
||||
/// <param name="sFileSeq"></param>
|
||||
/// <param name="sFileVer"></param>
|
||||
/// <param name="sDownDiv"></param>
|
||||
/// <param name="sDeployDate"></param>
|
||||
/// <param name="sDeployDT"></param>
|
||||
/// <returns></returns>
|
||||
public string PGMUpdate_Complete(string sKind, string sAppType, string sFileName, string sFileSeq, string sFileVer, string sDownDiv, string sDeployDate, string sDeployDT)
|
||||
{
|
||||
Hashtable htSendData = new Hashtable();
|
||||
Hashtable htRecvData = new Hashtable();
|
||||
|
||||
string sRet = UserCom.RST_ERR;
|
||||
|
||||
try
|
||||
{
|
||||
if (sFileVer.Trim() == "") return sRet;
|
||||
|
||||
// 서버 조회
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.PGMUPDATECOMPLTE);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_GROUP, CmUtil.MidH(sKind, 0, 2));
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_KIND, CmUtil.MidH(sKind, 2, 2));
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_APP_TY, sAppType);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_NM, sFileName);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_VER, sFileVer);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.FILE_SEQ, sFileSeq);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.RES_CD, "");
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.DOWN_DIV, sDownDiv);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.DEPLOY_DT, sDeployDate);
|
||||
htSendData.Add(Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.REG_DT, sDeployDT);
|
||||
|
||||
sRet = ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.SysInfoPort, 10000, htSendData, ref htRecvData, false);
|
||||
if (sRet == UserCom.RST_OK)
|
||||
{
|
||||
if (htRecvData[Column.IQ_PGMUPDATE_COMPLETE_REQ.DATA.RES_CD].ToString() == "00")
|
||||
{
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 프로그램 적용 및 이력 관리
|
||||
/// <summary>
|
||||
/// 프로그램 이력 관리
|
||||
/// </summary>
|
||||
/// <param name="sKind"></param>
|
||||
/// <param name="sFileSeq"></param>
|
||||
/// <param name="sFileVer"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <param name="sApplyDate"></param>
|
||||
/// <param name="sApplyTime"></param>
|
||||
/// <param name="sApplyType"></param>
|
||||
/// <param name="sDeployDate"></param>
|
||||
/// <param name="sDeployTime"></param>
|
||||
/// <param name="sFTP_IP"></param>
|
||||
/// <param name="sFTP_Port"></param>
|
||||
/// <param name="sFTP_ID"></param>
|
||||
/// <param name="sFTP_Pwd"></param>
|
||||
/// <param name="sFTP_FILEPATH"></param>
|
||||
/// <param name="sDOWN_DIV"></param>
|
||||
/// <returns></returns>
|
||||
public string PGMUpdate_History_Isert(string sKind, string sFileSeq, string sFileVer, string sFileNm, string sApplyDate, string sApplyTime, string sApplyType, string sDeployDate, string sDeployTime, string sFTP_IP, string sFTP_Port, string sFTP_ID, string sFTP_Pwd, string sFTP_FILEPATH, string sDOWN_DIV, string sDeployDT, string sUseYn)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
int iRet = -1;
|
||||
|
||||
try
|
||||
{
|
||||
string sQuery = "";
|
||||
sQuery = "";
|
||||
sQuery += "IF EXISTS(SELECT CMP_CD \n";
|
||||
sQuery += " FROM POSMST..MST_PGM_VER_NEW \n";
|
||||
sQuery += " WHERE \n";
|
||||
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n";
|
||||
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n";
|
||||
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n";
|
||||
sQuery += " AND KIND = '" + sKind.Trim() + "' \n";
|
||||
sQuery += " AND FILE_SEQ = '" + sFileSeq.Trim() + "' \n";
|
||||
sQuery += " AND FILE_VER = '" + sFileVer.Trim() + "') \n";
|
||||
sQuery += " BEGIN \n";
|
||||
sQuery += " UPDATE POSMST..MST_PGM_VER_NEW \n";
|
||||
sQuery += " SET \n";
|
||||
sQuery += " FILE_NM = '" + sFileNm.Trim() + "' \n";
|
||||
sQuery += " , APPLY_DATE = '" + sApplyDate.Trim() + "' \n";
|
||||
sQuery += " , APPLY_TIME = '" + sApplyTime.Trim() + "' \n";
|
||||
sQuery += " , APP_TYPE = '" + sApplyType + "' \n";
|
||||
sQuery += " , DEPLOY_DATE = '" + sDeployDate.Trim() + "' \n";
|
||||
sQuery += " , DEPLOY_TIME = '" + sDeployTime.Trim() + "' \n";
|
||||
sQuery += " , FTP_IP = '" + sFTP_IP.Trim() + "' \n";
|
||||
sQuery += " , FTP_PORT = '" + sFTP_Port.Trim() + "' \n";
|
||||
sQuery += " , FTP_ID = '" + sFTP_ID.Trim() + "' \n";
|
||||
sQuery += " , FTP_PWD = '" + sFTP_Pwd.Trim() + "' \n";
|
||||
sQuery += " , FTP_FILEPATH = '" + sFTP_FILEPATH.Trim() + "' \n";
|
||||
sQuery += " , DOWN_DIV = '" + sDOWN_DIV.Trim() + "' \n";
|
||||
sQuery += " , UPD_DT = CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 108), ':', '') \n";
|
||||
sQuery += " , DEPLOY_DT = '" + sDeployDT.Trim() + "' \n";
|
||||
sQuery += " , USE_YN = '" + sUseYn.Trim() + "' \n";
|
||||
sQuery += " WHERE \n"; ;
|
||||
sQuery += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n";
|
||||
sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n";
|
||||
sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n";
|
||||
sQuery += " AND KIND = '" + sKind.Trim() + "' \n";
|
||||
sQuery += " AND FILE_SEQ = '" + sFileSeq.Trim() + "' \n";
|
||||
sQuery += " AND FILE_VER = '" + sFileVer.Trim() + "' \n";
|
||||
sQuery += " END \n";
|
||||
sQuery += "ELSE \n";
|
||||
sQuery += " BEGIN \n";
|
||||
sQuery += " INSERT INTO POSMST..MST_PGM_VER_NEW \n";
|
||||
sQuery += " (CMP_CD, STOR_CD, POS_NO, KIND, FILE_SEQ, FILE_VER, FILE_NM, APPLY_DATE, APPLY_TIME, APP_TYPE, DEPLOY_DATE, DEPLOY_TIME, FTP_IP, FTP_PORT, FTP_ID, FTP_PWD, FTP_FILEPATH, DOWN_DIV, REG_DT, DEPLOY_DT, USE_YN) \n";
|
||||
sQuery += " VALUES( \n";
|
||||
sQuery += " '" + m_cPosStatus.Base.CmpCd + "' \n";
|
||||
sQuery += " , '" + m_cPosStatus.Base.StoreNo + "' \n";
|
||||
sQuery += " , '" + m_cPosStatus.Base.PosNo + "' \n";
|
||||
sQuery += " , '" + sKind.Trim() + "' \n";
|
||||
sQuery += " , '" + sFileSeq.Trim() + "' \n";
|
||||
sQuery += " , '" + sFileVer.Trim() + "' \n";
|
||||
sQuery += " , '" + sFileNm.Trim() + "' \n";
|
||||
sQuery += " , '" + sApplyDate.Trim() + "' \n";
|
||||
sQuery += " , '" + sApplyTime.Trim() + "' \n";
|
||||
sQuery += " , '" + sApplyType + "' \n";
|
||||
sQuery += " , '" + sDeployDate.Trim() + "' \n";
|
||||
sQuery += " , '" + sDeployTime.Trim() + "' \n";
|
||||
sQuery += " , '" + sFTP_IP.Trim() + "' \n";
|
||||
sQuery += " , '" + sFTP_Port.Trim() + "' \n";
|
||||
sQuery += " , '" + sFTP_ID.Trim() + "' \n";
|
||||
sQuery += " , '" + sFTP_Pwd.Trim() + "' \n";
|
||||
sQuery += " , '" + sFTP_FILEPATH.Trim() + "' \n";
|
||||
sQuery += " , '" + sDOWN_DIV.Trim() + "' \n";
|
||||
sQuery += " , CONVERT(VARCHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8), GETDATE(), 108), ':', '') \n";
|
||||
sQuery += " , '" + sDeployDT.Trim() + "' \n";
|
||||
sQuery += " , '" + sUseYn.Trim() + "' \n";
|
||||
sQuery += " ) \n";
|
||||
sQuery += " END \n";
|
||||
sQuery = sQuery.Replace("\t", " ");
|
||||
|
||||
m_cSqlDbService.SetDBConnectionString(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
|
||||
iRet = m_cSqlDbService.DBExecuteNonQuery(new string[] { sQuery });
|
||||
|
||||
if (iRet == 1) sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region POS IRT 전문 송/수신
|
||||
/// <summary>
|
||||
/// POS IRT 전문 송/수신(점포서버 송수신: 제이슨 이용)
|
||||
/// </summary>
|
||||
public string ExecutePosIrt(string sMsgType, string sSvrIP, int nSvrPort, int nTimeout, Hashtable htSendData, ref Hashtable htRecvData, bool bVisibleMode)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
|
||||
try
|
||||
{
|
||||
string sCommHead = ItemColumn.MakeCommHeader(0, sMsgType); // 통신해더 생성
|
||||
|
||||
if (bVisibleMode == false)
|
||||
{
|
||||
// 팝업 화면 미표시
|
||||
m_bIRTComplete = true;
|
||||
m_htRecvData = null;
|
||||
|
||||
Thread thrSecondDisp = new Thread(() => sRet = OnNetworkIRT(sSvrIP, nSvrPort, nTimeout, sCommHead, htSendData));
|
||||
thrSecondDisp.Start();
|
||||
|
||||
while (m_bIRTComplete == true)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
htRecvData = m_htRecvData;
|
||||
}
|
||||
else
|
||||
{
|
||||
string sDispName = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0231), "");
|
||||
|
||||
m_cfPosIrtMsg.PosMessageStr = sDispName;
|
||||
m_cfPosIrtMsg.ServerIp = sSvrIP;
|
||||
m_cfPosIrtMsg.ServerPort = nSvrPort;
|
||||
m_cfPosIrtMsg.TimeOut = nTimeout;
|
||||
m_cfPosIrtMsg.CommHead = sCommHead;
|
||||
m_cfPosIrtMsg.SendData = htSendData;
|
||||
|
||||
m_cfPosIrtMsg.ShowDialog();
|
||||
|
||||
if (m_cfPosIrtMsg.RecvRet != UserCom.OK)
|
||||
{
|
||||
sRet = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0158);
|
||||
// 통신 실패 로그
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
string.Format("SOCKET ERROR,{0},{1}, RET={2}", sSvrIP, nSvrPort, m_cfPosIrtMsg.RecvRet));
|
||||
return sRet;
|
||||
}
|
||||
htRecvData = m_cfPosIrtMsg.RecvData;
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region POS IRT 전문 송수신 - 화면 미표시용
|
||||
private string OnNetworkIRT(string sServerIp, int nServerPort, int nTimeOut, string sCommHead, Hashtable htSendData)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
int nRecvRet = -1;
|
||||
try
|
||||
{
|
||||
m_bIRTComplete = true;
|
||||
|
||||
nRecvRet = m_cNetJSONService.IRTSendReceive(sServerIp, nServerPort, nTimeOut, sCommHead, htSendData, ref m_htRecvData);
|
||||
|
||||
if (nRecvRet == BaseCom.OK) sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"Process Exception !!! " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_bIRTComplete = false;
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 설정 파일 읽기
|
||||
/// <summary>
|
||||
/// 설정 파일 읽기
|
||||
/// </summary>
|
||||
/// <param name="cCfgInfo"></param>
|
||||
/// <param name="sGroup"></param>
|
||||
/// <param name="sValueName"></param>
|
||||
/// <returns></returns>
|
||||
private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName)
|
||||
{
|
||||
return GetConfigInfo(cCfgInfo, sGroup, sValueName, "");
|
||||
}
|
||||
private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName);
|
||||
if (sValue == null)
|
||||
return sDefault;
|
||||
else
|
||||
return sValue;
|
||||
}
|
||||
catch { }
|
||||
|
||||
return sDefault;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
}
|
99
Agent/MasterDown/frmPosIrtMessage.Designer.cs
generated
Normal file
|
@ -0,0 +1,99 @@
|
|||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
partial class frmPosIrtMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.lblMessage = new System.Windows.Forms.Label();
|
||||
this.picSearchMessage = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picSearchMessage)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tmrStart
|
||||
//
|
||||
this.tmrStart.Interval = 50;
|
||||
this.tmrStart.Tick += new System.EventHandler(this.tmrStart_Tick);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(697, 274);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(73, 21);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// lblMessage
|
||||
//
|
||||
this.lblMessage.BackColor = System.Drawing.Color.White;
|
||||
this.lblMessage.Font = new System.Drawing.Font("나눔스퀘어 Bold", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.lblMessage.Location = new System.Drawing.Point(12, 16);
|
||||
this.lblMessage.Name = "lblMessage";
|
||||
this.lblMessage.Size = new System.Drawing.Size(764, 179);
|
||||
this.lblMessage.TabIndex = 5;
|
||||
this.lblMessage.Text = "조회 중 입니다. 잠시만 기다려 주세요.";
|
||||
this.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// picSearchMessage
|
||||
//
|
||||
this.picSearchMessage.BackColor = System.Drawing.Color.White;
|
||||
this.picSearchMessage.Location = new System.Drawing.Point(0, 0);
|
||||
this.picSearchMessage.Name = "picSearchMessage";
|
||||
this.picSearchMessage.Size = new System.Drawing.Size(788, 212);
|
||||
this.picSearchMessage.TabIndex = 4;
|
||||
this.picSearchMessage.TabStop = false;
|
||||
//
|
||||
// frmPosIrtMessage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(788, 212);
|
||||
this.Controls.Add(this.lblMessage);
|
||||
this.Controls.Add(this.picSearchMessage);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "frmPosIrtMessage";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "조회중";
|
||||
this.Load += new System.EventHandler(this.frmPosIrtMessage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.picSearchMessage)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Timer tmrStart;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label lblMessage;
|
||||
private System.Windows.Forms.PictureBox picSearchMessage;
|
||||
}
|
||||
}
|
224
Agent/MasterDown/frmPosIrtMessage.cs
Normal file
|
@ -0,0 +1,224 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : 점포서버 IRT 통신 처리(제이슨 방식)
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.BackgroundDown
|
||||
{
|
||||
public partial class frmPosIrtMessage : Form
|
||||
{
|
||||
private SManager sManager = new SManager(); //이 객체를 통해 업무 Service 호출
|
||||
|
||||
private INetworkJSON m_cNetService = null;
|
||||
|
||||
private bool m_bSecondDisp = false; //초 표시여부
|
||||
private int m_nSecondCount = 0; //초(경과)
|
||||
|
||||
string m_sMessageStr;
|
||||
/// <summary>
|
||||
/// 화면표시 메시지
|
||||
/// </summary>
|
||||
public string PosMessageStr
|
||||
{
|
||||
get { return this.m_sMessageStr; }
|
||||
set
|
||||
{
|
||||
this.m_sMessageStr = value;
|
||||
try
|
||||
{
|
||||
lblMessage.Text = m_sMessageStr;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
string m_sServerIp;
|
||||
/// <summary>
|
||||
/// 서버IP
|
||||
/// </summary>
|
||||
public string ServerIp
|
||||
{
|
||||
get { return this.m_sServerIp; }
|
||||
set { this.m_sServerIp = value; }
|
||||
}
|
||||
|
||||
int m_nServerPort;
|
||||
/// <summary>
|
||||
/// 서버PORT
|
||||
/// </summary>
|
||||
public int ServerPort
|
||||
{
|
||||
get { return this.m_nServerPort; }
|
||||
set { this.m_nServerPort = value; }
|
||||
}
|
||||
|
||||
int m_nTimeOut;
|
||||
/// <summary>
|
||||
/// 서버 Timeout
|
||||
/// </summary>
|
||||
public int TimeOut
|
||||
{
|
||||
get { return this.m_nTimeOut; }
|
||||
set { this.m_nTimeOut = value; }
|
||||
}
|
||||
|
||||
string m_sCommHead;
|
||||
/// <summary>
|
||||
/// 송신데이터(공통해더)
|
||||
/// </summary>
|
||||
public string CommHead
|
||||
{
|
||||
get { return this.m_sCommHead; }
|
||||
set { this.m_sCommHead = value; }
|
||||
}
|
||||
|
||||
Hashtable m_htSendData;
|
||||
/// <summary>
|
||||
/// 송신데이터
|
||||
/// </summary>
|
||||
public Hashtable SendData
|
||||
{
|
||||
get { return this.m_htSendData; }
|
||||
set { this.m_htSendData = value; }
|
||||
}
|
||||
|
||||
Hashtable m_htRecvData;
|
||||
/// <summary>
|
||||
/// 수신데이터
|
||||
/// </summary>
|
||||
public Hashtable RecvData
|
||||
{
|
||||
get { return this.m_htRecvData; }
|
||||
set { this.m_htRecvData = value; }
|
||||
}
|
||||
|
||||
int m_nRecvRet;
|
||||
/// <summary>
|
||||
/// 수신리턴값
|
||||
/// </summary>
|
||||
public int RecvRet
|
||||
{
|
||||
get { return this.m_nRecvRet; }
|
||||
set { this.m_nRecvRet = value; }
|
||||
}
|
||||
|
||||
public frmPosIrtMessage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
||||
//this.UpdateStyles();
|
||||
|
||||
m_cNetService = (INetworkJSON)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK.DLL, ServiceLists.AGENT_NETWORK.NETWORK_JSON);
|
||||
}
|
||||
|
||||
private void frmPosIrtMessage_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + "PosConfig.INI");
|
||||
string sFont = m_PosConfig.GetMessage("GLOBAL").GetMessageValue("Font");
|
||||
FormManager.SetFormAllControlFont(this, sFont);
|
||||
long nScreenSizeUser = CmUtil.LongParse(m_PosConfig.GetMessage("GLOBAL").GetMessageValue("ScreenSizeUser"));
|
||||
FormManager.MovePopUpForm(this, false, nScreenSizeUser);
|
||||
|
||||
picSearchMessage.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.SCH_MESSAGE_BOX);
|
||||
|
||||
if (m_sMessageStr != "") lblMessage.Text = m_sMessageStr;
|
||||
|
||||
this.m_htRecvData = null;
|
||||
this.m_nRecvRet = 0;
|
||||
this.TopMost = true;
|
||||
|
||||
tmrStart.Enabled = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"Process Exception !!! " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void tmrStart_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
tmrStart.Enabled = false;
|
||||
|
||||
m_bSecondDisp = true;
|
||||
m_nSecondCount = 0;
|
||||
|
||||
Thread thrSecondDisp = new Thread(new ThreadStart(OnNetworkIRT));
|
||||
thrSecondDisp.Start();
|
||||
|
||||
OnSecondDisplay();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"Process Exception !!! " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSecondDisplay()
|
||||
{
|
||||
try
|
||||
{
|
||||
while(m_bSecondDisp == true)
|
||||
{
|
||||
m_nSecondCount++;
|
||||
if(m_nSecondCount % 10 == 0)
|
||||
{
|
||||
lblMessage.Text = m_sMessageStr + " (" + (int)(m_nSecondCount / 10) + ")";
|
||||
lblMessage.Update();
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"Process Exception !!! " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNetworkIRT()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bSecondDisp = true;
|
||||
if (m_cNetService == null) m_cNetService = (INetworkJSON)sManager.InitServiceInstance(ServiceLists.AGENT_NETWORK.DLL, ServiceLists.AGENT_NETWORK.NETWORK_IRT);
|
||||
m_nRecvRet = m_cNetService.IRTSendReceive(m_sServerIp, m_nServerPort, m_nTimeOut, m_sCommHead, m_htSendData, ref m_htRecvData);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"Process Exception !!! " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_bSecondDisp = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
123
Agent/MasterDown/frmPosIrtMessage.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="tmrStart.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
42
Agent/Measuring/Activator.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : 전자저울->라벨프린터 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
public Activator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_MEASURING.MEASURING_MAIN:
|
||||
{
|
||||
Cosmos.Measuring.MeasuringMain agentClass = new Cosmos.Measuring.MeasuringMain();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retObj;
|
||||
}
|
||||
}
|
||||
}
|
355
Agent/Measuring/LabelPrinter.cs
Normal file
|
@ -0,0 +1,355 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
namespace Cosmos.Measuring
|
||||
{
|
||||
public class LabelPrinter
|
||||
{
|
||||
#region 클래스 변수 선언
|
||||
private static SerialPort m_cSerialPort = null;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자
|
||||
public LabelPrinter()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion 생성자
|
||||
|
||||
#region OPEN / CLOSE 처리 함수
|
||||
public bool OpenLabelPrinter(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
if (m_cSerialPort != null)
|
||||
{
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Open 함수 Input Output 버퍼 삭제 (주석처리)
|
||||
// 추가
|
||||
if (m_cSerialPort.IsOpen != true) // 시리얼포트 오픈 실패
|
||||
{
|
||||
m_cSerialPort.Open(); // 시리얼포트 오픈
|
||||
}
|
||||
//m_cSerialPort.DiscardOutBuffer();
|
||||
//m_cSerialPort.DiscardInBuffer();
|
||||
//UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
// System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
// System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
// "▶▶ [Open InOut Buffer Clear]");
|
||||
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
return bRet;
|
||||
}
|
||||
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
m_cSerialPort = new SerialPort();
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT ERROR");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_cSerialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
|
||||
m_cSerialPort.PinChanged += new SerialPinChangedEventHandler(serialPort_PinChanged);
|
||||
m_cSerialPort.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort_ErrorReceived);
|
||||
|
||||
m_cSerialPort.NewLine = "\r\n";
|
||||
m_cSerialPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
|
||||
m_cSerialPort.WriteBufferSize = 1024 * 1024;
|
||||
m_cSerialPort.PortName = sSerialPort;
|
||||
m_cSerialPort.BaudRate = (int)lBaudrate;
|
||||
m_cSerialPort.DataBits = 8;
|
||||
m_cSerialPort.StopBits = StopBits.One;
|
||||
m_cSerialPort.Parity = Parity.None;
|
||||
m_cSerialPort.Handshake = Handshake.None;
|
||||
m_cSerialPort.ReadTimeout = 500;
|
||||
m_cSerialPort.WriteTimeout = 2000;
|
||||
|
||||
m_cSerialPort.Open();
|
||||
if(m_cSerialPort.IsOpen == false)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT OPEN ERROR");
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]" + bRet);
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool CloseLabelPrinter()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_cSerialPort == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Close 함수 Input Output 버퍼 삭제
|
||||
// 추가
|
||||
m_cSerialPort.DiscardOutBuffer();
|
||||
m_cSerialPort.DiscardInBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
m_cSerialPort.Close();
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (기존)
|
||||
//m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE] Close InOut Buffer Clear :" + bRet);
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (변경)
|
||||
m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion OPEN / CLOSE 처리 함수
|
||||
|
||||
#region SerialPort 이벤트
|
||||
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort serialPort = (SerialPort)sender;
|
||||
byte[] bytRecvBuf = new byte[serialPort.BytesToRead];
|
||||
|
||||
try
|
||||
{
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - DataReceived 시리얼 포트 null check
|
||||
// 기존
|
||||
//serialPort.Read(bytRecvBuf, 0, bytRecvBuf.Length);
|
||||
// 변경
|
||||
if (serialPort != null && serialPort.IsOpen == true) // 시리얼포트 객체 및 오픈 확인
|
||||
{
|
||||
serialPort.Read(bytRecvBuf, 0, bytRecvBuf.Length);
|
||||
|
||||
#region log
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [RECV] " + Encoding.UTF8.GetString(bytRecvBuf));
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
#endregion
|
||||
}
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void serialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion SerialPort 이벤트
|
||||
|
||||
#region 출력 함수
|
||||
/// <summary>
|
||||
/// 중량 출력
|
||||
/// </summary>
|
||||
/// <param name="sContent">상품명 : 중량g</param>
|
||||
/// <param name="iWeight">중량</param>
|
||||
/// <param name="sDateTime">YYYY-MM-DD HH:MM:SS</param>
|
||||
/// <param name="sStoreNm">점포명</param>
|
||||
public void PrintWeightInfo(string sContent, string sDateTime, string sStoreNm)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "NASC 949\r\n" // intermec 한글폰트 설정
|
||||
, "PRPOS 0,150\r\n"
|
||||
, "PRTXT \"" + sContent + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + sDateTime + "\"\r\n"
|
||||
, "PRPOS 0,70\r\n"
|
||||
, "PRTXT \"" + sStoreNm + "\"\r\n"
|
||||
, "PRPOS 0,30\r\n"
|
||||
, "PRTXT \"배달은 해피오더 / 1670-3131\"\r\n" //#10856_[BR] 저울 중량 라벨프린터 양식 변경_hs
|
||||
, "PF\r\n" };
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void PrintWeightInfo(string sContent, string sFlavour1, string sFlavour2, string sOrdDateTime, string sPckDateTime)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
|
||||
try
|
||||
{
|
||||
// EX)
|
||||
// 패밀리 / 980g (5516)
|
||||
// 플레이버1/플레이버2/플레이버3
|
||||
// 플레이버4/플레이버5/플레이버6
|
||||
//
|
||||
// 주문 YYYY-MM-DD HH시MM분
|
||||
// 포장 YYYY-MM-DD HH시MM분
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "NASC 949\r\n"
|
||||
, "PRPOS 0,190\r\n"
|
||||
, "PRTXT \"" + sContent + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 0,150\r\n"
|
||||
, "PRTXT \"" + sFlavour1 + "\"\r\n"
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + sFlavour2 + "\"\r\n"
|
||||
, "PRPOS 0,50\r\n"
|
||||
, "PRTXT \"" + sOrdDateTime + "\"\r\n"
|
||||
, "PRPOS 0,10\r\n"
|
||||
, "PRTXT \"" + sPckDateTime + "\"\r\n"
|
||||
, "PF\r\n" };
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 출력 함수
|
||||
|
||||
#region 명령어 전송 함수
|
||||
/// <summary>
|
||||
/// 시리얼포트에 명령어를 전송
|
||||
/// </summary>
|
||||
/// <param name="sCommands"></param>
|
||||
private void WriteCommand(string[] sCommands)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(string cmd in sCommands)
|
||||
{
|
||||
m_cSerialPort.Write(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 명령어 전송 함수
|
||||
}
|
||||
}
|
86
Agent/Measuring/Measuring.csproj
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C1D7E706-7F5B-4DF3-85DD-E3F2A097144B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Measuring</RootNamespace>
|
||||
<AssemblyName>Agent.Measuring</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="LabelPrinter.cs" />
|
||||
<Compile Include="MeasuringMain.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scale.cs" />
|
||||
<Compile Include="ScalePoleDisplay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.Measuring.dll .\Agent.Measuring.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.Measuring.dll .\IC\Agent.Measuring.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
696
Agent/Measuring/MeasuringMain.cs
Normal file
|
@ -0,0 +1,696 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
|
||||
namespace Cosmos.Measuring
|
||||
{
|
||||
public class MeasuringMain : IMeasuring
|
||||
{
|
||||
#region 클래스 변수 선언
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// POS Status Value (POS 상태값)
|
||||
/// </summary>
|
||||
private PosStatus m_cPosStatus = null;
|
||||
/// <summary>
|
||||
/// POS 주변장치
|
||||
/// </summary>
|
||||
private DeviceStatus m_cDevStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// 중량 출력 모드
|
||||
/// </summary>
|
||||
private PosConst.MEASURING_AGENT_PRINT_MODE PrintMode;
|
||||
|
||||
/// <summary>
|
||||
/// 출력용 핸드폰번호
|
||||
/// </summary>
|
||||
private string m_sCPNum = "";
|
||||
public string CPNum { get { return m_sCPNum; } set { m_sCPNum = value; } }
|
||||
/// <summary>
|
||||
/// 출력용 플레이버
|
||||
/// </summary>
|
||||
private string m_sFlavour1 = "";
|
||||
public string Flavour1 { get { return m_sFlavour1; } set { m_sFlavour1 = value; } }
|
||||
private string m_sFlavour2 = "";
|
||||
public string Flavour2 { get { return m_sFlavour2; } set { m_sFlavour2 = value; } }
|
||||
/// <summary>
|
||||
/// 출력용 주문시간
|
||||
/// </summary>
|
||||
private string m_sOrdDT = "";
|
||||
public string OrdDT { get { return m_sOrdDT; } set { m_sOrdDT = value; } }
|
||||
|
||||
private Scale m_cScaleDevice = null;
|
||||
private LabelPrinter m_cLabelPrtDevice = null;
|
||||
private ScalePoleDisplay m_cScalePoleDisplay = null;
|
||||
|
||||
private string m_sOldOrdDate = "";
|
||||
private string m_sOldOrdTime = "";
|
||||
|
||||
/// <summary>
|
||||
/// MSSQL DB 관련 객체
|
||||
/// </summary>
|
||||
private static SqlDB sqlDb = null;
|
||||
|
||||
/// <summary>
|
||||
/// Measuring Thread 작동 여부
|
||||
/// </summary>
|
||||
private bool m_MeasuringRunning = true;
|
||||
|
||||
/// <summary>
|
||||
/// Measuring Thread
|
||||
/// </summary>
|
||||
private Thread m_tMeasuring = null;
|
||||
|
||||
/// <summary>
|
||||
/// 대기시간
|
||||
/// </summary>
|
||||
private int WAIT_TIME = 60000 * 30;
|
||||
|
||||
/// <summary>
|
||||
/// 저울 델리게이트
|
||||
/// </summary>
|
||||
/// <param name="bPrintYn"></param>
|
||||
/// <param name="iWeight"></param>
|
||||
/// <param name="sUnit"></param>
|
||||
/// <param name="sItemNm"></param>
|
||||
public delegate void DelegateScaleDevice(bool bPrintYn, int iWeight, string sUnit, string sItemNm);
|
||||
|
||||
public delegate void DelegateScaleDeviceRaw(string sScaleData);
|
||||
|
||||
public static DelegateScaleDevice m_delegateScaleDev = null;
|
||||
public static DelegateScaleDeviceRaw m_delegateScaleDevRaw = null;
|
||||
|
||||
private bool m_bOncePrint = false;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자
|
||||
public MeasuringMain()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
|
||||
m_cScaleDevice = new Scale();
|
||||
m_cLabelPrtDevice = new LabelPrinter();
|
||||
m_cScalePoleDisplay = new ScalePoleDisplay();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Default 출력 모드는 일반중량출력
|
||||
PrintMode = PosConst.MEASURING_AGENT_PRINT_MODE.NORMAL;
|
||||
|
||||
CPNum = "";
|
||||
Flavour1 = "";
|
||||
Flavour2 = "";
|
||||
OrdDT = "";
|
||||
}
|
||||
#endregion 생성자
|
||||
|
||||
#region Measuring 데몬 기동/종료
|
||||
public void StartMeasuring()
|
||||
{
|
||||
try
|
||||
{
|
||||
Initialize();
|
||||
|
||||
// 저울 델리게이트 생성
|
||||
m_delegateScaleDev = new DelegateScaleDevice(OnScaleDeviceEvent);
|
||||
// 저울 RAW Data 델리게이트 생성
|
||||
m_delegateScaleDevRaw = new DelegateScaleDeviceRaw(OnScaleDataEvent);
|
||||
|
||||
if (m_tMeasuring == null)
|
||||
{
|
||||
m_tMeasuring = new Thread(new ThreadStart(ThreadMeasuringRun));
|
||||
m_MeasuringRunning = true;
|
||||
m_tMeasuring.Start();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopMeasuring()
|
||||
{
|
||||
try
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Measuring Service Stop!!!");
|
||||
|
||||
m_MeasuringRunning = false;
|
||||
|
||||
int count = 0;
|
||||
while(count < 10)
|
||||
{
|
||||
if (m_tMeasuring != null && m_tMeasuring.IsAlive) m_MeasuringRunning = false;
|
||||
else break;
|
||||
|
||||
count++;
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
|
||||
if(count >= 10)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Force Measuring Service Stop!!!");
|
||||
m_tMeasuring.Abort();
|
||||
}
|
||||
|
||||
m_tMeasuring = null;
|
||||
|
||||
// 저울 델리게이트 Release
|
||||
m_delegateScaleDev = null;
|
||||
|
||||
// 전자저울 SerialPort Close
|
||||
m_cScaleDevice.CloseScale();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion Measuring 데몬 기동/종료
|
||||
|
||||
#region Measuring Main
|
||||
private void ThreadMeasuringRun()
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Measuring Service Run!!");
|
||||
|
||||
while(m_MeasuringRunning)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 전자저울 SerialPort Open
|
||||
bool bReturn = m_cScaleDevice.OpenScale(m_cPosStatus.Base.OlePosScaleSerialPortNumber, m_cPosStatus.Base.OlePosScaleSerialBaudRate);
|
||||
// 2017.05.17
|
||||
Thread.Sleep(500);
|
||||
|
||||
if (bReturn == true)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Scale port open succeed");
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Scale port open failed");
|
||||
}
|
||||
|
||||
int nNowSleepTerm = 0;
|
||||
while(nNowSleepTerm < WAIT_TIME)
|
||||
{
|
||||
if (m_MeasuringRunning == false) break;
|
||||
Thread.Sleep(100);
|
||||
nNowSleepTerm += 100;
|
||||
}
|
||||
m_cScaleDevice.CloseScale();
|
||||
|
||||
// 2017.05.17
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Measuring Service Exception : " + ex.Message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Measuring Service Exit!!");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 중량 출력 모드 변경
|
||||
public void SetPrintMode(PosConst.MEASURING_AGENT_PRINT_MODE sMode)
|
||||
{
|
||||
try
|
||||
{
|
||||
PrintMode = sMode;
|
||||
|
||||
if(PrintMode == PosConst.MEASURING_AGENT_PRINT_MODE.NORMAL)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 중량 출력 모드 변경
|
||||
|
||||
#region 플레이버 내용 등록(출력용)
|
||||
public void SetHappyOrderData(string[] sData)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sData.Length == 1)
|
||||
{
|
||||
CPNum = sData[0];
|
||||
Flavour1 = "";
|
||||
Flavour2 = "";
|
||||
}
|
||||
else if (sData.Length == 2)
|
||||
{
|
||||
CPNum = sData[0];
|
||||
Flavour1 = sData[1];
|
||||
Flavour2 = "";
|
||||
}
|
||||
else if(sData.Length > 2)
|
||||
{
|
||||
CPNum = sData[0];
|
||||
Flavour1 = sData[1];
|
||||
Flavour2 = sData[2];
|
||||
OrdDT = sData[3];
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 플레이버 내용 등록(출력용)
|
||||
|
||||
#region Scale Device Event 관련
|
||||
public void OnScaleDeviceEvent(bool bPrintYn, int iWeight, string sUnit, string sItemNm)
|
||||
{
|
||||
try
|
||||
{
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
if (m_bOncePrint == false)
|
||||
{
|
||||
m_bOncePrint = true;
|
||||
string sCurDT = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string sScaleDate = sCurDT.Substring(0, 10).Replace("-", "");
|
||||
string sScaleTime = sCurDT.Substring(11, 8).Replace(":", "");
|
||||
|
||||
if (m_sOldOrdTime == "" || (m_sOldOrdTime.Equals(sScaleTime) == false))
|
||||
{
|
||||
m_sOldOrdDate = sScaleDate;
|
||||
m_sOldOrdTime = sScaleTime;
|
||||
|
||||
// 정상중량일 경우에만 라벨프린터 출력함
|
||||
if (bPrintYn == true)
|
||||
{
|
||||
if (PrintMode == PosConst.MEASURING_AGENT_PRINT_MODE.NORMAL)
|
||||
ProcWeightInfo(sItemNm, iWeight, sUnit, sCurDT);
|
||||
else
|
||||
ProcWeightInfoOnHappyOrder(sItemNm, iWeight, sUnit, sCurDT);
|
||||
}
|
||||
|
||||
// 저울 데이터 저장
|
||||
// 중량 미달일 경우에도 저울 데이터는 저장
|
||||
InsertScaleLog(sScaleDate, sScaleTime, iWeight, sItemNm, bPrintYn ? "1" : "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_bOncePrint = false;
|
||||
}
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
}
|
||||
|
||||
public void OnScaleDataEvent(string sScaleData)
|
||||
{
|
||||
try
|
||||
{
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
// ScalePoleDisplay 사용일 경우에만 출력
|
||||
if(m_cDevStatus.ScalePoleDisplay.UseYn == true)
|
||||
{
|
||||
ProcScalePoleDisplay(sScaleData);
|
||||
}
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion Device Event 관련
|
||||
|
||||
#region DB 관련
|
||||
public void InsertScaleLog(string sDate, string sTime, int iWeight, string sItemNm, string sNormalYn)
|
||||
{
|
||||
string sQuery = "";
|
||||
string sInsQuery = "";
|
||||
sqlDb = null;
|
||||
|
||||
try
|
||||
{
|
||||
sqlDb = new SqlDB(m_cPosStatus.Base.LocalDbSource, m_cPosStatus.Base.LocalDbCatalog, m_cPosStatus.Base.LocalDbUserID, m_cPosStatus.Base.LocalDbPassword);
|
||||
|
||||
sQuery = "INSERT INTO POSLOG..ETC_SCALE_LOG ";
|
||||
sQuery += " ( CMP_CD, BRAND_CD, SALE_DT, STOR_CD, POS_NO ";
|
||||
sQuery += " , SCALE_DT, SCALE_TM, WEIGHT, ITEM_NM, NORMAL_YN ";
|
||||
sQuery += " , SEND_YN, REG_DATE, UPD_DATE ) ";
|
||||
sQuery += "VALUES ";
|
||||
sQuery += " ( '{0}', '{1}', '{2}', '{3}', '{4}' ";
|
||||
sQuery += " , '{5}', '{6}', {7}, N'{8}', '{9}' ";
|
||||
sQuery += " , '{10}', '{11}', '{12}' ) ";
|
||||
|
||||
sInsQuery = string.Format( sQuery
|
||||
, m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.BrandCd, m_cPosStatus.Base.SaleDate, m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.PosNo
|
||||
, sDate, sTime, iWeight, sItemNm, sNormalYn
|
||||
, "0", DateTime.Now.ToString("yyyyMMddHHmmss"), DateTime.Now.ToString("yyyyMMddHHmmss"));
|
||||
|
||||
int iRet = sqlDb.DBExecuteNonQuery(sInsQuery, System.Data.CommandType.Text, (System.Data.SqlClient.SqlParameter[])null);
|
||||
if(iRet != UserCom.OK)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Insert Failed!! " + "[" + sInsQuery + "]");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sqlDb != null)
|
||||
{
|
||||
sqlDb.DBClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 라벨프린터 출력 함수
|
||||
public void ProcWeightInfo(string sItemNm, int iWeight, string sUnit, string sCurTime)
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
//if (m_bOncePrint == false)
|
||||
//{
|
||||
|
||||
// 라벨프린터 Open
|
||||
bRet = m_cLabelPrtDevice.OpenLabelPrinter(m_cPosStatus.Base.OlePosLabelPrinterSerialPortNumber, m_cPosStatus.Base.OlePosLabelPrinterSerialBaudRate);
|
||||
|
||||
if(bRet == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//m_bOncePrint = true;
|
||||
//grayber@20180228 중량 라벨 출력 변경 start
|
||||
//기존
|
||||
//string sContent = sItemNm + " : " + iWeight.ToString() + sUnit;
|
||||
//변경
|
||||
string sContent = sItemNm + " : " + string.Format( "{0:#,###}",iWeight) + sUnit;
|
||||
//grayber@20180228 중량 라벨 출력 변경 start
|
||||
|
||||
string sDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ LabelPrt: [" + sContent + "]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
// 중량정보 출력
|
||||
|
||||
//grayber@20180228 중량 라벨 출력 변경 start
|
||||
// 기존
|
||||
//m_cLabelPrtDevice.PrintWeightInfo(sContent, sDateTime, CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM));
|
||||
// 변경
|
||||
m_cLabelPrtDevice.PrintWeightInfo(sContent, sDateTime, CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM) + " 점");
|
||||
//grayber@20180228 중량 라벨 출력 변경 end
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
// 라벨프린터 Close
|
||||
bRet = m_cLabelPrtDevice.CloseLabelPrinter();
|
||||
|
||||
//m_bOncePrint = false;
|
||||
//}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcWeightInfoOnHappyOrder(string sItemNm, int iWeight, string sUnit, string sCurTime)
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
// 라벨프린터 Open
|
||||
bRet = m_cLabelPrtDevice.OpenLabelPrinter(m_cPosStatus.Base.OlePosLabelPrinterSerialPortNumber, m_cPosStatus.Base.OlePosLabelPrinterSerialBaudRate);
|
||||
|
||||
if (bRet == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_bOncePrint = true;
|
||||
|
||||
string sContent = sItemNm + " / " + iWeight.ToString() + sUnit + " (" + CPNum + ")";
|
||||
string sOrdDateTime = "주문 " + OrdDT;
|
||||
string sPckDateTime = "포장 " + sCurTime;
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ LabelPrt: [" + sContent + "]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
// 중량정보 출력
|
||||
m_cLabelPrtDevice.PrintWeightInfo(sContent, Flavour1, Flavour2, sOrdDateTime, sPckDateTime);
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [CLOSE]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
// 라벨프린터 Close
|
||||
bRet = m_cLabelPrtDevice.CloseLabelPrinter();
|
||||
|
||||
m_bOncePrint = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 라벨프린터 출력 함수
|
||||
|
||||
#region ScalePoleDisplay 출력 함수
|
||||
/// <summary>
|
||||
/// ScalePoleDisplay 출력
|
||||
/// </summary>
|
||||
/// <param name="sScaleData">저울에서 입력된 값 Ex) ST,+00000.00__g</param>
|
||||
public void ProcScalePoleDisplay(string sScaleData)
|
||||
{
|
||||
try
|
||||
{
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
m_cScalePoleDisplay.OpenScalePoleDisplay(m_cPosStatus.Base.OleScalePoleDisplayPortNumber, m_cPosStatus.Base.OleScalePoleDisplayBaudRate);
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ " + "PoleDisplay: " + "[" + sScaleData + "]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
m_cScalePoleDisplay.WriteToScalePoleDisplay(sScaleData);
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ CLOSE");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
m_cScalePoleDisplay.CloseScalePoleDisplay();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion ScalePoleDisplay 출력 함수
|
||||
}
|
||||
}
|
36
Agent/Measuring/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("Measuring")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Measuring")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("652f0e60-5407-4be2-b7c4-62bff0636cf2")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
425
Agent/Measuring/Scale.cs
Normal file
|
@ -0,0 +1,425 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
namespace Cosmos.Measuring
|
||||
{
|
||||
public class Scale
|
||||
{
|
||||
#region 클래스 변수 선언
|
||||
/// <summary>
|
||||
/// 전자저울과의 RS232 통신을 위한 시리얼포트 객체
|
||||
/// </summary>
|
||||
private SerialPort m_cSerialPort = null;
|
||||
/// <summary>
|
||||
/// 전자저울 이벤트 수신 후 처리할 작업용 스레드 작업(라벨프린터 출력)
|
||||
/// </summary>
|
||||
private BackgroundWorker bw = null;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자
|
||||
public Scale()
|
||||
{
|
||||
bw = new BackgroundWorker();
|
||||
}
|
||||
#endregion 생성자
|
||||
|
||||
#region OPEN / CLOSE 처리 함수
|
||||
public bool OpenScale(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_cSerialPort != null)
|
||||
{
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Open 함수 Input Output 버퍼 삭제 (주석처리)
|
||||
//m_cSerialPort.DiscardInBuffer();
|
||||
//m_cSerialPort.DiscardOutBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
m_cSerialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_cSerialPort = null;
|
||||
}
|
||||
|
||||
if (m_cSerialPort == null)
|
||||
{
|
||||
m_cSerialPort = new SerialPort();
|
||||
if (m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT ERROR");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_cSerialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
|
||||
m_cSerialPort.PinChanged += new SerialPinChangedEventHandler(serialPort_PinChanged);
|
||||
m_cSerialPort.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort_ErrorReceived);
|
||||
|
||||
m_cSerialPort.NewLine = "\r\n";
|
||||
m_cSerialPort.Encoding = Encoding.ASCII;
|
||||
m_cSerialPort.WriteBufferSize = 512;
|
||||
m_cSerialPort.PortName = sSerialPort;
|
||||
m_cSerialPort.BaudRate = (int)lBaudrate;
|
||||
m_cSerialPort.DataBits = 7;
|
||||
m_cSerialPort.StopBits = StopBits.One;
|
||||
m_cSerialPort.Parity = Parity.Even;
|
||||
m_cSerialPort.Handshake = Handshake.None;
|
||||
m_cSerialPort.ReadTimeout = 5000;
|
||||
m_cSerialPort.WriteTimeout = 5000;
|
||||
|
||||
m_cSerialPort.Open();
|
||||
if (m_cSerialPort.IsOpen == false)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT OPEN ERROR");
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// BackgroundWorker 이벤트 함수 등록
|
||||
bw.DoWork += DeviceEventHandler;
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool CloseScale()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_cSerialPort_Scale == null)");
|
||||
return bRet;
|
||||
}
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Close 함수 Input Output 버퍼 삭제
|
||||
m_cSerialPort.DiscardInBuffer();
|
||||
m_cSerialPort.DiscardOutBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
m_cSerialPort.Close();
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (기존)
|
||||
//m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
// BackgroundWorker 이벤트 함수 제거
|
||||
bw.DoWork -= DeviceEventHandler;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (변경)
|
||||
m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion OPEN / CLOSE 처리 함수
|
||||
|
||||
#region SerialPort Alive 체크
|
||||
public bool IsPortOpend()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_cSerialPort.IsOpen == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
bRet = false;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SerialPort 이벤트
|
||||
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort serialPort = (SerialPort)sender;
|
||||
string sHeader = "";
|
||||
|
||||
try
|
||||
{
|
||||
if ((SerialPort)sender == m_cSerialPort)
|
||||
{
|
||||
if (!bw.IsBusy)
|
||||
{
|
||||
// 데이터의 Terminator는 개행문자(\r\n)이므로 개행문자 까지 값을 읽는 ReadLine으로 수신
|
||||
string sScaleData = serialPort.ReadLine();
|
||||
sHeader = sScaleData.Substring(0, 2);
|
||||
|
||||
// ST:계량모드, QT:계수모드, US:데이터가 안정되지 않다, OL:데이터가 오버되어 있다.(계량범위를 넘었다.)
|
||||
if (sHeader.Equals("ST"))
|
||||
{
|
||||
bw.RunWorkerAsync(sScaleData);
|
||||
}
|
||||
else if (sHeader.Equals("QT"))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ " + "Recv: " + "[" + sScaleData + "]");
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"저울 이벤트 처리 전 이벤트 발생 불가");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void serialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion SerialPort 이벤트
|
||||
|
||||
#region Event Handler
|
||||
private void DeviceEventHandler(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
string sScaleData = "";
|
||||
string sHeader = "";
|
||||
string sWeight = "";
|
||||
string sUnit = "";
|
||||
string sItemNm = "";
|
||||
bool bPrintYn = false;
|
||||
|
||||
try
|
||||
{
|
||||
// Ex) ST,+00000.00__g
|
||||
sScaleData = (string)e.Argument;
|
||||
|
||||
sHeader = sScaleData.Substring(0, 2);
|
||||
sWeight = sScaleData.Substring(3, 9);
|
||||
sUnit = sScaleData.Substring(12, 3).Trim();
|
||||
bPrintYn = GetItemNameByWeight(Convert.ToInt32(sWeight), ref sItemNm);
|
||||
|
||||
// 저울 입력 이벤트 전달
|
||||
if (MeasuringMain.m_delegateScaleDev != null)
|
||||
MeasuringMain.m_delegateScaleDev(bPrintYn, Convert.ToInt32(sWeight), sUnit, sItemNm);
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"MeasuringMain.m_delegateScaleDev is null.");
|
||||
}
|
||||
|
||||
// 저울 입력 데이터 전달
|
||||
if(MeasuringMain.m_delegateScaleDevRaw != null)
|
||||
{
|
||||
MeasuringMain.m_delegateScaleDevRaw(sScaleData);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"MeasuringMain.m_delegateScaleDevRaw is null.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion Event Handler
|
||||
|
||||
#region 중량데이터로 상품명 얻기
|
||||
/// <summary>
|
||||
/// 측정된 중량으로 상품명 가져오기
|
||||
/// </summary>
|
||||
/// <param name="iWeight"></param>
|
||||
/// <param name="sItemNm"></param>
|
||||
/// <returns></returns>
|
||||
private bool GetItemNameByWeight(int iWeight, ref string sItemNm)
|
||||
{
|
||||
bool bIsOk = false;
|
||||
sItemNm = string.Empty;
|
||||
try
|
||||
{
|
||||
if (iWeight >= 236 && iWeight <= 335)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0545);
|
||||
bIsOk = false;
|
||||
}
|
||||
|
||||
//else if (iWeight >= 336 && iWeight <= 434)
|
||||
//{
|
||||
// sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0545);
|
||||
// bIsOk = true;
|
||||
//}
|
||||
//else if (iWeight >= 435 && iWeight <= 534)
|
||||
//{
|
||||
// sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0546);
|
||||
// bIsOk = true;
|
||||
//}
|
||||
//#10856] (신규) [BR] 저울 중량 라벨프린터 양식 변경
|
||||
//스타워즈 파인트 제외
|
||||
else if (iWeight >= 336 && iWeight <= 534)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0545);
|
||||
bIsOk = true;
|
||||
}
|
||||
else if (iWeight >= 545 && iWeight <= 642)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0547);
|
||||
bIsOk = false;
|
||||
}
|
||||
else if (iWeight >= 643 && iWeight <= 742)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0547);
|
||||
bIsOk = true;
|
||||
}
|
||||
else if (iWeight >= 889 && iWeight <= 988)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0548);
|
||||
bIsOk = false;
|
||||
}
|
||||
else if (iWeight >= 989 && iWeight <= 1088)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0548);
|
||||
bIsOk = true;
|
||||
}
|
||||
//grayber@20180213 [BR] 핸드팩 중량 출력 대상 제품 추가 요청 start
|
||||
// 추가
|
||||
else if (iWeight >= 1104 && iWeight <= 1199)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1095);
|
||||
bIsOk = true;
|
||||
}
|
||||
// 기존
|
||||
//else if (iWeight >= 1137 && iWeight <= 1236)
|
||||
// 변경
|
||||
else if (iWeight >= 1200 && iWeight <= 1236)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0549);
|
||||
bIsOk = false;
|
||||
}
|
||||
//grayber@20180213 [BR] 핸드팩 중량 출력 대상 제품 추가 요청 end
|
||||
|
||||
else if (iWeight >= 1237 && iWeight <= 1536)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0549);
|
||||
bIsOk = true;
|
||||
}
|
||||
else if (iWeight >= 1700 && iWeight <= 1999)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0550);
|
||||
bIsOk = false;
|
||||
}
|
||||
else if (iWeight >= 2000 && iWeight <= 2300)
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0550);
|
||||
bIsOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sItemNm = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0551);
|
||||
bIsOk = false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bIsOk;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
155
Agent/Measuring/ScalePoleDisplay.cs
Normal file
|
@ -0,0 +1,155 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
namespace Cosmos.Measuring
|
||||
{
|
||||
class ScalePoleDisplay
|
||||
{
|
||||
#region 클래스 변수 선언
|
||||
private static SerialPort m_cSerialPort = null;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자
|
||||
#endregion 생성자
|
||||
|
||||
#region OPEN / CLOSE 처리 함수
|
||||
public bool OpenScalePoleDisplay(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if(m_cSerialPort != null)
|
||||
{
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Open 함수 Input Output 버퍼 삭제(주석처리)
|
||||
m_cSerialPort.DiscardInBuffer();
|
||||
m_cSerialPort.DiscardOutBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
m_cSerialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_cSerialPort = null;
|
||||
}
|
||||
|
||||
m_cSerialPort = new SerialPort();
|
||||
|
||||
m_cSerialPort.NewLine = "\r\n";
|
||||
m_cSerialPort.Encoding = Encoding.Default;
|
||||
m_cSerialPort.WriteBufferSize = 512;
|
||||
m_cSerialPort.PortName = sSerialPort;
|
||||
m_cSerialPort.BaudRate = (int)lBaudrate;
|
||||
m_cSerialPort.ReadTimeout = 500;
|
||||
m_cSerialPort.WriteTimeout = 2000;
|
||||
m_cSerialPort.DataBits = 8;
|
||||
m_cSerialPort.StopBits = StopBits.One;
|
||||
m_cSerialPort.Parity = Parity.None;
|
||||
m_cSerialPort.Handshake = Handshake.None;
|
||||
|
||||
m_cSerialPort.Open();
|
||||
if(m_cSerialPort.IsOpen == false)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"SERIAL PORT OPEN ERROR");
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 start
|
||||
#if true // 로그추가
|
||||
//grayber@20171222 디버그 로그 추가 - 저울 디버그
|
||||
UserLog.WriteLogFile(UserCom.LOG_OP,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"▶▶ [OPEN]" + bRet);
|
||||
#endif
|
||||
//grayber@20171222 저울,라벨프린터, PoleDisplay 디버그 로그 추가 end
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool CloseScalePoleDisplay()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if(m_cSerialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_cSerialPort_Scale == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - Close 함수 Input Output 버퍼 삭제
|
||||
m_cSerialPort.DiscardInBuffer();
|
||||
m_cSerialPort.DiscardOutBuffer();
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
|
||||
m_cSerialPort.Close();
|
||||
bRet = true;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (기존)
|
||||
//m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
//grayber@20180307 시리얼 포트 flush 추가 start - try 문 밖으로 이동 (변경)
|
||||
m_cSerialPort = null;
|
||||
//grayber@20180307 시리얼 포트 flush 추가 end
|
||||
return bRet;
|
||||
}
|
||||
#endregion OPEN / CLOSE 처리 함수
|
||||
|
||||
#region 출력 함수
|
||||
public void WriteToScalePoleDisplay(string sScaleData)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
m_cSerialPort.WriteLine(sScaleData);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
m_cSerialPort.WriteLine(sScaleData);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
|
||||
m_cSerialPort.WriteLine(sScaleData);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion 출력 함수
|
||||
}
|
||||
}
|
81
Agent/Network/Activator.cs
Normal file
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : Network 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Load BaseFrame and save information (BaseFrame의 로드하고 정보를 보관한다)
|
||||
/// </summary>
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Define main entrance point of project load. (프로젝트 로드의 주진입점을 정의합니다.)
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_NETWORK.NETWORK_FTP:
|
||||
{
|
||||
Cosmos.Network.NetworkFtp agentClass = new Cosmos.Network.NetworkFtp();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_NETWORK.NETWORK_IRT:
|
||||
{
|
||||
Cosmos.Network.NetworkIRT agentClass = new Cosmos.Network.NetworkIRT();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_NETWORK.NETWORK_JSON:
|
||||
{
|
||||
Cosmos.Network.NetworkJSON agentClass = new Cosmos.Network.NetworkJSON();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_NETWORK.NETWORK_VAN_SPCN:
|
||||
{
|
||||
Cosmos.Network.NetworkVanSPCN agentClass = new Cosmos.Network.NetworkVanSPCN();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_NETWORK.NETWORK_HTTP:
|
||||
{
|
||||
Cosmos.Network.NetworkHttp agentClass = new Cosmos.Network.NetworkHttp();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
}
|
||||
}
|
||||
}
|
93
Agent/Network/Network.csproj
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{233E83BF-BFFE-495D-9E3C-3583F9CD2773}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Network</RootNamespace>
|
||||
<AssemblyName>Agent.Network</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\BIN\Agent.Network.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="NetworkFtp.cs" />
|
||||
<Compile Include="NetworkHttp.cs" />
|
||||
<Compile Include="NetworkIRT.cs" />
|
||||
<Compile Include="NetworkJSON.cs" />
|
||||
<Compile Include="NetworkVanSPCN.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.Network.dll .\Agent.Network.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.Network.dll .\IC\Agent.Network.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
181
Agent/Network/NetworkFtp.cs
Normal file
|
@ -0,0 +1,181 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Data;
|
||||
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : FTP 다운로드
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Network
|
||||
{
|
||||
public class NetworkFtp : INetworkFTP
|
||||
{
|
||||
private readonly string LOCAL_DOWN_PATH = BaseCom.NxRootPath + @"DOWN\"; //Download File Location (다운로드 파일위치)
|
||||
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// POS Status Value (POS 상태값)
|
||||
/// </summary>
|
||||
private PosStatus m_cPosStatus = null;
|
||||
|
||||
private FTP m_ClsFtp;
|
||||
|
||||
public NetworkFtp()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP 서버에 Connect
|
||||
/// </summary>
|
||||
/// <param name="sServer"></param>
|
||||
/// <param name="sUserId"></param>
|
||||
/// <param name="sPassword"></param>
|
||||
/// <param name="iTimeOutSeconds"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <returns>0 : 정상접속, -1:시간초과, -2:로그인 실패, -3:서버접속 실패, -4:지원하지 않는 시스템</returns>
|
||||
public int Connect(string sServer, string sUserId, string sPassword, int iTimeOutSeconds, int iPort)
|
||||
{
|
||||
int nReturn = -9;
|
||||
|
||||
try
|
||||
{
|
||||
m_ClsFtp = new FTP((iPort == 0) ? sServer : sServer + ":" + iPort, sUserId, sPassword);
|
||||
|
||||
if (m_ClsFtp != null) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
|
||||
////m_ClsFtp = new ClsFtp(sServer, sUserId, sPassword, iTimeOutSeconds, iPort);
|
||||
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// //MessageBox.Show("FTP Server Connect Error !!! [" + nReturn.ToString() + "]");
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Connect()", e.Message);
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상종료, -1:Not Connected, -2:Binary Mode set failed, -3: failed local file Create, -4:socket 에러, -5:remote file 없슴, -6:정상수신실패, -7: 파일사이즈 틀림</returns>
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
string sMsg = "";
|
||||
return Download(sSvrDirectory, sLocalDirectory, sFileNm, ref sMsg, sFtpMode);
|
||||
}
|
||||
public int Download(string sSvrDirectory, string sLocalDirectory, string sFileNm, ref string sMsg, string sFtpMode = PosConst.FTP_CONN_TYPE.PASSIVE)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (CmUtil.RightH(sLocalDirectory, 1) != "\\") sLocalDirectory += "\\";
|
||||
|
||||
if (Directory.Exists(sLocalDirectory) == false) Directory.CreateDirectory(sLocalDirectory);
|
||||
|
||||
bRet = m_ClsFtp.Download(sSvrDirectory + sFileNm, sLocalDirectory + sFileNm, ref sMsg, sFtpMode);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Download(sLocalDirectory, sFileNm, true);
|
||||
////if (nReturn < 0 && File.Exists(BaseCom.NxDownPath + sFileNm + ".ftp") == true)
|
||||
////{
|
||||
//// File.Delete(BaseCom.NxDownPath + sFileNm + ".ftp");
|
||||
////}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Download()", e.Message);
|
||||
|
||||
sMsg = sFileNm + " " + e.Message;
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FTP서버와의 연결을 종료
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
//m_ClsFtp.Close();
|
||||
//m_ClsFtp.cleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 정해진 디렉토리에 정해진 파일을 업로드
|
||||
/// </summary>
|
||||
/// <param name="sSvrDirectory"></param>
|
||||
/// <param name="sLocalDirectory"></param>
|
||||
/// <param name="sFileNm"></param>
|
||||
/// <returns>0:정상완료, -1:Not Connected, -2: data socket create error, -3: file write 실패, -4:socket error, -5: 정상처리 실패(서버)</returns>
|
||||
public int Upload(string sSvrDirectory, string sLocalDirectory, string sFileNm)
|
||||
{
|
||||
int nReturn = -9;
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
bRet = m_ClsFtp.Upload(sLocalDirectory + sFileNm, sSvrDirectory + sFileNm);
|
||||
|
||||
if (bRet) nReturn = 0;
|
||||
else nReturn = -1;
|
||||
////if ((nReturn = m_ClsFtp.Connect()) != 0)
|
||||
////{
|
||||
//// return nReturn;
|
||||
////}
|
||||
|
||||
////string sDir = m_ClsFtp.ChangeDir(sSvrDirectory);
|
||||
|
||||
////nReturn = m_ClsFtp.Upload(sLocalDirectory, sFileNm, true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkFtp.Upload()", e.Message);
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
return nReturn;
|
||||
}
|
||||
}
|
||||
}
|
564
Agent/Network/NetworkHttp.cs
Normal file
|
@ -0,0 +1,564 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
|
||||
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
|
||||
namespace Cosmos.Network
|
||||
{
|
||||
public class NetworkHttp : INetworkHttp
|
||||
{
|
||||
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
private PosStatus m_cPosStatus; // 기본정보 참조
|
||||
private DeviceStatus m_cDevStatus; // 장비정보 참조
|
||||
|
||||
public NetworkHttp()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
||||
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; // POS 장치정보
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 해피오더 POST방식 Request
|
||||
/// </summary>
|
||||
/// <param name="sUrl"></param>
|
||||
/// <param name="sWorkType"></param>
|
||||
/// <param name="htReqData"></param>
|
||||
/// <param name="sRespJsonData"></param>
|
||||
/// <returns></returns>
|
||||
public int HttpJsonPOST_SendReceive(string sUrl, string sWorkType, Hashtable htReqData, ref Hashtable htRspData, ref string sRespJsonData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType);
|
||||
|
||||
string sSendJsonData = JsonConvert.SerializeObject(htReqData);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
sSendJsonData);
|
||||
|
||||
byte[] reqByte = Encoding.UTF8.GetBytes(sSendJsonData);
|
||||
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
req.ContentLength = reqByte.Length;
|
||||
|
||||
// create our stream to send
|
||||
Stream webDataStream = req.GetRequestStream();
|
||||
webDataStream.Write(reqByte, 0, reqByte.Length);
|
||||
|
||||
// get thre response from our stream
|
||||
WebResponse resp = req.GetResponse();
|
||||
webDataStream = resp.GetResponseStream();
|
||||
|
||||
// convert the result into a string
|
||||
StreamReader respStreamReader = new StreamReader(webDataStream);
|
||||
string respFromServer = respStreamReader.ReadToEnd();
|
||||
|
||||
respStreamReader.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
respFromServer);
|
||||
|
||||
Hashtable temp = JsonConvert.DeserializeObject<Hashtable>(respFromServer);
|
||||
|
||||
foreach (string key in temp.Keys)
|
||||
{
|
||||
string jsonString = temp[key].ToString();
|
||||
if (key.Equals("status"))
|
||||
{
|
||||
Hashtable htHeader = JsonConvert.DeserializeObject<Hashtable>(jsonString);
|
||||
if (htHeader["status"].ToString().Equals("200"))
|
||||
{
|
||||
iRet = BaseCom.OK;
|
||||
}
|
||||
htRspData = htHeader;
|
||||
}
|
||||
else
|
||||
{
|
||||
sRespJsonData = jsonString;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 해피오더 GET방식 Request
|
||||
/// </summary>
|
||||
/// <param name="sUrl">서버URL</param>
|
||||
/// <param name="sWorkType">작업구분</param>
|
||||
/// <param name="sReqData">요청Data</param>
|
||||
/// <param name="sRespJsonData">JSON String 형태의 응답 데이터</param>
|
||||
/// <returns></returns>
|
||||
public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData);
|
||||
req.Method = "GET";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
sUrl + sWorkType + "?" + sReqData);
|
||||
|
||||
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
|
||||
{
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//StreamReader streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
|
||||
StreamReader streamReader = new StreamReader(stream, Encoding.GetEncoding("ks_c_5601-1987"));
|
||||
sRespString = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
}
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
sRespString);
|
||||
|
||||
Hashtable temp = JsonConvert.DeserializeObject<Hashtable>(sRespString);
|
||||
|
||||
foreach (string key in temp.Keys)
|
||||
{
|
||||
string jsonString = temp[key].ToString();
|
||||
if (key.Equals("status"))
|
||||
{
|
||||
Hashtable htHeader = JsonConvert.DeserializeObject<Hashtable>(jsonString);
|
||||
if (htHeader["status"].ToString().Equals("200"))
|
||||
{
|
||||
iRet = BaseCom.OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sRespJsonData = jsonString;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GET방식 Request
|
||||
/// </summary>
|
||||
/// <param name="sUrl">서버URL</param>
|
||||
/// <param name="sWorkType">작업구분</param>
|
||||
/// <param name="sReqData">요청Data</param>
|
||||
/// <param name="sRespJsonData">JSON String 형태의 응답 데이터</param>
|
||||
/// <returns></returns>
|
||||
public int HttpGET_SendReceive(string sUrl, string sWorkType, string sReqData, string sEncodingFlag, ref string sRespData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
StreamReader streamReader = null;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData);
|
||||
req.Method = "GET";
|
||||
|
||||
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
|
||||
{
|
||||
Stream stream = resp.GetResponseStream();
|
||||
|
||||
if (sEncodingFlag == PosConst.ENCODING_FLAG.UTF)
|
||||
{
|
||||
streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
|
||||
}
|
||||
else
|
||||
{
|
||||
streamReader = new StreamReader(stream, Encoding.GetEncoding("ks_c_5601-1987"));
|
||||
}
|
||||
|
||||
sRespString = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
}
|
||||
|
||||
iRet = BaseCom.OK;
|
||||
|
||||
sRespData = sRespString;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 해피버즈 http 통신
|
||||
/// </summary>
|
||||
/// <param name="sUrl"></param>
|
||||
/// <param name="sWorkType"></param>
|
||||
/// <param name="htReqData"></param>
|
||||
/// <param name="htRspData"></param>
|
||||
/// <param name="sRespJsonData"></param>
|
||||
/// <returns></returns>
|
||||
public int HttpJsonPOST_SendReceiveForBuzz(string sUrl, string sWorkType, Hashtable htReqData, ref Hashtable htRspData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType);
|
||||
|
||||
string sSendJsonData = JsonConvert.SerializeObject(htReqData);
|
||||
byte[] reqByte = Encoding.UTF8.GetBytes(sSendJsonData);
|
||||
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
req.ContentLength = reqByte.Length;
|
||||
|
||||
// create our stream to send
|
||||
Stream webDataStream = req.GetRequestStream();
|
||||
webDataStream.Write(reqByte, 0, reqByte.Length);
|
||||
|
||||
// get thre response from our stream
|
||||
WebResponse resp = req.GetResponse();
|
||||
webDataStream = resp.GetResponseStream();
|
||||
|
||||
// convert the result into a string
|
||||
StreamReader respStreamReader = new StreamReader(webDataStream);
|
||||
string respFromServer = respStreamReader.ReadToEnd();
|
||||
|
||||
respStreamReader.Close();
|
||||
|
||||
htRspData = JsonConvert.DeserializeObject<Hashtable>(respFromServer);
|
||||
|
||||
if (htRspData["result"].Equals(true))
|
||||
{
|
||||
iRet = BaseCom.OK;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 관공서 방문 알림 통신
|
||||
/// </summary>
|
||||
/// <param name="sUrl"></param>
|
||||
/// <param name="sWorkType"></param>
|
||||
/// <param name="htReqData"></param>
|
||||
/// <param name="htRspData"></param>
|
||||
/// <param name="sRespJsonData"></param>
|
||||
/// <returns></returns>
|
||||
public int HttpPOST_SendReceiveForGoverVisit(string sUrl, string sWorkType, Hashtable htReqData, ref Hashtable htRspData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 요청 String -> 요청 Byte 변환
|
||||
byte[] byteDataParams = UTF8Encoding.UTF8.GetBytes(htReqData.ToString());
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType);
|
||||
|
||||
req.Method = "POST"; // 기본값 "GET"
|
||||
req.ContentType = "application/x-www-form-urlencoded";
|
||||
req.ContentLength = byteDataParams.Length;
|
||||
|
||||
// 요청 Byte -> 요청 Stream 변환
|
||||
Stream stDataParams = req.GetRequestStream();
|
||||
stDataParams.Write(byteDataParams, 0, byteDataParams.Length);
|
||||
stDataParams.Close();
|
||||
|
||||
// 요청, 응답 받기
|
||||
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
|
||||
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
iRet = BaseCom.OK;
|
||||
}
|
||||
|
||||
//HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType);
|
||||
|
||||
//string sSendJsonData = JsonConvert.SerializeObject(htReqData);
|
||||
//byte[] reqByte = Encoding.UTF8.GetBytes(sSendJsonData);
|
||||
|
||||
//req.Method = "POST";
|
||||
//req.ContentType = "application/json";
|
||||
//req.ContentLength = reqByte.Length;
|
||||
|
||||
//// create our stream to send
|
||||
//Stream webDataStream = req.GetRequestStream();
|
||||
//webDataStream.Write(reqByte, 0, reqByte.Length);
|
||||
|
||||
//// get thre response from our stream
|
||||
//WebResponse resp = req.GetResponse();
|
||||
//webDataStream = resp.GetResponseStream();
|
||||
|
||||
//// convert the result into a string
|
||||
//StreamReader respStreamReader = new StreamReader(webDataStream);
|
||||
//string respFromServer = respStreamReader.ReadToEnd();
|
||||
|
||||
//respStreamReader.Close();
|
||||
|
||||
//htRspData = JsonConvert.DeserializeObject<Hashtable>(respFromServer);
|
||||
|
||||
//if (htRspData["result"].Equals(true))
|
||||
//{
|
||||
// iRet = BaseCom.OK;
|
||||
//}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
// #20170616, 해피앱 스탬프 Start
|
||||
/// <summary>
|
||||
/// 해피앱 스탬프 http 통신
|
||||
/// </summary>
|
||||
/// <param name="sUrl"></param>
|
||||
/// <param name="htReqData"></param>
|
||||
/// <param name="htRspData"></param>
|
||||
/// <returns></returns>
|
||||
public int HttpJsonPOST_SendReceiveForStamp(string sUrl, Hashtable htReqData, ref Hashtable htRspData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
string sRespString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl);
|
||||
|
||||
string sSendJsonData = JsonConvert.SerializeObject(htReqData);
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // project name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // class name (class name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // function name (function name (함수명))
|
||||
sSendJsonData);
|
||||
|
||||
byte[] reqByte = Encoding.UTF8.GetBytes(sSendJsonData);
|
||||
|
||||
req.Method = "post";
|
||||
req.ContentType = "application/json";
|
||||
req.ContentLength = reqByte.Length;
|
||||
//#20171117 해피앱 스탬프 timeout 설정 start
|
||||
req.Timeout = 3000;
|
||||
//#20171117 해피앱 스탬프 timeout 설정 end
|
||||
|
||||
// create our stream to send
|
||||
Stream webDataStream = req.GetRequestStream();
|
||||
webDataStream.Write(reqByte, 0, reqByte.Length);
|
||||
|
||||
// get thre response from our stream
|
||||
|
||||
WebResponse resp = req.GetResponse();
|
||||
webDataStream = resp.GetResponseStream();
|
||||
|
||||
// convert the result into a string
|
||||
StreamReader respStreamReader = new StreamReader(webDataStream);
|
||||
string respFromServer = respStreamReader.ReadToEnd();
|
||||
|
||||
respStreamReader.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // project name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // class name (class name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // function name (function name (함수명))
|
||||
respFromServer);
|
||||
|
||||
htRspData = JsonConvert.DeserializeObject<Hashtable>(respFromServer);
|
||||
|
||||
if (htRspData["result"].Equals("00"))
|
||||
{
|
||||
iRet = BaseCom.OK;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
ex.ToString());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
// #20170616, 해피앱 스탬프 End
|
||||
|
||||
//contentType 에 따른 HTTP Post 전송, girak.kim , 2017.09.11
|
||||
|
||||
public static bool CheckValidationResult(object sender, X509Certificate certficate, X509Chain chain, SslPolicyErrors errors)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#region HTTP Post 전송
|
||||
|
||||
//#20170911.001, Http post 통신 추가 start;girak.kim;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sUrl">경로</param>
|
||||
/// <param name="sContentType">전송 컨텐츠 타입</param>
|
||||
/// <param name="sReqString">전송 데이타</param>
|
||||
/// <param name="sRespData">결과 데이타</param>
|
||||
/// <returns></returns>
|
||||
public int HttpPOST_SendReceive(string sUrl, string sContentType, string sReqString, ref string sRespData)
|
||||
{
|
||||
int iRet = BaseCom.NG;
|
||||
|
||||
string result = "";
|
||||
int nConnecLimit = 200;
|
||||
|
||||
HttpWebRequest request = null;
|
||||
HttpWebResponse response = null;
|
||||
Stream reqStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
ServicePointManager.DefaultConnectionLimit = nConnecLimit;//동시 연결
|
||||
if (sUrl.StartsWith("https", StringComparison.OrdinalIgnoreCase))//ssl 일 경우 인증서 무시
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
|
||||
}
|
||||
|
||||
Uri uri = new Uri(sUrl);
|
||||
|
||||
request = (HttpWebRequest)WebRequest.Create(uri);
|
||||
request.Method = "POST";
|
||||
request.Timeout = 30000;//30sec
|
||||
request.ContentType = sContentType;// "text/xml";// "text/xml; encoding='UTF-8'";
|
||||
|
||||
//request.KeepAlive = false;
|
||||
|
||||
byte[] bData = System.Text.Encoding.UTF8.GetBytes(sReqString);
|
||||
request.ContentLength = bData.Length;
|
||||
|
||||
reqStream = request.GetRequestStream();
|
||||
reqStream.Write(bData, 0, bData.Length);
|
||||
reqStream.Close();
|
||||
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
|
||||
StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
|
||||
result = sr.ReadToEnd().Trim();
|
||||
sr.Close();
|
||||
|
||||
sRespData = result;
|
||||
iRet = BaseCom.OK;
|
||||
|
||||
}
|
||||
catch (System.Threading.ThreadAbortException e)
|
||||
{
|
||||
//e.Message
|
||||
// System.Threading.Thread.ResetAbort();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
e.ToString());
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
e.ToString());
|
||||
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
// (HttpWebResponse)e.Response).StatusCode;
|
||||
//(HttpWebResponse)e.Response).StatusDescription;
|
||||
}
|
||||
//throw new Exception(e.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
e.ToString());
|
||||
//throw new Exception(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (response != null) response.Close();
|
||||
if (request != null) request.Abort();
|
||||
}
|
||||
|
||||
sRespData = result;
|
||||
return iRet;
|
||||
|
||||
}
|
||||
|
||||
//#20170911.001, Http post 통신 추가 end;girak.kim;
|
||||
#endregion
|
||||
}
|
||||
}
|
670
Agent/Network/NetworkIRT.cs
Normal file
|
@ -0,0 +1,670 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : SC / HQ IRT Request (SC / 본부 IRT 요청)
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Network
|
||||
{
|
||||
public class NetworkIRT : INetworkIRT
|
||||
{
|
||||
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
private PosStatus m_cPosStatus; // 기본정보 참조
|
||||
private DeviceStatus m_cDevStatus; // 장비정보 참조
|
||||
|
||||
/// <summary>
|
||||
/// Sending Socket (전송 소켓)
|
||||
/// </summary>
|
||||
private TcpSocket m_IrtSocket = null;
|
||||
//private static TcpSocket m_IrtSocket = null;
|
||||
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
private string m_ServerIp = "";
|
||||
|
||||
/// <summary>
|
||||
/// Port
|
||||
/// </summary>
|
||||
private int m_ServerPort = 0;
|
||||
|
||||
/// <summary>
|
||||
/// TimeOut
|
||||
/// </summary>
|
||||
private int m_ServerTimeout = 10000;
|
||||
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Constructor (생성자)
|
||||
/// </summary>
|
||||
/// ---------------------------------------------------------------------------------------------
|
||||
public NetworkIRT()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
|
||||
m_cDevStatus = (DeviceStatus)StateObject.DEVICE; // POS 장치정보 (PDA)
|
||||
}
|
||||
|
||||
#region OnLine 상태체크
|
||||
/// <summary>
|
||||
/// Get network online status with Ping check. (Ping체크로 network Online상태를 취득한다,)
|
||||
/// </summary>
|
||||
/// <param name="pHostAddress">Ip address</param>
|
||||
/// <returns>True : online false : Offline</returns>
|
||||
private int CheckNetworkOnline(string pHostAddress)
|
||||
{
|
||||
//Ping Check (Ping 체크)
|
||||
Ping pingSender = new Ping();
|
||||
PingOptions optins = new PingOptions();
|
||||
optins.DontFragment = true;
|
||||
string data = "aaa";
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
int timeout = 120;
|
||||
PingReply reply = pingSender.Send(pHostAddress, timeout, buffer, optins);
|
||||
|
||||
if (reply.Status == IPStatus.Success)
|
||||
return UserCom.OK;
|
||||
else
|
||||
return UserCom.NG;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 암호화 편집
|
||||
/// <summary>
|
||||
/// 암호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="plainData">평문</param>
|
||||
/// <returns>암호문, 에러시 평문 리턴</returns>
|
||||
private byte[] EncryptData(byte[] plainData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, plainData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] byteEncryptData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "0") // "0" 평문
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[plainData.Length - nNowPos];
|
||||
|
||||
Array.Copy(plainData, nNowPos, tranBytes, 0, plainData.Length - nNowPos);
|
||||
|
||||
//암호화
|
||||
byteEncryptData = AES.DynamicKeyEncrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + byteEncryptData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "1"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
byte[] byteCommHeader = Encoding.UTF8.GetBytes(sChangedCommHeader);
|
||||
|
||||
editedAllData = new byte[iMsgLen];
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(byteEncryptData, 0, editedAllData, byteCommHeader.Length, byteEncryptData.Length);
|
||||
|
||||
return editedAllData;
|
||||
}
|
||||
else // "1" 암호문
|
||||
{
|
||||
return plainData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 복호화 편집
|
||||
/// <summary>
|
||||
/// 복호화 위해 전문 편집
|
||||
/// </summary>
|
||||
/// <param name="EncryptData"></param>
|
||||
/// <returns></returns>
|
||||
private byte[] DecryptData(byte[] EncryptData)
|
||||
{
|
||||
int nNowPos = 0;
|
||||
|
||||
//통신헤더전문편집
|
||||
string[] aCommHead = new string[Column.COMM_HEADER.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE, EncryptData, ref nNowPos, ref aCommHead);
|
||||
|
||||
string sPosNo = aCommHead[Column.COMM_HEADER.SEQ.PosNo].ToString();
|
||||
//string sRegNo = aCommHead[Column.COMM_HEADER.SEQ.RegNo].ToString();
|
||||
string sRegNo = "";
|
||||
string sMsgLen = aCommHead[Column.COMM_HEADER.SEQ.MsgLen].ToString();
|
||||
string sEncType = aCommHead[Column.COMM_HEADER.SEQ.EncType].ToString();
|
||||
byte[] bytePlainData = null;
|
||||
byte[] editedAllData = null;
|
||||
|
||||
if (sEncType == "1") //복호화
|
||||
{
|
||||
//Tran헤더 포함 전문 데이터
|
||||
byte[] tranBytes = new byte[EncryptData.Length - nNowPos];
|
||||
|
||||
Array.Copy(EncryptData, nNowPos, tranBytes, 0, tranBytes.Length);
|
||||
|
||||
//복호화
|
||||
bytePlainData = AES.DynamicKeyDecrypt(sPosNo, sRegNo, tranBytes);
|
||||
|
||||
int iMsgLen = nNowPos + bytePlainData.Length;
|
||||
|
||||
aCommHead[Column.COMM_HEADER.SEQ.MsgLen] = iMsgLen.ToString(); //공통헤더와 암호문 더해진 길이
|
||||
aCommHead[Column.COMM_HEADER.SEQ.EncType] = "0"; //0:평문 1:암호화
|
||||
|
||||
string sChangedCommHeader = ItemColumn.MakeMessage(aCommHead, Column.COMM_HEADER.LEN, Column.COMM_HEADER.TYPE);
|
||||
|
||||
byte[] byteCommHeader = Encoding.Default.GetBytes(sChangedCommHeader);
|
||||
editedAllData = new byte[byteCommHeader.Length + bytePlainData.Length];
|
||||
|
||||
Array.Copy(byteCommHeader, editedAllData, byteCommHeader.Length);
|
||||
Array.Copy(bytePlainData, 0, editedAllData, byteCommHeader.Length, bytePlainData.Length);
|
||||
|
||||
return editedAllData;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return EncryptData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRT Send/Receive
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(byte[] pSendData, ref byte[] pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
byte[] rRecvData = null;
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = null;
|
||||
}
|
||||
//m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT전문의 Send/Receive
|
||||
/// </summary>
|
||||
/// <param name="pSendData"></param>
|
||||
/// <param name="pRecvData"></param>
|
||||
/// <returns></returns>
|
||||
private int SendReceiveData(string pSendData, ref string pRecvData)
|
||||
{
|
||||
int nRecvLen = 0;
|
||||
int nStat = BaseCom.NG;
|
||||
string rRecvData = "";
|
||||
|
||||
try
|
||||
{
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
// Data Send & Receive
|
||||
nRecvLen = m_IrtSocket.SendReceiveData(pSendData, ref rRecvData, m_ServerTimeout);
|
||||
|
||||
if (nRecvLen > 0)
|
||||
{
|
||||
pRecvData = rRecvData;
|
||||
nStat = BaseCom.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
pRecvData = "";
|
||||
nStat = nRecvLen;
|
||||
}
|
||||
//m_IrtSocket.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveData()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 암호화/복화화 전송
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sComm"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceive(string sIP, int iPort, int iTimeOut, string sComm, ref string sRecvData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
byte[] bEditedSendData = null;
|
||||
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
//암호화
|
||||
if (sComm.Length != 0)
|
||||
{
|
||||
//bEditedSendData = EncryptData(Encoding.Default.GetBytes(sComm));
|
||||
bEditedSendData = Encoding.Default.GetBytes(sComm);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sComm);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] SendData is Null");
|
||||
}
|
||||
|
||||
//SendReceive
|
||||
nStat = SendReceiveData(Encoding.Default.GetString(bEditedSendData, 0, bEditedSendData.Length), ref sReturn);
|
||||
|
||||
//복호화
|
||||
if (sReturn.Length != 0)
|
||||
{
|
||||
byte[] byteRecv = DecryptData(Encoding.Default.GetBytes(sReturn));
|
||||
sRecvData = Encoding.Default.GetString(byteRecv, 0, byteRecv.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] RecvData Is Null");
|
||||
}
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="comm"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceive(string sIP, int iPort, int iTimeOut, byte[] comm, ref byte[] sRecvData)
|
||||
{
|
||||
int nStat = 9;
|
||||
string sReturn = string.Empty;
|
||||
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
byte[] bEditedSendData = null;
|
||||
|
||||
if (m_ServerIp != "" && m_ServerPort != 0)
|
||||
{
|
||||
//암호화
|
||||
if (comm != null)
|
||||
{
|
||||
bEditedSendData = EncryptData(comm);
|
||||
|
||||
string sTmpLog = Encoding.Default.GetString(comm, 0, comm.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sTmpLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] SendData Is Null");
|
||||
}
|
||||
|
||||
//SendReceive
|
||||
nStat = SendReceiveData(bEditedSendData, ref sRecvData);
|
||||
|
||||
//복호화
|
||||
if (sRecvData != null)
|
||||
{
|
||||
byte[] sDecryptRecvData = DecryptData(sRecvData);
|
||||
|
||||
sRecvData = sDecryptRecvData;
|
||||
|
||||
string sTmpLog = Encoding.Default.GetString(sDecryptRecvData, 0, sDecryptRecvData.Length);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sTmpLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceive()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] RecvData Is Null");
|
||||
}
|
||||
}
|
||||
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 전송 - 외부 VAN
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv - 외부 Van
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sSendData"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="sAckData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, int nRecvDataLen, string sAckData)
|
||||
{
|
||||
return IRTSendReceiveEx(sIP, iPort, iTimeOut, sSendData, ref sRecvData, nRecvDataLen, sAckData, false);
|
||||
}
|
||||
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, int nRecvDataLen, string sAckData, bool bErrorSkip)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
sRecvData = "";
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sSendData);
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + sSendData);
|
||||
nStat = m_IrtSocket.SendReceiveData(sSendData, ref sRecvData, m_ServerTimeout, nRecvDataLen, sAckData, bErrorSkip);
|
||||
System.Diagnostics.Debug.Print("응답=" + sRecvData);
|
||||
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
//m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveSEx()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="sAckData"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveEx(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen, byte[] sAckData)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.SendReceiveData(bSendData, ref bRecvData, m_ServerTimeout, nRecvDataLen, sAckData);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
//m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveEx()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT 전송 - 외부 VAN (전문길이 위치지정)
|
||||
|
||||
/// <summary>
|
||||
/// IRT String로의 Send/Recv - 외부 Van (길이 위치지정)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="sSendData"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <param name="bFullSize"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="nRecvDataStartPosion"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveLen(string sIP, int iPort, int iTimeOut, string sSendData, ref string sRecvData, bool bFullSize, int nRecvDataLen, int nRecvDataStartPosion)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
sRecvData = "";
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sSendData);
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + sSendData);
|
||||
nStat = m_IrtSocket.SendReceiveData(sSendData, ref sRecvData, m_ServerTimeout, bFullSize, nRecvDataLen, "", nRecvDataStartPosion, false );
|
||||
System.Diagnostics.Debug.Print("응답=" + sRecvData);
|
||||
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
//m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + sRecvData);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataEx()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(100);
|
||||
return nStat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van (전문길이 위치지정)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <param name="nRecvDataStartPosion"></param>
|
||||
/// <returns></returns>
|
||||
public int IRTSendReceiveLen(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen, int nRecvDataStartPosion)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.SendReceiveData(bSendData, ref bRecvData, m_ServerTimeout, nRecvDataLen, null, nRecvDataStartPosion);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
//m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataLen()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRT Byte로의 Send/Recv - 외부 Van (Bypass Byte)
|
||||
/// <summary>
|
||||
/// IRT Byte로의 Send/Recv - 외부 Van (Bypass Byte)
|
||||
/// </summary>
|
||||
/// <param name="sIP"></param>
|
||||
/// <param name="iPort"></param>
|
||||
/// <param name="iTimeOut"></param>
|
||||
/// <param name="bSendData"></param>
|
||||
/// <param name="bRecvData"></param>
|
||||
/// <param name="nRecvDataLen"></param>
|
||||
/// <returns></returns>
|
||||
public int ByPassSendReceiveData(string sIP, int iPort, int iTimeOut, byte[] bSendData, ref byte[] bRecvData, int nRecvDataLen)
|
||||
{
|
||||
int nStat = BaseCom.NG;
|
||||
try
|
||||
{
|
||||
//bRecvData[0] = 0;
|
||||
if (sIP == "" || iPort == 0) return nStat;
|
||||
|
||||
// Connect 설정
|
||||
m_ServerIp = sIP;
|
||||
m_ServerPort = iPort;
|
||||
m_ServerTimeout = iTimeOut;
|
||||
m_IrtSocket = new TcpSocket(m_ServerIp, m_ServerPort, m_ServerTimeout);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[SEND" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
|
||||
// Data Send & Receive
|
||||
System.Diagnostics.Debug.Print("요청=" + Encoding.Default.GetString(bSendData, 0, bSendData.Length));
|
||||
nStat = m_IrtSocket.ByPassSendReceiveData(bSendData, nRecvDataLen, ref bRecvData, m_ServerTimeout);
|
||||
System.Diagnostics.Debug.Print("응답=" + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
if (nStat > 0) nStat = BaseCom.OK;
|
||||
|
||||
//m_IrtSocket.Close();
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (Project Name (프로젝트명))
|
||||
"NetworkIRT.IRTSendReceiveLen()", CmUtil.RPadH("[RECV" + ":" + m_ServerIp + ":" + m_ServerPort, 27) + "] " + Encoding.Default.GetString(bRecvData, 0, bRecvData.Length));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//if (m_IrtSocket != null) m_IrtSocket.Close();
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
"NetworkIRT.SendReceiveDataLen()", "NetworkIrt Error : ThreadNetworkIrt Exception !!! " + e.ToString());
|
||||
}
|
||||
return nStat;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
1087
Agent/Network/NetworkJSON.cs
Normal file
18
Agent/Network/NetworkVanSPCN.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
namespace Cosmos.Network
|
||||
{
|
||||
class NetworkVanSPCN : INetworkVanSPCN
|
||||
{
|
||||
//카드 리더 처리 클래스 통합 2016-06-17 SBSEO
|
||||
|
||||
}
|
||||
}
|
36
Agent/Network/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("Network")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Network")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("6c2b4bd7-4335-44af-a2d7-f89369063e96")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
55
Agent/NetworkCheckOver/Activator.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Load BaseFrame and save information (BaseFrame의 로드하고 정보를 보관한다)
|
||||
/// </summary>
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Define main entrance point of project load. (프로젝트 로드의 주진입점을 정의합니다.)
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_NETWORK_CHECKOVER.NetworkCheckOver:
|
||||
{
|
||||
Cosmos.Network.NetworkCheckOver agentClass = new Cosmos.Network.NetworkCheckOver();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
553
Agent/NetworkCheckOver/CheckOverDetail.cs
Normal file
|
@ -0,0 +1,553 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
|
||||
namespace Cosmos.Network
|
||||
{
|
||||
class CheckOverDetail : ICheckOverUs
|
||||
{
|
||||
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public CheckOverDetail()
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 해피오더 - 주문 상태별 건수 조회
|
||||
/// </summary>
|
||||
/// <param name="sRespData"></param>
|
||||
/// <returns></returns>
|
||||
///grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 인자 추가 SelectHappyOrderCountByOrderStatus HashTable 인자추가
|
||||
/// 기존
|
||||
///public string SelectHappyOrderCountByOrderStatus(Hashtable[] htOrderStatus)
|
||||
/// 변경
|
||||
public string SelectHappyOrderCountByOrderStatus(Hashtable[] htOrderStatus , ref Hashtable htRspData)
|
||||
//grayber@20180306 해피오더 주문가능 상태 추가 end
|
||||
{
|
||||
// 주문접수-일반
|
||||
int iOrderRegNormalCnt = 0;
|
||||
// 주문접수-배달
|
||||
int iOrderRegDeliveryCnt = 0;
|
||||
// 주문접수-예약
|
||||
int iOrderRegReservedCnt = 0;
|
||||
// 총 주문접수 건수
|
||||
int iTotOrderRegCnt = 0;
|
||||
int iProductReadyCnt = 0;
|
||||
int iPreReservedCnt = 0;
|
||||
int iPickupWaitCnt = 0;
|
||||
int iPickupDelayCnt = 0;
|
||||
int iNoPickupAndDelayCnt = 0;
|
||||
int iDeliveryRequestCnt = 0;
|
||||
int iDeliveryRegCnt = 0;
|
||||
int iDeliveryingCnt = 0;
|
||||
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 start
|
||||
int iDeliveryDirectCnt = 0;
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 end
|
||||
|
||||
//#20180605 해피오더 개선 start
|
||||
|
||||
//즉시주문, 예약주문 알림
|
||||
//즉시픽업 건수
|
||||
int iOrdCnt_Direct = 0;
|
||||
//즉시배달 건수
|
||||
int iOrdCnt_Reserv = 0;
|
||||
|
||||
//#20180605 해피오더 개선 end
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
int iDeliveryProductReadyCnt = 0;
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
string sRet = UserCom.RST_ERR;
|
||||
try
|
||||
{
|
||||
foreach(Hashtable htData in htOrderStatus)
|
||||
{
|
||||
string sOrderType = htData["type"].ToString();
|
||||
|
||||
switch(htData["status"].ToString())
|
||||
{
|
||||
case ItemConst.HAPPYORDER_STATUS.ORDER_REG: // "4" : 주문접수
|
||||
// 일반 주문건수 계산
|
||||
if(sOrderType == ItemConst.ORDER_TYPE.SHOP_DIRECT ||
|
||||
sOrderType == ItemConst.ORDER_TYPE.SHOP_TIME)
|
||||
{
|
||||
iOrderRegNormalCnt += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
// 배달 주문건수 계산
|
||||
else if(sOrderType == ItemConst.ORDER_TYPE.INNER_DELIVERY ||
|
||||
sOrderType == ItemConst.ORDER_TYPE.OUTTER_DELIVERY)
|
||||
{
|
||||
iOrderRegDeliveryCnt += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
// 예약 주문건수 계산
|
||||
else if(sOrderType == ItemConst.ORDER_TYPE.RESERVED_ORDER ||
|
||||
sOrderType == ItemConst.ORDER_TYPE.PRE_RESERVED)
|
||||
{
|
||||
iOrderRegReservedCnt += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
|
||||
//#20180605 해피오더 개선 start
|
||||
//즉시주문, 예약주문 알림
|
||||
//즉시픽업 건수 계산
|
||||
else if(sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER)
|
||||
{
|
||||
iOrdCnt_Direct += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
//즉시배달 건수 계산
|
||||
else if(sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)
|
||||
{
|
||||
iOrdCnt_Reserv += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
//#20180605 해피오더 개선 end
|
||||
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.PRODUCT_READY: // "5" : 상품준비
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
//기존
|
||||
//iProductReadyCnt += int.Parse(htData["count"].ToString());
|
||||
//변경
|
||||
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY)
|
||||
{
|
||||
iProductReadyCnt += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
iDeliveryProductReadyCnt += int.Parse(htData["count"].ToString());
|
||||
}
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.PRE_RESERVED: // "6" : 사전예약
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
iPreReservedCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT: // "7" : 픽업대기
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
iPickupWaitCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.PICKUP_DELAY: // "2000" : 픽업지연
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
iPickupDelayCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.NO_PICKUP_AND_DELAY: // "2018" : 픽업지연미픽업
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
iNoPickupAndDelayCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ: // "9004" : 배달요청
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
iDeliveryRequestCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.DELIVERY_REG: // "9005" : 배달접수
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
iDeliveryRegCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
case ItemConst.HAPPYORDER_STATUS.DELIVERY_ING: // "9007" : 배달중
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
iDeliveryingCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 start
|
||||
case ItemConst.HAPPYORDER_STATUS.DELIVERY_DIRECT: // "9003" : 직접배달
|
||||
//#20180905 즉시픽업,즉시배달 제외 start
|
||||
if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
|
||||
//#20180905 즉시픽업,즉시배달 제외 end
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
if (sOrderType != ItemConst.ORDER_TYPE.OUTTER_DELIVERY && sOrderType != ItemConst.ORDER_TYPE.INNER_DELIVERY) continue;
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
iDeliveryDirectCnt += int.Parse(htData["count"].ToString());
|
||||
break;
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 end
|
||||
}
|
||||
}
|
||||
|
||||
iTotOrderRegCnt = iOrderRegNormalCnt + iOrderRegDeliveryCnt + iOrderRegReservedCnt;
|
||||
|
||||
// 신규 주문 알림 팝업 Show 여부
|
||||
// 최초 신규 주문 건수 가져올 시 주문 알림 팝업 Show - 문성진D 요청(BR, PC 합의 사항)
|
||||
//if((m_cPosStatus.Sale.HappyOrderRegCnt != string.Empty && int.Parse(m_cPosStatus.Sale.HappyOrderRegCnt) != iOrderRegCnt) ||
|
||||
// (m_cPosStatus.Sale.HappyOrderPickupDelayCnt != string.Empty && int.Parse(m_cPosStatus.Sale.HappyOrderPickupDelayCnt) != iPickupDelayCnt))
|
||||
// 신규 주문 건수 타입 별 변경 체크
|
||||
//if ((int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0")) != iTotOrderRegCnt) ||
|
||||
// (int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderPickupDelayCnt, "0")) != iPickupDelayCnt))
|
||||
// PC, BRK 에 따라 상단 문구와 팝업알림 로직이 달라짐(2017/03/14)
|
||||
//if ((int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderRegCnt, "0")) != iOrderRegNormalCnt) ||
|
||||
// (int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0")) != iOrderRegDeliveryCnt) ||
|
||||
// (int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderReservedRegCnt, "0")) != iOrderRegReservedCnt))
|
||||
//{
|
||||
// m_cPosStatus.Sale.HappyOrderAlarm = true;
|
||||
//}
|
||||
// 연습모드일 경우에는 해피오더 알림팝업이 뜨지 않도록 처리(20170619)
|
||||
if (m_cPosStatus.Base.TrainingFlag != "1")
|
||||
{
|
||||
if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.PC)
|
||||
{
|
||||
// 신규주문 건수, 픽업미처리 건수, 배달미처리 건수 변경 시 팝업 알림
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 start
|
||||
//기존
|
||||
/*
|
||||
if ((int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0")) != iOrderRegNormalCnt + iOrderRegReservedCnt + iOrderRegDeliveryCnt) ||
|
||||
(int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderProductReadyCnt, "0")) + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderPickupWaitCnt, "0")) != iProductReadyCnt + iPickupWaitCnt) ||
|
||||
(int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0")) + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0")) + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0")) != iDeliveryRequestCnt + iDeliveryRegCnt + iDeliveryingCnt))
|
||||
{
|
||||
m_cPosStatus.Sale.HappyOrderAlarm = true;
|
||||
}
|
||||
*/
|
||||
//변경
|
||||
if ((int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0")) != iOrderRegNormalCnt + iOrderRegReservedCnt + iOrderRegDeliveryCnt) ||
|
||||
(int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderProductReadyCnt, "0")) + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderPickupWaitCnt, "0")) != iProductReadyCnt + iPickupWaitCnt) ||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
//기존
|
||||
/*
|
||||
(int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryDirectCnt, "0")) != iDeliveryRequestCnt + iDeliveryRegCnt + iDeliveryingCnt + iDeliveryDirectCnt))
|
||||
*/
|
||||
//변경
|
||||
(int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0")) +
|
||||
//int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryDirectCnt, "0")) +
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryProductReadyCnt, "0")) !=
|
||||
iDeliveryRequestCnt +
|
||||
iDeliveryRegCnt +
|
||||
//iDeliveryingCnt +
|
||||
iDeliveryDirectCnt +
|
||||
iDeliveryProductReadyCnt))
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
{
|
||||
m_cPosStatus.Sale.HappyOrderAlarm = true;
|
||||
}
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 end
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 일반 건수, 배달 건수, 예약 건수 변경 시 팝업 알림
|
||||
if (int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderRegCnt, "0")) != iOrderRegNormalCnt ||
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryOrderRegCnt, "0")) != iOrderRegDeliveryCnt ||
|
||||
int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderReservedRegCnt, "0")) != iOrderRegReservedCnt)
|
||||
{
|
||||
m_cPosStatus.Sale.HappyOrderAlarm = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 해피오더 일반 주문접수 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderRegCnt = Convert.ToString(iOrderRegNormalCnt);
|
||||
// 해피오더 예약 주문접수 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderReservedRegCnt = Convert.ToString(iOrderRegReservedCnt);
|
||||
// 해피오더 배달 주문접수 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryOrderRegCnt = Convert.ToString(iOrderRegDeliveryCnt);
|
||||
// 해피오더 총 주문접수 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderTotRegCnt = Convert.ToString(iTotOrderRegCnt);
|
||||
|
||||
// 해피오더 상품준비 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderProductReadyCnt = Convert.ToString(iProductReadyCnt);
|
||||
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryProductReadyCnt = Convert.ToString(iDeliveryProductReadyCnt);
|
||||
//#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end
|
||||
|
||||
// 해피오더 픽업대기 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderPickupWaitCnt = Convert.ToString(iPickupWaitCnt);
|
||||
// 해피오더 픽업지연 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderPickupDelayCnt = Convert.ToString(iPickupDelayCnt);
|
||||
// 해피오더 픽업지연미픽업 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderNoPickupAndDelayCnt = Convert.ToString(iNoPickupAndDelayCnt);
|
||||
// 해피오더 배달요청 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt = Convert.ToString(iDeliveryRequestCnt);
|
||||
// 해피오더 배달접수 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryRegCnt = Convert.ToString(iDeliveryRegCnt);
|
||||
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 start
|
||||
// 해피오더 직접배달 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryDirectCnt = Convert.ToString(iDeliveryDirectCnt);
|
||||
//#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 end
|
||||
|
||||
// 해피오더 배달중 건수 갱신
|
||||
m_cPosStatus.Sale.HappyOrderDeliveryingCnt = Convert.ToString(iDeliveryingCnt);
|
||||
|
||||
//grayber@20180306 해피오더 주문가능 상태 추가 start - 해피오더 배달 가능 상태 전역변수에 값 설정
|
||||
m_cPosStatus.Sale.DeliverySupport = string.Empty; // 기본값 string.Empty
|
||||
if (CmUtil.IsNull(htRspData) != true )
|
||||
{
|
||||
if (CmUtil.IsNull(htRspData["deliverySupport"]) != true)
|
||||
{// 전역변수에 값 추가
|
||||
m_cPosStatus.Sale.DeliverySupport = htRspData["deliverySupport"].ToString(); // Y:N
|
||||
}
|
||||
}
|
||||
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToShortTimeString() + " ▶▶▶ m_cPosStatus.Sale.DeliverySupport:" + m_cPosStatus.Sale.DeliverySupport); // Debug output console
|
||||
//grayber@20180306 해피오더 주문가능 상태 추가 end
|
||||
|
||||
//#20180605 해피오더 개선 start
|
||||
|
||||
//즉시주문, 예약주문 알림
|
||||
// 즉시픽업 건수
|
||||
m_cPosStatus.Sale.HappyOrderDirectCnt = Convert.ToString(iOrdCnt_Direct);
|
||||
// 즉시배달 건수
|
||||
m_cPosStatus.Sale.HappyOrderReservCnt = Convert.ToString(iOrdCnt_Reserv);
|
||||
|
||||
////#15058 해피오더 버튼 변경 start,phj
|
||||
//m_cPosStatus.Sale.SaleMainRepeat = true;
|
||||
//m_cPosStatus.Sale.PosMainRepeat = true;
|
||||
//m_cPosStatus.Sale.TableMainRepeat = true;
|
||||
////#15058 해피오더 버튼 변경 end,phj
|
||||
|
||||
//#20180605 해피오더 개선 end
|
||||
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 빚은몰 주문 건수 조회
|
||||
/// </summary>
|
||||
/// <param name="sRespData"></param>
|
||||
/// <returns></returns>
|
||||
public string SelectBizeunOrderCount(string sRespData)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
try
|
||||
{
|
||||
if(CmUtil.IsNumber(sRespData.Trim()) == true)
|
||||
{
|
||||
m_cPosStatus.Sale.BizeunOrderCnt = sRespData.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cPosStatus.Sale.BizeunOrderCnt = "0";
|
||||
}
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 이지웰 주문건수 조회
|
||||
/// </summary>
|
||||
/// <param name="sRespData"></param>
|
||||
/// <returns></returns>
|
||||
public string SelectEzwelOrderCount(string sRespData)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
try
|
||||
{
|
||||
if (CmUtil.IsNumber(sRespData.Trim()) == true)
|
||||
{
|
||||
m_cPosStatus.Sale.EzwelOrderCnt = sRespData.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cPosStatus.Sale.EzwelOrderCnt = "0";
|
||||
}
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 온도정보 Http 통신
|
||||
/// </summary>
|
||||
/// <param name="aParam"></param>
|
||||
/// <returns></returns>
|
||||
public string SelectStoreTempInfo (string sRespData)
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
string sTempInfo = string.Empty;
|
||||
string[] sTempSep = null;
|
||||
int iTotCnt = 0;
|
||||
|
||||
int iStartCnt = 0;
|
||||
int iEndCnt = 0;
|
||||
|
||||
try
|
||||
{
|
||||
string sResp = string.Empty;
|
||||
if (sRespData.Trim().Length > 0)
|
||||
{
|
||||
iTotCnt = Convert.ToInt16(sRespData.Substring(0, 2));
|
||||
|
||||
sRespData = sRespData.Remove(0, 2);
|
||||
|
||||
if (iTotCnt > 2)
|
||||
{
|
||||
// 첫번째 온도 정보
|
||||
iStartCnt = sRespData.IndexOf("[");
|
||||
iEndCnt = sRespData.IndexOf("]");
|
||||
|
||||
if (iEndCnt != 0)
|
||||
{
|
||||
sTempInfo = sRespData.Substring(iStartCnt, iEndCnt + 1).Replace("[", "").Replace("]", "");
|
||||
|
||||
sTempSep = sTempInfo.Split('|');
|
||||
|
||||
// 코드1
|
||||
m_cPosStatus.Temp.Code1 = sTempSep[0];
|
||||
// 이름1
|
||||
m_cPosStatus.Temp.Name1 = sTempSep[1];
|
||||
// 온도1
|
||||
m_cPosStatus.Temp.Temperature1 = sTempSep[2];
|
||||
// 알람1
|
||||
m_cPosStatus.Temp.Alarm1 = sTempSep[3];
|
||||
// 경고1
|
||||
m_cPosStatus.Temp.Warning1 = sTempSep[4];
|
||||
// 미수신1
|
||||
m_cPosStatus.Temp.receiveYN1 = sTempSep[5];
|
||||
// 최종온도수집1
|
||||
m_cPosStatus.Temp.CollectionTime1 = sTempSep[6];
|
||||
|
||||
sRespData = sRespData.Remove(iStartCnt, iEndCnt + 1);
|
||||
}
|
||||
|
||||
// 두번째 온도 정보
|
||||
iStartCnt = sRespData.IndexOf("[");
|
||||
iEndCnt = sRespData.IndexOf("]");
|
||||
|
||||
if (iEndCnt != 0)
|
||||
{
|
||||
sTempInfo = sRespData.Substring(iStartCnt, iEndCnt + 1).Replace("[", "").Replace("]", "");
|
||||
|
||||
sTempSep = sTempInfo.Split('|');
|
||||
|
||||
// 코드2
|
||||
m_cPosStatus.Temp.Code2 = sTempSep[0];
|
||||
// 이름2
|
||||
m_cPosStatus.Temp.Name2 = sTempSep[1];
|
||||
// 온도2
|
||||
m_cPosStatus.Temp.Temperature2 = sTempSep[2];
|
||||
// 알람2
|
||||
m_cPosStatus.Temp.Alarm2 = sTempSep[3];
|
||||
// 경고2
|
||||
m_cPosStatus.Temp.Warning2 = sTempSep[4];
|
||||
// 미수신2
|
||||
m_cPosStatus.Temp.receiveYN2 = sTempSep[5];
|
||||
// 최종온도수집2
|
||||
m_cPosStatus.Temp.CollectionTime2 = sTempSep[6];
|
||||
|
||||
sRespData = sRespData.Remove(iStartCnt, iEndCnt + 1);
|
||||
}
|
||||
|
||||
iStartCnt = sRespData.IndexOf("[");
|
||||
iEndCnt = sRespData.IndexOf("]");
|
||||
|
||||
if (iEndCnt != 0)
|
||||
{
|
||||
sTempInfo = sRespData.Substring(iStartCnt, iEndCnt + 1).Replace("[", "").Replace("]", "");
|
||||
|
||||
sTempSep = sTempInfo.Split('|');
|
||||
|
||||
// 세번째 온도 정보
|
||||
// 코드3
|
||||
m_cPosStatus.Temp.Code3 = sTempSep[0];
|
||||
// 이름3
|
||||
m_cPosStatus.Temp.Name3 = sTempSep[1];
|
||||
// 온도3
|
||||
m_cPosStatus.Temp.Temperature3 = sTempSep[2];
|
||||
// 알람3
|
||||
m_cPosStatus.Temp.Alarm3 = sTempSep[3];
|
||||
// 경고3
|
||||
m_cPosStatus.Temp.Warning3 = sTempSep[4];
|
||||
// 미수신3
|
||||
m_cPosStatus.Temp.receiveYN3 = sTempSep[5];
|
||||
// 최종온도수집3
|
||||
m_cPosStatus.Temp.CollectionTime3 = sTempSep[6];
|
||||
|
||||
sRespData = sRespData.Remove(iStartCnt, iEndCnt + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
}
|
||||
}
|
2833
Agent/NetworkCheckOver/NetworkCheckOver.cs
Normal file
96
Agent/NetworkCheckOver/NetworkCheckOver.csproj
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D7F0F611-E694-47D5-AB09-8C5514B04B6F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Network</RootNamespace>
|
||||
<AssemblyName>Agent.NetworkCheckOver</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="CheckOverDetail.cs" />
|
||||
<Compile Include="NetworkCheckOver.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.NetworkCheckOver.dll .\Agent.NetworkCheckOver.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.NetworkCheckOver.dll .\IC\Agent.NetworkCheckOver.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
Agent/NetworkCheckOver/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("NetworkCheckOver")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NetworkCheckOver")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("e0c7ddd1-3d25-472c-ad5c-7373ebeb2640")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
60
Agent/NetworkTranSend/Activator.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : Network 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Load BaseFrame and save information (BaseFrame의 로드하고 정보를 보관한다)
|
||||
/// </summary>
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Define main entrance point of project load. (프로젝트 로드의 주진입점을 정의합니다.)
|
||||
/// </summary>
|
||||
public Activator()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
//클래스 찾아오기 위함
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_NETWORK_TRANSEND.NetworkTranSend:
|
||||
{
|
||||
Cosmos.Network.NetworkTranSend agentClass = new Cosmos.Network.NetworkTranSend();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Completed !!!");
|
||||
|
||||
return retObj;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
7145
Agent/NetworkTranSend/NetworkTranSend.cs
Normal file
88
Agent/NetworkTranSend/NetworkTranSend.csproj
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B709B5A7-A4F0-4B18-8E07-1EA3541DDB01}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.Network</RootNamespace>
|
||||
<AssemblyName>Agent.NetworkTranSend</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Cosmos.BaseFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider">
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame">
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="NetworkTranSend.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.NetworkTranSend.dll .\Agent.NetworkTranSend.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.NetworkTranSend.dll .\IC\Agent.NetworkTranSend.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
Agent/NetworkTranSend/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("NetworkTranSend")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NetworkTranSend")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("2786bf88-f09e-4e7c-9875-0653209757e1")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
121
Agent/OLEDevice/Activator.cs
Normal file
|
@ -0,0 +1,121 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : OLEDevice 관련 클래스 Activator
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Load BaseFrame and save information (BaseFrame의 로드하고 정보를 보관한다)
|
||||
/// </summary>
|
||||
public class Activator : InitServiceAbstract
|
||||
{
|
||||
/// <summary>
|
||||
/// Class별 객체를 리턴
|
||||
/// </summary>
|
||||
/// <param name="sClassNm"></param>
|
||||
/// <returns></returns>
|
||||
public override object InitServiceInstance(string sClassNm)
|
||||
{
|
||||
//UserLog.WriteLogFile(UserCom.LOG_DEBUG, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "Activator.InitServiceInstance()", "Message : " + sClassNm + " Registration Starting !!!");
|
||||
|
||||
object retObj = null;
|
||||
|
||||
switch (sClassNm)
|
||||
{
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_MSR:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceMsr agentClass = new Cosmos.OLEDevice.DeviceMsr();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER:
|
||||
{
|
||||
Cosmos.OLEDevice.DevicePosPrinter agentClass = new Cosmos.OLEDevice.DevicePosPrinter();
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_SCANNER:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceScanner agentclass = new Cosmos.OLEDevice.DeviceScanner();
|
||||
retObj = agentclass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_CASHDRAWER:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceCashdrawer agentClass = new Cosmos.OLEDevice.DeviceCashdrawer();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_CATTERMINAL:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceCatTerminal agentClass = new Cosmos.OLEDevice.DeviceCatTerminal();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceICReader agentClass = new Cosmos.OLEDevice.DeviceICReader();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceSignPad agentClass = new Cosmos.OLEDevice.DeviceSignPad();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_SCALE:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceScale agentClass = new Cosmos.OLEDevice.DeviceScale();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_LABELPRINTER:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceLabelPrinter agentClass = new Cosmos.OLEDevice.DeviceLabelPrinter();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_OURHOME:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceOurHome agentClass = new Cosmos.OLEDevice.DeviceOurHome();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.DEVICE_TPAYGLE:
|
||||
{
|
||||
Cosmos.OLEDevice.DeviceTPaygle agentClass = new Cosmos.OLEDevice.DeviceTPaygle();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
case ServiceLists.AGENT_OLEDEVICE.OCB_DIRECT:
|
||||
{
|
||||
Cosmos.OLEDevice.OCBDirect agentClass = new Cosmos.OLEDevice.OCBDirect();
|
||||
|
||||
retObj = agentClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retObj;
|
||||
}
|
||||
}
|
||||
}
|
552
Agent/OLEDevice/DeviceCashdrawer.cs
Normal file
|
@ -0,0 +1,552 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO.Ports;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.ServiceProvider;
|
||||
|
||||
using Microsoft.PointOfService;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : CahsDrawer 제어
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// CASHDRAWER 제어 CLASS
|
||||
/// </summary>
|
||||
public class DeviceCashdrawer : ICashdrawerUs
|
||||
{
|
||||
#region VctDraw2kSs.dll 제어 함수
|
||||
[DllImport("VctDraw2kSs.dll", EntryPoint = "OpenDrawPort")]
|
||||
public static extern int OpenDrawPortFor9700();
|
||||
|
||||
[DllImport("VctDraw2kSs.dll", EntryPoint = "CloseDrawPort")]
|
||||
public static extern int CloseDrawPortFor9700();
|
||||
|
||||
[DllImport("VctDraw2kSs.dll", EntryPoint = "OpenDraw")]
|
||||
public static extern void OpenDrawFor9700();
|
||||
#endregion
|
||||
|
||||
#region TgDrawA.dll 제어 함수
|
||||
[DllImport("TgDrawA.dll", EntryPoint = "OpenDrawPort")]
|
||||
public static extern int OpenDrawPortForTg();
|
||||
|
||||
[DllImport("TgDrawA.dll", EntryPoint = "CloseDrawPort")]
|
||||
public static extern int CloseDrawPortForTg();
|
||||
|
||||
[DllImport("TgDrawA.dll", EntryPoint = "OpenDraw")]
|
||||
public static extern void OpenDrawForTg();
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = new DeviceStatus();
|
||||
/// <summary>
|
||||
/// POS 기본 정보
|
||||
/// </summary>
|
||||
public PosStatus m_cPosStatus = null;
|
||||
/// <summary>
|
||||
/// Pos for .Net CashDrawer 객체
|
||||
/// </summary>
|
||||
private CashDrawer cashdrawer = null;
|
||||
/// <summary>
|
||||
/// Pos for .Net의 Device 정보를 가져오기 위한 객체
|
||||
/// </summary>
|
||||
private PosExplorer posExplorer = null;
|
||||
/// <summary>
|
||||
/// RS232통신을 위한 시리얼포트 객체
|
||||
/// </summary>
|
||||
private SerialPort m_serialPort = null;
|
||||
|
||||
private IPosPrinterUs objPosPrinter = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>g
|
||||
private int m_sUpdateStatus = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 0:OPOS, 1:RS232(프린터에 연결), 2:IBM본체에 연결하는 돈통
|
||||
/// <para>DRAWER_TYPE 참고</para>
|
||||
/// </summary>
|
||||
private int drawerType = 0;
|
||||
|
||||
#region 초기화
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceCashdrawer()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
posExplorer = new PosExplorer();
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
objPosPrinter = (IPosPrinterUs)(new SManager()).InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER);
|
||||
DeviceStatusInit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 초기화
|
||||
/// </summary>
|
||||
private void DeviceStatusInit()
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "";
|
||||
devStatus.Cashdrawer.DeviceName = "";
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 디바이스 OPEN/CLOSE 처리
|
||||
/// <summary>
|
||||
/// 디바이스 Open시 처리함수
|
||||
/// </summary>
|
||||
/// <param name="sDeviceType">장비종류(ex- "Msr","PosPrinter","Scanner"...)</param>
|
||||
/// <param name="sLogicalName">레지스트리 항목(ex- "DefaultMsr","DefaultPosPrinter","DefaultScanner"...)</param>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice(string sDeviceType, string sLogicalName)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if(devStatus.Cashdrawer.UseYn == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._1_PRINTER)
|
||||
{
|
||||
if(devStatus.Printer.UseYn == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
devStatus.Cashdrawer.Open = true;
|
||||
devStatus.Cashdrawer.Status = "SUCCESS";
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._2_OPOS_IBM)
|
||||
{
|
||||
OpenDeviceByOPOS(sDeviceType, sLogicalName);
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._3_DLL_TPS8700)
|
||||
{
|
||||
OpenDrawForTg();
|
||||
bRet = true;
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._4_DLL_VPS9700)
|
||||
{
|
||||
OpenDrawFor9700();
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._5_IBM_MAIN)
|
||||
{
|
||||
OpenDeviceByRS232(m_cPosStatus.Base.OlePosCashDrawerSerialPortNumber, m_cPosStatus.Base.OlePosCashDrawerBaudRate);
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "CashDrawer Device Open Exception";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status + "/" + ex.Message);
|
||||
return bRet;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool OpenDeviceByOPOS(string sDeviceType, string sLogicalName)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
DeviceInfo devInfo = null;
|
||||
|
||||
if (sDeviceType == DeviceType.CashDrawer && sLogicalName == PosConst.OPOS_LDN.CASHDRAWER)
|
||||
{
|
||||
devInfo = posExplorer.GetDevice(DeviceType.CashDrawer, PosConst.OPOS_LDN.CASHDRAWER);
|
||||
}
|
||||
else
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "DEVICE INFO ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.OpenDeviceByOPOS()", devStatus.Printer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
if(devInfo == null)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "DEVICE INFO ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.OpenDeviceByOPOS()", devStatus.Printer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
cashdrawer = (CashDrawer)posExplorer.CreateInstance(devInfo);
|
||||
|
||||
if(cashdrawer != null)
|
||||
{
|
||||
cashdrawer.StatusUpdateEvent += new StatusUpdateEventHandler(CashDrawer_StatusUpdateEventDataEvent);
|
||||
|
||||
try
|
||||
{
|
||||
cashdrawer.Open();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "OPEN FAIL";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.OpenDeviceByOPOS()", devStatus.Printer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cashdrawer.Claim(1000);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "CLAIM FAIL";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.OpenDeviceByOPOS()", devStatus.Printer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cashdrawer.DeviceEnabled = true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "DEVICE ENABLED FAIL";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.ERROR_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.OpenDeviceByOPOS()", devStatus.Printer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
devStatus.Cashdrawer.DeviceName = devInfo.ServiceObjectName;
|
||||
devStatus.Cashdrawer.Open = true;
|
||||
devStatus.Cashdrawer.Status = "Success";
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "CashDrawer Device Open Exception";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status + "/" + ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool OpenDeviceByRS232(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if(m_serialPort != null)
|
||||
{
|
||||
m_serialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_serialPort = null;
|
||||
}
|
||||
|
||||
if(m_serialPort == null)
|
||||
{
|
||||
m_serialPort = new SerialPort();
|
||||
if(m_serialPort == null)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.NewLine = "\r\n";
|
||||
m_serialPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
|
||||
m_serialPort.WriteBufferSize = 1024 * 3;
|
||||
m_serialPort.PortName = sSerialPort;
|
||||
m_serialPort.BaudRate = (int)lBaudrate;
|
||||
m_serialPort.DataBits = 8;
|
||||
m_serialPort.StopBits = StopBits.One;
|
||||
m_serialPort.Parity = Parity.None;
|
||||
|
||||
m_serialPort.Open();
|
||||
if(m_serialPort.IsOpen == false)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "SERIAL PORT OPEN ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
devStatus.Cashdrawer.Open = true;
|
||||
devStatus.Cashdrawer.Status = "SUCCESS";
|
||||
bRet = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
devStatus.Cashdrawer.Status = "CashDrawer Device Open Exception";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디바이스 Close시 처리함수</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._2_OPOS_IBM)
|
||||
{
|
||||
if (cashdrawer == null)
|
||||
return bRet;
|
||||
|
||||
cashdrawer.DeviceEnabled = false;
|
||||
cashdrawer.Release();
|
||||
cashdrawer.Close();
|
||||
cashdrawer = null;
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._3_DLL_TPS8700)
|
||||
{
|
||||
CloseDrawPortForTg();
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._4_DLL_VPS9700)
|
||||
{
|
||||
CloseDrawPortFor9700();
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._5_IBM_MAIN)
|
||||
{
|
||||
if(m_serialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceCashdrawer.CloseDevice()", "m_serialPort == null");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.Close();
|
||||
m_serialPort = null;
|
||||
}
|
||||
bRet = true;
|
||||
|
||||
devStatus.Cashdrawer.Status = "CLOSE";
|
||||
devStatus.Cashdrawer.Open = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "CLOSE EXCEPTION";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status + "/" + ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region POS for .NET 이벤트 처리
|
||||
/// <summary>
|
||||
/// Cashdrawer 상태 변경에 따른 이벤트 처리
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void CashDrawer_StatusUpdateEventDataEvent(object sender, StatusUpdateEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_sUpdateStatus = e.Status;
|
||||
|
||||
switch (m_sUpdateStatus)
|
||||
{
|
||||
case CashDrawer.StatusOpen:
|
||||
devStatus.Cashdrawer.Status = "DRAWER OPENED";
|
||||
break;
|
||||
case CashDrawer.StatusClosed:
|
||||
devStatus.Cashdrawer.Status = "DRAWER CLOSED";
|
||||
break;
|
||||
}
|
||||
|
||||
if (PosOLEDevice.m_delegateOlePos != null)
|
||||
PosOLEDevice.m_delegateOlePos(PosConst.OPOS_DEVICE.CASHDRAWER, devStatus.Cashdrawer.Status, string.Empty, string.Empty);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "STATUS UPDATE EVENT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status + "-" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 돈통 개방 처리
|
||||
/// <summary>
|
||||
/// 돈통 개방
|
||||
/// </summary>
|
||||
public void OpenCashDrawer()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (devStatus.Cashdrawer.Open == false)
|
||||
{
|
||||
OpenDevice(DeviceType.CashDrawer, PosConst.OPOS_LDN.CASHDRAWER);
|
||||
}
|
||||
|
||||
if (devStatus.Cashdrawer.Open == true)
|
||||
{
|
||||
if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._1_PRINTER)
|
||||
{
|
||||
objPosPrinter.OpenCashDrawer();
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._2_OPOS_IBM)
|
||||
{
|
||||
cashdrawer.OpenDrawer();
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._3_DLL_TPS8700)
|
||||
{
|
||||
OpenDrawForTg();
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._4_DLL_VPS9700)
|
||||
{
|
||||
OpenDrawFor9700();
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCashDrawerType == PosConst.POS_DEVICE_LIST.CASHDRAWER._5_IBM_MAIN)
|
||||
{
|
||||
TransmitCommand(PosConst.ESCP_COMMAND.CASHDRAWER_OPEN_IBMHOST, true);
|
||||
bRet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "DRAWER TYPE ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status);
|
||||
}
|
||||
devStatus.Cashdrawer.Status = "DRAWER OPEN";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Cashdrawer.Status = "DRAWER OPEN ERROR";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Cashdrawer.Status + "/" + ex.Message);
|
||||
}
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Open Drawer=" + (bRet ? "SUCCESS" : "FAIL"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SerialPort 전송
|
||||
private void TransmitCommand(byte[] aCmd, bool bSleepOn = true)
|
||||
{
|
||||
if (m_serialPort.IsOpen == true)
|
||||
{
|
||||
int iOffset = 0;
|
||||
//int iReadBuf = 2048;
|
||||
int iReadBuf = m_serialPort.WriteBufferSize;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (iOffset >= aCmd.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (iReadBuf + iOffset > aCmd.Length)
|
||||
{
|
||||
iReadBuf = aCmd.Length - iOffset;
|
||||
}
|
||||
m_serialPort.Write(aCmd, iOffset, iReadBuf);
|
||||
|
||||
iOffset += iReadBuf;
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}
|
||||
//m_serialPort.Write(Encoding.Default.GetString(aCmd, 0, aCmd.Length));
|
||||
|
||||
if (bSleepOn == true) System.Threading.Thread.Sleep(30);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
335
Agent/OLEDevice/DeviceCatTerminal.cs
Normal file
|
@ -0,0 +1,335 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : CAT 단말기 제어
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// CAT 단말기 제어 CLASS
|
||||
/// </summary>
|
||||
public class DeviceCatTerminal : ICatTerminalUs
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 단말기와 승인/취소 통신을 처리하는 함수
|
||||
/// </summary>
|
||||
/// <param name="comport"></param>
|
||||
/// <param name="baud"></param>
|
||||
/// <param name="input_msg"></param>
|
||||
/// <param name="output_msg"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("SPCNSecuCAT.dll")]
|
||||
public static extern int SPCNSecuCAT_Payment(int comport, int baud, byte[] input_msg, byte[] output_msg);
|
||||
|
||||
/// <summary>
|
||||
/// 단말기에 저장된 미전송 내역을 받아오는 함수
|
||||
/// </summary>
|
||||
/// <param name="comport"></param>
|
||||
/// <param name="baud"></param>
|
||||
/// <param name="output_msg"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("SPCNSecuCAT.dll")]
|
||||
public static extern int SPCNSecuCAT_GetRemain(int comport, int baud, byte[] output_msg);
|
||||
|
||||
/// <summary>
|
||||
/// 중국 - 샨더 단말기와 승인/취소 통신을 처리하는 함수
|
||||
/// </summary>
|
||||
/// <param name="comport"></param>
|
||||
/// <param name="input_msg"></param>
|
||||
/// <param name="output_msg"></param>
|
||||
[DllImport("LibSand.dll")]
|
||||
public static extern void card_trans(int comport, byte[] input_msg, byte[] output_msg);
|
||||
|
||||
/// <summary>
|
||||
/// 중국 - 은련 단말기와 승인/취소 통신을 처리하는 함수
|
||||
/// </summary>
|
||||
/// <param name="comport"></param>
|
||||
/// <param name="input_msg"></param>
|
||||
/// <param name="output_msg"></param>
|
||||
[DllImport("posinf.dll")]
|
||||
public static extern int bankall(byte[] request, byte[] response);
|
||||
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus m_cdevStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pos 상태 정보 객체
|
||||
/// </summary>
|
||||
public PosStatus m_cPosStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceCatTerminal()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
m_cdevStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 연결확인
|
||||
/// <summary>
|
||||
/// 연결확인(가동시 체크)
|
||||
/// </summary>
|
||||
public bool SPCNSecuCatStatus()
|
||||
{
|
||||
bool bRet = false;
|
||||
string sSendData = string.Empty;
|
||||
string sRecvData = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_cPosStatus.Base.OlePosCATModel == PosConst.CAT_MODEL_DIV._KOR_SPCN)
|
||||
{
|
||||
sSendData = CmUtil.RPadH("Z0A0 000000000000000000000000000", 360);
|
||||
if (SPCNSecuCatApprove(sSendData, ref sRecvData) > 0)
|
||||
bRet = true;
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosCATModel == PosConst.CAT_MODEL_DIV._CHN_SAND || m_cPosStatus.Base.OlePosCATModel == PosConst.CAT_MODEL_DIV._CHN_UNION)
|
||||
{
|
||||
// 중국산은 상태 체크 없어 패스
|
||||
//if (SPCNSecuCatApprove(sSendData, ref sRecvData) >= 0)
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 연결 상태 확인 및 CAT 단말기 정보 확인
|
||||
/// <summary>
|
||||
/// 연결 상태 및 CAT 단말기 정보 확인
|
||||
/// </summary>
|
||||
public int SPCNSecuCatInfo(string sSendData, ref string sRecvData)
|
||||
{
|
||||
int nReturn = -99;
|
||||
|
||||
try
|
||||
{
|
||||
nReturn = SPCNSecuCatApprove(sSendData, ref sRecvData);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return nReturn;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 승인/취소 요청
|
||||
/// <summary>
|
||||
/// 승인/취소 요청
|
||||
/// </summary>
|
||||
/// <param name="sSendData"></param>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int SPCNSecuCatApprove(string sSendData, ref string sRecvData)
|
||||
{
|
||||
int nReturn = -99;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
byte[] bytInputMsg = null;
|
||||
byte[] bytOutput = new byte[4096];
|
||||
|
||||
sRecvData = string.Empty;
|
||||
Array.Clear(bytOutput, 0, bytOutput.Length);
|
||||
|
||||
bytInputMsg = Encoding.Default.GetBytes(sSendData);
|
||||
|
||||
switch (m_cPosStatus.Base.OlePosCATModel)
|
||||
{
|
||||
case PosConst.CAT_MODEL_DIV._KOR_SPCN:
|
||||
{
|
||||
nReturn = SPCNSecuCAT_Payment(CmUtil.IntParse(m_cPosStatus.Base.OlePosCATSerialPortNumber.Replace("COM", "")), (int)m_cPosStatus.Base.OlePosCATSerialBaudRate, bytInputMsg, bytOutput); // 승인조회
|
||||
|
||||
if (nReturn < 0) //승인실퍠
|
||||
{
|
||||
//실패경우
|
||||
sRecvData = ErrCodeToMsg(nReturn);
|
||||
}
|
||||
else
|
||||
{
|
||||
sRecvData = ByteToString(bytOutput);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PosConst.CAT_MODEL_DIV._CHN_SAND:
|
||||
{
|
||||
// 중국 샨더 단말기
|
||||
card_trans(CmUtil.IntParse(m_cPosStatus.Base.OlePosCATSerialPortNumber.Replace("COM", "")), bytInputMsg, bytOutput); // 승인조회
|
||||
|
||||
sRecvData = ByteToString(bytOutput);
|
||||
|
||||
if (sRecvData.Length > 0) nReturn = 0;
|
||||
break;
|
||||
}
|
||||
case PosConst.CAT_MODEL_DIV._CHN_UNION:
|
||||
{
|
||||
// 중국 은련 단말기
|
||||
bankall(bytInputMsg, bytOutput); // 승인조회
|
||||
|
||||
sRecvData = ByteToString(bytOutput);
|
||||
|
||||
if (sRecvData.Length > 0) nReturn = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 승인/취소 요청
|
||||
/// <summary>
|
||||
/// 단말기에 저장된 미전송 내역을 받아오는 함수
|
||||
/// </summary>
|
||||
/// <param name="sRecvData"></param>
|
||||
/// <returns></returns>
|
||||
public int SPCNSecuCatRemain(ref string sRecvData)
|
||||
{
|
||||
int nReturn = -99;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] bytOutput = new byte[4096];
|
||||
|
||||
sRecvData = string.Empty;
|
||||
Array.Clear(bytOutput, 0, bytOutput.Length);
|
||||
|
||||
nReturn = SPCNSecuCAT_GetRemain(CmUtil.IntParse(m_cPosStatus.Base.OlePosCATSerialPortNumber.Replace("COM", "")), (int)m_cPosStatus.Base.OlePosCATSerialBaudRate, bytOutput);
|
||||
|
||||
if (nReturn < 0) //승인실퍠
|
||||
{
|
||||
//실패경우
|
||||
sRecvData = ErrCodeToMsg(nReturn);
|
||||
}
|
||||
else
|
||||
{
|
||||
sRecvData = ByteToString(bytOutput);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return nReturn;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Byte배열을 string으로 변환 (Byte배열의 null(0x00)값 제거)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
private string ByteToString(byte[] data)
|
||||
{
|
||||
int inx = Array.FindIndex(data, 0, (x) => x == 0x0);
|
||||
if (inx >= 0)
|
||||
{
|
||||
return Encoding.Default.GetString(data, 0, inx);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Encoding.Default.GetString(data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 응답코드
|
||||
/// </summary>
|
||||
/// <param name="nErrCode"></param>
|
||||
/// <returns></returns>
|
||||
private string ErrCodeToMsg(int nErrCode)
|
||||
{
|
||||
string sMsg = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
switch (nErrCode)
|
||||
{
|
||||
case -101: sMsg = "시리얼포트번호오류"; break;
|
||||
case -102: sMsg = "통신속도오류"; break;
|
||||
case -103: sMsg = "전문길이오류"; break;
|
||||
case -210: sMsg = "할부개월오류"; break;
|
||||
case -211: sMsg = "금액봉사료세금오류"; break;
|
||||
case -212: sMsg = "원거래일자오류"; break;
|
||||
case -213: sMsg = "포인트거래구분오류"; break;
|
||||
case -301: sMsg = "거래중카드제거"; break;
|
||||
case -302: sMsg = "단말기 사용자 강제종료"; break;
|
||||
case -303: sMsg = "기타단말기오류"; break;
|
||||
case -304: sMsg = "카드삽입되어있음"; break;
|
||||
case -305: sMsg = "사용자강제취소"; break;
|
||||
case -401: sMsg = "시리얼포트오픈오류"; break;
|
||||
case -402: sMsg = "시리얼쓰기오류"; break;
|
||||
case -403: sMsg = "시리얼읽기오류"; break;
|
||||
case -404: sMsg = "시리얼닫기오류"; break;
|
||||
case -405: sMsg = "시리얼타임아웃"; break;
|
||||
case -411: sMsg = "미전송내역없음"; break;
|
||||
default: sMsg = "정의되어 있지 않은 메세지" + "[" + nErrCode + "]"; break;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return sMsg;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2757
Agent/OLEDevice/DeviceICReader.cs
Normal file
582
Agent/OLEDevice/DeviceLabelPrinter.cs
Normal file
|
@ -0,0 +1,582 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
public class DeviceLabelPrinter : ILabelPrinterUs
|
||||
{
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pos 상태 정보 객체
|
||||
/// </summary>
|
||||
public PosStatus m_cPosStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// RS232통신을 위한 시리얼포트 객체
|
||||
/// </summary>
|
||||
private SerialPort m_serialPort = null;
|
||||
|
||||
private BackgroundWorker bw = null;
|
||||
|
||||
public DeviceLabelPrinter()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
bw = new BackgroundWorker();
|
||||
|
||||
DeviceInit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceInit()
|
||||
{
|
||||
devStatus.LabelPrinter.Data = string.Empty;
|
||||
}
|
||||
|
||||
#region OPEN/CLOSE 처리 함수
|
||||
/// <summary>
|
||||
/// 디바이스 OPEN시 처리 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_serialPort != null)
|
||||
{
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start (주석처리)
|
||||
//m_serialPort.DiscardInBuffer();
|
||||
//m_serialPort.DiscardOutBuffer();
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
|
||||
m_serialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_serialPort = null;
|
||||
}
|
||||
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
m_serialPort = new SerialPort();
|
||||
//m_serialPort = new SerialPort(sSerialPort, (int)lBaudrate, Parity.None, 8, StopBits.One);
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
devStatus.LabelPrinter.Open = false;
|
||||
devStatus.LabelPrinter.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.LabelPrinter.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
|
||||
m_serialPort.PinChanged += new SerialPinChangedEventHandler(serialPort_PinChanged);
|
||||
m_serialPort.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort_ErrorReceived);
|
||||
|
||||
m_serialPort.NewLine = "\r\n";
|
||||
m_serialPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
|
||||
m_serialPort.WriteBufferSize = 1024 * 1024;
|
||||
m_serialPort.PortName = sSerialPort;
|
||||
m_serialPort.BaudRate = (int)lBaudrate;
|
||||
m_serialPort.DataBits = 8;
|
||||
m_serialPort.StopBits = StopBits.One;
|
||||
m_serialPort.Parity = Parity.None;
|
||||
m_serialPort.Handshake = Handshake.None;
|
||||
m_serialPort.ReadTimeout = 500;
|
||||
m_serialPort.WriteTimeout = 2000;
|
||||
|
||||
m_serialPort.Open();
|
||||
if (m_serialPort.IsOpen == false)
|
||||
{
|
||||
devStatus.LabelPrinter.Open = false;
|
||||
devStatus.LabelPrinter.Status = "SERIAL PORT OPEN ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.LabelPrinter.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
devStatus.LabelPrinter.Open = true;
|
||||
devStatus.LabelPrinter.Status = "SUCCESS";
|
||||
|
||||
bw.DoWork += OlePosHandler;
|
||||
bRet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
devStatus.LabelPrinter.Open = false;
|
||||
devStatus.LabelPrinter.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.LabelPrinter.Status);
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 디바이스 CLOSE시 처리 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_serialPort == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
m_serialPort.DiscardInBuffer();
|
||||
m_serialPort.DiscardOutBuffer();
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
|
||||
m_serialPort.Close();
|
||||
bRet = true;
|
||||
m_serialPort = null;
|
||||
devStatus.LabelPrinter.Status = "CLOSE";
|
||||
devStatus.LabelPrinter.Open = false;
|
||||
bw.DoWork -= OlePosHandler;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 이벤트 처리
|
||||
private void OlePosHandler(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PosOLEDevice.m_delegateOlePos != null)
|
||||
PosOLEDevice.m_delegateOlePos(PosConst.OPOS_DEVICE.LABELPRINTER, devStatus.Scale.Data, string.Empty, string.Empty);
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"이벤트 전송 대상 없음");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort serialPort = (SerialPort)sender;
|
||||
byte[] bytRecvBuf = new byte[serialPort.BytesToRead];
|
||||
|
||||
try
|
||||
{
|
||||
if (!bw.IsBusy)
|
||||
{
|
||||
serialPort.Read(bytRecvBuf, 0, bytRecvBuf.Length);
|
||||
|
||||
bw.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"이벤트 처리 전 이벤트 발생 불가");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void serialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 명령어 처리 함수
|
||||
/// <summary>
|
||||
/// 일반 제품정보 라벨 프린터 출력 함수
|
||||
/// </summary>
|
||||
/// <param name="sProductNm_Ko">제품명(한글) ex)"파인트"</param>
|
||||
/// <param name="sProductNm_En">제품명(영문) ex)"Pint"</param>
|
||||
/// <param name="sWeight">중량 ex)"340g"</param>
|
||||
/// <param name="sStoreNm">점포명 ex)"양재사옥점"</param>
|
||||
public void PrintProductWeightInfo(string sProductNm_Ko, string sProductNm_En, string sWeight, string sStoreNm)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
try
|
||||
{
|
||||
if (m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.OLD_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "NASC 949\r\n" // intermec 한글폰트 설정
|
||||
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "PRPOS 0,150\r\n"
|
||||
//grayber@20180308 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sProductNm_Ko + " : " + sWeight + "\"\r\n"
|
||||
, "PRTXT \"" + sProductNm_Ko + " : " + string.Format( "{0:#,###}",CmUtil.IntParse(sWeight)) + "\"\r\n"
|
||||
//grayber@20180308 시리얼 포트 버퍼 초기화 end
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\"\r\n"
|
||||
|
||||
, "PRPOS 0,70\r\n"
|
||||
//grayber@20180308 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sStoreNm + "\"\r\n"
|
||||
, "PRTXT \"" + sStoreNm +" 점" + "\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else if(m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.NEW_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "SETUP \"MEDIA,MEDIA SIZE,LENGTH,1200\"\r\n" // 용지출력범위 조정
|
||||
, "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "NASC 949\r\n" // intermec 한글폰트 설정
|
||||
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 110,290\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sStoreNm + "\"\r\n"
|
||||
, "PRTXT \"" + sStoreNm + " 점" + "\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
|
||||
, "FONT \"HYGothic-Medium\",5\r\n"
|
||||
, "PRPOS 110,270\r\n"
|
||||
, "PRTXT \"" + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",7\r\n"
|
||||
, "PRPOS 70,50\r\n"
|
||||
, "PRTXT \"" + sProductNm_En + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 70,20\r\n"
|
||||
, "PRTXT \"" + sProductNm_Ko + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",14\r\n"
|
||||
, "PRPOS 170,20\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sWeight + "\"\r\n"
|
||||
, "PRTXT \"" + string.Format( "{0:#,###}",CmUtil.IntParse(sWeight)) + "\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Check label printer model configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 02O(해피오더) 제품정보 라벨 프린터 출력 함수
|
||||
/// </summary>
|
||||
/// <param name="sProductNm">제품명 ex)"패밀리"</param>
|
||||
/// <param name="sOrderNo">주문번호 ex)"123456"</param>
|
||||
/// <param name="sWeight">중량 ex)"990g"</param>
|
||||
/// <param name="sContent_1">ex) "플레이버1/플레이버2/플레이버3"</param>
|
||||
/// <param name="sContent_2">ex) "플레이버4/플레이버5/플레이버6"</param>
|
||||
/// <param name="sStoreNm">점포명 ex)"양재사옥"</param>
|
||||
/// <param name="sOrderYmdhms">주문시간 ex)"2016-06-23 14:00:00"</param>
|
||||
/// <param name="sPackingYmdhms">포장시간 ex)"2016-06-23 14:20:00"</param>
|
||||
public void PrintO2OProductInfo(string sProductNm, string sOrderNo, string sWeight, string sContent_1, string sContent_2, string sStoreNm, string sOrderYmdhms, string sPackingYmdhms)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
try
|
||||
{
|
||||
if (m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.OLD_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "CLL\r\n"
|
||||
, "NEW\r\n"
|
||||
, "CLIP ON\r\n"
|
||||
, "FONT \"HYGothic-Medium\",12\r\n"
|
||||
, "NASC 949\r\n"
|
||||
|
||||
, "PRPOS 0,190\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sProductNm + " / " + sWeight + " (" + sOrderNo + ")\"\r\n"
|
||||
, "PRTXT \"" + sProductNm + " / " + string.Format( "{0:#,###}", CmUtil.IntParse( sWeight)) + " (" + sOrderNo + ")\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
|
||||
, "PRPOS 0,150\r\n"
|
||||
, "PRTXT \"" + sContent_1 + "\"\r\n"
|
||||
|
||||
, "PRPOS 0,110\r\n"
|
||||
, "PRTXT \"" + sContent_2 + "\"\r\n"
|
||||
|
||||
, "PRPOS 0,50\r\n"
|
||||
, "PRTXT \"주문 " + sOrderYmdhms + "\"\r\n"
|
||||
|
||||
, "PRPOS 0,10\r\n"
|
||||
, "PRTXT \"포장 " + sPackingYmdhms + "\"\r\n"
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.NEW_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "SETUP \"MEDIA,MEDIA SIZE,Length,1200\"\r\n" // 라벨프린터 용지범위 수정
|
||||
, "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "NASC 949\r\n" // intermec 한글폰트 설정
|
||||
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 110,290\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sStoreNm + "\"\r\n"
|
||||
, "PRTXT \"" + sStoreNm + " 점" + "\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
|
||||
, "FONT \"HYGothic-Medium\",5\r\n"
|
||||
, "PRPOS 90,270\r\n"
|
||||
, "PRTXT \"주문 " + sOrderYmdhms + "\"\r\n"
|
||||
|
||||
, "PRPOS 90,250\r\n"
|
||||
, "PRTXT \"포장 " + sPackingYmdhms + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PRPOS 60,200\r\n"
|
||||
, "PRTXT \"" + sProductNm + "(" + sOrderNo + ")" + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",8\r\n"
|
||||
, "PRPOS 60,170\r\n"
|
||||
, "PRTXT \"" + sContent_1 + "\"\r\n"
|
||||
|
||||
, "PRPOS 60,150\r\n"
|
||||
, "PRTXT \"" + sContent_2 + "\"\r\n"
|
||||
|
||||
, "FONT \"HYGothic-Medium\",14\r\n"
|
||||
, "PRPOS 200,20\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 start
|
||||
//, "PRTXT \"" + sWeight + "\"\r\n"
|
||||
, "PRTXT \"" + string.Format("{0:#,###}", CmUtil.IntParse(sWeight)) + "\"\r\n"
|
||||
//grayber@20180308 라벨프린터 처리, 시리얼 포트 버퍼 초기화 end
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Check label printer model configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 바코드 출력 라벨 프린터 출력 함수
|
||||
/// </summary>
|
||||
/// <param name="sProductNm_Ko">제품명(한글) ex)"파인트"</param>
|
||||
/// <param name="sBarcode_Data">바코드 ex)"zxcgfdsgfhgsf"</param>
|
||||
/// <param name="sStoreNm">점포명 ex)"양재사옥점"</param>
|
||||
public void PrintProductBarCodeInfo(string sProductNm_Ko, string sBarcode_Data, string sStoreNm)
|
||||
{
|
||||
string[] sCommands = null;
|
||||
try
|
||||
{
|
||||
if (m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.OLD_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "CLIP ON\r\n"
|
||||
, "BF ON\r\n"
|
||||
, "PP 100,90\r\n"
|
||||
, "BM 1\r\n"
|
||||
, "BT \"CODE128\r\n"
|
||||
, "BF \"Swiss 721 BT\",7\r\n"
|
||||
, "PB \"" + sBarcode_Data + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",10\r\n"
|
||||
, "NASC 949\r\n"
|
||||
, "PP 20,40\r\n"
|
||||
, "PT \"" + sProductNm_Ko + "\"\r\n"
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else if (m_cPosStatus.Base.OlePosLabelPrinterModel == PosConst.POS_DEVICE_LIST.LABEL_PRINTER.NEW_TYPE)
|
||||
{
|
||||
sCommands = new string[] { "SETUP \"MEDIA,MEDIA SIZE,LENGTH,1200\"\r\n" // 용지출력범위 조정
|
||||
, "CLL\r\n" // 메모리 클리어
|
||||
, "NEW\r\n" // 새로운 명령어 시작
|
||||
, "BF ON\r\n"
|
||||
, "PP 90,150\r\n"
|
||||
, "BH 50\r\n"
|
||||
, "BM 1\r\n"
|
||||
, "BT \"CODE128\r\n"
|
||||
, "BF \"Swiss 721 BT\",7\r\n"
|
||||
, "PB \"" + sBarcode_Data + "\"\r\n"
|
||||
, "NASC 949\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PP 130,290\r\n"
|
||||
, "PT \"" + sStoreNm + "\" 점\r\n"
|
||||
, "FONT \"HYGothic-Medium\",5\r\n"
|
||||
, "PP 130,270\r\n"
|
||||
, "PT \"시간" + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\"\r\n"
|
||||
, "FONT \"HYGothic-Medium\",9\r\n"
|
||||
, "PP 90,20\r\n"
|
||||
, "PT \"" + sProductNm_Ko + "\"\r\n"
|
||||
, "PF\r\n" };
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Check label printer model configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sCommands != null)
|
||||
WriteCommand(sCommands);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write commands to port.
|
||||
/// </summary>
|
||||
/// <param name="sCommands"></param>
|
||||
private void WriteCommand(string[] sCommands)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(devStatus.LabelPrinter.Open)
|
||||
{
|
||||
foreach(string cmd in sCommands)
|
||||
{
|
||||
m_serialPort.Write(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
308
Agent/OLEDevice/DeviceLineDisplay.cs
Normal file
|
@ -0,0 +1,308 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Line Display 제어 CLASS
|
||||
/// </summary>
|
||||
public class DeviceLineDisplay : ILineDisplayUs
|
||||
{
|
||||
#region VctCdpStdJo.dll 제어 함수
|
||||
[DllImport("VctCdpStdJo.dll")]
|
||||
public static extern int CdpOpen();
|
||||
|
||||
[DllImport("VctCdpStdJo.dll")]
|
||||
public static extern int CdpWrite(string sMsg, int iAmt);
|
||||
|
||||
[DllImport("VctCdtpStdJo.dll")]
|
||||
public static extern int CdpClose();
|
||||
#endregion
|
||||
#region 클래스 변수 선언
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
|
||||
public PosStatus m_cPosStatus = new PosStatus();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = new DeviceStatus();
|
||||
|
||||
/// <summary>
|
||||
/// RS232통신을 위한 시리얼포트 객체
|
||||
/// </summary>
|
||||
private SerialPort m_serialPort = null;
|
||||
|
||||
//private BackgroundWorker bw = null;
|
||||
#endregion 클래스 변수 선언
|
||||
|
||||
#region 생성자 / 초기화
|
||||
public DeviceLineDisplay()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
|
||||
DeviceStatusInit();
|
||||
//bw = new BackgroundWorker();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceStatusInit()
|
||||
{
|
||||
devStatus.LineDisplay.Open = false;
|
||||
devStatus.LineDisplay.Status = string.Empty;
|
||||
}
|
||||
#endregion 생성자 / 초기화
|
||||
|
||||
#region OPEN / CLOSE 처리
|
||||
public bool OpenDevice(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_serialPort != null)
|
||||
{
|
||||
m_serialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_serialPort = null;
|
||||
}
|
||||
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
m_serialPort = new SerialPort();
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
devStatus.Scale.Open = false;
|
||||
devStatus.Scale.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_ERROR,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.NewLine = "\r\n";
|
||||
m_serialPort.Encoding = System.Text.Encoding.GetEncoding("ks_c_5601-1987");
|
||||
|
||||
m_serialPort.WriteBufferSize = 1024 * 1024;
|
||||
m_serialPort.PortName = sSerialPort;
|
||||
m_serialPort.BaudRate = (int)lBaudrate;
|
||||
m_serialPort.ReadTimeout = 500;
|
||||
m_serialPort.WriteTimeout = 2000;
|
||||
|
||||
if(m_cPosStatus.Base.OleCdpModel == PosConst.POS_DEVICE_LIST.CDP._0_TOSHIBA)
|
||||
{
|
||||
m_serialPort.Parity = Parity.Odd;
|
||||
m_serialPort.DataBits = 8;
|
||||
m_serialPort.StopBits = StopBits.One;
|
||||
m_serialPort.Handshake = Handshake.RequestToSend;
|
||||
m_serialPort.RtsEnable = true;
|
||||
m_serialPort.DtrEnable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_serialPort.Parity = Parity.None;
|
||||
m_serialPort.DataBits = 8;
|
||||
m_serialPort.StopBits = StopBits.One;
|
||||
m_serialPort.Handshake = Handshake.None;
|
||||
m_serialPort.RtsEnable = false;
|
||||
m_serialPort.DtrEnable = false;
|
||||
}
|
||||
|
||||
m_serialPort.Open();
|
||||
if (m_serialPort.IsOpen == false)
|
||||
{
|
||||
devStatus.LineDisplay.Open = false;
|
||||
devStatus.LineDisplay.Status = "SERIAL PORT OPEN ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
devStatus.LineDisplay.Open = true;
|
||||
devStatus.LineDisplay.Status = "SUCCESS";
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
devStatus.LineDisplay.Open = false;
|
||||
devStatus.LineDisplay.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_serialPort == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.Close();
|
||||
bRet = true;
|
||||
m_serialPort = null;
|
||||
devStatus.LineDisplay.Status = "CLOSE";
|
||||
devStatus.LineDisplay.Open = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.LineDisplay.Status = "CLOSE EXCEPTION";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
#endregion OPEN / CLOSE 처리
|
||||
|
||||
#region LineDisplay 제어
|
||||
public bool DisplayText(int iAmt, string sMsg)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
DisplayClear();
|
||||
|
||||
if (m_cPosStatus.Base.OleCdpModel == PosConst.POS_DEVICE_LIST.CDP._0_TOSHIBA)
|
||||
{
|
||||
TransmitCommand(PosConst.CDP_COMMAND.LINE_START_1);
|
||||
TransmitCommand(Convert.ToString(iAmt));
|
||||
TransmitCommand(PosConst.CDP_COMMAND.LINE_START_2);
|
||||
TransmitCommand(sMsg);
|
||||
}
|
||||
else if (m_cPosStatus.Base.OleCdpModel == PosConst.POS_DEVICE_LIST.CDP._1_XN)
|
||||
{
|
||||
TransmitCommand(string.Format("{0, -20}", Convert.ToString(iAmt)));
|
||||
TransmitCommand(string.Format("{0, -20}", sMsg));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
public bool DisplayClear()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if(m_cPosStatus.Base.OleCdpModel == PosConst.POS_DEVICE_LIST.CDP._0_TOSHIBA)
|
||||
{
|
||||
TransmitCommand(PosConst.CDP_COMMAND.LINE_CLEAR);
|
||||
}
|
||||
else if(m_cPosStatus.Base.OleCdpModel == PosConst.POS_DEVICE_LIST.CDP._1_XN)
|
||||
{
|
||||
TransmitCommand(PosConst.CDP_COMMAND.LINE_CLEAR_XN);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void TransmitCommand(byte[] aCmd, bool bSleepOn = true)
|
||||
{
|
||||
if (m_serialPort.IsOpen == true)
|
||||
{
|
||||
int iOffset = 0;
|
||||
//int iReadBuf = 2048;
|
||||
int iReadBuf = m_serialPort.WriteBufferSize;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (iOffset >= aCmd.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (iReadBuf + iOffset > aCmd.Length)
|
||||
{
|
||||
iReadBuf = aCmd.Length - iOffset;
|
||||
}
|
||||
m_serialPort.Write(aCmd, iOffset, iReadBuf);
|
||||
|
||||
iOffset += iReadBuf;
|
||||
System.Threading.Thread.Sleep(10);
|
||||
}
|
||||
//m_serialPort.Write(Encoding.Default.GetString(aCmd, 0, aCmd.Length));
|
||||
|
||||
if (bSleepOn == true) System.Threading.Thread.Sleep(30);
|
||||
}
|
||||
}
|
||||
|
||||
private void TransmitCommand(string sMsg, bool bSleepOn = true)
|
||||
{
|
||||
if(m_serialPort.IsOpen == true)
|
||||
{
|
||||
m_serialPort.WriteLine(sMsg);
|
||||
|
||||
if (bSleepOn == true) System.Threading.Thread.Sleep(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
184
Agent/OLEDevice/DeviceMsr.cs
Normal file
|
@ -0,0 +1,184 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
//using Microsoft.PointOfService;
|
||||
using System.ComponentModel;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : Msr 제어
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Msr 제어 CLASS
|
||||
/// </summary>
|
||||
public class DeviceMsr : IMsrUs
|
||||
{
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = new DeviceStatus();
|
||||
///// <summary>
|
||||
///// Pos for .Net Msr 객체
|
||||
///// </summary>
|
||||
//private Msr msr = null;
|
||||
///// <summary>
|
||||
///// Pos for .Net의 Device 정보를 가져오기 위한 객체
|
||||
///// </summary>
|
||||
//private PosExplorer posExplorer = null;
|
||||
|
||||
|
||||
private string m_sTrackData1 = string.Empty;
|
||||
private string m_sTrackData2 = string.Empty;
|
||||
private string m_sTrackData3 = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 이벤트 비동기 발생을 위한 대리자
|
||||
/// </summary>
|
||||
private BackgroundWorker bw = null;
|
||||
|
||||
private int m_nErrorCount = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceMsr()
|
||||
{
|
||||
try
|
||||
{
|
||||
//posExplorer = new PosExplorer();
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
DeviceStatusInit();
|
||||
bw = new BackgroundWorker();
|
||||
|
||||
m_nErrorCount = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DevicePosPrinter.DeviceMsr()", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 장비의 Event 발생 Enable 상태 설정
|
||||
/// <para>True:사용가능, False:사용불가능</para>
|
||||
/// </summary>
|
||||
public bool DeviceEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
bool bRet = SetDeviceEnabled(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceMsr.DeviceEnabled()", ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 장비의 Event 발생 Enable 상태 설정
|
||||
/// <para>True:사용가능, False:사용불가능</para>
|
||||
/// </summary>
|
||||
private bool SetDeviceEnabled(bool bEnable)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceMsr.SetDeviceEnabled()", ex.Message);
|
||||
devStatus.Msr.Status = "DEVICE ENABLED FAIL";
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디바이스 Open시 처리함수
|
||||
/// </summary>
|
||||
/// <param name="sDeviceType">장비종류(ex- "Msr","PosPrinter","Scanner"...)</param>
|
||||
/// <param name="sLogicalName">레지스트리 항목(ex- "DefaultMsr","DefaultPosPrinter","DefaultScanner"...)</param>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice(string sDeviceType, string sLogicalName)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceMsr.OpenDevice()", ex.Message);
|
||||
devStatus.Msr.Open = false;
|
||||
devStatus.Msr.Status = "DEVICE OPEN EXCEPTION";
|
||||
return bRet;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Msr StateServer 정보 초기화
|
||||
/// </summary>
|
||||
private void DeviceStatusInit()
|
||||
{
|
||||
devStatus.Msr.Track1Data = "";
|
||||
devStatus.Msr.Track2Data = "";
|
||||
devStatus.Msr.Track3Data = "";
|
||||
devStatus.Msr.DeviceName = "";
|
||||
devStatus.Msr.Status = "";
|
||||
devStatus.Msr.Open = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디바이스 Close시 처리함수</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
devStatus.Msr.Status = "CLOSE";
|
||||
devStatus.Msr.Open = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceMsr.CloseDevice()", ex.Message);
|
||||
devStatus.Msr.Status = "CLOSE EXCEPTION";
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
}
|
105
Agent/OLEDevice/DeviceOurHome.cs
Normal file
|
@ -0,0 +1,105 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.UserFrame;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : 아워홈
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
public class DeviceOurHome : IOurHome
|
||||
{
|
||||
#region 변수 선언
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
|
||||
/// <summary>
|
||||
/// 아워홈 OCX form 객체
|
||||
/// </summary>
|
||||
frmDeviceOurHome frmOurHome = null;
|
||||
#endregion
|
||||
|
||||
#region 생성자
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceOurHome()
|
||||
{
|
||||
try
|
||||
{
|
||||
frmOurHome = new frmDeviceOurHome();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 고객정보 조회
|
||||
/// <summary>
|
||||
/// 고객정보 조회
|
||||
/// </summary>
|
||||
/// <param name="sStoreCD"></param>
|
||||
/// <param name="sRFNo"></param>
|
||||
/// <param name="sRFType"></param>
|
||||
/// <returns></returns>
|
||||
public string Rf_EmpInfo(string sStoreCD, string sRFNo, string sRFType)
|
||||
{
|
||||
string sResult = "9^Not Connect DataBase!!!";
|
||||
try
|
||||
{
|
||||
sResult = frmOurHome.Rf_EmpInfo(sStoreCD, sRFNo, sRFType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 결제
|
||||
/// <summary>
|
||||
/// 결제
|
||||
/// </summary>
|
||||
/// <param name="sStoreCD"></param>
|
||||
/// <param name="sTranData"></param>
|
||||
/// <param name="sRfType"></param>
|
||||
/// <returns></returns>
|
||||
public string Rf_TransData(string sStoreCD, string sTranData, string sRfType)
|
||||
{
|
||||
string sResult = "9^Not Connect DataBase!!!";
|
||||
try
|
||||
{
|
||||
sResult = frmOurHome.Rf_TransData(sStoreCD, sTranData, sRfType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
5701
Agent/OLEDevice/DevicePosPrinter.cs
Normal file
324
Agent/OLEDevice/DeviceScale.cs
Normal file
|
@ -0,0 +1,324 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
public class DeviceScale : IScaleUs
|
||||
{
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pos 상태 정보 객체
|
||||
/// </summary>
|
||||
public PosStatus m_cPosStatus = null;
|
||||
|
||||
/// <summary>
|
||||
/// RS232통신을 위한 시리얼포트 객체
|
||||
/// </summary>
|
||||
private SerialPort m_serialPort = null;
|
||||
|
||||
private BackgroundWorker bw = null;
|
||||
|
||||
private string m_sReceivedData = string.Empty;
|
||||
|
||||
#region 초기화
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceScale()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
|
||||
DeviceStatusInit();
|
||||
bw = new BackgroundWorker();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeviceStatusInit()
|
||||
{
|
||||
devStatus.Scale.Open = false;
|
||||
devStatus.Scale.Data = string.Empty;
|
||||
devStatus.Scale.Status = string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OPEN/CLOSE 처리 함수
|
||||
/// <summary>
|
||||
/// 디바이스 OPEN시 처리 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice(string sSerialPort, long lBaudrate)
|
||||
{
|
||||
bool bRet = false;
|
||||
try
|
||||
{
|
||||
if (m_serialPort != null)
|
||||
{
|
||||
m_serialPort.Close();
|
||||
System.Threading.Thread.Sleep(50);
|
||||
m_serialPort = null;
|
||||
}
|
||||
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
m_serialPort = new SerialPort();
|
||||
if( m_serialPort == null)
|
||||
{
|
||||
devStatus.Scale.Open = false;
|
||||
devStatus.Scale.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
|
||||
//m_serialPort.PinChanged += new SerialPinChangedEventHandler(serialPort_PinChanged);
|
||||
//m_serialPort.ErrorReceived += new SerialErrorReceivedEventHandler(serialPort_ErrorReceived);
|
||||
|
||||
m_serialPort.NewLine = "\r\n";
|
||||
m_serialPort.Encoding = Encoding.ASCII;
|
||||
|
||||
m_serialPort.WriteBufferSize = 512;
|
||||
m_serialPort.PortName = sSerialPort;
|
||||
m_serialPort.BaudRate = (int)lBaudrate;
|
||||
m_serialPort.DataBits = 7;
|
||||
m_serialPort.StopBits = StopBits.One;
|
||||
m_serialPort.Parity = Parity.Even;
|
||||
m_serialPort.Handshake = Handshake.None;
|
||||
m_serialPort.ReadTimeout = 500;
|
||||
m_serialPort.WriteTimeout = 2000;
|
||||
|
||||
m_serialPort.Open();
|
||||
if (m_serialPort.IsOpen == false)
|
||||
{
|
||||
devStatus.Scale.Open = false;
|
||||
devStatus.Scale.Status = "SERIAL PORT OPEN ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
devStatus.Scale.Open = true;
|
||||
devStatus.Scale.Status = "SUCCESS";
|
||||
|
||||
bw.DoWork += OlePosHandler;
|
||||
bRet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
devStatus.Scale.Open = false;
|
||||
devStatus.Scale.Status = "SERIAL PORT ERROR";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
devStatus.Scale.Status);
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
/// <summary>
|
||||
/// 디바이스 Close시 처리 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (m_serialPort == null)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Close fail(m_serialPort == null)");
|
||||
return bRet;
|
||||
}
|
||||
|
||||
m_serialPort.Close();
|
||||
bRet = true;
|
||||
m_serialPort = null;
|
||||
devStatus.Scale.Status = "CLOSE";
|
||||
devStatus.Scale.Open = false;
|
||||
bw.DoWork -= OlePosHandler;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Printer.Status = "CLOSE EXCEPTION";
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 이벤트 처리
|
||||
private void OlePosHandler(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PosOLEDevice.m_delegateOlePos != null)
|
||||
PosOLEDevice.m_delegateOlePos(PosConst.OPOS_DEVICE.SCALE, devStatus.Scale.Data, string.Empty, string.Empty);
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.INFO_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"이벤트 전송 대상 없음");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort serialPort = (SerialPort)sender;
|
||||
string sHeader = string.Empty;
|
||||
string sWeight = string.Empty;
|
||||
string sUnit = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
if(!bw.IsBusy)
|
||||
{
|
||||
// 데이터의 Terminator는 개행문자(\r\n) 이므로 개행문자 까지 값을 읽는 ReadLine으로 수신
|
||||
string sBuf = serialPort.ReadLine();
|
||||
sHeader = sBuf.Substring(0, 2);
|
||||
|
||||
// 계량모드에서의 데이터만 처리.
|
||||
// ST:계량모드, QT:계수모드, US:데이터가 안정되지 않다., OL:데이터가 오버되어 있다.(계량범위를 넘었다.)
|
||||
if (sHeader.Equals("ST"))
|
||||
{
|
||||
sWeight = sBuf.Substring(3, 9);
|
||||
sUnit = sBuf.Substring(12, 3).Trim();
|
||||
|
||||
//devStatus.Scale.Data = sWeight;
|
||||
devStatus.Scale.Data = sBuf;
|
||||
devStatus.Scale.Unit = sUnit;
|
||||
}
|
||||
|
||||
bw.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
UserCom.WARNING_LEVEL,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"저울 이벤트 처리 전 이벤트 발생 불가");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void serialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void serialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 저울 0점 조정
|
||||
/// <summary>
|
||||
/// 저울 0점 조정
|
||||
/// </summary>
|
||||
public void ScaleCalibration()
|
||||
{
|
||||
byte[] bytCalibrationCmd = new byte[] { (byte)0x54, (byte)0x0A };
|
||||
|
||||
if(devStatus.Scale.Open == true)
|
||||
{
|
||||
m_serialPort.Write(bytCalibrationCmd, 0, bytCalibrationCmd.Length);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 무게 전송 요청
|
||||
/// <summary>
|
||||
/// 무게 전송 요청
|
||||
/// </summary>
|
||||
public void ScaleWeigh()
|
||||
{
|
||||
byte[] bytWeighCmd = new byte[] { (byte)0x53, (byte)0x0A };
|
||||
|
||||
if (devStatus.Scale.Open == true)
|
||||
{
|
||||
m_serialPort.Write(bytWeighCmd, 0, bytWeighCmd.Length);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
507
Agent/OLEDevice/DeviceScanner.cs
Normal file
|
@ -0,0 +1,507 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
//using Microsoft.PointOfService;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : Hand Scanner 제어
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
public class DeviceScanner : IScannerUs
|
||||
{
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Device 상태 정보 객체
|
||||
/// </summary>
|
||||
public DeviceStatus devStatus = new DeviceStatus();
|
||||
|
||||
///// <summary>
|
||||
///// Pos for .Net Scanner 객체
|
||||
///// </summary>
|
||||
//private Scanner scanner = null;
|
||||
///// <summary>
|
||||
///// Pos for .Net의 Device 정보를 가져오기 위한 객체
|
||||
///// </summary>
|
||||
//private PosExplorer posExplorer = null;
|
||||
|
||||
private string m_sScanData = string.Empty;
|
||||
private string m_sScanDataLabel = string.Empty;
|
||||
private string m_sScanDataType = string.Empty;
|
||||
|
||||
private BackgroundWorker bw = null;
|
||||
|
||||
private int m_nErrorCount = 0;
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceScanner()
|
||||
{
|
||||
try
|
||||
{
|
||||
//posExplorer = new PosExplorer();
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
DeviceStatusInit();
|
||||
bw = new BackgroundWorker();
|
||||
|
||||
m_nErrorCount = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DevicePosPrinter.Devicescanner()", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디바이스 Open시 처리함수
|
||||
/// </summary>
|
||||
/// <param name="sDeviceType">장비종류(ex- "Msr","PosPrinter","Scanner"...)</param>
|
||||
/// <param name="sLogicalName">레지스트리 항목(ex- "DefaultMsr","DefaultPosPrinter","DefaultScanner"...)</param>
|
||||
/// <returns></returns>
|
||||
public bool OpenDevice(string sDeviceType, string sLogicalName)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
//DeviceInfo devinfo = null;
|
||||
|
||||
//if (sDeviceType == DeviceType.Scanner && sLogicalName == PosConst.OPOS_LDN.SCANNER)
|
||||
// devinfo = posExplorer.GetDevice(DeviceType.Scanner, PosConst.OPOS_LDN.SCANNER);
|
||||
//else
|
||||
//{
|
||||
// devStatus.Scanner.Open = false;
|
||||
// devStatus.Scanner.Status = "DEVICE INFO ERROR";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OpenDevice()", devStatus.Scanner.Status);
|
||||
// return bRet;
|
||||
//}
|
||||
|
||||
//if (devinfo == null)
|
||||
//{
|
||||
// devStatus.Scanner.Open = false;
|
||||
// devStatus.Scanner.Status = "DEVICE INFO ERROR";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OpenDevice()", devStatus.Scanner.Status);
|
||||
// return bRet;
|
||||
//}
|
||||
|
||||
//scanner = (Scanner)posExplorer.CreateInstance(devinfo);
|
||||
|
||||
//if (scanner != null)
|
||||
//{
|
||||
// scanner.DataEvent += new DataEventHandler(Scanner_DataEvent);
|
||||
// scanner.ErrorEvent += new DeviceErrorEventHandler(Scanner_ErrorEvent);
|
||||
|
||||
// try
|
||||
// {
|
||||
// scanner.Open();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// devStatus.Scanner.Status = "OPEN FAIL";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OpenDevice()", devStatus.Scanner.Status + " " + ex.Message);
|
||||
// //UserLog.WriteAMSLog("DEV", "ERR", "0103", "GunScanner " + devStatus.Scanner.Status);
|
||||
|
||||
// return bRet;
|
||||
// }
|
||||
|
||||
|
||||
// try
|
||||
// {
|
||||
// scanner.Claim(1000);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// devStatus.Scanner.Status = "CLAIM FAIL";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "Devicescanner.OpenDevice()", devStatus.Scanner.Status + " " + ex.Message);
|
||||
// //UserLog.WriteAMSLog("DEV", "ERR", "0203", "GunScanner " + devStatus.Scanner.Status);
|
||||
// //장비관련 AMS 로그 삭제 요청(2015.07.23)
|
||||
|
||||
// return bRet;
|
||||
// }
|
||||
|
||||
// try
|
||||
// {
|
||||
// scanner.DeviceEnabled = true;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// devStatus.Scanner.Status = "DEVICE ENABLED FAIL";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OpenDevice()", devStatus.Scanner.Status + " " + ex.Message);
|
||||
// return bRet;
|
||||
// }
|
||||
|
||||
// try
|
||||
// {
|
||||
// scanner.DataEventEnabled = true;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// devStatus.Scanner.Status = "DATAEVENT ENABLED FAIL";
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OpenDevice()", devStatus.Scanner.Status + " " + ex.Message);
|
||||
// return bRet;
|
||||
// }
|
||||
// scanner.DecodeData = true;
|
||||
// devStatus.Scanner.Open = true;
|
||||
// devStatus.Scanner.Status = "Success";
|
||||
|
||||
// bw.DoWork += OlePosHandler;
|
||||
// bRet = true;
|
||||
//}
|
||||
//m_nErrorCount = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
devStatus.Scanner.Open = false;
|
||||
devStatus.Scanner.Status = "DEVICE OPEN EXCEPTION";
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.OpenDevice()", devStatus.Scanner.Status + " " + ex.Message);
|
||||
return bRet;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//private void Scanner_DataEvent(object sender, DataEventArgs e)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if(!bw.IsBusy)
|
||||
// {
|
||||
// ASCIIEncoding encoder = new ASCIIEncoding();
|
||||
|
||||
// m_sScanData = encoder.GetString(scanner.ScanData);
|
||||
// m_sScanDataLabel = encoder.GetString(scanner.ScanDataLabel);
|
||||
// m_sScanDataType = scanner.ScanDataType.ToString();
|
||||
|
||||
// devStatus.Scanner.Data = m_sScanData;
|
||||
// devStatus.Scanner.DataLabel = "";
|
||||
// //for (int i = 0; i < m_sScanDataLabel.Length; i++)
|
||||
// //{
|
||||
// // if (CmUtil.IsNumber(m_sScanDataLabel.Substring(i, 1)) == true)
|
||||
// // devStatus.Scanner.DataLabel += m_sScanDataLabel.Substring(i, 1);
|
||||
// //}
|
||||
// string sChgDataLabel = "";
|
||||
// for (int i = 0; i < scanner.ScanDataLabel.Length; i++)
|
||||
// {
|
||||
// if (scanner.ScanDataLabel[i] == (byte)29)
|
||||
// sChgDataLabel += "|";
|
||||
// else
|
||||
// sChgDataLabel += Convert.ToChar(scanner.ScanDataLabel[i]).ToString();
|
||||
// }
|
||||
// for (int i = 0; i < sChgDataLabel.Length; i++)
|
||||
// {
|
||||
// if (CmUtil.IsNumber(sChgDataLabel.Substring(i, 1)) == true)
|
||||
// {
|
||||
// devStatus.Scanner.DataLabel = sChgDataLabel.Substring(i, sChgDataLabel.Length - i);
|
||||
// break;
|
||||
// }
|
||||
// //if (sChgDataLabel.Substring(i, 1) != string.Format("{0}", (char)10) && sChgDataLabel.Substring(i, 1) != string.Format("{0}", (char)13))
|
||||
// //{
|
||||
// // devStatus.Scanner.DataLabel = devStatus.Scanner.DataLabel + sChgDataLabel.Substring(i, 1);
|
||||
// //}
|
||||
// }
|
||||
// devStatus.Scanner.DataType = m_sScanDataType;
|
||||
|
||||
// UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.Scanner_DataEvent()",
|
||||
// "Data=" + m_sScanData + ", DataLabel=" + m_sScanDataLabel + "=>" + devStatus.Scanner.DataLabel + ", DataType=" + m_sScanDataType);
|
||||
// bw.RunWorkerAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.Scanner_DataEvent()", "스캐너 이벤트 처리 전 이벤트 발생 불가");
|
||||
// //Cosmos.CommonManager.WinManager.ErrorMessage("해당 화면에서 스캐너를 입력 할 수 없습니다.", "스캐너 입력 오류", true);
|
||||
// //MessageStartTimer(100);
|
||||
// }
|
||||
|
||||
// //if (PosOLEDevice.m_delegateOlePos != null)
|
||||
// // PosOLEDevice.m_delegateOlePos(PosConst.OPOS_DEVICE.SCANNER, m_sScanData, devStatus.Scanner.DataLabel, m_sScanDataType);
|
||||
// //else
|
||||
// //{
|
||||
// // UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// // "DeviceScanner.Scanner_DataEvent()", "이벤트 전송 대상 없음.");
|
||||
// // Cosmos.CommonManager.WinManager.ErrorMessage("해당 화면에서 스캐너를 입력 할 수 없습니다.", "스캐너 입력 오류", true);
|
||||
// //}
|
||||
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.Scanner_DataEvent()", ex.Message);
|
||||
// devStatus.Scanner.Status = "DATAEVENT ERROR";
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// scanner.ClearInput();
|
||||
// scanner.DataEventEnabled = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OlePosHandler(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PosOLEDevice.m_delegateOlePos != null)
|
||||
PosOLEDevice.m_delegateOlePos(PosConst.OPOS_DEVICE.SCANNER, string.Empty, devStatus.Scanner.DataLabel, string.Empty);
|
||||
else
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.OlePosHandler()", "이벤트 전송 대상 없음.");
|
||||
//Cosmos.CommonManager.WinManager.ErrorMessage("해당 화면에서 스캐너를 입력 할 수 없습니다.", "스캐너 입력 오류", true);
|
||||
//MessageStartTimer(100);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.OlePosHandler()", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
//private void MessageStartTimer(int dueTime)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// Thread thrBeep = new Thread(new ThreadStart(OnBeepSound));
|
||||
// thrBeep.Start();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.MessageStartTimer()", ex.Message);
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void OnBeepSound()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + "PosConfig.INI");
|
||||
// string sPosUseType = m_PosConfig.GetMessage("olepos").GetMessageValue("PosUseType");
|
||||
// string sKeyboard = m_PosConfig.GetMessage("control").GetMessageValue("Keyboard");
|
||||
|
||||
// for (int i = 0; i < 5; i++)
|
||||
// {
|
||||
// WinManager.BuzzSoundOn(sPosUseType, sKeyboard);
|
||||
// Thread.Sleep(200);
|
||||
// }
|
||||
|
||||
// //CmMessage m_PosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + "PosConfig.INI");
|
||||
|
||||
// //string sPosUseType = m_PosConfig.GetMessage("olepos").GetMessageValue("PosUseType");
|
||||
// //string sKeyboard = m_PosConfig.GetMessage("control").GetMessageValue("Keyboard");
|
||||
|
||||
// //for (int i = 0; i < 5; i++)
|
||||
// //{
|
||||
// // if (sPosUseType == "2" || sPosUseType == "9" || sPosUseType == "4" || sKeyboard == "2")
|
||||
// // // POS모델 ==> 2:7K, 9.B20(Toshiba) 4.3000XC(분스)
|
||||
// // // POS키보드 ==> (0:104, 1:40, 2:32)
|
||||
// // Console.Beep();
|
||||
// // else
|
||||
// // BuzzOn(0, 0);
|
||||
// // Thread.Sleep(200);
|
||||
// //}
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.OnBeepSound()", ex.Message);
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void MessageStartTimer(int dueTime)
|
||||
//{
|
||||
// if (m_nErrorCount < 2)
|
||||
// {
|
||||
// Timer t = new Timer(new TimerCallback(MessageTimerProc));
|
||||
// t.Change(dueTime, 0);
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void MessageTimerProc(object state)
|
||||
//{
|
||||
// m_nErrorCount++;
|
||||
// // The state object is the Timer object.
|
||||
// Timer t = (Timer)state;
|
||||
// t.Dispose();
|
||||
|
||||
// Cosmos.CommonManager.WinManager.ErrorMessage("해당 화면에서 스캐너를 입력 할 수 없습니다.", "스캐너 입력 오류", true);
|
||||
// m_nErrorCount--;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//private void Scanner_ErrorEvent(object sender, DeviceErrorEventArgs e)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// ASCIIEncoding encoder = new ASCIIEncoding();
|
||||
|
||||
// m_sScanData = encoder.GetString(scanner.ScanData);
|
||||
// m_sScanDataLabel = encoder.GetString(scanner.ScanDataLabel);
|
||||
// m_sScanDataType = scanner.ScanDataType.ToString();
|
||||
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.Scanner_ErrorEvent()",
|
||||
// "ErrorEvent 발생 ScanData=[" + m_sScanData + "] ScanDataLabel=[" + m_sScanDataLabel + "] ScanDataType=[" + m_sScanDataType + "]");
|
||||
|
||||
// devStatus.Scanner.Data = string.Empty;
|
||||
// devStatus.Scanner.DataLabel = string.Empty;
|
||||
|
||||
// scanner.ClearInput();
|
||||
// scanner.DataEventEnabled = true;
|
||||
|
||||
// devStatus.Scanner.Status = "ERROR EVENT";
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
// "DeviceScanner.Scanner_ErrorEvent()", ex.Message);
|
||||
|
||||
// devStatus.Scanner.Status = "ErrorEvent Error 발생";
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Scanner StateServer 정보 초기화
|
||||
/// </summary>
|
||||
private void DeviceStatusInit()
|
||||
{
|
||||
devStatus.Scanner.Data = "";
|
||||
devStatus.Scanner.DataLabel = "";
|
||||
devStatus.Scanner.DataType = "";
|
||||
devStatus.Scanner.DeviceName = "";
|
||||
devStatus.Scanner.Status = "";
|
||||
devStatus.Scanner.Open = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 디바이스 Close시 처리함수</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CloseDevice()
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
//if (scanner == null)
|
||||
// return bRet;
|
||||
|
||||
//scanner.DataEventEnabled = false;
|
||||
//scanner.DeviceEnabled = false;
|
||||
//scanner.Release();
|
||||
//scanner.Close();
|
||||
//scanner = null;
|
||||
bRet = true;
|
||||
devStatus.Scanner.Status = "CLOSE";
|
||||
devStatus.Scanner.Open = false;
|
||||
bw.DoWork -= OlePosHandler;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
bw.DoWork -= OlePosHandler;
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.CloseDevice()", ex.Message);
|
||||
|
||||
devStatus.Scanner.Status = "CLOSE EXCEPTION";
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 장비의 Event 발생 Enable 상태 설정
|
||||
/// <para>True:사용가능, False:사용불가능</para>
|
||||
/// </summary>
|
||||
public bool DeviceEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (scanner.DeviceEnabled && scanner.DataEventEnabled)
|
||||
// return true;
|
||||
//else
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.DeviceEnabled()", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
bool bRet = SetDeviceEnabled(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.DeviceEnabled()", ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 장비의 Event 발생 Enable 상태 설정
|
||||
/// <para>True:사용가능, False:사용불가능</para>
|
||||
/// </summary>
|
||||
/// <param name="bEnable"></param>
|
||||
/// <returns></returns>
|
||||
private bool SetDeviceEnabled(bool bEnable)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
try
|
||||
{
|
||||
//scanner.DataEventEnabled = bEnable;
|
||||
//scanner.DeviceEnabled = bEnable;
|
||||
devStatus.Scanner.Status = "DEVICE ENABLED " + bEnable.ToString();
|
||||
bRet = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
"DeviceScanner.SetDeviceEnabled()", ex.Message);
|
||||
devStatus.Scanner.Status = "DEVICE ENABLED FAIL";
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
}
|
1934
Agent/OLEDevice/DeviceSignPad.cs
Normal file
455
Agent/OLEDevice/DeviceTPaygle.cs
Normal file
|
@ -0,0 +1,455 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using Cosmos.BaseFrame;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// T-PAY BLE Dongle (paygle)
|
||||
/// </summary>
|
||||
class DeviceTPaygle : ITPaygleUs
|
||||
{
|
||||
|
||||
#region ## XPayLib.dll Function
|
||||
/// <summary>
|
||||
/// 체크인 된 고객리스트를 수신
|
||||
/// </summary>
|
||||
/// <param name="connectList"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern int GetPOSConnectList(byte[] connectList);
|
||||
|
||||
/// <summary>
|
||||
/// 선택고객의 BLE OTB 발급요청(구버전 호환성문제로 유지)
|
||||
/// </summary>
|
||||
/// <param name="XPT"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern int ReqPOSProvide(byte[] XPT);
|
||||
|
||||
/// <summary>
|
||||
/// 선택고객의 BLE OTB 발급요청/수신(폰의 OS별로 지원 가능)
|
||||
/// </summary>
|
||||
/// <param name="XPT"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern int ReqPOSProvide2(byte[] XPT, byte[] param);
|
||||
|
||||
/// <summary>
|
||||
/// BLE OTB 수신
|
||||
/// </summary>
|
||||
/// <param name="KeyRlt"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern int GetOTB(byte[] KeyRlt);
|
||||
|
||||
/// <summary>
|
||||
/// 수신된 비밀번호를 40Byte 해시코드로 변환
|
||||
/// </summary>
|
||||
/// <param name="Rlt">HashString 반환버퍼</param>
|
||||
/// <param name="param">변환할 비밀번호</param>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern void PWHashing(byte[] Rlt, byte[] param);
|
||||
|
||||
/// <summary>
|
||||
/// Paygle상태를 체크하고 업데이트가 필요한 경우 업데이트
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DllImport("PaygleCheck.dll")]
|
||||
private static extern int PaygleCheckProc();
|
||||
|
||||
//#20170906 T페이 고도화 작업 phj, start
|
||||
/// 수신된 OTB를 분류 검증 (결제방식, 사전인증 체크 기능)
|
||||
/// 입력된 OTB의 유효성과, 선인증여부를 확인합니다.
|
||||
/// </summary>
|
||||
/// <param name="ClassifyOTB"> 카드번호 </param>
|
||||
[DllImport("XPayLib.dll")]
|
||||
private static extern int ClassifyOTB(byte[] ClassifyOTB);
|
||||
//#20170906 T페이 고도화 작업 phj, end
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
private PosStatus posStatus = new PosStatus(); // 기본정보 참조
|
||||
private DeviceStatus devStatus = new DeviceStatus(); // 장치정보 참조
|
||||
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public DeviceTPaygle()
|
||||
{
|
||||
devStatus = (DeviceStatus)StateObject.DEVICE;
|
||||
posStatus = (PosStatus)StateObject.POS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 체크인 고객리스트 수신
|
||||
/// </summary>
|
||||
/// <param name="phoneList">고객리스트(JSON)</param>
|
||||
/// <returns>체크인된고객수</returns>
|
||||
/// <remarks>
|
||||
/// * Connect List (JSON Format)
|
||||
/// 1 DATETIME YYYYMMDDHHMMSS 결과수신시간/처리시간
|
||||
/// 2 POSID string 요청POS 식별번호
|
||||
/// 3 LIST JSONList 체크인 고객리스트
|
||||
/// 3.1 XPT String 단말기 식별코드 (반복)
|
||||
/// 3.2 NAME String 단말기 등록이름 (반복)
|
||||
/// 3.3 NICKNAME String 단말기 등록 닉네임 (반복)
|
||||
/// 3.4 MDN String 단말기 전화번호 (반복)
|
||||
/// 3.5 DEVICE_TYPE String “001” : 안드로이드, “002” : 아이폰(iOS 적용 버전)
|
||||
///
|
||||
/// * Sample
|
||||
/// {
|
||||
/// "DATETIME":"20160329144522",
|
||||
/// "POSID":"WHONEED010",
|
||||
/// "LIST":[
|
||||
/// {"XPT":"********lVGOW48naN0mRPg==", "NAME":"**호", "NICK_NAME":"별명", "MDN":"01089**23**","DEVICE_TYPE":"001"}
|
||||
/// …(반복)
|
||||
/// ]
|
||||
/// }
|
||||
/// </remarks>
|
||||
public int GetConnectList(out string phoneList)
|
||||
{
|
||||
phoneList = string.Empty;
|
||||
try
|
||||
{
|
||||
byte[] buffer = new byte[1024 * 2];
|
||||
|
||||
int ret = GetPOSConnectList(buffer);
|
||||
if (ret < 0)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll GetPOSConnectList Function Error (ErrorCode=" + ret.ToString() + ")");
|
||||
}
|
||||
phoneList = Encoding.Default.GetString(buffer).Replace("\0", "");
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
return -9;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="phoneList"></param>
|
||||
/// <returns></returns>
|
||||
public int GetConnectList(out Column.TPAY_CONNECT_INFO phoneList)
|
||||
{
|
||||
phoneList = null;
|
||||
try
|
||||
{
|
||||
byte[] buffer = new byte[1024 * 2];
|
||||
|
||||
int ret = GetPOSConnectList(buffer);
|
||||
string result = Encoding.Default.GetString(buffer).Replace("\0", "");
|
||||
if (ret < 0)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll GetPOSConnectList Function Error (ErrorCode=" + ret.ToString() + ")");
|
||||
return ret;
|
||||
}
|
||||
|
||||
phoneList = new Column.TPAY_CONNECT_INFO();
|
||||
|
||||
JObject json = JObject.Parse(result);
|
||||
phoneList.DATATIME = json["DATETIME"].ToString();
|
||||
phoneList.POSID = json["POSID"].ToString();
|
||||
|
||||
JArray jArray = JArray.Parse(json["LIST"].ToString());
|
||||
for (var i = 0; i < ret; i++)
|
||||
{
|
||||
JObject js = JObject.Parse(jArray[i].ToString());
|
||||
|
||||
Column.TPAY_PHONE phone = new Column.TPAY_PHONE();
|
||||
phone.XPT = js["XPT"].ToString();
|
||||
phone.NAME = js["NAME"].ToString();
|
||||
phone.NICK_NAME = js["NICK_NAME"].ToString();
|
||||
phone.MDN = js["MDN"].ToString();
|
||||
phone.DEVICE_TYPE = js["DEVICE_TYPE"].ToString();
|
||||
|
||||
phoneList.LIST.Add(phone);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
phoneList = null;
|
||||
return -9;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 선택된 XPT 단말기(스마트폰)에 BLE BOT 발급 요청
|
||||
/// </summary>
|
||||
/// <param name="xpt">결제키 발급대상 단말기 식별코드</param>
|
||||
/// <param name="posID">요청POS식별번호</param>
|
||||
/// <param name="deviceType">장비구분(001:안드로이드, 002:iOS)</param>
|
||||
/// <returns</returns>
|
||||
public bool ReqPosProvide(string xpt, string posID, string deviceType, out string errMsg)
|
||||
{
|
||||
errMsg = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
//byte[] param1 = Encoding.Default.GetBytes(xpt);
|
||||
//byte[] param2 = Encoding.Default.GetBytes(posID);
|
||||
//int ret = ReqPOSProvide(param1);
|
||||
|
||||
string temp = JObject.FromObject(new { XPT = xpt, DEVICE_TYPE = deviceType }).ToString();
|
||||
//string temp = "{" + string.Format("\"XPT\":\"{0}\",\"DEVICE_TYPE\":\"{1}\"", xpt, deviceType) + "}";
|
||||
byte[] param1 = Encoding.Default.GetBytes(xpt);
|
||||
byte[] param2 = Encoding.Default.GetBytes(temp);
|
||||
int ret = ReqPOSProvide2(param1, param2);
|
||||
if (ret < 0)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll ReqPOSProvide2 Function Error (ErrorCode=" + ret.ToString() + ")");
|
||||
|
||||
}
|
||||
|
||||
errMsg = ret == 0 ? string.Empty : "Error Code =" + ret.ToString();
|
||||
return ret == 0 ? true : false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
errMsg = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BLE OTB 수신
|
||||
/// </summary>
|
||||
/// <param name="result">성공:OTB, 실패:오류메시지</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>0:성공, -10001:Timeout, -10002:DeviceError</remarks>
|
||||
public bool GetOTB(out string result)
|
||||
{
|
||||
result = string.Empty;
|
||||
try
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
int ret = GetOTB(buffer);
|
||||
switch(ret)
|
||||
{
|
||||
case 0:
|
||||
result = Encoding.Default.GetString(buffer).Replace("\0", "").Trim();
|
||||
break;
|
||||
case -10001:
|
||||
result = "Timeout";
|
||||
break;
|
||||
case -10002:
|
||||
result = "Device Error";
|
||||
break;
|
||||
}
|
||||
if (ret != 0)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll GetOTB Function Error (ErrorCode=" + ret.ToString() + ", " + result + ")");
|
||||
}
|
||||
|
||||
return ret == 0 ? true : false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
result = ex.Message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 수신된 비밀번호를 40Byte 해시코드로 변환
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public string GetHashPassword(string password)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] buffer = new byte[40];
|
||||
byte[] pws = new byte[4];
|
||||
pws = Encoding.Default.GetBytes(password);
|
||||
|
||||
PWHashing(buffer, pws);
|
||||
|
||||
return Encoding.Default.GetString(buffer).Replace("\0", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CheckPaygle()
|
||||
{
|
||||
try
|
||||
{
|
||||
int ret = PaygleCheckProc();
|
||||
return ret == 0 ? true : false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"Exception." + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//#20170906 T페이 고도화 작업 phj, start
|
||||
#region ## ClassifyOTBCheck 입력된 OTB의 유효성과, 선인증여부를 확인
|
||||
public int ClassifyOTBCheck(string pOTB)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] GetOTB = Encoding.Default.GetBytes(pOTB);
|
||||
|
||||
//입력된 OTB의 유효성과, 선인증여부를 확인
|
||||
//10 : 구버전의 OTB로 제약 없음
|
||||
//20 : 할인/결제 가능, 핀패드 입력 필요
|
||||
//21 : 할인/결제 가능, 핀패드 입력 불필요
|
||||
//30 : 결제만 가능, 핀패드 입력 필요
|
||||
//31 : 결제만 가능, 핀패드 입력 불필요
|
||||
|
||||
ret = ClassifyOTB(GetOTB);
|
||||
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll ClassifyOTB Function Result : " + ret.ToString() + ", (" + pOTB + ")");
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll ClassifyOTB Function Exception : " + ex.Message + ", Result : " + ret.ToString() + ", (" + pOTB + ")");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
//#20170906 T페이 고도화 작업 phj, end
|
||||
|
||||
//#20170906 T페이 고도화 작업 phj, start
|
||||
#region ## ClassifyOTBCheckMsg 메세지
|
||||
public string ClassifyOTBCheckMsg(string pOTB)
|
||||
{
|
||||
string result = string.Empty;
|
||||
try
|
||||
{
|
||||
switch (pOTB)
|
||||
{
|
||||
case "0":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0729);//"유효하지 않은 OTB 입니다"
|
||||
break;
|
||||
case "10":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0730);//"구버전의 OTB 입니다"
|
||||
break;
|
||||
case "20":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0731);//"통합결제만 가능 합니다(결제비밀번호 필수)";
|
||||
break;
|
||||
case "21":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0732);//"통합결제만 가능 합니다(결제비밀번호 불필요)";
|
||||
break;
|
||||
case "30":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0733);//"일반결제만 가능 합니다(결제비밀번호 필수)";
|
||||
break;
|
||||
case "31":
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0734);//"일반결제만 가능 합니다(결제비밀번호 불필요)";
|
||||
break;
|
||||
|
||||
default:
|
||||
result = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0735);//"해당응답코드없음";
|
||||
break;
|
||||
}
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll ClassifyOTB Function Msg : " + result + ", (" + pOTB + ")");
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
"XPayLib.dll ClassifyOTB Function Msg Exception : " + ex.Message + ", Result : " + result + ", (" + pOTB + ")");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//#20170906 T페이 고도화 작업 phj, end
|
||||
}
|
||||
}
|
623
Agent/OLEDevice/OCBDirect.cs
Normal file
|
@ -0,0 +1,623 @@
|
|||
using Cosmos.Common;
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.UserFrame;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
// 설 명 : OCB 직통신
|
||||
// 작 성 자 :
|
||||
// 변경 이력 :
|
||||
/*-----------------------------------------------------------------------------------------------*/
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// OCB 직통신
|
||||
/// </summary>
|
||||
public class OCBDirect : IOCBDirect
|
||||
{
|
||||
#region MPS.DLL 함수
|
||||
/// <summary>
|
||||
/// 가맹점등록
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int RegisterMcht(string A, string B, string C, string D, string E, string F, string G, string H, string I, string J, byte[] K);
|
||||
/// <summary>
|
||||
/// 가맹점등록
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int AuthMcht(string A, string B, string C, string D, string E, string F, string G, string H, string I, string J, byte[] K);
|
||||
|
||||
/// <summary>
|
||||
/// 포인트조회
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int InquiryPoint(string A, string B, string C, string D, string E, string F, string G, string H, string I, string J, string K, string L, byte[] M);
|
||||
/// <summary>
|
||||
/// 포인트적립
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int SavePoint(string A, string B, string C, string D, string E, string F, string G, string H,
|
||||
string I, string J, string K, string L, string M, string N, string O, string P,
|
||||
string Q, string R, string S, string T, string U, string V, string W, string X,
|
||||
string Y, int Z, byte[] AA, int BB, byte[] CC, byte[] DD);
|
||||
/// <summary>
|
||||
/// 포인트적립취소
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int CancelSavePoint(string A, string B, string C, string D, string E, string F, string G, string H,
|
||||
string I, string J, string K, string L, string M, string N, string O, string P,
|
||||
string Q, string R, string S, string T, string U, string V, byte[] W);
|
||||
/// <summary>
|
||||
/// 포인트사용
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int UsePoint ( string A, string B, string C, string D, string E, string F, string G, string H,
|
||||
string I, string J, string K, string L, string M, string N, string O, string P,
|
||||
string Q, string R, string S, string T, byte[] U );
|
||||
/// <summary>
|
||||
/// 포인트사용취소
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int CancelUsePoint(string A, string B, string C, string D, string E, string F, string G, string H,
|
||||
string I, string J, string K, string L, string M, string N, string O, string P,
|
||||
string Q, string R, string S, byte[] T);
|
||||
/// <summary>
|
||||
/// 포인트할인
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int DiscountService(string A, string B, string C, string D, string E, string F, string G, string H, string I,
|
||||
string J, string K, string L, string M, string N, string O, string P, string Q, string R,
|
||||
string S, string T, byte[] U);
|
||||
/// <summary>
|
||||
/// 포인트할인취소
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int CancelDiscountService ( string A, string B, string C, string D, string E, string F, string G, string H, string I,
|
||||
string J, string K, string L, string M, string N, string O, string P, string Q, string R,
|
||||
string S, byte[] T );
|
||||
/// <summary>
|
||||
/// 망취소
|
||||
/// </summary>
|
||||
[DllImport("MPS.dll")]
|
||||
public static extern int ForcedCancelUsePoint(string A, string B, string C, string D, string E, string F, string G, string H,
|
||||
string I, string J, string K, string L, string M, string N, string O, string P,
|
||||
string Q, string R, string S, byte[] T);
|
||||
|
||||
private IDataCommonUs m_cDataCommon = null;
|
||||
protected SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
|
||||
#endregion
|
||||
|
||||
#region 생성자
|
||||
/// <summary>
|
||||
/// StateServer Object (StateServer 객체)
|
||||
/// </summary>
|
||||
public StateServer StateObject = (StateServer)StateServer.GetInstance();
|
||||
/// <summary>
|
||||
/// Pos 상태 정보 객체
|
||||
/// </summary>
|
||||
public PosStatus m_cPosStatus = null;
|
||||
/// <summary>
|
||||
/// 생성자
|
||||
/// </summary>
|
||||
public OCBDirect()
|
||||
{
|
||||
try
|
||||
{
|
||||
m_cPosStatus = (PosStatus)StateObject.POS;
|
||||
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OCB 직통신
|
||||
/// <summary>
|
||||
/// OCB 직통신
|
||||
/// </summary>
|
||||
/// <param name="sTradeDiv"></param>
|
||||
/// <param name="sPayWayCD"></param>
|
||||
/// <param name="sPayWayDtlCD"></param>
|
||||
/// <param name="sTranType"></param>
|
||||
/// <param name="sCardNo"></param>
|
||||
/// <param name="sCardPwd"></param>
|
||||
/// <param name="sPayAmt"></param>
|
||||
/// <param name="sApprDt"></param>
|
||||
/// <param name="sApprNo"></param>
|
||||
/// <param name="sUniqueID"></param>
|
||||
/// <param name="sResMsg"></param>
|
||||
/// <param name="aIrtRspDTL"></param>
|
||||
/// <returns></returns>
|
||||
public string OCB_Direct_Point(string sTradeDiv, string sPayWayCD, string sPayWayDtlCD, string sTranType, string sCardNo, string sCardPwd, string sPayAmt, string sApprDt, string sApprNo, string sUniqueID, ref string sResMsg, ref string[] aIrtRspDTL)
|
||||
{
|
||||
int nRet = -1;
|
||||
string sRet = UserCom.RST_ERR;
|
||||
|
||||
byte[] bRecvData = new byte[4096];
|
||||
int nNowPos = 0;
|
||||
|
||||
string sResCD = "0";
|
||||
string sApprTm = "";
|
||||
|
||||
try
|
||||
{
|
||||
#region 0.기초설정
|
||||
// 응답메시지
|
||||
sResMsg = "";
|
||||
|
||||
// VAN 정보 조회
|
||||
//string sCMPApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosMst.MST_VAN.DATA.CMP_APPR_ID);
|
||||
//string sApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosMst.MST_VAN.DATA.APPR_ID);
|
||||
//string sApprPWD = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.POINT_ITEM, ItemConst.TR_ITEM_ID.POINT_USE.OKCASHBACK_POINT, PosMst.MST_VAN.DATA.APPR_PWD);
|
||||
string sCMPApprID = PosMstManager.GetMstVan(PosMstManager.GetPosOption(POS_OPTION.OPT326), PosMst.MST_VAN.DATA.CMP_APPR_ID);
|
||||
string sApprID = PosMstManager.GetMstVan(PosMstManager.GetPosOption(POS_OPTION.OPT326), PosMst.MST_VAN.DATA.APPR_ID);
|
||||
string sApprPWD = PosMstManager.GetMstVan(PosMstManager.GetPosOption(POS_OPTION.OPT326), PosMst.MST_VAN.DATA.APPR_PWD);
|
||||
|
||||
// 입력구분
|
||||
string sInputType = "2";
|
||||
if (sCardNo.IndexOf("=") > 0) sInputType = "0";
|
||||
|
||||
// 추적번호 = POS번호(2) + 일자(DD) + 시간(SSFFF)
|
||||
if (sTranType != PosConst.POS_OCB_DIRECT.NET_CAN_POINT)
|
||||
sUniqueID = m_cPosStatus.Base.PosNo.PadLeft(2, '0') + DateTime.Now.ToString("dd") + string.Format("{0:00000}", DateTime.Now.ToString("ssfff")) + "0";
|
||||
#endregion
|
||||
|
||||
// 요청 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
|
||||
string sSendData = sTranType + CmUtil.MidH(sCMPApprID, 0, 4) + DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss") + CmUtil.MidH(sUniqueID, 0, 10) + "A" + "A1" + CmUtil.MidH(sApprID, 0, 15) + CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10) + CmUtil.MidH(sApprPWD, 0, 16) + CmUtil.MidH(sCardNo, 0, 16) + CmUtil.MidH(sCardPwd, 0, 16) + CmUtil.MidH(sPayAmt, 0, 16) + CmUtil.MidH(sApprDt, 0, 8) + CmUtil.MidH(sApprNo, 0, 16) + CmUtil.MidH(sUniqueID, 0, 10);
|
||||
|
||||
// 승인데이터 중 카드번호 마스킹 처리(2017.05.25)
|
||||
string sWriteSendData = CmUtil.MakeLogDataToMask(false, sCardNo, sSendData);
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"[SEND:" + sWriteSendData);
|
||||
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { sPayWayCD, sPayWayDtlCD, sTranType, "S", sCardNo, sPayAmt, "", "", "", "", "", sWriteSendData });
|
||||
|
||||
#region 1.요청전문
|
||||
// 1.요청전문
|
||||
switch (sTranType)
|
||||
{
|
||||
case PosConst.POS_OCB_DIRECT.STOR_REGISTER:
|
||||
{
|
||||
#region 가맹점 등록
|
||||
/*
|
||||
A CHAR 4 전문번호 2A10
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 16 가맹점 비밀번호 예:1111
|
||||
*/
|
||||
nRet = RegisterMcht(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1"
|
||||
, CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10), CmUtil.MidH(sApprPWD, 0, 16), bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.STOR_AUTH:
|
||||
{
|
||||
#region 가맹점 인증
|
||||
/*
|
||||
A CHAR 4 전문번호 2A20
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 16 가맹점 비밀번호 예:1111
|
||||
*/
|
||||
nRet = AuthMcht(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1"
|
||||
, CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10), CmUtil.MidH(sApprPWD, 0, 16), bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.INQ_POINT:
|
||||
{
|
||||
#region 포인트 조회
|
||||
/*
|
||||
A CHAR 4 전문번호 2M30
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
K CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
L CHAR 2 요청구분 카드번호 : 'R1' , 주민번호 :'R2'
|
||||
*/
|
||||
nRet = InquiryPoint(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1"
|
||||
, CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), "R1", bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.SAVE_POINT:
|
||||
{
|
||||
#region 포인트 적립
|
||||
/*
|
||||
A CHAR 4 전문번호 2100
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 8 거래일자 예:20030924(YYYYMMDD)
|
||||
K CHAR 6 거래시간 예:130201(HHMMSS)
|
||||
L CHAR 1 KEY-IN 여부 '0':Swapping, '2':Key-in, 'F': mart 수집상품 only
|
||||
M CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
N CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
O CHAR 2 전표코드 '01' : 적립
|
||||
P CHAR 2 거래구분코드 '11' : 금액현재, '12' : 금액가용, '21' : 포인트현재, '22' : 포인트가용
|
||||
Q CHAR 2 계약구분코드 현금:01, 카드:02
|
||||
R CHAR 10 거래금액 예:10000
|
||||
S CHAR 9 현금거래금액 예:12000 (공급가액(T) + 부가가치세(U) + 봉사료(V)의 합계)
|
||||
T CHAR 9 공급가액 예:10000(현금결제시 현금영수증발급을 위해 입력)
|
||||
U CHAR 9 부가가치세 예:1000(현금결제시 현금영수증발급을 위해 입력)
|
||||
V CHAR 9 봉사료 예:1000(현금결제시 현금영수증발급을 위해 입력)
|
||||
W CHAR 1 거래자구분 소비자소득공제용(0:기본값), 사업자지출증빙용(1)
|
||||
X CHAR 1 현금영수증처리구분 적립+현금(0), 적립Only(1)
|
||||
Y CHAR 30 영수증번호 예:123456789(공백은 Space처리)
|
||||
Z INT 4 쿠폰상품개수 예:2 (50개를 초과하지 않음) (상품 없을 경우 0(Zero))
|
||||
AA STRUCT 가변 상품바코드(18) 예:8823456789123 (적립코드)(상품 없을 경우 입력안함)
|
||||
(모두 CHAR형) 상품수량(5) 예:2 (공백은 Space로처리)(상품 없을 경우 입력안함)
|
||||
적립용 상품 제휴사코드(6) 예:123456 (상품 없을 경우 입력안함)
|
||||
포인트구분(1)
|
||||
BB INT 4 마트상품개수 예:2 (50개를 초과하지 않음) (상품 없을 경우 0(Zero))
|
||||
CC STRUCT 가변 상품바코드(18) 예:8823456789123 (적립코드)(상품 없을 경우 입력안함)
|
||||
(모두 CHAR형) 상품수량(6) 예:2 (공백은 Space로처리) (상품 없을 경우 입력안함)
|
||||
수집용 상품 제휴사코드(6) 예:123456 (상품 없을 경우 입력안함)
|
||||
상품판매단가(9) 예:10000 (공백은 Space로처리)(상품 없을 경우 입력안함)
|
||||
상품분류코드(6) 예:F10000 (상품 없을 경우 입력안함)
|
||||
인자를 넘길때 (CHAR *)으로 Type Casting해서 넘긴다.
|
||||
*/
|
||||
nRet = SavePoint(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1", CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10)
|
||||
, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
|
||||
, CmUtil.MidH(sInputType, 0, 1), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), "01", "11", "01"
|
||||
, CmUtil.MidH(sPayAmt, 0, 10), CmUtil.MidH("", 0, 9), CmUtil.MidH("", 0, 9), CmUtil.MidH("", 0, 9), CmUtil.MidH("", 0, 9)
|
||||
, CmUtil.MidH("0", 0, 1), "1", CmUtil.MidH("", 0, 30), 0, null, 0, null, bRecvData);
|
||||
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.SAVE_CAN_POINT:
|
||||
{
|
||||
#region 포인트 적립 취소
|
||||
/*
|
||||
A CHAR 4 전문번호 2110
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 8 거래일자 예:20030924(YYYYMMDD)
|
||||
K CHAR 6 거래시간 예:130201(HHMMSS)
|
||||
L CHAR 1 KEY-IN 여부 0':Swapping, '2':Key-in
|
||||
M CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
N CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
O CHAR 8 원거래일자 예:20030924(YYYYMMDD)
|
||||
P CHAR 9 원거래승인번호 예:123456789(공백은 Space로처리)
|
||||
Q CHAR 2 전표코드 '21' : 적립취소
|
||||
R CHAR 2 거래구분코드 '41' : 적립취소
|
||||
S CHAR 10 원거래금액 예:10000(공백은 Space로처리)
|
||||
T CHAR 1 취소요청구분 적립+현금(0), 적립Only(1)
|
||||
U CHAR 30 원거래 영수증번호 예:123456789(공백은 Space처리)
|
||||
V CHAR 1 현금영수증 취소사유 코드 '1' : 반품/거래취소, '2' : 거래오류로인한 취소, '3' : 기타(사유분류 불분명)
|
||||
*/
|
||||
nRet = CancelSavePoint(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1", CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10)
|
||||
, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
|
||||
, CmUtil.MidH(sInputType, 0, 1), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), CmUtil.MidH(sApprDt, 0, 8), CmUtil.MidH(sApprNo, 0, 9), "21", "41"
|
||||
, CmUtil.MidH(sPayAmt, 0, 10), "1", CmUtil.MidH("", 0, 30), "1", bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.USE_POINT:
|
||||
{
|
||||
#region 포인트 사용
|
||||
/*
|
||||
A CHAR 4 전문번호 2400
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 8 거래일자 예:20030924(YYYYMMDD)
|
||||
K CHAR 6 거래시간 예:130201(HHMMSS)
|
||||
L CHAR 1 KEY-IN 여부 0':Swapping, '2':Key-in
|
||||
M CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
N CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
O CHAR 16 카드 비밀번호 예:1111
|
||||
P CHAR 2 전표코드 '11' : 사용
|
||||
Q CHAR 2 거래구분코드 '40' : 사용
|
||||
R CHAR 2 계약구분코드 '08' : 포인트 사용
|
||||
S CHAR 10 사용포인트 예:10000
|
||||
T CHAR 10 총거래금액 예:10000
|
||||
*/
|
||||
nRet = UsePoint(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1", CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10)
|
||||
, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
|
||||
, CmUtil.MidH(sInputType, 0, 1), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), CmUtil.MidH(sCardPwd, 0, 16), "11", "40", "08"
|
||||
, CmUtil.MidH(sPayAmt, 0, 10), CmUtil.MidH("", 0, 10), bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.USE_CAN_POINT:
|
||||
{
|
||||
#region 포인트 사용 취소
|
||||
/*
|
||||
A CHAR 4 전문번호 2410
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 Sequence number(일별 Unique)
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 8 거래일자 예:20030924(YYYYMMDD)
|
||||
K CHAR 6 거래시간 예:130201(HHMMSS)
|
||||
L CHAR 1 KEY-IN 여부 0':Swapping, '2':Key-in
|
||||
M CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
N CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
O CHAR 8 원거래일자 예:20030924(YYYYMMDD)
|
||||
P CHAR 9 원거래승인번호 예:123456789(공백은 Space로처리)
|
||||
Q CHAR 2 전표코드 '22' : 사용취소
|
||||
R CHAR 2 거래구분코드 '42' : 사용취소
|
||||
S CHAR 10 원거래금액 예:10000(공백은 Space로처리)
|
||||
*/
|
||||
nRet = CancelUsePoint(sTranType, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1", CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10)
|
||||
, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
|
||||
, CmUtil.MidH(sInputType, 0, 1), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), CmUtil.MidH(sApprDt, 0, 8), CmUtil.MidH(sApprNo, 0, 9), "22", "42"
|
||||
, CmUtil.MidH(sPayAmt, 0, 10), bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.NET_CAN_POINT:
|
||||
{
|
||||
#region 망취소
|
||||
/*
|
||||
A CHAR 4 전문번호 2410
|
||||
B CHAR 4 기관코드 해당기관코드
|
||||
C CHAR 8 전송일자 예:20030924(YYYYMMDD)
|
||||
D CHAR 6 전송시간 예:130201(HHMMSS)
|
||||
E CHAR 10 추적번호 포인트 사용 호출시 사용한 추적번호
|
||||
F CHAR 1 멤버쉽프로그램ID 'A' : OKCashbag
|
||||
G CHAR 2 서비스구분 'A1' : OK캐쉬백서비스, 'A2' : T포인트서비스 , 'A3' : 로디아서비스
|
||||
H CHAR 15 가맹점번호 가맹점번호(8)+SPACE 7자리 입력
|
||||
I CHAR 10 가맹점사업자번호 예:1111111111
|
||||
J CHAR 8 거래일자 예:20030924(YYYYMMDD)
|
||||
K CHAR 6 거래시간 예:130201(HHMMSS)
|
||||
L CHAR 1 KEY-IN 여부 0':Swapping, '2':Key-in
|
||||
M CHAR 19 카드번호 예:1234123412341234 ('-'제외)
|
||||
N CHAR 19 주민번호 예:1234123412341234 ('-'제외)
|
||||
O CHAR 8 원거래일자 예:20030924(YYYYMMDD)
|
||||
P CHAR 9 원거래승인번호 예:123456789(공백은 Space로처리)
|
||||
Q CHAR 2 전표코드 '21' : 적립취소 '22' : 사용취소
|
||||
R CHAR 2 거래구분코드 '41' : 적립취소 '42' : 사용취소
|
||||
S CHAR 10 원거래금액 예:10000(공백은 Space로처리)
|
||||
*/
|
||||
nRet = ForcedCancelUsePoint(PosConst.POS_OCB_DIRECT.NET_CAN_POINT, CmUtil.MidH(sCMPApprID, 0, 4), DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss"), CmUtil.MidH(sUniqueID, 0, 10), "A", "A1", CmUtil.MidH(sApprID, 0, 15), CmUtil.MidH(m_cPosStatus.Mst.StorBizPsnNo, 0, 10)
|
||||
, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")
|
||||
, CmUtil.MidH(sInputType, 0, 1), CmUtil.MidH(sCardNo, 0, 19), CmUtil.MidH("", 0, 19), CmUtil.MidH(sApprDt, 0, 8), CmUtil.MidH(sApprNo, 0, 9), (sTranType == PosConst.POS_OCB_DIRECT.SAVE_CAN_POINT ? "21" : "22"), (sTranType == PosConst.POS_OCB_DIRECT.SAVE_CAN_POINT ? "41" : "42")
|
||||
, CmUtil.MidH(sPayAmt, 0, 10), bRecvData);
|
||||
break;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 2.처리결과
|
||||
// 2.처리결과
|
||||
if (nRet != 1)
|
||||
{
|
||||
sResMsg = ErrCodeToMsg(nRet); // 오류
|
||||
sResCD = "1";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 3.응답전문(정상)
|
||||
else
|
||||
{
|
||||
// 정상응답
|
||||
switch (sTranType)
|
||||
{
|
||||
case PosConst.POS_OCB_DIRECT.STOR_REGISTER: // 가맹점 등록
|
||||
case PosConst.POS_OCB_DIRECT.STOR_AUTH: // 가맹점 인증
|
||||
{
|
||||
nNowPos = 0;
|
||||
aIrtRspDTL = new string[Column.POS_REQ_OCB_AUTHMCHT.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.POS_REQ_OCB_AUTHMCHT.LEN, Column.POS_REQ_OCB_AUTHMCHT.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
|
||||
if (aIrtRspDTL[Column.POS_REQ_OCB_AUTHMCHT.SEQ.RES_CD].Trim() != "1")
|
||||
{
|
||||
// 응답오류
|
||||
sResMsg = aIrtRspDTL[Column.POS_REQ_OCB_AUTHMCHT.SEQ.RES_MSG].Trim();
|
||||
sResCD = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 정상
|
||||
sResMsg = "OK";
|
||||
sResCD = "0";
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.INQ_POINT: // 포인트 조회
|
||||
{
|
||||
nNowPos = 0;
|
||||
aIrtRspDTL = new string[Column.POS_REQ_OCB_INQPOINT.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.POS_REQ_OCB_INQPOINT.LEN, Column.POS_REQ_OCB_INQPOINT.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
|
||||
if (aIrtRspDTL[Column.POS_REQ_OCB_INQPOINT.SEQ.RES_CD].Trim() != "1")
|
||||
{
|
||||
// 응답오류
|
||||
sResMsg = aIrtRspDTL[Column.POS_REQ_OCB_INQPOINT.SEQ.RES_MSG1].Trim();
|
||||
sResCD = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 정상
|
||||
sResMsg = "OK";
|
||||
sResCD = "0";
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.SAVE_POINT: // 포인트 적립
|
||||
case PosConst.POS_OCB_DIRECT.USE_POINT: // 포인트 사용
|
||||
{
|
||||
nNowPos = 0;
|
||||
aIrtRspDTL = new string[Column.POS_REQ_OCB_POINT.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.POS_REQ_OCB_POINT.LEN, Column.POS_REQ_OCB_POINT.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
|
||||
if (aIrtRspDTL[Column.POS_REQ_OCB_POINT.SEQ.RES_CD].Trim() != "1")
|
||||
{
|
||||
// 응답오류
|
||||
sResMsg = aIrtRspDTL[Column.POS_REQ_OCB_POINT.SEQ.RES_MSG1].Trim();
|
||||
sResCD = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 정상
|
||||
sResMsg = "OK";
|
||||
sResCD = "0";
|
||||
sApprDt = aIrtRspDTL[Column.POS_REQ_OCB_POINT.SEQ.APPR_DATE].Trim();
|
||||
sApprTm = aIrtRspDTL[Column.POS_REQ_OCB_POINT.SEQ.APPR_TIME].Trim();
|
||||
sApprNo = aIrtRspDTL[Column.POS_REQ_OCB_POINT.SEQ.APPR_NO].Trim();
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PosConst.POS_OCB_DIRECT.SAVE_CAN_POINT: // 포인트 적립 취소
|
||||
case PosConst.POS_OCB_DIRECT.USE_CAN_POINT: // 포인트 사용 취소
|
||||
case PosConst.POS_OCB_DIRECT.NET_CAN_POINT: // 포인트 망 취소
|
||||
{
|
||||
nNowPos = 0;
|
||||
aIrtRspDTL = new string[Column.POS_REQ_OCB_CANPOINT.LEN.Length];
|
||||
ItemColumn.ParseMessage(Column.POS_REQ_OCB_CANPOINT.LEN, Column.POS_REQ_OCB_CANPOINT.TYPE, bRecvData, ref nNowPos, ref aIrtRspDTL);
|
||||
if (aIrtRspDTL[Column.POS_REQ_OCB_CANPOINT.SEQ.RES_CD].Trim() != "1")
|
||||
{
|
||||
// 응답오류
|
||||
sResMsg = aIrtRspDTL[Column.POS_REQ_OCB_CANPOINT.SEQ.RES_MSG1].Trim();
|
||||
sResCD = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 정상
|
||||
sResMsg = "OK";
|
||||
sResCD = "0";
|
||||
sApprDt = aIrtRspDTL[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_DATE].Trim();
|
||||
sApprTm = aIrtRspDTL[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_TIME].Trim();
|
||||
sApprNo = aIrtRspDTL[Column.POS_REQ_OCB_CANPOINT.SEQ.APPR_NO].Trim();
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 응답 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
|
||||
string sRecvData = ByteToString(bRecvData);
|
||||
|
||||
// 승인데이터 중 카드번호 마스킹 처리(2017.05.25)
|
||||
string sWriteRecvData = CmUtil.MakeLogDataToMask(false, sCardNo, sRecvData.Trim());
|
||||
UserLog.WriteLogFile(UserCom.LOG_SOCK, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
|
||||
"[RECV:" + sWriteRecvData);
|
||||
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { sPayWayCD, sPayWayDtlCD, sTranType, "R"
|
||||
, sCardNo, sPayAmt
|
||||
, sApprNo, (sApprDt == "" ? DateTime.Now.ToString("yyyyMMdd") : sApprDt), (sApprTm == "" ? DateTime.Now.ToString("HHmmss") : sApprTm)
|
||||
, sResCD
|
||||
, sResMsg
|
||||
, sWriteRecvData });
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
sResMsg = ex.Message;
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 응답코드
|
||||
/// <summary>
|
||||
/// 응답코드
|
||||
/// </summary>
|
||||
/// <param name="nErrCode"></param>
|
||||
/// <returns></returns>
|
||||
private string ErrCodeToMsg(int nErrCode)
|
||||
{
|
||||
string sMsg = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
switch (nErrCode)
|
||||
{
|
||||
case -1 : sMsg = "실패 - 함수Parameter값 이상"; break;
|
||||
case 2 : sMsg = "암호화 실패 - 암호화, 복호화오류"; break;
|
||||
case 3 : sMsg = "소켓 초기화 실패 - 네트워크 단절에 의한 소켓 초기화 실패"; break;
|
||||
case 4 : sMsg = "소켓 Send 실패"; break;
|
||||
case 5 : sMsg = "소켓 Receive 실패"; break;
|
||||
case 6 : sMsg = "소켓 타임아웃"; break;
|
||||
case 7 : sMsg = "인터넷 연결 실패"; break;
|
||||
default: sMsg = "알 수 없는 에러"; break;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return sMsg;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Byte 문자열 처리
|
||||
/// <summary>
|
||||
/// Byte배열을 string으로 변환 (Byte배열의 null(0x00)값 제거)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
private string ByteToString(byte[] data)
|
||||
{
|
||||
int inx = Array.FindIndex(data, 0, (x) => x == 0x0);
|
||||
if (inx >= 0)
|
||||
{
|
||||
return Encoding.Default.GetString(data, 0, inx);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Encoding.Default.GetString(data);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
139
Agent/OLEDevice/OLEDevice.csproj
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{404D077E-7CD4-49E6-8219-E79A28749DE0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Cosmos.OLEDevice</RootNamespace>
|
||||
<AssemblyName>Agent.OLEDevice</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>Svn</SccProjectName>
|
||||
<SccLocalPath>Svn</SccLocalPath>
|
||||
<SccAuxPath>Svn</SccAuxPath>
|
||||
<SccProvider>SubversionScc</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\BIN\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\..\BIN\Agent.OLEDevice.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AxInterop.SPCNSECUCATLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\AxInterop.SPCNSECUCATLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AxInterop.SPCNSECUMSRLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\AxInterop.SPCNSECUMSRLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.BaseFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.BaseFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.ServiceProvider, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.ServiceProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cosmos.UserFrame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Cosmos.UserFrame.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.PointOfService, Version=1.12.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Microsoft.PointOfService.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\BIN\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Activator.cs" />
|
||||
<Compile Include="DeviceCashdrawer.cs" />
|
||||
<Compile Include="DeviceCatTerminal.cs" />
|
||||
<Compile Include="DeviceICReader.cs" />
|
||||
<Compile Include="DeviceLabelPrinter.cs" />
|
||||
<Compile Include="DeviceLineDisplay.cs" />
|
||||
<Compile Include="DeviceScale.cs" />
|
||||
<Compile Include="DeviceOurHome.cs" />
|
||||
<Compile Include="OCBDirect.cs" />
|
||||
<Compile Include="DeviceTPaygle.cs" />
|
||||
<Compile Include="frmDeviceOurHome.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmDeviceOurHome.Designer.cs">
|
||||
<DependentUpon>frmDeviceOurHome.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DeviceMsr.cs" />
|
||||
<Compile Include="DevicePosPrinter.cs" />
|
||||
<Compile Include="DeviceScanner.cs" />
|
||||
<Compile Include="DeviceSignPad.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="frmDeviceOurHome.resx">
|
||||
<DependentUpon>frmDeviceOurHome.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="AxOUT_STOR_RF">
|
||||
<Guid>{0C240E1D-AB66-45B9-A7D5-A523F36009C2}</Guid>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>aximp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Library\CommonManager\CommonManager.csproj">
|
||||
<Project>{670a81be-cee3-4c29-846d-a37652ca270d}</Project>
|
||||
<Name>CommonManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Library\Common\Common.csproj">
|
||||
<Project>{a5b7accd-79eb-4261-bd36-01ab484ad8e3}</Project>
|
||||
<Name>Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy .\IC\Agent.OLEDevice.dll .\Agent.OLEDevice.dll</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy .\Agent.OLEDevice.dll .\IC\Agent.OLEDevice.dll</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
Agent/OLEDevice/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
|
||||
// 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이 특성 값을 변경하십시오.
|
||||
[assembly: AssemblyTitle("OLEDevice")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OLEDevice")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("cec0ee82-9b18-4cf3-b591-21e8967580dc")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
|
||||
// 지정되도록 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
65
Agent/OLEDevice/frmDeviceOurHome.Designer.cs
generated
Normal file
|
@ -0,0 +1,65 @@
|
|||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
partial class frmDeviceOurHome
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDeviceOurHome));
|
||||
this.axOUT_STORE_RF1 = new AxOUT_STOR_RF.AxOUT_STORE_RF();
|
||||
((System.ComponentModel.ISupportInitialize)(this.axOUT_STORE_RF1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// axOUT_STORE_RF1
|
||||
//
|
||||
this.axOUT_STORE_RF1.Enabled = true;
|
||||
this.axOUT_STORE_RF1.Location = new System.Drawing.Point(95, 12);
|
||||
this.axOUT_STORE_RF1.Name = "axOUT_STORE_RF1";
|
||||
this.axOUT_STORE_RF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axOUT_STORE_RF1.OcxState")));
|
||||
this.axOUT_STORE_RF1.Size = new System.Drawing.Size(34, 36);
|
||||
this.axOUT_STORE_RF1.TabIndex = 0;
|
||||
//
|
||||
// frmDeviceOurHome
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(380, 325);
|
||||
this.Controls.Add(this.axOUT_STORE_RF1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "frmDeviceOurHome";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "frmOurHome";
|
||||
((System.ComponentModel.ISupportInitialize)(this.axOUT_STORE_RF1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AxOUT_STOR_RF.AxOUT_STORE_RF axOUT_STORE_RF1;
|
||||
|
||||
}
|
||||
}
|
237
Agent/OLEDevice/frmDeviceOurHome.cs
Normal file
|
@ -0,0 +1,237 @@
|
|||
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;
|
||||
|
||||
using Cosmos.Common;
|
||||
using Cosmos.ServiceProvider;
|
||||
using Cosmos.CommonManager;
|
||||
using Cosmos.UserFrame;
|
||||
using Cosmos.BaseFrame;
|
||||
|
||||
namespace Cosmos.OLEDevice
|
||||
{
|
||||
public partial class frmDeviceOurHome : Form
|
||||
{
|
||||
#region 변수 선언
|
||||
|
||||
protected SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
||||
protected StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
||||
protected PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
||||
|
||||
/// <summary>
|
||||
/// 빌딩코드
|
||||
/// </summary>
|
||||
///private string m_sRegStorCode = "";
|
||||
/// <summary>
|
||||
/// 서버 IP
|
||||
/// </summary>
|
||||
private string m_sServerIP = "";
|
||||
/// <summary>
|
||||
/// DB 스키마
|
||||
/// </summary>
|
||||
private string m_sDBChema = "";
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
private string m_sID = "";
|
||||
/// <summary>
|
||||
/// Password
|
||||
/// </summary>
|
||||
private string m_sPassword = "";
|
||||
#endregion
|
||||
|
||||
public frmDeviceOurHome()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
|
||||
//this.UpdateStyles();
|
||||
|
||||
//m_sRegStorCode = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.EMP_PAY_ITEM, ItemConst.TR_ITEM_ID.EMP_PAY.OURHOME, PosMst.MST_VAN.DATA.CMP_APPR_ID);
|
||||
m_sServerIP = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.EMP_PAY_ITEM, ItemConst.TR_ITEM_ID.EMP_PAY.OURHOME, PosMst.MST_VAN.DATA.IP);
|
||||
|
||||
// 접속정보
|
||||
LoadPosConfig_OurHome();
|
||||
if (m_sDBChema == null || m_sDBChema.Trim() == "") SavePosConfig_OurHome();
|
||||
}
|
||||
|
||||
#region 접속/해제 처리 함수
|
||||
/// <summary>
|
||||
/// DB 접속
|
||||
/// </summary>
|
||||
/// <param name="sStorCode"></param>
|
||||
/// <param name="sServerIP"></param>
|
||||
/// <param name="sDBSchema"></param>
|
||||
/// <param name="sID"></param>
|
||||
/// <param name="sPassword"></param>
|
||||
/// <returns></returns>
|
||||
private string DBConnect(string sStorCode, string sServerIP, string sDBSchema, string sID, string sPassword)
|
||||
{
|
||||
string sResult = "9^Not Connect DataBase!!!";
|
||||
try
|
||||
{
|
||||
sResult = axOUT_STORE_RF1.DbConnect(sStorCode, sServerIP, sDBSchema, sID, sPassword);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DB 접속 해제
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private void DBDisConnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
axOUT_STORE_RF1.DbDisConnect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 고객정보 조회
|
||||
/// <summary>
|
||||
/// 고객정보 조회
|
||||
/// </summary>
|
||||
/// <param name="sStoreCD"></param>
|
||||
/// <param name="sRFNo"></param>
|
||||
/// <param name="sRFType"></param>
|
||||
/// <returns></returns>
|
||||
public string Rf_EmpInfo(string sStoreCD, string sRFNo, string sRFType)
|
||||
{
|
||||
string sResult = "9^Not Connect DataBase!!!";
|
||||
string[] aRecvData = null;
|
||||
try
|
||||
{
|
||||
sResult = DBConnect(sStoreCD, m_sServerIP, m_sDBChema, m_sID, m_sPassword);
|
||||
aRecvData = sResult.Split(new string[] { "^" }, StringSplitOptions.None);
|
||||
if (aRecvData[0] != "1") return sResult;
|
||||
|
||||
sResult = axOUT_STORE_RF1.Rf_EmpInfo(sStoreCD, sRFNo, sRFType);
|
||||
DBDisConnect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 결제
|
||||
/// <summary>
|
||||
/// 결제
|
||||
/// </summary>
|
||||
/// <param name="sTranData"></param>
|
||||
/// <param name="sRfType"></param>
|
||||
/// <returns></returns>
|
||||
public string Rf_TransData(string sStoreCD, string sTranData, string sRfType)
|
||||
{
|
||||
string sResult = "9^Not Connect DataBase!!!";
|
||||
string[] aRecvData = null;
|
||||
try
|
||||
{
|
||||
sResult = DBConnect(sStoreCD, m_sServerIP, m_sDBChema, m_sID, m_sPassword);
|
||||
aRecvData = sResult.Split(new string[] { "^" }, StringSplitOptions.None);
|
||||
if (aRecvData[0] != "1") return sResult;
|
||||
|
||||
sResult = axOUT_STORE_RF1.Rf_TransData(sTranData, sRfType);
|
||||
DBDisConnect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UserLog.WriteLogFile(UserCom.LOG_IOS,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명)
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명))
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명))
|
||||
ex.Message);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SavePosConfig Pos 환경설정정보 저장 (PosConfig.INI)
|
||||
/// <summary>
|
||||
/// POS환경설정정보 파일저장 (PosConfig.INI)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string SavePosConfig_OurHome()
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
try
|
||||
{
|
||||
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
||||
|
||||
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("DBChema".Trim(), "OURHOME");
|
||||
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("ID".Trim(), "OUT_STORE");
|
||||
cmPosConfig.GetMessage("OURHOME".Trim()).MakeMessageOverWrite("Password".Trim(), "OUT_STORE");
|
||||
|
||||
// 파일저장
|
||||
cmPosConfig.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
||||
|
||||
LoadPosConfig_OurHome();
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadPosConfig Pos 환경설정정보 읽기(PosConfig.INI)
|
||||
/// <summary>
|
||||
/// POS환경설정정보 파일읽기 (PosConfig.INI)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string LoadPosConfig_OurHome()
|
||||
{
|
||||
string sRet = UserCom.RST_ERR;
|
||||
try
|
||||
{
|
||||
CmMessage cmPosConfig = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosConfig);
|
||||
|
||||
m_sDBChema = cmPosConfig.GetMessage("OURHOME").GetMessageValue("DBChema");
|
||||
m_sID = cmPosConfig.GetMessage("OURHOME").GetMessageValue("ID");
|
||||
m_sPassword = cmPosConfig.GetMessage("OURHOME").GetMessageValue("Password");
|
||||
|
||||
sRet = UserCom.RST_OK;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
||||
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
||||
}
|
||||
return sRet;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
129
Agent/OLEDevice/frmDeviceOurHome.resx
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="axOUT_STORE_RF1.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAXQAAAAIB
|
||||
AAAAAQAAAAAAAAAAAAAAAEgAAACTsgAASAAAAAMACAAL8ldHIAAAAF8AZQB4AHQAZQBuAHQAeACEAwAA
|
||||
AwAIAAryV0fg////XwBlAHgAdABlAG4AdAB5ALkDAAAL
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
BIN
Dropimage/Bl_bar.png
Normal file
After Width: | Height: | Size: 1002 B |
BIN
Dropimage/Bl_discount.png
Normal file
After Width: | Height: | Size: 982 B |
BIN
Dropimage/Bl_num1.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
Dropimage/Bl_num2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
Dropimage/Bl_num3.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
Dropimage/Btn_coupondelete.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
Dropimage/Btn_toggle_off.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
Dropimage/Btn_toggle_on.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
Dropimage/Ic_Basket.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
Dropimage/Ic_ai_off.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
Dropimage/Ic_ai_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
Dropimage/Ic_mylist_d.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
Dropimage/Ic_mylist_n.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
Dropimage/Ic_mylist_s.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
Dropimage/Ic_mylist_x.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Dropimage/Ic_order_off.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
Dropimage/Ic_order_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |