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.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
{
public static class AiScannerProcess
{
[DllImport("user32.dll")]
@ -28,6 +38,16 @@ namespace SPC.Kiosk.Common
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
{
get
@ -66,6 +86,8 @@ namespace SPC.Kiosk.Common
AiScannerExe.WaitForInputIdle(500);
SetParent(AiScannerExe.MainWindowHandle, _openner);
//AiScannerExe.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
//StartListening();
}
}
else
@ -87,11 +109,19 @@ namespace SPC.Kiosk.Common
AiScannerExe.WaitForExit();
AiScannerExe.Dispose();
AiScannerExe = null;
}
else
{
if (AiScannerExe != null) AiScannerExe = null;
}
}
}
}

View File

@ -53,6 +53,14 @@
</Reference>
<Reference Include="PresentationCore" />
<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.Core" />
<Reference Include="System.Drawing" />

View File

@ -725,19 +725,29 @@ namespace SPC.Kiosk.DataHelper
var nhsFuncInfoType = new NhsFuncInfoType();
var dictionaryNhsFuncInfo = new Dictionary<string, string>();
var dt = m_cDataCommon.Select_NHS_FUNC_INFO();
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields())
try
{
//DataTable에서 키와 일치하는 값을 찾아냄
var rowData = dt.Select($"FUNC_CD = {item.GetValue(item.Name)}").FirstOrDefault();
if (rowData != null)
var dt = m_cDataCommon.Select_NHS_FUNC_INFO();
if (dt != null)
{
//Dictionary에 키와 Use_Yn값을 추가
dictionaryNhsFuncInfo.Add(item.GetValue(item.Name)?.ToString(), rowData["USE_YN"]?.ToString());
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields())
{
//DataTable에서 키와 일치하는 값을 찾아냄
var rowData = dt.Select($"FUNC_CD = {item.GetValue(item.Name)}").FirstOrDefault();
if (rowData != null)
{
//Dictionary에 키와 Use_Yn값을 추가
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;
}

View File

@ -44,6 +44,15 @@ namespace SPC.Kiosk.PB.ViewModel
public WaitWindow WaitWindowFrom { get; set; }
private PBPaymentPageType defaultPage = PBPaymentPageType.DetailBasket;
/// <summary>
/// Default Page
/// </summary>
public PBPaymentPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private NhsFuncInfoItem nhsFuncInfo;
/// <summary>
/// NHS Func Info
@ -54,15 +63,6 @@ namespace SPC.Kiosk.PB.ViewModel
set { nhsFuncInfo = value; PropertyChange("NhsFuncInfo"); }
}
/// <summary>
/// Default Page
/// </summary>
public PBPaymentPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private string optionValue802;
/// <summary>
/// 진동벨 사용유무
@ -1320,14 +1320,12 @@ namespace SPC.Kiosk.PB.ViewModel
GotoLeftCommand = new Command(GotoLeftCommandHandler);
GotoRightCommand = new Command(GotoRightCommandHandler);
this.GetPosOption();
this.GetNhsFuncInfo();
this.IsCompanyMember = new posHappyPoint().IsCompanyMember;
this.PropertyChanged += PBPaymentsViewModel_PropertyChanged;
ShowLanguageType = CommonValue.CommonLanguageType;
this.GetPosOption();
this.GetNhsFuncInfo();
}
catch (Exception ex)
{
@ -1355,18 +1353,22 @@ namespace SPC.Kiosk.PB.ViewModel
{
//Get NHS_FUNC_INFO Data Dictionary
var nhsFuncInfoData = commonDataHelper.GetNhsFuncInfo();
//고유식별 Type
var nhsFuncInfoType = new NhsFuncInfoType();
//View Binding 데이터
if (NhsFuncInfo == null) { NhsFuncInfo = new NhsFuncInfoItem(); }
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields())
{
if (nhsFuncInfoData.ContainsKey(item.GetValue(nhsFuncInfoType)?.ToString()))
if (nhsFuncInfoData?.Count > 0)
{
//고유식별 Type
var nhsFuncInfoType = new NhsFuncInfoType();
//View Binding 데이터
if (NhsFuncInfo == null) { NhsFuncInfo = new NhsFuncInfoItem(); }
//전체 const로 잡힌 필드를 돌며 DB에서 받아온 Key와 매칭
foreach (var item in nhsFuncInfoType.GetType().GetFields())
{
//받아온 데이터 키와 고유식별 Type을 매칭해 View Binding데이터와 일치하게 삽입
NhsFuncInfo.GetType().GetProperty(item.Name).SetValue(NhsFuncInfo, nhsFuncInfoData[item.GetValue(nhsFuncInfoType)?.ToString()], System.Reflection.BindingFlags.SetField, null, null, null);
if (nhsFuncInfoData.ContainsKey(item.GetValue(nhsFuncInfoType)?.ToString()))
{
//받아온 데이터 키와 고유식별 Type을 매칭해 View Binding데이터와 일치하게 삽입
NhsFuncInfo.GetType().GetProperty(item.Name).SetValue(NhsFuncInfo, nhsFuncInfoData[item.GetValue(nhsFuncInfoType)?.ToString()], System.Reflection.BindingFlags.SetField, null, null, null);
}
}
}
}
@ -1513,7 +1515,7 @@ namespace SPC.Kiosk.PB.ViewModel
GotoRightWidth = 254d;
GotoLeftText = Languages.GetMessages("BTN0028");
GotoRightText = Languages.GetMessages("BTN0008");
DetailBasketDeleteAllShow = false;
DetailBasketDeleteAllShow = false;
}
private void InitailizeCouponUsePoints()
{

View File

@ -22,6 +22,9 @@ using SPC.Kiosk.PB.Model;
using SPC.Kiosk.Popup;
using SPC.Kiosk.Popup.Model;
using System.Threading;
using System.Net.Sockets;
using System.Net;
using Newtonsoft.Json.Linq;
#endregion
namespace SPC.Kiosk.PB.ViewModel
{
@ -38,6 +41,17 @@ namespace SPC.Kiosk.PB.ViewModel
private Task ScanProcess = null;
//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;
/// <summary>
/// 자동계산 사용여부
@ -67,6 +81,16 @@ namespace SPC.Kiosk.PB.ViewModel
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>
@ -673,15 +697,7 @@ namespace SPC.Kiosk.PB.ViewModel
/// Info LogoX
/// </summary>
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;
/// <summary>
/// Read Barcode
@ -942,6 +958,8 @@ namespace SPC.Kiosk.PB.ViewModel
ShowLanguageType = CommonValue.CommonLanguageType;
ScanProcess = new Task(ScanDataProcessor);
ScanProcess.Start();
this.GetPosOption();
}
catch (Exception ex)
{
@ -953,6 +971,21 @@ namespace SPC.Kiosk.PB.ViewModel
}
}
private void GetPosOption()
{
//PosOption 값 획득
using (var backDataService = new BackDataService())
{
this.OptionValue810 = backDataService.GetPosOption(nameof(PosOptionType.OPT810));
this.OptionValue811 = backDataService.GetPosOption(nameof(PosOptionType.OPT811));
this.OptionValue812 = backDataService.GetPosOption(nameof(PosOptionType.OPT812));
//if (this.PosOptionValues == null) this.PosOptionValues = new Dictionary<string, string>();
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT810))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT810), this.optionValue810); }
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT811))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT811), this.optionValue811); }
}
}
private void SetCommon()
{
#if TESTMODE
@ -961,18 +994,6 @@ namespace SPC.Kiosk.PB.ViewModel
if (!dataHelper.NeedInitModule) dataHelper.SetCommonLanguage();
}
#endif
//PosOption 값 획득
using (var backDataService = new BackDataService())
{
this.OptionValue810 = backDataService.GetPosOption(nameof(PosOptionType.OPT810));
this.OptionValue811 = backDataService.GetPosOption(nameof(PosOptionType.OPT811));
this.OptionValue812 = backDataService.GetPosOption(nameof(PosOptionType.OPT812));
//if (this.PosOptionValues == null) this.PosOptionValues = new Dictionary<string, string>();
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT810))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT810), this.optionValue810); }
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT811))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT811), this.optionValue811); }
}
}
@ -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()
{
while (IsScanProcess)
@ -2185,17 +2235,21 @@ namespace SPC.Kiosk.PB.ViewModel
FindOrderHistoryItems = null;
SetIntro();
DeledteAllBasket();
//EndListening();
break;
case PBPageType.FirstSelect:
ToIntorTimerStart();
//EndListening();
break;
case PBPageType.Items:
GmbOrderEnable = false;
SetContents();
SetOrderHistoryItems();
ToIntorTimerStart();
//EndListening();
break;
case PBPageType.Sensing:
StartListening();
GmbAIscannerEnable = false;
AIScanCount = 0;
ToIntorTimerStart();
@ -2847,6 +2901,117 @@ namespace SPC.Kiosk.PB.ViewModel
#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
}

