spc-kiosk-pb/Service/BsvOpenClose/PrepStorNotice.cs
2019-06-16 14:12:09 +09:00

181 lines
8.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
namespace Cosmos.Service
{
class PrepStorNotice : IDataServiceUs
{
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private PosStatus m_cPosStatus = new PosStatus(); //기본정보 참조
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private IMasterUs m_cMstService = null; // 마스터 인터페이스
private ISaleCompleteUs m_cSaleComplete = null; // 거래완료처리
protected IDataCommonUs m_cDataCommon = null; // 판매공통 모듈
public PrepStorNotice()
{
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER);
m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
}
/// <summary>
/// 준비점검공지사항 조회
/// </summary>
/// <returns></returns>
public object GetData(string[] aParam)
{
DataTable dtDataInfo = new DataTable();
if (aParam.Count() > 0)
{
if (aParam[0] == "1")
{
dtDataInfo = StoreNoticeList(aParam[1]);
}
else if (aParam[0] == "2")
{
dtDataInfo = StoreNoticeDTL(aParam[1], aParam[2]);
}
}
return dtDataInfo;
}
private DataTable StoreNoticeList(string sInspctEntryGrp)
{
string sQuery = "";
try
{
sQuery += " SELECT B.INSPCT_ENTRY_L_CLSS_NM ";
sQuery += " , B.INSPCT_ENTRY_GRP_CD ";
sQuery += " , B.INSPCT_ENTRY_L_CLSS_CD ";
sQuery += " FROM POSMST.dbo.MST_STOR_INSPCT AS A";
sQuery += " LEFT OUTER JOIN POSMST.dbo.MST_SALESORG_INSPCT_GRP AS B ON A.CMP_CD = B.CMP_CD AND A.INSPCT_ENTRY_GRP_CD = B.INSPCT_ENTRY_GRP_CD ";
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND B.BRAND_CD = '" + m_cPosStatus.Base.BrandCd + "'";
sQuery += " AND A.POS_DIV = 'S' ";
sQuery += " AND A.SALE_POS_ALARM_TYPE = '0' ";
sQuery += " AND A.USE_YN = '1' ";
sQuery += " AND B.USE_YN = '1' ";
sQuery += " ORDER BY A.INSPCT_ENTRY_GRP_CD, B.INSPCT_ENTRY_L_CLSS_CD ASC ";
DataTable dtDataInfo = m_cMstService.Select(new string[] { sQuery });
return dtDataInfo;
}
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 null;
}
private DataTable StoreNoticeDTL(string sINSPCT_ENTRY_GRP, string sInspctEntryLclssCd)
{
string sQuery = "";
try
{
sQuery += " SELECT A.INSPCT_ENTRY_L_CLSS_NM ";
sQuery += " , B.INSPCT_ENTRY_NM ";
sQuery += " , B.INSPCT_ENTRY ";
sQuery += " , B.SEL_ENTRY_CNT ";
sQuery += " , B.SEL_ENTRY_1 ";
sQuery += " , B.SEL_ENTRY_2 ";
sQuery += " , B.SEL_ENTRY_3 ";
sQuery += " , B.SEL_ENTRY_4 ";
sQuery += " , B.SEL_ENTRY_5 ";
sQuery += " FROM POSMST..MST_SALESORG_INSPCT_GRP AS A ";
sQuery += " LEFT OUTER JOIN POSMST..MST_SALESORG_INSPCT_DTL AS B ";
sQuery += " ON A.CMP_CD = B.CMP_CD AND A.BRAND_CD = B.BRAND_CD AND A.INSPCT_ENTRY_GRP_CD = B.INSPCT_ENTRY_GRP_CD AND A.INSPCT_ENTRY_L_CLSS_CD = B.INSPCT_ENTRY_L_CLSS_CD ";
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND A.BRAND_CD = '" + m_cPosStatus.Base.BrandCd + "'";
sQuery += " AND A.INSPCT_ENTRY_GRP_CD = '" + sINSPCT_ENTRY_GRP + "'";
sQuery += " AND A.INSPCT_ENTRY_L_CLSS_CD = '" + sInspctEntryLclssCd + "'";
sQuery += " AND A.USE_YN = '" + PosConst.MST_USE_YN.YES + "'";
sQuery += " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "'";
sQuery += " ORDER BY B.QUE ASC ";
DataTable dtDataInfo = m_cMstService.Select(new string[] { sQuery });
return dtDataInfo;
}
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 null;
}
public string Execute(string[] aParam)
{
DataTable dtDataInfo = new DataTable();
string sRet = UserCom.RST_ERR;
string sQuery = "";
try
{
sQuery += " SELECT B.INSPCT_ENTRY_L_CLSS_NM ";
sQuery += " , C.INSPCT_ENTRY_NM ";
sQuery += " , C.INSPCT_ENTRY ";
sQuery += " , C.SEL_ENTRY_CNT ";
sQuery += " , C.SEL_ENTRY_1 ";
sQuery += " , C.SEL_ENTRY_2 ";
sQuery += " , C.SEL_ENTRY_3 ";
sQuery += " , C.SEL_ENTRY_4 ";
sQuery += " , C.SEL_ENTRY_5 ";
sQuery += " FROM POSMST.dbo.MST_STOR_INSPCT AS A";
sQuery += " LEFT OUTER JOIN POSMST..MST_SALESORG_INSPCT_GRP AS B ";
sQuery += " ON A.CMP_CD = B.CMP_CD AND A.INSPCT_ENTRY_GRP_CD = B.INSPCT_ENTRY_GRP_CD ";
sQuery += " LEFT OUTER JOIN POSMST..MST_SALESORG_INSPCT_DTL AS C ";
sQuery += " ON B.CMP_CD = C.CMP_CD AND B.BRAND_CD = C.BRAND_CD AND B.INSPCT_ENTRY_GRP_CD = C.INSPCT_ENTRY_GRP_CD AND B.INSPCT_ENTRY_L_CLSS_CD = C.INSPCT_ENTRY_L_CLSS_CD ";
sQuery += " WHERE A.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "'";
sQuery += " AND B.BRAND_CD = '" + m_cPosStatus.Base.BrandCd + "'";
sQuery += " AND A.POS_DIV = 'S' ";
sQuery += " AND A.SALE_POS_ALARM_TYPE = '0' ";
sQuery += " AND A.USE_YN = '1' ";
sQuery += " AND B.USE_YN = '" + PosConst.MST_USE_YN.YES + "'";
sQuery += " AND C.USE_YN = '" + PosConst.MST_USE_YN.YES + "'";
sQuery += " ORDER BY A.INSPCT_ENTRY_GRP_CD, B.INSPCT_ENTRY_L_CLSS_CD ASC ";
dtDataInfo = m_cMstService.Select(new string[] { sQuery });
if (dtDataInfo.Rows.Count > 0)
{
// 영수증 출력
sRet = m_cSaleComplete.PrepStoreReceipt(dtDataInfo);
if (sRet != UserCom.RST_OK) return sRet;
return sRet;
}
}
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;
}
public string SetData(object oParam)
{
throw new NotImplementedException();
}
}
}