Example #1
0
        //回傳值 true.通過驗證 false.未通過驗證,
        protected override bool WfItemCheck(object sender, ItemCheckInfo e)
        {
            baa_tb     baaModel;
            vw_cari010 masterModel;
            string     errMsg;

            try
            {
                baaModel    = BoBas.OfGetBaaModel();
                masterModel = DrMaster.ToItem <vw_cari010>();
                #region 單頭-pick vw_cari010
                if (e.Row.Table.Prefix.ToLower() == "vw_cari010")
                {
                    switch (e.Column.ToLower())
                    {
                    case "cac01":    //單別
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        if (GlobalFn.isNullRet(baaModel.baa06.Value, 0) != GlobalFn.isNullRet(e.Value, "").Length)
                        {
                            errMsg = string.Format("單別限定長度為{0}碼", GlobalFn.isNullRet(baaModel.baa06, ""));
                            WfShowErrorMsg(errMsg);
                            return(false);
                        }
                        if (BoCar.OfChkCacPKValid(GlobalFn.isNullRet(e.Value, "")) == true)
                        {
                            WfShowErrorMsg("單別已存在,請檢核!");
                            return(false);
                        }
                        break;

                    case "cac03":    //模組別
                        e.Row["cac04"]   = "";
                        e.Row["cac04_c"] = "";
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            return(true);
                        }
                        WfDisplayMode();
                        ute_cac04.Focus();
                        break;

                    case "cac04":    //單據性質
                        if (GlobalFn.varIsNull(e.Value))
                        {
                            e.Row["cac04_c"] = "";
                            return(true);
                        }
                        if (GlobalFn.varIsNull(masterModel.cac03))
                        {
                            WfShowErrorMsg("請先輸入模組別!");
                            return(true);
                        }
                        if (BoAdm.OfChkAzf02Exists(masterModel.cac03, GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此模組+單據性質!");
                            return(false);
                        }
                        e.Row["cac04_c"] = BoAdm.OfGetAzf02(masterModel.cac03, GlobalFn.isNullRet(e.Value, ""));
                        break;

                    case "cac08":
                        if (e.Value.ToString() == "Y")
                        {
                            WfSetControlReadonly(ucx_cac09, false);
                            WfSetControlReadonly(ute_cac10, false);
                        }
                        else
                        {
                            WfSetControlReadonly(ucx_cac09, true);
                            WfSetControlReadonly(ute_cac10, true);
                            e.Row["cac09"] = "N";
                            e.Row["cac10"] = "";
                        }
                        break;

                    case "cac10":
                        if (GlobalFn.isNullRet(e.Value, "") == "")
                        {
                            return(true);
                        }
                        if (BoGla.OfChkGacPKValid(GlobalFn.isNullRet(e.Value, "")) == false)
                        {
                            WfShowErrorMsg("無此單別,請檢核!");
                            return(false);
                        }
                        break;
                    }
                }
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }