7월4일 업데이트

This commit is contained in:
crusader 2019-07-05 13:15:37 +09:00
parent 60754b31f8
commit ef94d13699
11 changed files with 289 additions and 62 deletions

View File

@ -3,8 +3,18 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
namespace SPC.Kiosk.Common namespace SPC.Kiosk.Common
{ {
public static class AiScannerProcess public static class AiScannerProcess
{ {
[DllImport("user32.dll")] [DllImport("user32.dll")]
@ -28,6 +38,16 @@ namespace SPC.Kiosk.Common
private static Process AiScannerExe = null; private static Process AiScannerExe = null;
private static readonly string ip = "127.0.0.1";
private static readonly int port = 11004;
private static Thread listenThread;
private static Thread recevieThread;
private static Socket clientSocket;
private static Socket listenSocket;
public static bool Excuted public static bool Excuted
{ {
get get
@ -66,6 +86,8 @@ namespace SPC.Kiosk.Common
AiScannerExe.WaitForInputIdle(500); AiScannerExe.WaitForInputIdle(500);
SetParent(AiScannerExe.MainWindowHandle, _openner); SetParent(AiScannerExe.MainWindowHandle, _openner);
//AiScannerExe.StartInfo.WindowStyle = ProcessWindowStyle.Normal; //AiScannerExe.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
//StartListening();
} }
} }
else else
@ -87,11 +109,19 @@ namespace SPC.Kiosk.Common
AiScannerExe.WaitForExit(); AiScannerExe.WaitForExit();
AiScannerExe.Dispose(); AiScannerExe.Dispose();
AiScannerExe = null; AiScannerExe = null;
} }
else else
{ {
if (AiScannerExe != null) AiScannerExe = null; if (AiScannerExe != null) AiScannerExe = null;
} }
} }
} }
} }

View File

@ -53,6 +53,14 @@
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="redLIB.Common, Version=1.0.0.15, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BIN\redLIB.Common.dll</HintPath>
</Reference>
<Reference Include="redLIB.IO, Version=1.0.0.10, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BIN\redLIB.IO.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />

View File

@ -725,8 +725,12 @@ namespace SPC.Kiosk.DataHelper
var nhsFuncInfoType = new NhsFuncInfoType(); var nhsFuncInfoType = new NhsFuncInfoType();
var dictionaryNhsFuncInfo = new Dictionary<string, string>(); var dictionaryNhsFuncInfo = new Dictionary<string, string>();
try
{
var dt = m_cDataCommon.Select_NHS_FUNC_INFO(); var dt = m_cDataCommon.Select_NHS_FUNC_INFO();
if (dt != null)
{
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭 //전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields()) foreach (var item in nhsFuncInfoType.GetType().GetFields())
{ {
@ -738,6 +742,12 @@ namespace SPC.Kiosk.DataHelper
dictionaryNhsFuncInfo.Add(item.GetValue(item.Name)?.ToString(), rowData["USE_YN"]?.ToString()); dictionaryNhsFuncInfo.Add(item.GetValue(item.Name)?.ToString(), rowData["USE_YN"]?.ToString());
} }
} }
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "GetNhsFuncInfo()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
return dictionaryNhsFuncInfo; return dictionaryNhsFuncInfo;
} }

View File

