/// <summary>
 /// 控制關卡向後跳關
 /// </summary>
 /// <param name="jumpFlag"></param>
 protected virtual void DOAJump()
 {
     oDOAHandler._sJump = "Y";//設置跳關標誌
     try
     {
         oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);//DOA XML STR進行跳關處理
     }
     catch (Exception ex)
     {
         DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
         throw new Exception("Server or network is busy now,pls try again");
     }
 }
 //跳關
 private void GoJump()
 {
     oDOAHandler._sJump = "Y";//不用簽,向后跳關
     try
     {
         oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
     }
     catch (Exception ex)
     {
         DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
         throw new Exception("Server or network is busy now,pls try again");
     }
 }
        /// <summary>
        /// 重載標準DOA-特殊規則獲取簽核人(TYPE C)
        /// </summary>
        /// <param name="roleCode"></param>
        /// <param name="dtHead"></param>
        /// <param name="dtDetail"></param>
        protected override void GetDOABySpeicalRule(string roleCode, DataTable dtHead, DataTable dtDetail)
        {
            #region
            bool    jumpFlag     = false;//跳關標示
            string  buyerCode    = string.Empty;
            DataRow drHead       = dtHead.Rows[0];
            string  sAPTYP       = drHead["APTYP"].ToString();
            string  sLOCFrom     = drHead["LOCFM"].ToString();
            string  sLOCTo       = drHead["LOCTO"].ToString();
            string  sCostCenter  = drHead["KOSTL"].ToString().ToUpper().Trim();
            string  sDepartment  = drHead["ABTEI"].ToString().ToUpper().Trim();
            string  materialType = string.Empty;
            switch (roleCode)
            {
            case "2675-PMC01":
                #region
                switch (sAPTYP)
                {
                case "T1":
                    oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                    if (oDOAHandler._sJump == "Y")
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    else
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString();
                        //儲位0010簽MC
                        if (sLOCTo == "0019" && (sLOCFrom == "0030" || sLOCFrom == "0020"))
                        {
                            //非儲位0030/0030 轉0019簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                        else
                        {
                            //簽MC
                            buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                            if (buyerCode.Length > 0)
                            {
                                oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                            }
                            else
                            {
                                GetHandlerErrAlarm(dtHead, "物料BUYER CODE缺失,無法獲取簽核人");
                            }
                            break;
                        }
                    }
                    break;

                case "I1":
                    //material storage location
                    Hashtable dtSLoc = new Hashtable();
                    dtSLoc.Add("0010", "0010");
                    dtSLoc.Add("0013", "0013");
                    dtSLoc.Add("0012", "0012");
                    dtSLoc.Add("0019", "0019");
                    dtSLoc.Add("SHJ1", "SHJ1");
                    //sepcial storage location(include material/fg/ft)
                    Hashtable dtSLoc2 = new Hashtable();
                    dtSLoc2.Add("0024", "0024");
                    dtSLoc2.Add("0028", "0028");

                    if (dtSLoc.Contains(sLOCFrom))
                    {
                        Hashtable ht = new Hashtable();
                        //檢查每顆料的採購,如有多個則進行並簽
                        foreach (DataRow dr in dtDetail.Rows)
                        {
                            buyerCode = dr["EKGRP"].ToString().Trim().ToUpper();
                            string logonId = GetDOAHandlerByBuyerCode(buyerCode);
                            if (ht.Contains(logonId) == false)
                            {
                                ht.Add(logonId, 0);
                                if (oDOAHandler._sHandler.Length > 0)
                                {
                                    oDOAHandler._sHandler += ",";
                                }
                                oDOAHandler._sHandler += logonId;
                                break;
                            }
                        }
                        if (oDOAHandler._sHandler.Length == 0)
                        {
                            GetHandlerErrAlarm(dtHead, "物料對應BuyerCode信息有誤,無法獲取簽核人");
                        }
                    }
                    else if (dtSLoc2.Contains(sLOCFrom))
                    {
                        materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                        //看最後兩碼 FT =成品
                        //RH = 材料
                        //HL = 半品
                        //VP = 包材
                        if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                        {
                            buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                            string logonId =
                                oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    else
                    {
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;

                case "IA":

                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        string logonId =
                            oDOAHandler._sJump = "N";
                        //簽MC
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                    else
                    {
                        oDOAHandler._sJump = "N";
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;
                }
                break;

                #endregion
            case "2675-MFG02":
                #region
                switch (sAPTYP)
                {
                case "T1":
                    oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                    if (oDOAHandler._sJump == "Y")
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "A");        //抓取簽核人空白 Bug 修復
                    }
                    break;

                default:        //應稽核要求 7302N成本中心 I3,I5單第一關簽核人 單獨指定 2019-05-30
                    if (sCostCenter == "7302N")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "A");
                    }
                    break;
                }
                break;
                #endregion

            case "2675-PMC02":

                #region
                switch (sAPTYP)
                {
                case "T1":
                    //儲位0010簽MC主管
                    if (sLOCFrom == "0010")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        break;
                    }
                    else
                    {
                        //非儲位0010簽PC主管
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;

                case "IS":
                case "I1":
                    //material storage location
                    Hashtable dtSLoc = new Hashtable();
                    dtSLoc.Add("0010", "0010");
                    dtSLoc.Add("0013", "0013");
                    dtSLoc.Add("0019", "0019");
                    dtSLoc.Add("SHJ1", "SHJ1");
                    dtSLoc.Add("0012", "0012");
                    //sepcial storage location(include material/fg/ft)
                    Hashtable dtSLoc2 = new Hashtable();
                    dtSLoc2.Add("0024", "0024");
                    dtSLoc2.Add("0028", "0028");
                    if (dtSLoc.Contains(sLOCFrom))
                    {
                        if (sCostCenter == "7406N" && sDepartment == "MC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        }
                    }
                    else if (dtSLoc2.Contains(sLOCFrom))
                    {
                        materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                        //看最後兩碼 FT =成品
                        //RH = 材料
                        //HL = 半品
                        //VP = 包材
                        if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                        {
                            if (sCostCenter == "7406N" && sDepartment == "MC")
                            {
                                //本部門申請跳過
                                oDOAHandler._sJump = "Y";
                                oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                            }
                            else
                            {
                                oDOAHandler._sJump = "N";
                                //簽MC
                                oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                            }
                        }
                        else
                        {
                            if (sCostCenter == "7406N" && sDepartment == "PC")
                            {
                                //本部門申請跳過
                                oDOAHandler._sJump = "Y";
                                oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                            }
                            else
                            {
                                oDOAHandler._sJump = "N";
                                //簽PC
                                oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                            }
                        }
                    }
                    else
                    {
                        if (sCostCenter == "7406N" && sDepartment == "PC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    break;

                case "I6":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        if (sCostCenter == "7406N" && sDepartment == "MC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        }
                    }
                    else
                    {
                        if (sCostCenter == "7406N" && sDepartment == "PC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    break;

                case "IA":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        string logonId =
                            oDOAHandler._sJump = "N";
                        //簽MC
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                    else
                    {
                        oDOAHandler._sJump = "N";
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }

                    break;
                }

                break;

                #endregion
            case "2675-DEPT01":
                #region
                oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, sCostCenter, sDepartment);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                }
                break;
                #endregion

            case "2675-DEPT02":
                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    oDOAHandler._sJump = "Y";    //PCT不用簽,主管與窗口為同一人向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump = "N";
                }
                break;
                #endregion

            case "2675-APP01":
                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                }
                break;
                #endregion

            case "2675-FIN01":
                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode);
                break;
                #endregion

            case "2675-CUST01":
                #region
                switch (sAPTYP)
                {
                case "IS":
                    jumpFlag = false;
                    break;

                case "I1":
                    string returnFlag = drHead["RTNIF"].ToString();
                    if (returnFlag == "N")
                    {
                        jumpFlag = false;
                    }
                    else
                    {
                        jumpFlag = true;
                    }
                    break;

                default:
                    jumpFlag = true;
                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            default:
                break;

            case "2675-DEPT01-T1":
                #region     //costcenter +dept

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, sCostCenter, sDepartment);
                }
                break;


                #endregion

            case "2675-DEPT02-T1":
                #region       //costcenter

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                }

                break;
                #endregion


            case "2675-PMC01-T1":
                #region

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        if (buyerCode.Length > 0)
                        {
                            oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                        }
                        else
                        {
                            GetHandlerErrAlarm(dtHead, "物料BUYER CODE缺失,無法獲取簽核人");
                        }
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                }
                break;
                #endregion

            case "2675-MC01-I3":
                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "HL")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "CZ2");     //半成品簽PC人員 CZ2 : CLWANG 2019/03/06
                    }
                    else
                    {
                        buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                }
                break;

            case "2675-SQE01-T1":
            case "2675-IQE01-T1":
                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, buyerCode);
                }
                break;

            case "2675-QRA01-T1":
                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "RH");
                    }
                    else
                    {
                        //2019-04-18 HIS CZ2 T1轉倉單 變更簽核人 根據成本中心類型 N為lijuanxie  T為Owenwu
                        string KOSTL = dtHead.Rows[0]["KOSTL"].ToString();
                        if (KOSTL.Contains("N"))
                        {
                            oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "N");
                        }
                        else if (KOSTL.Contains("T"))
                        {
                            oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "T");
                        }
                        else
                        {
                            Hashtable dtSLoc = new Hashtable();
                            dtSLoc.Add("0023", "0023");
                            if (dtSLoc.Contains(sLOCFrom) || dtSLoc.Contains(sLOCTo))
                            {
                                oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "A");
                            }
                            else
                            {
                                oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "B");
                            }
                        }
                    }
                }
                break;

            case "2675-MFG01-T1":
            case "2675-IQM02-T1":
            case "2675-PC01-T1":
            case "2675-PMC02-T1":
            case "2675-WH01-T1":
            case "2675-MC02-T1":
                #region

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2675-MC01-T1":
                #region     //buyercode

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                }

                break;
                #endregion

            case "2675-IQC01":
                switch (sAPTYP)
                {
                case "IA":
                case "IC":
                    string KOSTL = dtHead.Rows[0]["KOSTL"].ToString();
                    if (KOSTL.Contains("N"))
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "N");
                    }
                    else if (KOSTL.Contains("T"))
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "T");
                    }
                    break;
                }
                break;
            }
            #endregion
        }
