Exemple #1
0
    /// <summary>
    /// 檢查條件
    /// </summary>
    /// <param name="s_Type"></param>
    /// <returns></returns>
    private ArrayList Check_Condition(string s_Type, DataTable dt_CHK)
    {
        #region 宣告

        BCO.ITMCommon ITMComm = new BCO.ITMCommon();
        BCO.ITM04_BCO bco = new BCO.ITM04_BCO(ConntionDB);
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region SLP轉型

        TextBox txt_MDC_START_DATE = (TextBox)this.slp_MDC_START_DATE.FindControl("TextBoxCode");//[DC開始日]
        TextBox txt_MDC_END_DATE = (TextBox)this.slp_MDC_END_DATE.FindControl("TextBoxCode");//[DC結束日]
        TextBox txt_PUBLISH_DATE = (TextBox)this.slp_PUBLISH_DATE.FindControl("TextBoxCode");//[出版日期]
        TextBox txt_PERIOD_END_DATE = (TextBox)this.slp_PERIOD_END_DATE.FindControl("TextBoxCode");//[期別結束日]

        DropDownList drop_PUBLISH_TYPE = (DropDownList)this.slp_PUBLISH_TYPE.FindControl("D1");//出刊種類
        DropDownList drop_UNIT = (DropDownList)this.slp_UNIT.FindControl("D1");//銷售單位
        DropDownList drop_TARGET_RULE = (DropDownList)this.slp_TARGET_RULE.FindControl("D1");//物流費規則
        DropDownList drop_TAX_TYPE = (DropDownList)this.slp_TAX_TYPE.FindControl("D1");//稅別

        #endregion

        #region 新增模式 & 編輯模式 BUTTON [儲存]鈕,編輯模式 BUTTON [產生異動序號]鈕

        if (s_Type == "BUTTON [儲存]鈕,新增狀態" ||
            s_Type == "BUTTON [儲存]鈕,編輯狀態" ||
            s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_1")
        {
            #region 檢查欄位的Byte長度

            #region 頁籤=商品主檔

            if (ITMComm.Get_Byte_Length(this.slp_ITEM.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]長度不可大於 10 Byte", "1", this.slp_ITEM.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_NAME.Text) > 30)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品名]長度不可大於 30 Byte", "1", this.txt_ITEM_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_VICE_ITEM_NAME.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[副主題]長度不可大於 20 Byte", "1", this.txt_VICE_ITEM_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_MANUFACTURE.Text) > 12)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]長度不可大於 12 Byte", "1", this.slp_MANUFACTURE.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_EDIT_NO.Text) > 11)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動序號]長度不可大於 11 Byte", "1", this.txt_EDIT_NO.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_EDIT_REASON.Text) > 50)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動原因]長度不可大於 50 Byte", "1", this.txt_EDIT_REASON.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_ROOT_NO.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類]長度不可大於 2 Byte", "1", this.slp_ROOT_NO.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_PMA.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[大分類]長度不可大於 2 Byte", "1", this.slp_PMA.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_CATEGORY.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中分類]長度不可大於 2 Byte", "1", this.slp_CATEGORY.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.slp_SORT_OUT.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[小分類]長度不可大於 2 Byte", "1", this.slp_SORT_OUT.TextBox_Code.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_STATEMENTS.Text) > 30)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[敘述]長度不可大於 30 Byte", "1", this.txt_STATEMENTS.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_FIRST_PERIOD.Text) > 6)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]長度不可大於 6 Byte", "1", this.txt_FIRST_PERIOD.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_OPEN_SIZE.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[開本]長度不可大於 10 Byte", "1", this.txt_OPEN_SIZE.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_AUTHOR.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作者]長度不可大於 20 Byte", "1", this.txt_AUTHOR.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_CIP.Text) > 8)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中央圖書分類碼(CIP)]長度不可大於 8 Byte", "1", this.txt_CIP.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PUBLISH.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[VCMS出版社]長度不可大於 10 Byte", "1", this.txt_PUBLISH.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_PUBLISHER_NO.Text) > 10)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商代號]長度不可大於 10 Byte", "1", this.txt_ITEM_PUBLISHER_NO.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_ITEM_PUBLISHER_NAME.Text) > 20)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商名稱]長度不可大於 20 Byte", "1", this.txt_ITEM_PUBLISHER_NAME.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PUBLISHER_TYPE.Text) > 2)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出版社書系]長度不可大於 2 Byte", "1", this.txt_PUBLISHER_TYPE.ClientID); }

            #endregion

            #region 頁籤=首期期別

            if (ITMComm.Get_Byte_Length(this.txt_BARCODE.Text) > 15)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]長度不可大於 15 Byte", "1", this.txt_BARCODE.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_PERIOD_BARCODE.Text) > 13)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[二段條碼]長度不可大於 13 Byte", "1", this.txt_PERIOD_BARCODE.ClientID); }

            #endregion

            #region 頁籤=商品指定參照

            if (ITMComm.Get_Byte_Length(this.txt_RESEMBLE_GOODS.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[類似商品]長度不可大於 100 Byte", "1", this.txt_RESEMBLE_GOODS.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_GOODS_MATTER.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品說明]長度不可大於 100 Byte", "1", this.txt_GOODS_MATTER.ClientID); }
            if (ITMComm.Get_Byte_Length(this.txt_COMMEND_CAUSE.Text) > 100)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[推薦理由]長度不可大於 100 Byte", "1", this.txt_COMMEND_CAUSE.ClientID); }

            #endregion

            #endregion

            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ITEM.Text, "text", "欄位[品號]為必填欄位", "1", this.slp_ITEM.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_NAME.Text, "text", "欄位[品名]為必填欄位", "1", this.txt_ITEM_NAME.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MDC_START_DATE.Text, "text", "欄位[DC開始日]為必填欄位", "1", txt_MDC_START_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MDC_END_DATE.Text, "text", "欄位[DC結束日]為必填欄位", "1", txt_MDC_END_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_MANUFACTURE.Text, "text", "欄位[供應商]為必填欄位", "1", this.slp_MANUFACTURE.TextBox_Code.ClientID, arl_Return);
            if (s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_1")
            { arl_Return = ITMComm.Check_MustFillin_Column(this.txt_EDIT_REASON.Text, "text", "欄位[異動原因]為必填欄位", "1", this.txt_EDIT_REASON.ClientID, arl_Return); }
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_ROOT_NO.Text, "text", "欄位[群分類]為必填欄位", "1", this.slp_ROOT_NO.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_OUT_OF_PRINT.SelectedIndex.ToString(), "radio", "欄位[絕版]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PMA.Text, "text", "欄位[大分類]為必填欄位", "1", this.slp_PMA.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_CATEGORY.Text, "text", "欄位[中分類]為必填欄位", "1", this.slp_CATEGORY.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_SORT_OUT.Text, "text", "欄位[小分類]為必填欄位", "1", this.slp_SORT_OUT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_ATTRIBUTE.SelectedIndex.ToString(), "radio", "欄位[是否定期]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_FIRST_PERIOD.Text, "text", "欄位[首期期別]為必填欄位", "1", this.txt_FIRST_PERIOD.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_NEW_SW.SelectedIndex.ToString(), "radio", "欄位[新商品]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PERIOD_STEP.Text, "text", "欄位[期別累加值]為必填欄位", "1", this.slp_PERIOD_STEP.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_INTERVAL.Text, "text", "欄位[出刊間隔]為必填欄位", "1", this.slp_INTERVAL.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(drop_PUBLISH_TYPE.SelectedIndex.ToString(), "drop", "欄位[出刊種類]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(drop_UNIT.SelectedIndex.ToString(), "drop", "欄位[銷售單位]為必填欄位", "1", string.Empty, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_PUBLISHER_NO.Text, "text", "欄位[商品出版商代號]為必填欄位", "1", this.txt_ITEM_PUBLISHER_NO.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.txt_ITEM_PUBLISHER_NAME.Text, "text", "欄位[商品出版商名稱]為必填欄位", "1", this.txt_ITEM_PUBLISHER_NAME.ClientID, arl_Return);
            arl_Return = ITMComm.Check_MustFillin_Column(this.radl_DISTRIBUTE_MODE.SelectedIndex.ToString(), "radio", "欄位[配量方式]為必填欄位", "1", string.Empty, arl_Return);

            if (s_Type == "BUTTON [儲存]鈕,新增狀態")
            {
                arl_Return = ITMComm.Check_MustFillin_Column(this.txt_BARCODE.Text, "text", "欄位[商品條碼]為必填欄位", "1", this.txt_BARCODE.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_PRICE.Text, "text", "欄位[零售價]為必填欄位", "1", this.slp_PRICE.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.slp_COST.Text, "text", "欄位[成本價]為必填欄位", "1", this.slp_COST.TextBox_Code.ClientID, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(this.radl_PERIOD_PAY_TYPE.SelectedIndex.ToString(), "radio", "欄位[物流費基準]為必填欄位", "1", string.Empty, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(drop_TARGET_RULE.SelectedIndex.ToString(), "drop", "欄位[物流費規則]為必填欄位", "1", string.Empty, arl_Return);
                arl_Return = ITMComm.Check_MustFillin_Column(drop_TAX_TYPE.SelectedIndex.ToString(), "drop", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
            }

            #endregion

            #region 檢查SLP日期格式

            arl_Return = ITMComm.Check_Format_Date(this.slp_MDC_START_DATE.Text, "欄位[DC開始日]日期格式錯誤", "1", txt_MDC_START_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_MDC_END_DATE.Text, "欄位[DC開始日]日期格式錯誤", "1", txt_MDC_END_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_PUBLISH_DATE.Text, "欄位[出版日期]日期格式錯誤", "1", txt_PUBLISH_DATE.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Date(this.slp_PERIOD_END_DATE.Text, "欄位[期別結束日]日期格式錯誤", "1", txt_PERIOD_END_DATE.ClientID, arl_Return);

            #endregion

            #region 檢查SLP數字格式

            arl_Return = ITMComm.Check_Format_Int(this.slp_PERIOD_STEP.Text, "欄位[期別累加值]數字格式錯誤", "32", "1", this.slp_PERIOD_STEP.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_INTERVAL.Text, "欄位[出刊間隔]數字格式錯誤", "32", "1", this.slp_INTERVAL.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_PAGE_NUM.Text, "欄位[頁數]數字格式錯誤", "32", "1", this.slp_PAGE_NUM.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_PRICE.Text, "欄位[零售價]數字格式錯誤", "32", "1", this.slp_PRICE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_QUANTITY.Text, "欄位[每店]數字格式錯誤", "32", "1", this.slp_QUANTITY.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Int(this.slp_ACCEPT_TOTAL.Text, "欄位[總進貨量]數字格式錯誤", "32", "1", this.slp_ACCEPT_TOTAL.TextBox_Code.ClientID, arl_Return);

            arl_Return = ITMComm.Check_Format_Double(this.slp_WIDTH.Text, "欄位[寬]數字格式錯誤", "寬", true, 3, 2, "1", this.slp_WIDTH.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_HIEGHT.Text, "欄位[高]數字格式錯誤", "高", true, 3, 2, "1", this.slp_HIEGHT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_LENGTH.Text, "欄位[深]數字格式錯誤", "深", true, 3, 2, "1", this.slp_LENGTH.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_COST.Text, "欄位[成本價]數字格式錯誤", "成本價", true, 5, 2, "1", this.slp_COST.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_ACCEPT_RATE.Text, "欄位[進貨物流費(%)]數字格式錯誤", "進貨物流費(%)", true, 4, 3, "1", this.slp_ACCEPT_RATE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_RETURN_RATE.Text, "欄位[退貨物流費(%)]數字格式錯誤", "退貨物流費(%)", true, 4, 3, "1", this.slp_RETURN_RATE.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_ACCEPT_AMT.Text, "欄位[進貨物流費(元)]數字格式錯誤", "進貨物流費(元)", true, 5, 2, "1", this.slp_ACCEPT_AMT.TextBox_Code.ClientID, arl_Return);
            arl_Return = ITMComm.Check_Format_Double(this.slp_RETURN_AMT.Text, "欄位[退貨物流費(元)]數字格式錯誤", "退貨物流費(元)", true, 5, 2, "1", this.slp_RETURN_AMT.TextBox_Code.ClientID, arl_Return);

            #endregion

            #region 欄位[品號]不可顯示[資料重覆]

            if (Request[this.slp_ITEM.TextBox_Name.UniqueID] == "資料重覆")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, " 該品號已存在,請重新輸入品號", "1", this.slp_ITEM.TextBox_Code.ClientID); }

            #endregion

            #region 欄位[品號]必需為六位數目字

            System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
            if (reg_SIX.IsMatch(this.slp_ITEM.Text) == false)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", this.slp_ITEM.TextBox_Code.ClientID); }

            #endregion

            #region 欄位[首期期別]必需為六位數目字

            if (reg_SIX.IsMatch(this.txt_FIRST_PERIOD.Text) == false)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]必需為六位數目字", "1", this.txt_FIRST_PERIOD.ClientID); }

            #endregion

            #region 如果基本檢查有誤,則Return

            if (arl_Return[1].ToString() != string.Empty)
            { return arl_Return; }

            #endregion

            #region 自訂檢查

            #region 檢查Between欄位結束欄位一定要大於或等於開始欄位(DC開始日 & DC結束日)

            arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
                (this.slp_MDC_START_DATE.Text,
                 this.slp_MDC_END_DATE.Text,
                 "date",
                 "欄位[DC結束日]一定要大於或等於欄位[DC開始日]",
                 "1",
                 txt_MDC_END_DATE.ClientID,
                 arl_Return);

            #endregion

            #region 檢查[群分類][大分類][中分類][小分類]的階層關係是否正確

            #region 設定變數

            string s_PATTERN_NO = string.Empty;
            string s_Result = string.Empty;

            #endregion

            #region 傳入參數

            s_PATTERN_NO = this.slp_ROOT_NO.Text + this.slp_PMA.Text + this.slp_CATEGORY.Text + this.slp_SORT_OUT.Text;

            ParameterList.Clear();
            ParameterList.Add(ITMComm.GetValueSetParameter(s_PATTERN_NO, "string", false));//[PATTERN_NO]
            ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

            #endregion

            #region 連結資料庫

            s_Result = bco.CHK_ITM042_PATTERN_NO(ParameterList).Rows[0]["result"].ToString();

            #endregion

            #region 檢查回傳值

            if (s_Result == "NO")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "[群分類][大分類][中分類][小分類]的階層關係不正確", "1", string.Empty); }

            #endregion

            #endregion

            #region 新增模式下,才需要的檢查

            if (s_Type == "BUTTON [儲存]鈕,新增狀態")
            {
                #region 欄位[期別結束日]必需大於或等於系統日

                if (this.slp_PERIOD_END_DATE.Text != string.Empty)
                {
                    DateTime d_PERIOD_END_DATE = DateTime.Parse(this.slp_PERIOD_END_DATE.Text);

                    if (d_PERIOD_END_DATE < DateTime.Now.Date)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別結束日]必需大於或等於系統日", "1", txt_PERIOD_END_DATE.ClientID); }
                }

                #endregion

                #region 欄位[零售價]必需大於欄位[成本價]

                if (double.Parse(this.slp_COST.Text) > int.Parse(this.slp_PRICE.Text))
                { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]必需大於欄位[成本價]", "1", this.slp_PRICE.TextBox_Code.ClientID); }

                #endregion

                #region 欄位[折扣率]計算是否正確

                //若欄位[零售價]=0,則欄位[折扣率]必須=0
                //折扣率=成本/零售價
                if ((double.Parse(this.slp_PRICE.Text) == 0 && this.txt_DISCOUNT_RATE.Text != "0") &&
                    (Convert.ToString(System.Math.Round(double.Parse(this.slp_COST.Text) / int.Parse(this.slp_PRICE.Text), 2, MidpointRounding.AwayFromZero)) != this.txt_DISCOUNT_RATE.Text))
                { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折扣率]計算錯誤", "1", this.txt_DISCOUNT_RATE.ClientID); }

                #endregion

                #region 判斷欄位[物流費基準]

                if (this.radl_PERIOD_PAY_TYPE.SelectedValue == "1")//元
                {
                    if (this.slp_ACCEPT_RATE.Text != string.Empty ||
                        this.slp_RETURN_RATE.Text != string.Empty)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]選擇[元]時,只能填寫進退貨物流費(元)", "1", string.Empty); }
                }
                else if (this.radl_PERIOD_PAY_TYPE.SelectedValue == "2")//率
                {
                    if (this.slp_ACCEPT_AMT.Text != string.Empty ||
                        this.slp_RETURN_AMT.Text != string.Empty)
                    { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]選擇[率]時,只能填寫進退貨物流費(%)", "1", string.Empty); }
                }

                #endregion
            }

            #endregion

            #endregion
        }

        #endregion

        #region 編輯模式 BUTTON [產生異動序號]鈕

        else if (s_Type == "BUTTON [產生異動序號]鈕,編輯狀態_2")
        {
            #region 規則

            /* 規則
             * 檢查所有欄位是否有更新,
             * 如果可修改欄位(不含異動原因欄位)都沒有修改,
             * 則顯示[沒有更新任何資料]
             */

            #endregion

            #region 宣告變數

            bool b_Is_All_Same = true;
            ArrayList arl_Chk_Column = new ArrayList();

            #endregion

            #region 設定要檢查的欄位

            arl_Chk_Column.Clear();
            arl_Chk_Column.Add("ITEM_NAME,VARCHAR2");//品名
            arl_Chk_Column.Add("VICE_ITEM_NAME,VARCHAR2");//副主題
            arl_Chk_Column.Add("MDC_START_DATE,DATE");//DC開始日
            arl_Chk_Column.Add("MDC_END_DATE,DATE");//DC結束日
            arl_Chk_Column.Add("MANUFACTURE,VARCHAR2");//供應商
            arl_Chk_Column.Add("ROOT_NO,VARCHAR2");//群分類
            arl_Chk_Column.Add("OUT_OF_PRINT,NUMBER");//絕版
            arl_Chk_Column.Add("PMA,VARCHAR2");//大分類
            arl_Chk_Column.Add("CATEGORY,VARCHAR2");//中分類
            arl_Chk_Column.Add("SORT_OUT,VARCHAR2");//小分類
            arl_Chk_Column.Add("STATEMENTS,VARCHAR2");//敘述
            arl_Chk_Column.Add("ATTRIBUTE,NUMBER");//是否定期
            arl_Chk_Column.Add("FIRST_PERIOD,VARCHAR2");//首期期別
            arl_Chk_Column.Add("NEW_SW,VARCHAR2");//新商品
            arl_Chk_Column.Add("PERIOD_STEP,NUMBER");//期別累加值
            arl_Chk_Column.Add("INTERVAL,NUMBER");//出刊間隔
            arl_Chk_Column.Add("PUBLISH_TYPE,VARCHAR2");//出刊種類
            arl_Chk_Column.Add("UNIT,NUMBER");//銷售單位
            arl_Chk_Column.Add("OPEN_SIZE,VARCHAR2");//開本
            arl_Chk_Column.Add("PAGE_NUM,NUMBER");//頁數
            arl_Chk_Column.Add("WIDTH,NUMBER");//寬
            arl_Chk_Column.Add("HIEGHT,NUMBER");//高
            arl_Chk_Column.Add("LENGTH,NUMBER");//深
            arl_Chk_Column.Add("AUTHOR,VARCHAR2");//作者
            arl_Chk_Column.Add("CIP,VARCHAR2");//中央圖書分類碼(CIP)
            arl_Chk_Column.Add("PUBLISH,VARCHAR2");//VCMS出版社
            arl_Chk_Column.Add("ITEM_PUBLISHER_NO,VARCHAR2");//商品出版商代號
            arl_Chk_Column.Add("ITEM_PUBLISHER_NAME,VARCHAR2");//商品出版商名稱
            arl_Chk_Column.Add("PUBLISHER_TYPE,VARCHAR2");//出版社書系
            arl_Chk_Column.Add("PUBLISH_DATE,DATE");//出版日期
            arl_Chk_Column.Add("DISTRIBUTE_MODE,VARCHAR2");//配量方式
            arl_Chk_Column.Add("QUANTITY,NUMBER");//每店
            arl_Chk_Column.Add("ACCEPT_TOTAL,NUMBER");//總進貨量
            arl_Chk_Column.Add("RESEMBLE_GOODS,VARCHAR2");//類似商品
            arl_Chk_Column.Add("GOODS_MATTER,VARCHAR2");//商品說明
            arl_Chk_Column.Add("COMMEND_CAUSE,VARCHAR2");//推薦理由

            #endregion

            #region 檢查資料是否有異動

            for (int i = 0; i < arl_Chk_Column.Count; i++)
            {
                string[] s_Chk = arl_Chk_Column[i].ToString().Split(',');

                if (s_Chk[1] == "VARCHAR2")
                {
                    if (dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString() !=
                        dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString())
                    { b_Is_All_Same = false; }
                }
                else if (s_Chk[1] == "NUMBER")
                {
                    if (ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString(), "double", false).ToString() !=
                        ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString(), "double", false).ToString())
                    { b_Is_All_Same = false; }
                }
                else if (s_Chk[1] == "DATE")
                {
                    if (ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["OLD_" + s_Chk[0]].ToString(), "date", false).ToString() !=
                        ITMComm.GetValueSetParameter(dt_CHK.Rows[0]["NEW_" + s_Chk[0]].ToString(), "date", false).ToString())
                    { b_Is_All_Same = false; }
                }
            }

            #endregion

            #region 如果可修改欄位(不含異動原因欄位)都沒有修改,則顯示[沒有更新任何資料]

            if (b_Is_All_Same == true)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "沒有更新任何資料!", "1", string.Empty); }

            #endregion
        }

        #endregion

        #region 檢視模式 BUTTON [確定複製]鈕

        else if (s_Type == "BUTTON [確定複製]鈕,檢視狀態")
        {
            #region 檢查必填欄位

            arl_Return = ITMComm.Check_MustFillin_Column(this.slp_CopyInsert_ITEM.Text, "text", "欄位[品號]為必填欄位", "1", this.slp_CopyInsert_ITEM.TextBox_Code.ClientID, arl_Return);

            #endregion

            #region 欄位[品號]不可顯示[資料重覆]

            if (Request[this.slp_CopyInsert_ITEM.TextBox_Name.UniqueID] == "資料重覆")
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, " 該品號已存在,請重新輸入品號", "1", this.slp_CopyInsert_ITEM.TextBox_Code.ClientID); }

            #endregion
        }

        #endregion

        return arl_Return;
    }