@ -44,6 +44,15 @@ namespace SPC.Kiosk.PB.ViewModel
public WaitWindow WaitWindowFrom { get; set; } public WaitWindow WaitWindowFrom { get; set; }
private PBPaymentPageType defaultPage = PBPaymentPageType.DetailBasket; private PBPaymentPageType defaultPage = PBPaymentPageType.DetailBasket;
/// <summary>
/// Default Page
/// </summary>
public PBPaymentPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private NhsFuncInfoItem nhsFuncInfo; private NhsFuncInfoItem nhsFuncInfo;
/// <summary> /// <summary>
/// NHS Func Info /// NHS Func Info
@ -54,15 +63,6 @@ namespace SPC.Kiosk.PB.ViewModel
set { nhsFuncInfo = value; PropertyChange("NhsFuncInfo"); } set { nhsFuncInfo = value; PropertyChange("NhsFuncInfo"); }
} }
/// <summary>
/// Default Page
/// </summary>
public PBPaymentPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private string optionValue802; private string optionValue802;
/// <summary> /// <summary>
/// 진동벨 사용유무 /// 진동벨 사용유무
@ -1320,14 +1320,12 @@ namespace SPC.Kiosk.PB.ViewModel
GotoLeftCommand = new Command(GotoLeftCommandHandler); GotoLeftCommand = new Command(GotoLeftCommandHandler);
GotoRightCommand = new Command(GotoRightCommandHandler); GotoRightCommand = new Command(GotoRightCommandHandler);
this.GetPosOption();
this.GetNhsFuncInfo();
this.IsCompanyMember = new posHappyPoint().IsCompanyMember; this.IsCompanyMember = new posHappyPoint().IsCompanyMember;
this.PropertyChanged += PBPaymentsViewModel_PropertyChanged; this.PropertyChanged += PBPaymentsViewModel_PropertyChanged;
ShowLanguageType = CommonValue.CommonLanguageType; ShowLanguageType = CommonValue.CommonLanguageType;
this.GetPosOption();
this.GetNhsFuncInfo();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1355,6 +1353,9 @@ namespace SPC.Kiosk.PB.ViewModel
{ {
//Get NHS_FUNC_INFO Data Dictionary //Get NHS_FUNC_INFO Data Dictionary
var nhsFuncInfoData = commonDataHelper.GetNhsFuncInfo(); var nhsFuncInfoData = commonDataHelper.GetNhsFuncInfo();
if (nhsFuncInfoData?.Count > 0)
{
//고유식별 Type //고유식별 Type
var nhsFuncInfoType = new NhsFuncInfoType(); var nhsFuncInfoType = new NhsFuncInfoType();
//View Binding 데이터 //View Binding 데이터
@ -1371,6 +1372,7 @@ namespace SPC.Kiosk.PB.ViewModel
} }
} }
} }
}
#region Contents #region Contents
private void InitailizeDetailBasket() private void InitailizeDetailBasket()

View File