Exemple #4
0
        /// <summary>
        /// 重載標準DOA-特殊規則獲取簽核人(TYPE C)
        /// </summary>
        /// <param name="roleCode"></param>
        /// <param name="dtHead"></param>
        /// <param name="dtDetail"></param>
        protected override void GetDOABySpeicalRule(string roleCode, DataTable dtHead, DataTable dtDetail)
        {
            #region
            string  sAPTYP    = string.Empty;
            string  sLOC      = string.Empty;
            string  buyerCode = string.Empty;
            string  sTemp     = string.Empty;
            DataRow drHead    = dtHead.Rows[0];

            string sCostCenter  = drHead["KOSTL"].ToString().ToUpper().Trim(); //成本中心
            string sDepartment  = drHead["ABTEI"].ToString().ToUpper().Trim(); //部門
            string materialType = string.Empty;                                //成品半成品/原物料

            string orderType = string.Empty;
            bool   jumpFlag  = false;                              //跳關標示
            sAPTYP = drHead["APTYP"].ToString();                   //AP TYPE
            sLOC   = drHead["LOCFM"].ToString();                   //儲位
            DataRow[] orderCheck = dtDetail.Select(" GMFLOW='R'"); //重工工單標誌 R:為重工,空為非重工
            if (orderCheck.Length > 0)
            {
                orderType = "R";
            }
            switch (roleCode.ToUpper())
            {
            case "2680-MFG02":    //I2,I7
                #region [check handler]
                //檢查APPLIER ID(GDS01-GDS05屬於MFG)
                switch (sAPTYP)
                {
                case "I2":
                    #region
                    switch (drHead["APPER"].ToString().ToUpper())
                    {
                    case "GDS01":
                    case "GDS02":
                    case "GDS03":
                    case "GDS04":
                    case "GDS05":
                        jumpFlag = false;
                        break;

                    default:
                        jumpFlag = true;
                        break;
                    }
                    #endregion
                    break;

                case "I7":
                    #region
                    switch (drHead["APPER"].ToString().ToUpper())
                    {
                    case "GDS01":
                    case "GDS02":
                    case "GDS03":
                    case "GDS04":
                    case "GDS05":
                        jumpFlag = false;
                        break;

                    default:
                        //非MFG無需簽核
                        jumpFlag = true;
                        break;
                    }


                    #endregion
                    break;

                default:
                    switch (drHead["APPER"].ToString().ToUpper())
                    {
                    case "GDS01":
                    case "GDS02":
                    case "GDS03":
                    case "GDS04":
                    case "GDS05":
                        jumpFlag = false;
                        break;

                    default:
                        //非MFG無需簽核
                        jumpFlag = true;
                        break;
                    }
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }

                #endregion [check handler]
                break;

            case "2680-MFG02-A3":    //I7
                #region [check handler]
                //檢查APPLIER ID(GDS01-GDS05屬於MFG)
                switch (sAPTYP)
                {
                case "I7":
                    #region
                    switch (drHead["APPER"].ToString().ToUpper())
                    {
                    case "GDS30":
                        jumpFlag = true;
                        break;

                    default:
                        jumpFlag = false;
                        break;
                    }


                    #endregion
                    break;

                default:
                    switch (drHead["APPER"].ToString().ToUpper())
                    {
                    case "GDS30":
                        jumpFlag = true;
                        break;

                    default:
                        jumpFlag = false;
                        break;
                    }
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }

                #endregion [check handler]
                break;

            case "2680-PUR01-A3":    //I7
                jumpFlag = false;
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

            case "2680-WH01-A3":
                oDOAHandler._sJump = "N";
                switch (drHead["APPER"].ToString().ToUpper())
                {
                case "GDS30":
                    string pdLine = drHead["ZPLINE"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, pdLine);
                    break;

                default:
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                    break;
                }
                break;

            case "2680-MFG01-A3":
                oDOAHandler._sJump = "N";
                switch (drHead["APPER"].ToString().ToUpper())
                {
                case "GDS30":
                    string pdLine = drHead["ZPLINE"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, pdLine);
                    break;

                default:
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                    break;
                }
                break;

            case "2680-PUR01":               //i2,ic
                #region
                DataTable dt2680_PUR01 = GetPartList(roleCode);

                //PUR窗口依舊料號前兩碼區分負責窗口(料號與窗口對應信息記錄與DB)
                //只檢查第一顆料的採購
                #region [loop check window info]

                sTemp = dtDetail.Rows[0]["MAKTX"].ToString().Trim().ToUpper();

                for (int j = 2; j < 6; j++)
                {
                    string    sTemp2 = sTemp.Substring(0, 7 - j);
                    DataRow[] al     = dt2680_PUR01.Select("OldPartNo='" + sTemp2 + "'");
                    if (al.Length > 0)
                    {
                        oDOAHandler._sHandler = al[0]["handler"].ToString();
                        break;
                    }
                }
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, "物料對應採購簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                }
                #endregion [loop check window info]
                #endregion
                break;

            case "2680-PUR02":              //I1,I7,IF
                #region
                DataTable dt2680_PUR02 = new DataTable();
                switch (sAPTYP)
                {
                case "I1":

                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) != "FT")
                    {
                        //原物料
                        jumpFlag = false;
                    }
                    else
                    {
                        //成品半成品
                        jumpFlag = true;
                    }

                    break;

                case "I7":
                case "IF":
                    jumpFlag = false;
                    break;

                default:
                    jumpFlag = true;
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    //PUR窗口依舊料號前兩碼區分負責窗口(料號與窗口對應信息記錄與DB)
                    dt2680_PUR02 = GetPartList("2680-PUR01");

                    #region [loop check window info]

                    Hashtable ht = new Hashtable();
                    oDOAHandler._sJump = "N";
                    //檢查每顆料的採購,如有多個則進行並簽
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        sTemp = dr["MAKTX"].ToString().Trim().ToUpper();

                        for (int j = 2; j < 6; j++)
                        {
                            string    sTemp2 = sTemp.Substring(0, 7 - j);
                            DataRow[] al     = dt2680_PUR02.Select("OldPartNo='" + sTemp2 + "'");
                            if (al.Length > 0 && ht.Contains(al[0]["handler"].ToString().ToUpper()) == false)
                            {
                                ht.Add(al[0]["handler"].ToString().ToUpper(), 0);
                                if (oDOAHandler._sHandler.Length > 0)
                                {
                                    oDOAHandler._sHandler += ",";
                                }
                                oDOAHandler._sHandler += al[0]["handler"].ToString();
                                break;
                            }
                        }
                    }

                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, "物料對應採購簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                    }
                    #endregion [loop check window info]
                }
                #endregion
                break;

            case "2680-PUR03":              //I1 PUR主管窗口 2019-01-25
                #region
                switch (sAPTYP)
                {
                case "I1":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) != "FT")
                    {
                        //原物料
                        jumpFlag = false;
                    }
                    else
                    {
                        //成品半成品
                        jumpFlag = true;
                    }
                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else     //PUR主管固定人員
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-PMM01":
                jumpFlag = true;
                //I2/I7如含有IC,PCB,线材等物料加会PMM主管
                switch (sAPTYP)
                {
                case "I2":
                case "I7":
                    string oldPartNo = string.Empty;
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        oldPartNo = dr["MAKTX"].ToString();
                        //PCB,IC,线材加会PMM MANAGER
                        if (oldPartNo.StartsWith("01X") || oldPartNo.StartsWith("32") || oldPartNo.StartsWith("04"))
                        {
                            jumpFlag = false;
                            break;
                        }
                    }

                    break;

                case "I1":          //I1,IA 簽PMM主管  2019-01-25
                case "IA":
                    jumpFlag = false;
                    break;

                default:
                    jumpFlag = true;
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

            case "2680-WH01":      //IC
                #region
                //IC單(不良品退料)簽不良品倉管
                if (sAPTYP == "IC")
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, sAPTYP);
                    break;
                }
                //I2單(溢領)且儲位為0019(AI倉庫)簽AI倉管
                if (sAPTYP == "I2" && sLOC == "0019")
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, sAPTYP + "-" + sLOC);
                    break;
                }
                //I2單(溢領)且儲位非為0019(AI倉庫)簽MFG倉管
                //MFG WH窗口依舊料號前兩碼區分負責窗口(料號與窗口對應信息記錄與DB)
                #region [loop check]
                DataTable dtP2680_WH01 = GetPartList(roleCode);

                sTemp = dtDetail.Rows[0]["MAKTX"].ToString().Trim().ToUpper();

                for (int j = 4; j < 6; j++)
                {
                    string    sTemp2 = sTemp.Substring(0, 7 - j);
                    DataRow[] al     = dtP2680_WH01.Select("OldPartNo='" + sTemp2 + "'");
                    if (al.Length > 0)
                    {
                        oDOAHandler._sHandler = al[0]["handler"].ToString();
                        break;
                    }
                }

                #endregion [loop check]
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, "物料對應倉管簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                }
                #endregion
                break;

            case "2680-WH02":      //I1需簽倉庫主管 2019-01-25
                #region
                switch (sAPTYP)
                {
                case "I1":
                case "IA":
                case "I6":
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                    break;
                }
                #endregion
                break;

            case "2680-IQC01":        //IC
                #region
                //IQC窗口依舊料號前兩碼區分負責窗口(料號與窗口對應信息記錄與DB)
                DataTable dt2680_IQC01 = GetPartList(roleCode);
                #region [loop check]

                sTemp = dtDetail.Rows[0]["MAKTX"].ToString().Trim().ToUpper();
                for (int j = 2; j < 6; j++)
                {
                    string    sTemp2 = sTemp.Substring(0, 7 - j);
                    DataRow[] al     = dt2680_IQC01.Select("OldPartNo='" + sTemp2 + "'");
                    if (al.Length > 0)
                    {
                        oDOAHandler._sHandler = al[0]["handler"].ToString();
                        break;
                    }
                }

                #endregion [loop check]
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, "物料對應IQC簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                }
                #endregion
                break;

            case "2680-PC01":               //I1,I7.IA
                #region
                switch (sAPTYP)
                {
                case "I1":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) != "FT")
                    {
                        jumpFlag = true;
                    }
                    else
                    {
                        jumpFlag = false;
                    }
                    break;

                case "I7":
                    if (orderType == "R")
                    {
                        //重工工單必簽
                        jumpFlag = false;
                    }
                    else
                    {
                        //非重工工單無需簽核
                        jumpFlag = true;
                    }
                    break;

                case "IA":
                    jumpFlag = false;
                    break;

                default:
                    jumpFlag = true;
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, "物料對應關務簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                    }
                }
                #endregion
                break;

            case "2680-DEPT01":             //I1,IA
                #region
                switch (sAPTYP)
                {
                case "I1":
                case "IA":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, sDepartment);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                    }
                    break;

                default:
                    break;
                }
                #endregion
                break;

            case "2680-DEPT02":             //I1,IA
                #region
                switch (sAPTYP)
                {
                case "I1":
                case "IA":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, "");
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sCostCenter));
                    }
                    break;

                default:
                    break;
                }
                #endregion
                break;

            case "2680-CUST01":             //I1
                #region
                string    iPart     = string.Empty;
                DataTable dtSpecial = GetPartList("2680-Cust01");
                switch (sAPTYP)
                {
                case "I1":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();

                    if (materialType.Length == 4 && materialType.Substring(2, 2) != "FT")
                    {
                        int i = 0;
                        foreach (DataRow dr in dtDetail.Rows)
                        {
                            if (dtSpecial.Select("PartDesc='" + dr["IPART"].ToString() + "'").Length > 0)
                            {
                                iPart = dr["IPART"].ToString();
                                i++;
                                break;
                            }
                        }
                        if (i > 0)
                        {
                            //原物料 簽
                            jumpFlag = false;
                        }
                        else
                        {
                            jumpFlag = true;
                        }
                    }
                    else
                    {
                        //成品半成品  跳
                        jumpFlag = true;
                    }
                    break;

                default:
                    jumpFlag = true;
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    //string iPart = dtDetail.Rows[0]["IPART"].ToString().Trim().ToUpper();
                    oDOAHandler._sJump    = "N"; //依COST CENTER 獲取簽核人
                    oDOAHandler._sHandler = dtSpecial.Select("PartDesc='" + iPart + "'")[0]["handler"].ToString();
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, "物料對應關務簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                    }
                }

                #endregion
                break;

            case "2680-MD01":                 //I1,I6
                #region
                switch (sAPTYP)
                {
                case "I1":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) != "FT")
                    {
                        jumpFlag = true;
                    }
                    else
                    {
                        jumpFlag = false;
                    }
                    break;

                case "I6":
                    jumpFlag = false;
                    break;

                case "I2":
                case "I7":
                    jumpFlag = true;
                    string oldPartNo = string.Empty;
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        oldPartNo = dr["MAKTX"].ToString();
                        //CASE 累计溢领超0.3%加会MD
                        if (oldPartNo.StartsWith("46"))
                        {
                            try
                            {
                                if (double.Parse(dr["OVER_RATE"].ToString()) > 3)
                                {
                                    jumpFlag = false;
                                    break;
                                }
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    break;

                default:
                    jumpFlag = true;
                    break;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, "MD簽核人資料缺失,無法獲取簽核人,請聯繫IT");
                    }
                }

                #endregion
                break;

            case "2680-QRA01":
                #region
                switch (sAPTYP)
                {
                case "I6":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, sDepartment);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                    }
                    break;
                }
                break;

                #endregion
            case "2680-QRA02":
                #region
                switch (sAPTYP)
                {
                case "I6":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, sDepartment);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                    }
                    break;
                }
                break;

                #endregion
            case "2680-QRA03":
                #region
                switch (sAPTYP)
                {
                case "I6":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, sDepartment);
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                    }
                    break;
                }
                break;

                #endregion
            case "2680-DEPT01-A3":     //I1
                #region
                switch (sAPTYP)
                {
                case "I1":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, "");
                    if (!string.IsNullOrEmpty(oDOAHandler._sHandler))
                    {
                        jumpFlag = false;
                    }
                    else
                    {
                        jumpFlag = true;
                    }
                    break;

                default:
                    jumpFlag = true;
                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, "");
                }
                #endregion
                break;

            case "2680-DEPT02-A3":             //I1
                #region
                switch (sAPTYP)
                {
                case "I1":
                    oDOAHandler._sHandler = GetDOAHandler_POWER(roleCode, sCostCenter, "");
                    if (oDOAHandler._sHandler.Length == 0)
                    {
                        GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sCostCenter));
                    }
                    break;

                default:
                    break;
                }
                #endregion
                break;

            case "2680-MD02":
                #region 根據金額簽核到廠長 大於等於2萬
                double TWD01 = GetAmount(dtDetail);    //匯率
                //double TWD01 = 100000;
                if (TWD01 >= 20000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-MD03":
                #region 根據金額簽核到總廠長 大於等於2萬
                double TWD05 = GetAmount(dtDetail);    //匯率
                //double TWD01 = 100000;
                if (TWD05 >= 20000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-BUHEAD":
                #region 根據金額簽核到BUHEAD 大於等於20萬
                double TWD00 = GetAmount(dtDetail);    //匯率
                //double TWD00 = 100000;
                if (TWD00 >= 200000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-BGHEAD":
                #region 根据金额判断是否需要签核至BGUHEAD  大於等於75萬
                double TWD02 = GetAmount(dtDetail);    //匯率
                //double TWD02 = 250001;
                if (TWD02 >= 750000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-CEO":
                #region 根据金额判断是否需要签核至CEO   大於等於500萬
                double TWD03 = GetAmount(dtDetail);    //匯率
                //double TWD03 = 600000;
                if (TWD03 >= 5000000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2680-CHAIRMAN":
                #region 根据金额判断是否需要签核至董事長 大於等於1000萬
                double TWD04 = GetAmount(dtDetail);    //匯率
                //double TWD04 = 100000000;
                if (TWD04 > 10000000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            default:
                break;
            }
            #endregion
        }
        /// <summary>
        /// 獲取DOA簽核人
        /// </summary>
        /// <param name="sLogonId">申請人</param>
        /// <param name="sDOA">DOA資訊</param>
        /// <param name="dtHead">單據表頭</param>
        /// <param name="dtDetail">單據DATA</param>
        /// <returns></returns>
        public Model_DOAHandler GetStepHandler(Model_DOAHandler pDOAHandler, DataTable dtHead, DataTable dtDetail)
        {
            oDOAHandler = pDOAHandler;
            //獲取當前簽核角色
            string currentRole = SPMAppLine.GetCurrentApprover(oDOAHandler._sDOA).Replace("{", "").Replace("}", "");

            //並簽檢查
            ParallelApprovalCheck(oDOAHandler, currentRole);
            oDOAHandler._sRoleCode = currentRole;
            //檢查是否最后一關簽核角色
            string nextRole = SPMAppLine.GetNextStep(oDOAHandler._sDOA);

            if (nextRole != "*")
            {
                //當前非最後一關簽核角色
                //檢查當前簽核角色是否並簽,是否最後一個並簽人員
                if (oDOAHandler._ParallelFlag == true && oDOAHandler._FinalFlag == false)
                {
                    //並簽,非最後一個人,將關卡打入下一關即END,觸發SPM並簽控制機制
                    oDOAHandler._sEndFlag = "Y";
                    //設置更新並簽FLAG為TRUE
                    oDOAHandler._UpdateParallelFlag = true;
                }
                else
                {
                    //非並簽或並簽且為最後一個人
                    //對DOA XML進行跳關處理
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                    do
                    {
                        //獲取當前簽核角色
                        currentRole = SPMAppLine.GetCurrentApprover(oDOAHandler._sDOA).Replace("{", "").Replace("}", "");
                        //並簽檢查
                        ParallelApprovalCheck(oDOAHandler, currentRole);
                        //CAL FUNCTION 抓取關卡簽核人直至該關卡非跳關狀態
                        StepCheck(dtHead, dtDetail);

                        //防止最後一個簽核角色為選簽時,前置條件不足陷於死循環
                        string currentStep = SPMAppLine.GetCurrentStep(oDOAHandler._sDOA);
                        if (currentStep == "*")
                        {
                            oDOAHandler._sJump    = "N";
                            oDOAHandler._sEndFlag = "Y";
                        }
                    }while (oDOAHandler._sJump == "Y");
                }
            }
            else
            {
                //當前為最後一關簽核角色
                //檢查當前簽核角色是否並簽
                if (oDOAHandler._ParallelFlag == true)
                {
                    //並簽,且為最後一個人
                    if (oDOAHandler._FinalFlag == true)
                    {
                        //對DOA XML進行跳關處理
                        oDOAHandler._sEndFlag = "Y";
                        try
                        {
                            oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        catch (Exception ex)
                        {
                            DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                            throw new Exception("Server or network is busy now,pls try again");
                        }
                    }
                    else
                    {
                        //並簽,非最後一個人,將關卡打入下一關即END,觸發SPM並簽控制機制
                        oDOAHandler._sEndFlag = "Y";
                    }
                    //設置更新並簽FLAG為TRUE
                    oDOAHandler._UpdateParallelFlag = true;
                }
                else
                {
                    //非並簽,對DOA XML進行跳關處理
                    oDOAHandler._sEndFlag = "Y";
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
            }
            return(oDOAHandler);
        }
        /// <summary>
        /// 重載標準DOA-特殊規則獲取簽核人(TYPE C)
        /// </summary>
        /// <param name="roleCode"></param>
        /// <param name="dtHead"></param>
        /// <param name="dtDetail"></param>
        protected override void GetDOABySpeicalRule(string roleCode, DataTable dtHead, DataTable dtDetail)
        {
            DataRow drHead          = dtHead.Rows[0];
            DataRow drDetail        = dtDetail.Rows[0];
            string  reasonCode      = drHead["GRUND"].ToString();
            string  sAPTYP          = drHead["APTYP"].ToString();
            string  sLOC            = drHead["LOCFM"].ToString();
            string  costCenter      = drHead["KOSTL"].ToString().ToUpper();
            string  procurementType = drDetail["BESKZ"].ToString().Trim().ToUpper();
            string  prdSuppervisor  = drDetail["FEVOR"].ToString().Trim().ToUpper();
            string  applydate       = drHead["ERDAT"].ToString().Trim().ToUpper();
            string  mrpcontroller   = drDetail["DISPO"].ToString().Trim().ToUpper();

            bool jumpFlag = false;//跳關標示

            switch (roleCode)
            {
            case "CE01-DEPT01":
                switch (costCenter)
                {
                case "B315":                  //PM
                    oDOAHandler._sJump = "Y"; //PM部門 窗口不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                    break;

                default:
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, costCenter);
                    break;
                }
                break;

            case "CE01-DEPT02":
                if (costCenter.Length > 0)
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, costCenter);
                }
                else
                {
                    GetHandlerErrAlarm(dtHead, "COST CENTER信息為空,無法獲取簽核人");
                }
                break;

            case "CE01-IPQC01":
                switch (sAPTYP)
                {
                case "I5":
                    switch (costCenter)
                    {
                    case "B460":            //I5單據,CC為CQS時無需簽核
                        jumpFlag = true;
                        break;

                    default:
                        jumpFlag = false;
                        break;
                    }
                    break;

                default:
                    jumpFlag = false;
                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N"; //依COST CENTER 獲取簽核人
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, costCenter);
                }

                break;

            case "CE01-IQC01":
                #region
                if (sAPTYP == "IC")
                {
                    switch (costCenter)
                    {
                    case "B411":
                    case "B412":
                    case "B450":
                        if (reasonCode == "0021" && procurementType != "E")            //  F 或 X 必簽
                        {
                            jumpFlag = false;
                        }
                        else
                        {
                            jumpFlag = true;
                        }
                        break;

                    default:
                        jumpFlag = true;
                        break;
                    }
                }
                else
                {
                    jumpFlag = true;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N"; //依COST CENTER 獲取簽核人
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, costCenter);
                }
                #endregion
                break;

            case "CE01-MC01":
                #region
                if (procurementType != "E")     //外購F or X
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }
                if (jumpFlag)                 //自制往後跳
                {
                    oDOAHandler._sJump = "Y"; //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump = "N";
                    //依MRP CODE 獲取簽核人
                    Hashtable ht = new Hashtable();
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        string mrpcode = dr["DISPO"].ToString();     //取物料的MRP Controller
                        if (mrpcontroller.Length > 0)
                        {
                            string buyer = GetDOAHandler(roleCode, mrpcode);
                            if (buyer.Length > 0)
                            {
                                if (ht.Contains(buyer) == false)
                                {
                                    ht.Add(buyer, 0);
                                    if (oDOAHandler._sHandler.Length > 0)
                                    {
                                        oDOAHandler._sHandler += ",";
                                    }
                                    oDOAHandler._sHandler += buyer;
                                }
                            }
                        }
                    }
                }
                #endregion
                break;

            case "CE01-PC01":
                #region
                if (sAPTYP == "IC")
                {
                    switch (costCenter)
                    {
                    case "B411":
                    case "B412":
                    case "B450":
                        if (procurementType == "E")
                        {
                            jumpFlag = false;
                        }
                        else
                        {
                            jumpFlag = true;
                        }
                        break;

                    default:
                        jumpFlag = true;
                        break;
                    }
                }
                else
                {
                    if (procurementType == "E")
                    {
                        jumpFlag = false;
                    }
                    else
                    {
                        jumpFlag = true;
                    }
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    //依production Suppervisor 獲取簽核人
                    oDOAHandler._sJump = "N";

                    Hashtable ht = new Hashtable();
                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        string mrpcode = dr["DISPO"].ToString();     //取物料的MRP Controller
                        if (mrpcode.Length > 0)
                        {
                            string controller = GetDOAHandler(roleCode, mrpcode);
                            if (controller.Length > 0)
                            {
                                if (ht.Contains(controller) == false)
                                {
                                    ht.Add(controller, 0);
                                    if (oDOAHandler._sHandler.Length > 0)
                                    {
                                        oDOAHandler._sHandler += ",";
                                    }

                                    oDOAHandler._sHandler += controller;
                                }
                            }
                        }
                    }
                }
                #endregion
                break;

            case "CE01-MC02":
                #region
                if (procurementType != "E")     //外購 F or X
                {
                    switch (costCenter)
                    {
                    case "B315":
                    case "B460":           //B315,B460 I5單據MC主管為必簽
                        if (sAPTYP == "I5")
                        {
                            jumpFlag = false;
                        }
                        else
                        {
                            //CC B315,B460 其它單據MC主管需檢查KPI
                            //jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                            jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, "F", dtDetail) == true) ? false : true;
                        }
                        break;

                    default:
                        //其它CC 所有單據MC主管需檢查KPI
                        //jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                        jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, "F", dtDetail) == true) ? false : true;
                        break;
                    }
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                #endregion
                break;

            case "CE01-PC02":
                #region
                if (procurementType == "E")
                {
                    switch (costCenter)
                    {
                    case "B315":
                    case "B460":           //B315,B460 I5單據PC主管為必簽
                        if (sAPTYP == "I5")
                        {
                            jumpFlag = false;
                        }
                        else
                        {
                            //CC B315,B460 其它單據PC主管需檢查KPI
                            jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                        }
                        break;

                    default:
                        //其它CC 所有單據PC主管需檢查KPI
                        jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                        break;
                    }
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                #endregion
                break;

            case "CE01-LMD01":
                #region
                switch (costCenter)
                {
                case "B315":
                case "B460":           //B315,B460 I5單據LMD主管為必簽
                    if (sAPTYP == "I5")
                    {
                        jumpFlag = false;
                    }
                    else
                    {
                        //CC B315,B460 其它單據LMD主管需檢查KPI
                        jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                    }
                    break;

                default:
                    //其它CC 所有單據PC主管需檢查KPI
                    if (procurementType == "X")
                    {
                        jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, "F", dtDetail) == true) ? false : true;
                    }
                    else
                    {
                        jumpFlag = (CheckKPI(sAPTYP, costCenter, applydate, procurementType, dtDetail) == true) ? false : true;
                    }

                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                #endregion
                break;

            default:
                break;
            }
        }
