Esempio n. 1
0
    public static string CheckDataBridgeAtServer(string ProcessingArgument, string strDisNo)
    {
        #region 各項檢核
        string[] strAryArg = ProcessingArgument.Split(",".ToCharArray());
        string CallServerValue = strAryArg[0];
        string ObjectFrom = strAryArg[1];
        string CtrlPending = strAryArg[2];
        string strResult = "";
        string strErrMsg = "";
        bool bResult = false;

        string[] strAry = CallServerValue.Split("_".ToCharArray());
        string[] strAryCtrlPending = CtrlPending.Split(";".ToCharArray());

        ALO_ALO211 ALO211 = new ALO_ALO211();
        LogEventErrorHandler LEH = new LogEventErrorHandler();
        string strLogFileFolder = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["LogFolder"]).Replace("ALO\\", "");
        string strLogFileName = string.Format("{0}_{1}.log", "ALO21", DateTime.Now.ToString("yyyyMMdd"));
        string strLogFilePath = string.Format("{0}\\{1}", strLogFileFolder, strLogFileName);
        HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAry[4])] = null;

        try
        {
            #region
            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 0】準備開始進行檢核", ObjectFrom), false);

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-1】檢核輸入參數是否異常,輸入參數:{1}", ObjectFrom, CallServerValue), false);

            if (strAry.Length != 5)
            {
                throw new Exception(string.Format("CheckDataBridgeAtServer:{0};輸入參數:{1}。", "輸入參數個數異常", CallServerValue));
            }

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-2】檢核輸出參數是否異常,輸出參數:{1}", ObjectFrom, CtrlPending), false);

            if (strAryCtrlPending.Length != 6)
            {
                throw new Exception(string.Format("CheckDataBridgeAtServer:{0};輸出參數:{1}。", "輸出參數個數異常", CtrlPending));
            }



            if (ObjectFrom.IndexOf("PICKDIFF") != -1) //出貨品項檢核
            {
                #region
                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行出貨品項檢核作業", ObjectFrom), false);

                bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.PICKDIFF, out strErrMsg);

                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束出貨品項檢核作業並組回傳字串", ObjectFrom), false);

                strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}", bResult.ToString().ToLower(), strErrMsg,
                    strAryCtrlPending[0], strAryCtrlPending[1], "PICKDIFF", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5]);
                #endregion
            }
            else if (ObjectFrom.IndexOf("DISDIFF") != -1) //配本品項檢核
            {
                #region
                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行配本品項檢核作業", ObjectFrom), false);

                bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.DISDIFF, out strErrMsg);

                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束配本品項檢核作業並組回傳字串", ObjectFrom), false);

                strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}", bResult.ToString().ToLower(), strErrMsg,
                    strAryCtrlPending[0], strAryCtrlPending[1], "DISDIFF", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5]);
                #endregion
            }
            else if (ObjectFrom.IndexOf("CHECKTRANS") != -1) //轉單前檢核
            {
                #region

                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行轉單前檢核作業", ObjectFrom), false);

                bResult = ALO211.CheckData(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], strDisNo, ProcessingType.CHECKTRANS, out strErrMsg);

                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束轉單前檢核作業並組回傳字串", ObjectFrom), false);

                strResult = string.Format("{0}||{1}||{2}||{3}||{4}||{5}||{6}||{7}||{8}||{9}||{10}||{11}||{12}", bResult.ToString().ToLower(), strErrMsg,
                    strAryCtrlPending[0], strAryCtrlPending[1], "CHECKTRANS", strAryCtrlPending[2], strAryCtrlPending[3], strAryCtrlPending[4], strAryCtrlPending[5],
                    strAry[0], strAry[2], strAry[3], strAry[4] + "_" + strAry[3]);
                #endregion
            }

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 4】組成並回傳PageMethod字串:{1}", ObjectFrom, strResult.Trim() == "" ? "無值" : strResult), true);
            #endregion
        }
        catch (Exception ex)
        {
            LEH.WriteErrorLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}執行發生異常】", ObjectFrom), ex, true);
            throw ex;
        }
        HttpContext.Current.Session[string.Format("ALO21_CheckResult_{0}", strAry[4])] = strResult;
        return strResult;
        #endregion
    }