Exemple #2
0
    /// <summary>
    /// 檢查文字檔條件
    /// </summary>
    /// <param name="dr"></param>
    /// <returns></returns>
    private ArrayList Check_Condition_DataLine(DataRow dr)
    {
        #region 宣告

        ITMCommon ITMComm = new ITMCommon();
        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region 檢查各個欄位型別,長度,是否必填

        #region Column[序號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["序號"].ToString(), "text", "欄位[序號]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["序號"].ToString(), "欄位[序號]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["序號"].ToString()) > 38)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[序號]長度不可大於 38 Byte", "1", string.Empty); }

        #endregion

        #region Column[通路代號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["通路代號"].ToString(), "text", "欄位[通路代號]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["通路代號"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[通路代號]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[品號]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["品號"].ToString(), "text", "欄位[品號]為必填欄位", "1", string.Empty, arl_Return);
        System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
        if (reg_SIX.IsMatch(dr["品號"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[期別]

        arl_Return = ITMComm.Check_MustFillin_Column(dr["期別"].ToString(), "text", "欄位[期別]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["期別"].ToString()) > 6)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別]長度不可大於 6 Byte", "1", string.Empty); }

        #endregion

        #endregion

        #region 如果基本檢查有誤,則Return

        if (arl_Return[1].ToString() != string.Empty)
        { return arl_Return; }

        #endregion

        return arl_Return;
    }
Exemple #3
0
    /// <summary>
    /// 檢查文字檔條件
    /// </summary>
    /// <param name="dr">要檢查的資料</param>
    /// <param name="dt_Temp">寫入TempTable的資料</param>
    /// <param name="dt_PUBLISH_TYPE">出刊種類 CODE</param>
    /// <param name="dt_UNIT">銷售單位 CODE</param>
    /// <param name="dt_PRINT_CNTY">印製國家 CODE</param>
    /// <param name="dt_LANGUAGE">語文 CODE</param>
    /// <returns></returns>
    private ArrayList Check_Condition_DataLine(DataRow dr,
                                               DataTable dt_Temp,
                                               DataTable dt_PUBLISH_TYPE,//出刊種類
                                               DataTable dt_UNIT,//銷售單位
                                               DataTable dt_PRINT_CNTY,//印製國家
                                               DataTable dt_LANGUAGE,//語文
                                               DataTable dt_Excel)//匯入的Excel檔
    {
        #region 宣告

        ITMCommon ITMComm = new ITMCommon();

        ArrayList arl_Return = new ArrayList();
        arl_Return.Add(string.Empty);//該欄位放Focus欄位之ClientID
        arl_Return.Add(string.Empty);//該欄位放錯誤訊息

        #endregion

        #region 檢查各個欄位型別,長度,是否必填

        #region Column[ID] ID

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ID"].ToString(), "text", "欄位[ID]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["ID"].ToString(), "欄位[ID]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ID"].ToString()) > 38)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[ID]長度不可大於 38 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM] 品號

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM"].ToString(), "text", "欄位[品號]為必填欄位", "1", string.Empty, arl_Return);
        System.Text.RegularExpressions.Regex reg_SIX = new System.Text.RegularExpressions.Regex(@"^[0-9]{6}$");
        if (reg_SIX.IsMatch(dr["ITEM"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品號]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[ITEM_NAME] 品名

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_NAME"].ToString(), "text", "欄位[品名]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_NAME"].ToString()) > 30)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[品名]長度不可大於 30 Byte", "1", string.Empty); }

        #endregion

        #region Column[VICE_ITEM_NAME] 副主題

        if (ITMComm.Get_Byte_Length(dr["VICE_ITEM_NAME"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[副主題]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[MDC_START_DATE] DC開始日

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MDC_START_DATE"].ToString(), "text", "欄位[DC開始日]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(dr["MDC_START_DATE"].ToString(), "欄位[DC開始日]日期格式錯誤(YYYYMMDD)", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[MDC_END_DATE] DC結束日

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MDC_END_DATE"].ToString(), "text", "欄位[DC結束日]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Date(dr["MDC_END_DATE"].ToString(), "欄位[DC結束日]日期格式錯誤(YYYYMMDD)", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[MANUFACTURE] 供應商

        arl_Return = ITMComm.Check_MustFillin_Column(dr["MANUFACTURE"].ToString(), "text", "欄位[供應商]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["MANUFACTURE"].ToString()) > 12)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]長度不可大於 12 Byte", "1", string.Empty); }

        #endregion

        #region Column[EDIT_NO] 異動序號

        if (dr["EDIT_NO"].ToString() != "0")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動序號]固定為0", "1", string.Empty); }

        #endregion

        #region Column[EDIT_REASON] 異動原因

        if (dr["EDIT_REASON"].ToString() != string.Empty)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[異動原因]固定為空值", "1", string.Empty); }

        #endregion

        #region Column[ROOT_NO] 群分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ROOT_NO"].ToString(), "text", "欄位[群分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ROOT_NO"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[OUT_OF_PRINT] 絕版

        arl_Return = ITMComm.Check_MustFillin_Column(dr["OUT_OF_PRINT"].ToString(), "text", "欄位[絕版]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["OUT_OF_PRINT"].ToString(), "欄位[絕版]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["OUT_OF_PRINT"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[絕版]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[PMA] 大分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PMA"].ToString(), "text", "欄位[大分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PMA"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[大分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[CATEGORY] 中分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["CATEGORY"].ToString(), "text", "欄位[中分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["CATEGORY"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[SORT_OUT] 小分類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["SORT_OUT"].ToString(), "text", "欄位[小分類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["SORT_OUT"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[小分類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[STATEMENTS] 敘述

        if (ITMComm.Get_Byte_Length(dr["STATEMENTS"].ToString()) > 30)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[敘述]長度不可大於 30 Byte", "1", string.Empty); }

        #endregion

        #region Column[ATTRIBUTE] 是否定期

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ATTRIBUTE"].ToString(), "text", "欄位[是否定期]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["ATTRIBUTE"].ToString(), "欄位[是否定期]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ATTRIBUTE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[是否定期]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[FIRST_PERIOD] 首期期別

        arl_Return = ITMComm.Check_MustFillin_Column(dr["FIRST_PERIOD"].ToString(), "text", "欄位[首期期別]為必填欄位", "1", string.Empty, arl_Return);
        if (reg_SIX.IsMatch(dr["FIRST_PERIOD"].ToString()) == false)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[首期期別]必需為六位數目字", "1", string.Empty); }

        #endregion

        #region Column[NEW_SW] 新商品

        arl_Return = ITMComm.Check_MustFillin_Column(dr["NEW_SW"].ToString(), "text", "欄位[新商品]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["NEW_SW"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[新商品]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[PERIOD_STEP] 期別累加值

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PERIOD_STEP"].ToString(), "text", "欄位[期別累加值]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PERIOD_STEP"].ToString(), "欄位[期別累加值]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PERIOD_STEP"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別累加值]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[INTERVAL] 出刊間隔

        arl_Return = ITMComm.Check_MustFillin_Column(dr["INTERVAL"].ToString(), "text", "欄位[出刊間隔]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["INTERVAL"].ToString(), "欄位[出刊間隔]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["INTERVAL"].ToString()) > 6)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊間隔]長度不可大於 6 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH_TYPE] 出刊種類

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PUBLISH_TYPE"].ToString(), "text", "欄位[出刊種類]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PUBLISH_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊種類]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[UNIT] 銷售單位

        arl_Return = ITMComm.Check_MustFillin_Column(dr["UNIT"].ToString(), "text", "欄位[銷售單位]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["UNIT"].ToString(), "欄位[銷售單位]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["UNIT"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[銷售單位]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[OPEN_SIZE] 開本

        if (ITMComm.Get_Byte_Length(dr["OPEN_SIZE"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[開本]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[PAGE_NUM] 頁數

        arl_Return = ITMComm.Check_Format_Int(dr["PAGE_NUM"].ToString(), "欄位[頁數]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PAGE_NUM"].ToString()) > 3)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[頁數]長度不可大於 3 Byte", "1", string.Empty); }

        #endregion

        #region Column[WIDTH] 寬

        arl_Return = ITMComm.Check_Format_Double(dr["WIDTH"].ToString(), "欄位[寬]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[HIEGHT] 高

        arl_Return = ITMComm.Check_Format_Double(dr["HIEGHT"].ToString(), "欄位[高]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[LENGTH] 深

        arl_Return = ITMComm.Check_Format_Double(dr["LENGTH"].ToString(), "欄位[深]數字格式錯誤", "WIDTH", true, 3, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[AUTHOR] 作者

        if (ITMComm.Get_Byte_Length(dr["AUTHOR"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[作者]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[CIP] 中央圖書分類碼

        if (ITMComm.Get_Byte_Length(dr["CIP"].ToString()) > 8)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[中央圖書分類碼]長度不可大於 8 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH] VCMS出版社

        if (ITMComm.Get_Byte_Length(dr["PUBLISH"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[VCMS出版社]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM_PUBLISHER_NO] 商品出版商代號

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_PUBLISHER_NO"].ToString(), "text", "欄位[商品出版商代號]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_PUBLISHER_NO"].ToString()) > 10)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商代號]長度不可大於 10 Byte", "1", string.Empty); }

        #endregion

        #region Column[ITEM_PUBLISHER_NAME] 商品出版商名稱

        arl_Return = ITMComm.Check_MustFillin_Column(dr["ITEM_PUBLISHER_NAME"].ToString(), "text", "欄位[商品出版商名稱]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ITEM_PUBLISHER_NAME"].ToString()) > 20)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品出版商名稱]長度不可大於 20 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISHER_TYPE] 出版社書系

        if (ITMComm.Get_Byte_Length(dr["PUBLISHER_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出版社書系]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[PUBLISH_DATE] 出版日期

        arl_Return = ITMComm.Check_Format_Date(dr["PUBLISH_DATE"].ToString(), "欄位[出版日期]日期格式錯誤", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[PERIOD_END_DATE] 期別結束日

        arl_Return = ITMComm.Check_Format_Date(dr["PERIOD_END_DATE"].ToString(), "欄位[期別結束日]日期格式錯誤", "yyyyMMdd", "1", string.Empty, arl_Return);

        #endregion

        #region Column[BARCODE] 商品條碼
        arl_Return = ITMComm.Check_MustFillin_Column(dr["BARCODE"].ToString(), "text", "欄位[商品條碼]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["BARCODE"].ToString()) > 15)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]長度不可大於 15 Byte", "1", string.Empty); }
        if (dr["BARCODE"].ToString().Trim() != "")
        {
            DataRow[] FindBarcode = dt_Excel.Select("BARCODE='" + dr["BARCODE"].ToString().Trim() + "'");
            if (FindBarcode.Length > 1)
            {
                arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]與匯入檔案內的其他商品條碼重覆", "1", string.Empty);
            }
            //if (CheckDup_BARCODE(dr["BARCODE"].ToString(), "") == true)
            //{
            //    arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品條碼]和已存在的商品條碼重覆", "1", string.Empty);
            //}
        }
        #endregion

        #region Column[PERIOD_BARCODE] 二段條碼

        if (ITMComm.Get_Byte_Length(dr["PERIOD_BARCODE"].ToString()) > 13)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[二段條碼]長度不可大於 13 Byte", "1", string.Empty); }

        #endregion

        #region Column[PRICE] 零售價

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PRICE"].ToString(), "text", "欄位[零售價]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PRICE"].ToString(), "欄位[零售價]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PRICE"].ToString()) > 5)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]長度不可大於 5 Byte", "1", string.Empty); }

        #endregion

        #region Column[COST] 成本價

        arl_Return = ITMComm.Check_MustFillin_Column(dr["COST"].ToString(), "text", "欄位[成本價]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Double(dr["COST"].ToString(), "欄位[成本價]數字格式錯誤", "COST", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DISCOUNT_RATE] 折扣率

        if (dr["DISCOUNT_RATE"].ToString() != string.Empty)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[折扣率]固定為空值", "1", string.Empty); }

        #endregion

        #region Column[PERIOD_PAY_TYPE] 物流費基準

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PERIOD_PAY_TYPE"].ToString(), "text", "欄位[物流費基準]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["PERIOD_PAY_TYPE"].ToString(), "欄位[物流費基準]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PERIOD_PAY_TYPE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[TARGET_RULE] 物流費規則

        arl_Return = ITMComm.Check_MustFillin_Column(dr["TARGET_RULE"].ToString(), "text", "欄位[物流費規則]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["TARGET_RULE"].ToString(), "欄位[物流費規則]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["TARGET_RULE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費規則]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[TAX_TYPE] 稅別

        arl_Return = ITMComm.Check_MustFillin_Column(dr["TAX_TYPE"].ToString(), "text", "欄位[稅別]為必填欄位", "1", string.Empty, arl_Return);
        arl_Return = ITMComm.Check_Format_Int(dr["TAX_TYPE"].ToString(), "欄位[稅別]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["TAX_TYPE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[稅別]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[DIS_ACCEPT_RATE] 進貨物流費(%)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_ACCEPT_RATE"].ToString(), "欄位[進貨物流費(%)]數字格式錯誤", "DIS_ACCEPT_RATE", true, 4, 3, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_RETURN_RATE] 退貨物流費(%)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_RETURN_RATE"].ToString(), "欄位[退貨物流費(%)]數字格式錯誤", "DIS_RETURN_RATE", true, 4, 3, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_ACCEPT_DOLLAR] 進貨物流費(元)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_ACCEPT_DOLLAR"].ToString(), "欄位[進貨物流費(元)]數字格式錯誤", "DIS_ACCEPT_DOLLAR", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[DIS_RETURN_DOLLAR] 退貨物流費(元)

        arl_Return = ITMComm.Check_Format_Double(dr["DIS_RETURN_DOLLAR"].ToString(), "欄位[退貨物流費(元)]數字格式錯誤", "DIS_RETURN_DOLLAR", true, 5, 2, "1", string.Empty, arl_Return);

        #endregion

        #region Column[PRINT_CNTY] 印製國家

        arl_Return = ITMComm.Check_MustFillin_Column(dr["PRINT_CNTY"].ToString(), "text", "欄位[印製國家]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["PRINT_CNTY"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[印製國家]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[LANGUAGE] 語文

        arl_Return = ITMComm.Check_MustFillin_Column(dr["LANGUAGE"].ToString(), "text", "欄位[語文]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["LANGUAGE"].ToString()) > 2)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[語文]長度不可大於 2 Byte", "1", string.Empty); }

        #endregion

        #region Column[DISTRIBUTE_MODE] 配量方式

        arl_Return = ITMComm.Check_MustFillin_Column(dr["DISTRIBUTE_MODE"].ToString(), "text", "欄位[配量方式]為必填欄位", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["DISTRIBUTE_MODE"].ToString()) > 1)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[配量方式]長度不可大於 1 Byte", "1", string.Empty); }

        #endregion

        #region Column[QUANTITY] 每店

        arl_Return = ITMComm.Check_Format_Int(dr["QUANTITY"].ToString(), "欄位[每店]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["QUANTITY"].ToString()) > 3)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[每店]長度不可大於 3 Byte", "1", string.Empty); }

        #endregion

        #region Column[ACCEPT_TOTAL] 總進貨量

        arl_Return = ITMComm.Check_Format_Int(dr["ACCEPT_TOTAL"].ToString(), "欄位[總進貨量]數字格式錯誤", "32", "1", string.Empty, arl_Return);
        if (ITMComm.Get_Byte_Length(dr["ACCEPT_TOTAL"].ToString()) > 8)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[總進貨量]長度不可大於 8 Byte", "1", string.Empty); }

        #endregion

        #region Column[RESEMBLE_GOODS] 類似商品

        if (ITMComm.Get_Byte_Length(dr["RESEMBLE_GOODS"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[類似商品]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #region Column[GOODS_MATTER] 商品說明

        if (ITMComm.Get_Byte_Length(dr["GOODS_MATTER"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[商品說明]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #region Column[COMMEND_CAUSE] 推薦理由

        if (ITMComm.Get_Byte_Length(dr["COMMEND_CAUSE"].ToString()) > 100)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[推薦理由]長度不可大於 100 Byte", "1", string.Empty); }

        #endregion

        #endregion

        #region 如果基本檢查有誤,則Return

        if (arl_Return[1].ToString() != string.Empty)
        { return arl_Return; }

        #endregion

        #region 自訂檢查

        #region 檢查代號是否有正確對應

        #region 檢查[供應商]代號

        ParameterList.Clear();
        ParameterList.Add(ITMComm.GetValueSetParameter(dr["MANUFACTURE"].ToString(), "string", false));
        ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

        if (bco.QUERY_VENDOR(ParameterList).Rows[0][0].ToString() == "0")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[供應商]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[出刊種類]代號

        if (dt_PUBLISH_TYPE.Select("CODE = '" + dr["PUBLISH_TYPE"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[出刊種類]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[銷售單位]代號

        if (dt_UNIT.Select("CODE = '" + dr["UNIT"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[銷售單位]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[印製國家]代號

        if (dt_PRINT_CNTY.Select("CODE = '" + dr["PRINT_CNTY"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[印製國家]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[語文]代號

        if (dt_LANGUAGE.Select("CODE = '" + dr["LANGUAGE"].ToString() + "'").Length == 0)
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[語文]的代號不正確", "1", string.Empty); }

        #endregion

        #region 檢查[配量方式]代號

        if (dr["DISTRIBUTE_MODE"].ToString() != "1" &&
            dr["DISTRIBUTE_MODE"].ToString() != "2" &&
            dr["DISTRIBUTE_MODE"].ToString() != "3" &&
            dr["DISTRIBUTE_MODE"].ToString() != "4" &&
            dr["DISTRIBUTE_MODE"].ToString() != "5")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[配量方式]的代號不正確", "1", string.Empty); }

        #endregion

        #endregion

        #region 檢查Between欄位結束欄位一定要大於或等於開始欄位(DC開始日 & DC結束日)

        arl_Return = ITMComm.Check_Between_End_GreaterThan_Begin
            (dr["MDC_START_DATE"].ToString(),
             dr["MDC_END_DATE"].ToString(),
             "date",
             "欄位[DC結束日]一定要大於或等於欄位[DC開始日]",
             "1",
             string.Empty,
             arl_Return);

        #endregion

        #region 檢查[群分類][大分類][中分類][小分類]的階層關係是否正確

        #region 設定變數

        string s_PATTERN_NO = string.Empty;
        string s_Result = string.Empty;

        #endregion

        #region 傳入參數

        s_PATTERN_NO = dr["ROOT_NO"].ToString() + dr["PMA"].ToString() + dr["CATEGORY"].ToString() + dr["SORT_OUT"].ToString();

        ParameterList.Clear();
        ParameterList.Add(ITMComm.GetValueSetParameter(s_PATTERN_NO, "string", false));//[PATTERN_NO]
        ParameterList.Add(ITMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));//[登入人員]

        #endregion

        #region 連結資料庫

        s_Result = bco.CHK_ITM_PATTERN_NO(ParameterList).Rows[0]["result"].ToString();

        #endregion

        #region 檢查回傳值

        if (s_Result == "NO")
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[群分類][大分類][中分類][小分類]的階層關係不正確", "1", string.Empty); }

        #endregion

        #endregion

        #region 欄位[期別結束日]必需大於或等於系統日

        if (dr["PERIOD_END_DATE"].ToString() != string.Empty)
        {
            DateTime d_PERIOD_END_DATE = DateTime.ParseExact(dr["PERIOD_END_DATE"].ToString(), "yyyyMMdd", null);

            if (d_PERIOD_END_DATE < DateTime.Now.Date)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[期別結束日]必需大於或等於系統日", "1", string.Empty); }
        }

        #endregion

        #region 欄位[零售價]必需大於欄位[成本價]

        if (double.Parse(dr["COST"].ToString()) > int.Parse(dr["PRICE"].ToString()))
        { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[零售價]必需大於欄位[成本價]", "1", string.Empty); }

        #endregion

        #region 欄位[折扣率]計算是否正確
        //整批匯入直接幫使用者算,不必檢查
        #endregion

        #region 判斷欄位[物流費基準]

        if (dr["PERIOD_PAY_TYPE"].ToString() == "1")//元
        {
            if (dr["DIS_ACCEPT_RATE"].ToString() != string.Empty ||
                dr["DIS_RETURN_RATE"].ToString() != string.Empty)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]=1時,[進貨物流費(%)][退貨物流費(%)]必須為空值", "1", string.Empty); }
        }
        else if (dr["PERIOD_PAY_TYPE"].ToString() == "2")//率
        {
            if (dr["DIS_ACCEPT_DOLLAR"].ToString() != string.Empty ||
                dr["DIS_RETURN_DOLLAR"].ToString() != string.Empty)
            { arl_Return = ITMComm.ToMakeUp_Err_ArrayList(arl_Return, "欄位[物流費基準]=2時,[進貨物流費(元)][退貨物流費(元)]必須為空值", "1", string.Empty); }
        }

        #endregion

        #endregion

        return arl_Return;
    }