@ -22,6 +22,9 @@ using SPC.Kiosk.PB.Model;
using SPC.Kiosk.Popup; using SPC.Kiosk.Popup;
using SPC.Kiosk.Popup.Model; using SPC.Kiosk.Popup.Model;
using System.Threading; using System.Threading;
using System.Net.Sockets;
using System.Net;
using Newtonsoft.Json.Linq;
#endregion #endregion
namespace SPC.Kiosk.PB.ViewModel namespace SPC.Kiosk.PB.ViewModel
{ {
@ -38,6 +41,17 @@ namespace SPC.Kiosk.PB.ViewModel
private Task ScanProcess = null; private Task ScanProcess = null;
//public Dictionary<string, string> PosOptionValues; //public Dictionary<string, string> PosOptionValues;
private static readonly string ip = "127.0.0.1";
private static readonly int port = 11004;
private static Thread listenThread;
private static Thread recevieThread;
private static Socket clientSocket;
private static Socket listenSocket;
private string optionValue810; private string optionValue810;
/// <summary> /// <summary>
/// 자동계산 사용여부 /// 자동계산 사용여부
@ -67,6 +81,16 @@ namespace SPC.Kiosk.PB.ViewModel
set { optionValue812 = value; PropertyChange("OptionValue812"); } set { optionValue812 = value; PropertyChange("OptionValue812"); }
} }
private PBSensingSubPageType sensingSubPage = PBSensingSubPageType.SensingPage;
/// <summary>
/// PB Sensing SubPage Type
/// </summary>
public PBSensingSubPageType SensingSubPage
{
get { return sensingSubPage; }
set { sensingSubPage = value; PropertyChange("SensingSubPage"); }
}
/// <summary> /// <summary>
/// 처리중 화면 /// 처리중 화면
/// </summary> /// </summary>
@ -673,15 +697,7 @@ namespace SPC.Kiosk.PB.ViewModel
/// Info LogoX /// Info LogoX
/// </summary> /// </summary>
public string InfoLogoX { get; set; } = ResourceManager.GetNximagePathAdd("btn_help.png", CommonValue.PBdesignImagesPath); public string InfoLogoX { get; set; } = ResourceManager.GetNximagePathAdd("btn_help.png", CommonValue.PBdesignImagesPath);
private PBSensingSubPageType sensingSubPage = PBSensingSubPageType.SensingPage;
/// <summary>
/// PB Sensing SubPage Type
/// </summary>
public PBSensingSubPageType SensingSubPage
{
get { return sensingSubPage; }
set { sensingSubPage = value; PropertyChange("SensingSubPage"); }
}
private string readBarCode; private string readBarCode;
/// <summary> /// <summary>
/// Read Barcode /// Read Barcode
@ -942,6 +958,8 @@ namespace SPC.Kiosk.PB.ViewModel
ShowLanguageType = CommonValue.CommonLanguageType; ShowLanguageType = CommonValue.CommonLanguageType;
ScanProcess = new Task(ScanDataProcessor); ScanProcess = new Task(ScanDataProcessor);
ScanProcess.Start(); ScanProcess.Start();
this.GetPosOption();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -953,15 +971,8 @@ namespace SPC.Kiosk.PB.ViewModel
} }
} }
private void SetCommon() private void GetPosOption()
{ {
#if TESTMODE
using (var dataHelper = new CommonDataHelper())
{
if (!dataHelper.NeedInitModule) dataHelper.SetCommonLanguage();
}
#endif
//PosOption 값 획득 //PosOption 값 획득
using (var backDataService = new BackDataService()) using (var backDataService = new BackDataService())
{ {
@ -975,6 +986,16 @@ namespace SPC.Kiosk.PB.ViewModel
} }
} }
private void SetCommon()
{
#if TESTMODE
using (var dataHelper = new CommonDataHelper())
{
if (!dataHelper.NeedInitModule) dataHelper.SetCommonLanguage();
}
#endif
}
#region Intro #region Intro
private void SetIntro() private void SetIntro()
@ -1895,6 +1916,35 @@ namespace SPC.Kiosk.PB.ViewModel
} }
} }
} }
private void ProcessBarcode(string msg)
{
try
{
CommonLog.InfoLogWrite(msg, "aiSocketSuccess");
if (msg.Replace("\0", "").Length == 0) return;
JObject json = JObject.Parse(msg.Replace("\0", ""));
//{"COUNT":1,"DATA":[{"ITEM_CDOE":"310105","ITEM_NAME":"베르깽)과일맛소프트캔디","ITEM_QTY":1,"ITEM_BARCODE":"00310105"}]}
foreach (var root in json["DATA"])
{
var itemCode = root["ITEM_CDOE"].ToString();
var barcord = root["ITEM_BARCODE"].ToString();
var newScanData = new M_ScanData
{
ItemCode = itemCode,
Barcord = barcord,
ItemType = BasketItemType.Scan
};
scanQueue.Enqueue(newScanData);
}
}
catch (Exception e)
{
//EndListening();
}
}
private void ScanDataProcessor() private void ScanDataProcessor()
{ {
while (IsScanProcess) while (IsScanProcess)
@ -2185,17 +2235,21 @@ namespace SPC.Kiosk.PB.ViewModel
FindOrderHistoryItems = null; FindOrderHistoryItems = null;
SetIntro(); SetIntro();
DeledteAllBasket(); DeledteAllBasket();
//EndListening();
break; break;
case PBPageType.FirstSelect: case PBPageType.FirstSelect:
ToIntorTimerStart(); ToIntorTimerStart();
//EndListening();
break; break;
case PBPageType.Items: case PBPageType.Items:
GmbOrderEnable = false; GmbOrderEnable = false;
SetContents(); SetContents();
SetOrderHistoryItems(); SetOrderHistoryItems();
ToIntorTimerStart(); ToIntorTimerStart();
//EndListening();
break; break;
case PBPageType.Sensing: case PBPageType.Sensing:
StartListening();
GmbAIscannerEnable = false; GmbAIscannerEnable = false;
AIScanCount = 0; AIScanCount = 0;
ToIntorTimerStart(); ToIntorTimerStart();
@ -2847,6 +2901,117 @@ namespace SPC.Kiosk.PB.ViewModel
#endif #endif
} }
} }
public void StartListening()
{
if (listenThread == null)
{
listenThread = new Thread(new ThreadStart(Listen));
listenThread.IsBackground = true;
listenThread.Start();
}
}
public void EndListening()
{
if (clientSocket != null)
{
clientSocket.Disconnect(false);
clientSocket.Close();
clientSocket = null;
}
if (listenSocket != null)
{
listenSocket.Disconnect(false);
listenSocket.Close();
listenSocket = null;
}
if (recevieThread != null)
{
recevieThread.Abort();
recevieThread = null;
}
if (listenThread != null)
{
listenThread.Abort();
listenThread = null;
}
}
private void Listen()
{
IPAddress ipaddress = IPAddress.Parse(ip);
IPEndPoint endPoint = new IPEndPoint(ipaddress, port);
listenSocket = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp
);
listenSocket.Bind(endPoint);
listenSocket.Listen(10);
clientSocket = listenSocket.Accept();
recevieThread = new Thread(new ThreadStart(Receive));
recevieThread.IsBackground = true;
recevieThread.Start(); //Receive() 호출
}
bool bConnected = true;
private void Receive()
{
byte[] receiveBuffer = new byte[512];
while (true)
{
if(bConnected == false)
{
clientSocket = listenSocket.Accept();
bConnected = true;
}
else
{
int len;
try
{
len = clientSocket.Receive(receiveBuffer);
if(len == 0)
{
bConnected = false;
clientSocket.Disconnect(true);
}
else
{
string msg = System.Text.Encoding.ASCII.GetString(receiveBuffer); //.rToEncString(CodeType.UTF8);
ProcessBarcode(msg);
}
}
catch (SocketException se)
{
bConnected = false;
}
}
//연결된 클라이언트가 보낸 데이터 수신
//byte[] receiveBuffer = new byte[512];
//int length = clientSocket.Receive(
// receiveBuffer, receiveBuffer.Length, SocketFlags.None
//);
//string msg = receiveBuffer.rToEncString(CodeType.UTF8);// Encoding.UTF8.GetString(receiveBuffer);
//if (msg.Replace("\0", "").Length >0) ProcessBarcode(msg);
}
}
#endregion Event Handlers #endregion Event Handlers
} }