Esempio n. 2
0
    public static string TransAcceptBridgeAtServer(string ProcessingArgument)
    {
        #region
        string[] strAryArg = ProcessingArgument.Split(",".ToCharArray());
        string CallServerValue = strAryArg[0];
        string ObjectFrom = strAryArg[1];
        string CtrlPending = strAryArg[2];
        string strResult = "";
        string strErrMsg = "";
        bool bResult = false;

        string[] strAry = CallServerValue.Split("_".ToCharArray());
        string[] strAryCtrlPending = CtrlPending.Split(";".ToCharArray());



        ALO_ALO211 ALO211 = new ALO_ALO211();
        LogEventErrorHandler LEH = new LogEventErrorHandler();
        string strLogFileFolder = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["LogFolder"]).Replace("ALO\\", "");
        string strLogFileName = string.Format("{0}_{1}.log", "ALO21", DateTime.Now.ToString("yyyyMMdd"));
        string strLogFilePath = string.Format("{0}\\{1}", strLogFileFolder, strLogFileName);
        //2010-05-01 cyhsu 
        HttpContext.Current.Session[string.Format("ALO21_TransResult_{0}", strAry[4])] = null;
        try
        {
            #region
            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 0】準備轉門市進貨單", ObjectFrom), false);

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-1】檢核輸入參數是否異常,輸入參數:{1}", ObjectFrom, CallServerValue), false);

            if (strAry.Length != 5)
            {
                throw new Exception(string.Format("TransAcceptBridgeAtServer:{0};輸入參數:{1}。", "輸入參數個數異常", CallServerValue));
            }

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 1-2】檢核輸出參數是否異常,輸出參數:{1}", ObjectFrom, CtrlPending), false);

            if (strAryCtrlPending.Length != 3)
            {
                throw new Exception(string.Format("TransAcceptBridgeAtServer:{0};輸出參數:{1}。", "輸出參數個數異常", CtrlPending));
            }

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 2-0】開始執行轉門市進貨單作業", ObjectFrom), false);

            bResult = ALO211.ProcessCreateMultiStoreAccepts2(strAry[0], strAry[1], strAry[2], strAry[3], strAry[4], out strErrMsg);

            LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 3】結束轉門市進貨單作業並組回傳字串", ObjectFrom), false);

            if (ObjectFrom.IndexOf("TRANSACCEPT") != -1) //轉門市進貨單
            {
                strResult = string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}", bResult.ToString().ToLower(), strErrMsg,
                            "TRANSACCEPT", strAryCtrlPending[0], strAryCtrlPending[1], strAryCtrlPending[2], strAry[0], strAry[1], strAry[2]);

                LEH.WriteEventLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}.STEP 4】組成並回傳PageMethod字串:{1}", ObjectFrom, strResult), true);

            }
            #endregion
        }
        catch (Exception ex)
        {
            LEH.WriteErrorLog(strLogFilePath, strAry[3], strAry[4], string.Format("【{0}執行發生異常】", ObjectFrom), ex, true);
            throw ex;
        }
        HttpContext.Current.Session[string.Format("ALO21_TransResult_{0}", strAry[4])] = strResult;
        return strResult;

        #endregion
    }