Exemple #7
0
        /// <summary>
        /// 重載標準DOA-特殊規則獲取簽核人(TYPE C)
        /// </summary>
        /// <param name="roleCode"></param>
        /// <param name="dtHead"></param>
        /// <param name="dtDetail"></param>
        protected override void GetDOABySpeicalRule(string roleCode, DataTable dtHead, DataTable dtDetail)
        {
            #region
            bool    jumpFlag     = false;//跳關標示
            string  buyerCode    = string.Empty;
            DataRow drHead       = dtHead.Rows[0];
            string  sAPTYP       = drHead["APTYP"].ToString();
            string  sLOCFrom     = drHead["LOCFM"].ToString();
            string  sLOCTo       = drHead["LOCTO"].ToString();
            string  sCostCenter  = drHead["KOSTL"].ToString().ToUpper().Trim();
            string  sDepartment  = drHead["ABTEI"].ToString().ToUpper().Trim();
            string  materialType = string.Empty;
            switch (roleCode)
            {
            case "2670-PMC01":
                #region
                switch (sAPTYP)
                {
                case "T1":
                    oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                    if (oDOAHandler._sJump == "Y")
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    else
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString();
                        //儲位0010簽MC
                        if (sLOCTo == "0019" && (sLOCFrom == "0030" || sLOCFrom == "0020" || sLOCFrom == "001A"))
                        {
                            //非儲位0030/0030 轉0019簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }

                        else
                        {
                            //簽MC
                            buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                            if (buyerCode.Length > 0)
                            {
                                oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                            }
                            else
                            {
                                GetHandlerErrAlarm(dtHead, "物料BUYER CODE缺失,無法獲取簽核人");
                            }
                            break;
                        }
                    }
                    break;

                case "I1":
                    //material storage location
                    Hashtable dtSLoc = new Hashtable();
                    dtSLoc.Add("0010", "0010");
                    dtSLoc.Add("0013", "0013");
                    dtSLoc.Add("0012", "0012");
                    dtSLoc.Add("0019", "0019");
                    dtSLoc.Add("SHJ1", "SHJ1");
                    //sepcial storage location(include material/fg/ft)
                    Hashtable dtSLoc2 = new Hashtable();
                    dtSLoc2.Add("0024", "0024");
                    dtSLoc2.Add("0028", "0028");

                    if (dtSLoc.Contains(sLOCFrom))
                    {
                        Hashtable ht = new Hashtable();
                        //檢查每顆料的採購,如有多個則進行並簽
                        foreach (DataRow dr in dtDetail.Rows)
                        {
                            buyerCode = dr["EKGRP"].ToString().Trim().ToUpper();
                            string logonId = GetDOAHandlerByBuyerCode(buyerCode);
                            if (ht.Contains(logonId) == false)
                            {
                                ht.Add(logonId, 0);
                                if (oDOAHandler._sHandler.Length > 0)
                                {
                                    oDOAHandler._sHandler += ",";
                                }
                                oDOAHandler._sHandler += logonId;
                                break;
                            }
                        }
                        if (oDOAHandler._sHandler.Length == 0)
                        {
                            GetHandlerErrAlarm(dtHead, "物料對應BuyerCode信息有誤,無法獲取簽核人");
                        }
                    }
                    else if (dtSLoc2.Contains(sLOCFrom))
                    {
                        materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                        //看最後兩碼 FT =成品
                        //RH = 材料
                        //HL = 半品
                        //VP = 包材
                        if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                        {
                            buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                            string logonId =
                                oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    else
                    {
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;

                case "IA":

                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        string logonId =
                            oDOAHandler._sJump = "N";
                        //簽MC
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                    else
                    {
                        oDOAHandler._sJump = "N";
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;
                }
                break;

                #endregion
            case "2670-MFG02":

                #region
                switch (sAPTYP)
                {
                case "T1":
                    oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                    if (oDOAHandler._sJump == "Y")
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "A");        //抓取簽核人空白 Bug 修復
                    }
                    break;

                default:        //應稽核要求 7302N成本中心 I3,I5單第一關簽核人 單獨指定 2019-05-30
                    if (sCostCenter == "7302N")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "A");
                    }
                    break;
                }
                break;

                #endregion
            case "2670-PMC02":

                #region
                switch (sAPTYP)
                {
                case "T1":
                    //儲位0010簽MC主管
                    if (sLOCFrom == "0010")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        break;
                    }
                    else
                    {
                        //非儲位0010簽PC主管
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                    break;

                case "IS":
                case "I1":
                    //material storage location
                    Hashtable dtSLoc = new Hashtable();
                    dtSLoc.Add("0010", "0010");
                    dtSLoc.Add("0013", "0013");
                    dtSLoc.Add("0019", "0019");
                    dtSLoc.Add("SHJ1", "SHJ1");
                    dtSLoc.Add("0012", "0012");
                    //sepcial storage location(include material/fg/ft)
                    Hashtable dtSLoc2 = new Hashtable();
                    dtSLoc2.Add("0024", "0024");
                    dtSLoc2.Add("0028", "0028");
                    if (dtSLoc.Contains(sLOCFrom))
                    {
                        if (sCostCenter == "7406N" && sDepartment == "MC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        }
                    }
                    else if (dtSLoc2.Contains(sLOCFrom))
                    {
                        materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                        //看最後兩碼 FT =成品
                        //RH = 材料
                        //HL = 半品
                        //VP = 包材
                        if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                        {
                            if (sCostCenter == "7406N" && sDepartment == "MC")
                            {
                                //本部門申請跳過
                                oDOAHandler._sJump = "Y";
                                oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                            }
                            else
                            {
                                oDOAHandler._sJump = "N";
                                //簽MC
                                oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                            }
                        }
                        else
                        {
                            if (sCostCenter == "7406N" && sDepartment == "PC")
                            {
                                //本部門申請跳過
                                oDOAHandler._sJump = "Y";
                                oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                            }
                            else
                            {
                                oDOAHandler._sJump = "N";
                                //簽PC
                                oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                            }
                        }
                    }
                    else
                    {
                        if (sCostCenter == "7406N" && sDepartment == "PC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    break;

                case "I6":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        if (sCostCenter == "7406N" && sDepartment == "MC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽MC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "MC");
                        }
                    }
                    else
                    {
                        if (sCostCenter == "7406N" && sDepartment == "PC")
                        {
                            //本部門申請跳過
                            oDOAHandler._sJump = "Y";
                            oDOAHandler._sDOA  = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                        }
                        else
                        {
                            oDOAHandler._sJump = "N";
                            //簽PC
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                        }
                    }
                    break;

                case "IA":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        string logonId =
                            oDOAHandler._sJump = "N";
                        //簽MC
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                    else
                    {
                        oDOAHandler._sJump = "N";
                        //簽PC
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }

                    break;
                }

                break;

                #endregion
            case "2670-DEPT01":

                #region
                oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, sCostCenter, sDepartment);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                }
                break;

                #endregion
            case "2670-DEPT02":

                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    oDOAHandler._sJump = "Y";    //PCT不用簽,主管與窗口為同一人向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump = "N";
                }
                break;

                #endregion
            case "2670-APP01":

                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                if (oDOAHandler._sHandler.Length == 0)
                {
                    GetHandlerErrAlarm(dtHead, string.Format("CostCenter:{0},Department:{1} 信息有誤,無法獲取簽核人", sCostCenter, sDepartment));
                }
                break;

                #endregion
            case "2670-FIN01":

                #region
                oDOAHandler._sHandler = GetDOAHandler(roleCode);
                break;

                #endregion
            case "2670-CUST01":

                #region
                switch (sAPTYP)
                {
                case "IS":
                    jumpFlag = false;
                    break;

                case "I1":
                    string returnFlag = drHead["RTNIF"].ToString();
                    if (returnFlag == "N")
                    {
                        jumpFlag = false;
                    }
                    else
                    {
                        jumpFlag = true;
                    }
                    break;

                default:
                    jumpFlag = true;
                    break;
                }
                if (jumpFlag)
                {
                    oDOAHandler._sJump = "Y";    //不用簽,向后跳關
                    try
                    {
                        oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                    }
                    catch (Exception ex)
                    {
                        DBIO.RecordTraceLog("E", ex.Message, oDOAHandler);
                        throw new Exception("Server or network is busy now,pls try again");
                    }
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            default:
                break;

            case "2670-DEPT01-T1":

                #region     //costcenter +dept

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, sCostCenter, sDepartment);
                }
                break;


                #endregion
            case "2670-DEPT02-T1":

                #region       //costcenter

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, sCostCenter);
                }

                break;
                #endregion

            case "2670-PMC01-T1":

                #region

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        if (buyerCode.Length > 0)
                        {
                            oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                        }
                        else
                        {
                            GetHandlerErrAlarm(dtHead, "物料BUYER CODE缺失,無法獲取簽核人");
                        }
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "PC");
                    }
                }
                break;

                #endregion
            case "2670-SQE01-T1":

            case "2670-IQE01-T1":

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandler(roleCode, buyerCode);
                }
                break;

            case "2670-QRA01-T1":

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "RH")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "RH");
                    }
                    else
                    {
                        Hashtable dtSLoc = new Hashtable();
                        dtSLoc.Add("0023", "0023");
                        if (dtSLoc.Contains(sLOCFrom) || dtSLoc.Contains(sLOCTo))
                        {
                            oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "A");
                        }
                        else if (sLOCFrom == "0024")
                        {
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "FT");
                        }
                        else
                        {
                            oDOAHandler._sHandler = GetDOAHandler_HIS(roleCode, "HL", "B");
                        }
                    }
                }
                break;

            case "2670-MC01-I3":
                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "HL")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "CZ1");     //半成品簽PC人員 CZ1 : Michael Liao 2019/03/06
                    }
                    else
                    {
                        buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                        oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                    }
                }
                break;

            case "2670-IQC01":
                switch (sAPTYP)
                {
                case "IA":
                    materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                    //看最後兩碼 FT =成品
                    //RH = 材料
                    //HL = 半品
                    //VP = 包材
                    if (materialType.Length == 4 && materialType.Substring(2, 2) == "FT")
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode, "FT");            //簽成品負責人
                    }
                    else
                    {
                        oDOAHandler._sHandler = GetDOAHandler(roleCode);            //簽其他負責人
                    }
                    break;

                case "IC":
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);            //簽其他負責人
                    break;
                }
                break;

            case "2670-MFG01-T1":
            case "2670-IQM02-T1":
            case "2670-PC01-T1":
            case "2670-PMC02-T1":
            case "2670-WH01-T1":
            case "2670-MC02-T1":
                #region

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    switch (sAPTYP)
                    {
                    case "IA":
                        materialType = dtDetail.Rows[0]["MTART"].ToString().Trim().ToUpper();
                        //看最後兩碼 FT =成品
                        //RH = 材料
                        //HL = 半品
                        //VP = 包材
                        if (materialType.Length == 4 && materialType.Substring(2, 2) == "FT")
                        {
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "FT");        //簽成品負責人
                        }
                        else
                        {
                            oDOAHandler._sHandler = GetDOAHandler(roleCode);        //簽其他負責人
                        }
                        break;

                    default:
                        if (sLOCFrom == "0010" && sLOCTo == "0013" && sAPTYP == "T1")         //原材料良品倉轉到原材料不良品倉 2670 簽核人變更  2018-12-24
                        {
                            oDOAHandler._sHandler = GetDOAHandler(roleCode, "UH");
                        }
                        else
                        {
                            oDOAHandler._sHandler = GetDOAHandler(roleCode);
                        }
                        break;
                    }
                }
                break;

                #endregion
            case "2670-MC01-T1":

                #region     //buyercode

                oDOAHandler._sJump = CheckJump(sLOCFrom, sLOCTo, roleCode, sAPTYP) == true ? "Y" : "N";
                if (oDOAHandler._sJump == "Y")
                {
                    oDOAHandler._sDOA = SPMAppLine.GetApproveXML(oDOAHandler._sDOA);
                }
                else
                {
                    buyerCode             = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper();
                    oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode);
                }

                break;

                #endregion

            case "2670-MD02":
                #region 根據金額簽核到廠長 大於等於2萬
                double TWD01 = GetAmount(dtDetail);    //匯率
                //double TWD01 = 100000;
                if (TWD01 >= 20000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2670-BUHEAD":
                #region 根據金額簽核到BUHEAD 大於等於20萬
                double TWD00 = GetAmount(dtDetail);    //匯率
                //double TWD00 = 100000;
                if (TWD00 >= 200000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2670-BGHEAD":
                #region 根据金额判断是否需要签核至BGUHEAD  大於等於50萬
                double TWD02 = GetAmount(dtDetail);    //匯率
                //double TWD02 = 250001;
                if (TWD02 >= 500000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2670-CEO":
                #region 根据金额判断是否需要签核至CEO   大於等於500萬
                double TWD03 = GetAmount(dtDetail);    //匯率
                //double TWD03 = 600000;
                if (TWD03 >= 5000000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;

                #endregion
            case "2670-CHAIRMAN":
                #region 根据金额判断是否需要签核至董事長 大於等於1000萬
                double TWD04 = GetAmount(dtDetail);    //匯率
                //double TWD04 = 100000000;
                if (TWD04 > 10000000)
                {
                    jumpFlag = false;
                }
                else
                {
                    jumpFlag = true;
                }

                if (jumpFlag)
                {
                    DOAJump();
                }
                else
                {
                    oDOAHandler._sJump    = "N";
                    oDOAHandler._sHandler = GetDOAHandler(roleCode);
                }
                break;
                #endregion
            }
            #endregion
        }