View File

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

View File

@ -98,11 +98,15 @@ namespace SPC.Kiosk.PB
PaymentExcuteGrid.RenderTransform = new TranslateTransform(0, 0);
break;
case PBPaymentPageType.DetailBasket:
//PaymentSelectGrid.Visibility = Visibility.Hidden;
DetailBasketGrid.Visibility = Visibility.Visible;
PaymentsGrid.Visibility = Visibility.Hidden;
PointsDisCountsGrid.RenderTransform = new TranslateTransform(0, 0);
//PaymentSelectGrid.RenderTransform = new TranslateTransform(PaymentSelectGrid.Width, 0);
PointsDisCountsGrid.Visibility = Visibility.Visible;
CouponUsePointsGrid.Visibility = Visibility.Hidden;
PaymentExcuteGrid.Visibility = Visibility.Hidden;
PointsDisCountsGrid.RenderTransform = new TranslateTransform(0, 0);
CouponUsePointsGrid.RenderTransform = new TranslateTransform(CouponUsePointsGrid.Width, 0);
PaymentExcuteGrid.RenderTransform = new TranslateTransform(PaymentExcuteGrid.Width, 0);
break;
}
@ -285,7 +289,10 @@ namespace SPC.Kiosk.PB
{
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;
}

View File

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

View File

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

View File

@ -6490,7 +6490,7 @@ namespace Cosmos.Service
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("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].[SALES_ORG_CD] = '{0}' ", m_cPosStatus.Base.BrandCd);
if (!string.IsNullOrEmpty(sBarCD)) { sbQuery.AppendFormat("AND [A].[BAR_CD] = '{0}' ", sBarCD); }

View File

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