View File

@ -37,6 +37,10 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<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="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="System" /> <Reference Include="System" />

View File

@ -98,11 +98,15 @@ namespace SPC.Kiosk.PB
PaymentExcuteGrid.RenderTransform = new TranslateTransform(0, 0); PaymentExcuteGrid.RenderTransform = new TranslateTransform(0, 0);
break; break;
case PBPaymentPageType.DetailBasket: case PBPaymentPageType.DetailBasket:
//PaymentSelectGrid.Visibility = Visibility.Hidden;
DetailBasketGrid.Visibility = Visibility.Visible; DetailBasketGrid.Visibility = Visibility.Visible;
PaymentsGrid.Visibility = Visibility.Hidden; PaymentsGrid.Visibility = Visibility.Hidden;
PointsDisCountsGrid.Visibility = Visibility.Visible;
CouponUsePointsGrid.Visibility = Visibility.Hidden;
PaymentExcuteGrid.Visibility = Visibility.Hidden;
PointsDisCountsGrid.RenderTransform = new TranslateTransform(0, 0); PointsDisCountsGrid.RenderTransform = new TranslateTransform(0, 0);
//PaymentSelectGrid.RenderTransform = new TranslateTransform(PaymentSelectGrid.Width, 0); CouponUsePointsGrid.RenderTransform = new TranslateTransform(CouponUsePointsGrid.Width, 0);
PaymentExcuteGrid.RenderTransform = new TranslateTransform(PaymentExcuteGrid.Width, 0);
break; break;
} }
@ -285,7 +289,10 @@ namespace SPC.Kiosk.PB
{ {
this.ViewModel.OpenFistPopup(); this.ViewModel.OpenFistPopup();
} }
if (this.FindName(getName) is Grid findGrid) findGrid.IsEnabled = true; if (this.FindName(getName) is Grid findGrid)
{
findGrid.IsEnabled = true;
}
senderStoryboard = null; senderStoryboard = null;
} }

View File

@ -778,7 +778,7 @@ namespace SPC.Kiosk.Popup.ViewModel
TalkButtonCommand = new Command(TalkButtonCommandHandler); TalkButtonCommand = new Command(TalkButtonCommandHandler);
StoreAgreeCommand = new Command(StoreAgreeCommandHandler); StoreAgreeCommand = new Command(StoreAgreeCommandHandler);
PointSavingButtonCommand = new Command(PointSavingCommandHandler); PointSavingButtonCommand = new Command(PointSavingCommandHandler);
TalkGetButtonCommand = new Command(TalkGetCommandHandler); TalkGetButtonCommand = new Command(GetNoticeTalkCommandHandler);
this.PropertyChanged += VmPaymentsEnd_PropertyChanged; this.PropertyChanged += VmPaymentsEnd_PropertyChanged;
//TitileImage = ResourceManager.GetNximagePathAdd("img_gif_barcode_happy.gif", CommonValue.PBdesignImagesPath); //TitileImage = ResourceManager.GetNximagePathAdd("img_gif_barcode_happy.gif", CommonValue.PBdesignImagesPath);
CashReceipTitileImage = ResourceManager.GetNximagePathAdd("img_cashreceipt.png", CommonValue.PBdesignImagesPath); CashReceipTitileImage = ResourceManager.GetNximagePathAdd("img_cashreceipt.png", CommonValue.PBdesignImagesPath);
@ -1046,7 +1046,7 @@ namespace SPC.Kiosk.Popup.ViewModel
PointSavingButtonOk = true; PointSavingButtonOk = true;
} }
private void TalkGetCommandHandler(object obj) private void GetNoticeTalkCommandHandler(object obj)
{ {
//Console.WriteLine("알림톡 받기"); //Console.WriteLine("알림톡 받기");
DoNewMemberRequest(); DoNewMemberRequest();

View File

@ -99,6 +99,7 @@
TextAlignment="Center" TextAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Text="{Binding FormatedBarCode}" Text="{Binding FormatedBarCode}"
Visibility="Hidden"
Margin="0,0,0,16" Margin="0,0,0,16"
/> />
</Grid> </Grid>

View File

@ -6490,7 +6490,7 @@ namespace Cosmos.Service
sbQuery.Append("FROM POSMST..NHS_PRD_MST AS [A] WITH (NOLOCK) "); sbQuery.Append("FROM POSMST..NHS_PRD_MST AS [A] WITH (NOLOCK) ");
sbQuery.Append("INNER JOIN [dbo].[MST_ITEM] AS [B] WITH (NOLOCK) ON ([A].[CMP_CD] = [B].[CMP_CD] AND [A].[ITEM_CD] = [B].[ITEM_CD]) "); sbQuery.Append("INNER JOIN [dbo].[MST_ITEM] AS [B] WITH (NOLOCK) ON ([A].[CMP_CD] = [B].[CMP_CD] AND [A].[ITEM_CD] = [B].[ITEM_CD]) ");
sbQuery.Append("WHERE 1 = 1 "); sbQuery.Append("WHERE 1 = 1 ");
sbQuery.Append("AND [A].[USE_YN] = 1 "); sbQuery.Append("AND [A].[USE_YN] = '1' ");
sbQuery.AppendFormat("AND [A].[CMP_CD] = '{0}' ", m_cPosStatus.Base.CmpCd); sbQuery.AppendFormat("AND [A].[CMP_CD] = '{0}' ", m_cPosStatus.Base.CmpCd);
sbQuery.AppendFormat("AND [A].[SALES_ORG_CD] = '{0}' ", m_cPosStatus.Base.BrandCd); sbQuery.AppendFormat("AND [A].[SALES_ORG_CD] = '{0}' ", m_cPosStatus.Base.BrandCd);
if (!string.IsNullOrEmpty(sBarCD)) { sbQuery.AppendFormat("AND [A].[BAR_CD] = '{0}' ", sBarCD); } if (!string.IsNullOrEmpty(sBarCD)) { sbQuery.AppendFormat("AND [A].[BAR_CD] = '{0}' ", sBarCD); }

View File

@ -1043,7 +1043,7 @@ namespace Cosmos.Win
#endregion #endregion
#region #region
DualPlayStartNkill(true); //DualPlayStartNkill(true);
#endregion #endregion
//#20170907 넥사크로 캐시 삭제 start //#20170907 넥사크로 캐시 삭제 start