Ejemplo n.º 1
0
    private bool GetItemPeriodDisStateByItemPeriod(string strItem, string strPeriod, string strStAcceptDate, out string strErrMsg)
    {
        #region
        bool bResult = true;

        strErrMsg = "";
        try
        {

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strItem);
            ParameterList.Add(strPeriod);
            ParameterList.Add(strStAcceptDate);


            ALOModel.QueryALOCommon BCO_comm = new ALOModel.QueryALOCommon(ConnectionDB);
            DataTable dtTaxType = BCO_comm.QueryItemPeriodInfo(ParameterList);

            #region 取得稅別

            #endregion

            s_TAX_TYPE = "";

            if(dtTaxType!=null && dtTaxType.Rows.Count>0)
            {
                s_TAX_TYPE = dtTaxType.Rows[0]["TAX_TYPE"].ToString().Trim();
            }

            ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
            Hashtable htTemp = BCO.CheckItemPeriodDisState(ParameterList);

            #region 取得前六期期別

            s_B1_PERIOD = "";
            s_B2_PERIOD = "";
            s_B3_PERIOD = "";
            s_B4_PERIOD = "";
            s_B5_PERIOD = "";
            s_B6_PERIOD = "";

            if (htTemp != null && htTemp.Count != 0)
            {

                if (htTemp["PERIODEXIST"].ToString().Trim() == "0")
                {
                    strErrMsg = string.Format("期別{0},不存在於期別主檔", strPeriod);
                    bResult = false;
                }
                else if (htTemp["DIS_DATE"] == null || htTemp["DIS_DATE"].ToString().Trim() != "")
                {
                    strErrMsg = string.Format("該品號期別於該配本日期已配本");
                    bResult = true;
                }

                if (bResult)
                {
                    s_B1_PERIOD = htTemp["P_B1"].ToString();//前一期別
                    s_B2_PERIOD = htTemp["P_B2"].ToString();//前二期別
                    s_B3_PERIOD = htTemp["P_B3"].ToString();//前三期別
                    s_B4_PERIOD = htTemp["P_B4"].ToString();//前四期別
                    s_B5_PERIOD = htTemp["P_B5"].ToString();//前五期別
                    s_B6_PERIOD = htTemp["P_B6"].ToString();//前六期別

                    DateTime dtIssDate;
                    DateTime.TryParse(htTemp["ISS_DATE"].ToString(), out dtIssDate);
                    s_ISS_DATE = dtIssDate.ToString("yyyy/MM/dd");//發行日

                    GetItemPeriodStock(strItem, strPeriod);
                }
            }
            else 
            {
                strErrMsg = string.Format("期別{0},不存在於期別主檔", strPeriod);
                bResult = false;
            }
            #endregion
        }
        catch (Exception ex)
        {
            bResult = false;
            throw ex;
        }

        return bResult;
        #endregion
    }