Esempio n. 3
0
    public static string SendReportMessage(
                                           string strType,
                                           string strStAcceptDate,
                                           string strPickBatch,
                                           string strOutStAcceptDate,
                                           string strDisType,
                                           string strTransStatus,
                                           string strUserID,
                                           string strUserName,
                                           string strPageTimeStamp)
    {
        #region

        ALO_ALO211 ALORPTPage = new ALO_ALO211();
        string Program_ID = "", ReportCode = "", ReportPath = "", ReportName = "", ProcessLogFile = "", ExcelName = "";
        ReportParameter[] DBParameter = null;
        ReportParameter[] CryReportParameter = null;
        ReportOutputFormat RptFormat = ReportOutputFormat.PDF;

        if (strType == "CHECKTRANS")
        {
            #region
            RptFormat = ReportOutputFormat.EXCEL;
            ReportCode = "ALO21_1";
            ReportPath = "";
            ExcelName = "轉單前檢查異常";
            Program_ID = "ALO21R";

            #region DB需要的變數
            DBParameter = new ReportParameter[4];
            DBParameter[0].ParameterName = "門市進貨日";
            DBParameter[0].ParameterValue = strStAcceptDate;
            DBParameter[1].ParameterName = "理貨批次";
            DBParameter[1].ParameterValue = strPickBatch;
            DBParameter[2].ParameterName = "使用者";
            DBParameter[2].ParameterValue = strUserID;
            DBParameter[3].ParameterName = "SESSIONID";
            DBParameter[3].ParameterValue = string.Format("{0}_{1}", strPageTimeStamp, strUserID);
            #endregion

            CryReportParameter = null;
            #endregion
        }
        else if (strType == "PRINT")
        {
            #region
            RptFormat = ReportOutputFormat.PDF;
            ReportPath = ALORPTPage.Server.MapPath("REPORT\\ALO21\\ALO21R01.rpt");
            ReportName = "轉門市進貨單明細表";
            ExcelName = "";
            Program_ID = "ALO21R";

            if (strTransStatus == "1")//已轉單
            {
                ReportCode = "ALO21_2";
            }
            else if (strTransStatus == "0")//未轉單
            {
                ReportCode = "ALO21_3";
            }

            //--------------------
            #region DB需要的變數
            DBParameter = new ReportParameter[8];
            DBParameter[0].ParameterName = "門市進貨日";
            DBParameter[0].ParameterValue = strStAcceptDate;
            DBParameter[1].ParameterName = "轉門市進貨單日";
            DBParameter[1].ParameterValue = strOutStAcceptDate;
            DBParameter[2].ParameterName = "配本方式";
            DBParameter[2].ParameterValue = strDisType;
            DBParameter[3].ParameterName = "理貨批次";
            DBParameter[3].ParameterValue = strPickBatch;
            DBParameter[4].ParameterName = "執行者";
            DBParameter[4].ParameterValue = strUserID;
            DBParameter[5].ParameterName = "執行日期";
            DBParameter[5].ParameterValue = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            DBParameter[6].ParameterName = "PageTimeStamp_LoginID";
            DBParameter[6].ParameterValue = string.Format("{0}_{1}", strPageTimeStamp, strUserID);
            DBParameter[7].ParameterName = "最大筆數";
            DBParameter[7].ParameterValue = "-1";
            #endregion

            #region RPT變數
            CryReportParameter = new ReportParameter[5];
            CryReportParameter[0].ParameterName = "par_Program_ID";
            CryReportParameter[0].ParameterValue = "ALO21R01";
            CryReportParameter[1].ParameterName = "par_LoginUser";
            CryReportParameter[1].ParameterValue = strUserID + strUserName;
            CryReportParameter[2].ParameterName = "par_StAcceptDate";
            CryReportParameter[2].ParameterValue = strStAcceptDate;
            CryReportParameter[3].ParameterName = "par_OutStAcceptDate";
            CryReportParameter[3].ParameterValue = strOutStAcceptDate;
            CryReportParameter[4].ParameterName = "par_DisType";
            CryReportParameter[4].ParameterValue = strDisType;
            #endregion

            #endregion
        }



        #region 報表變數 送出產生報表

        ALORPTPage.GenerReportConfigXML("ALO",
                                        "ALO211.aspx",
                                        ReportCode,
                                        ReportPath,
                                        DBParameter,
                                        CryReportParameter,
                                        RptFormat,
                                        ExcelName,
                                        ref ProcessLogFile
                                         );

        ALORPTPage.Dispose();

        #endregion

        return ProcessLogFile;
        #endregion
    }