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 클래스 변수 선언
///
/// StateServer Object (StateServer 객체)
///
public StateServer StateObject = (StateServer)StateServer.GetInstance();
///
/// POS Status Value (POS 상태값)
///
private PosStatus m_cPosStatus = null;
///
/// POS 주변장치
///
private DeviceStatus m_cDevStatus = null;
///
/// 중량 출력 모드
///
private PosConst.MEASURING_AGENT_PRINT_MODE PrintMode;
///
/// 출력용 핸드폰번호
///
private string m_sCPNum = "";
public string CPNum { get { return m_sCPNum; } set { m_sCPNum = value; } }
///
/// 출력용 플레이버
///
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; } }
///
/// 출력용 주문시간
///
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 = "";
///
/// MSSQL DB 관련 객체
///
private static SqlDB sqlDb = null;
///
/// Measuring Thread 작동 여부
///
private bool m_MeasuringRunning = true;
///
/// Measuring Thread
///
private Thread m_tMeasuring = null;
///
/// 대기시간
///
private int WAIT_TIME = 60000 * 30;
///
/// 저울 델리게이트
///
///
///
///
///
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 출력 함수
///
/// ScalePoleDisplay 출력
///
/// 저울에서 입력된 값 Ex) ST,+00000.00__g
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 출력 함수
}
}