/// <summary> /// DOA簽核角色檢查 /// </summary> /// <param name="dtHead">單據表頭</param> /// <param name="dtDetail">單據DATA</param> protected void StepCheck(DataTable dtHead, DataTable dtDetail) { //獲取當前簽核角色 string curRole = SPMAppLine.GetCurrentApprover(oDOAHandler._sDOA); string roleCode = curRole.Replace("{", "").Replace("}", ""); oDOAHandler._sRoleCode = roleCode; //獲取當前簽核角色 DOA設定信息 Model_DOAOption DOAOption = GetDOAOption(roleCode); if (DOAOption._bExist) { //依DOA設定信息獲取 簽核人 oDOAHandler._sJump = DOAOption._sJumpOption; string buyerCode = string.Empty; string pdLine = string.Empty; switch (DOAOption._sCheckOption) { case "A": //BY固定簽核人 oDOAHandler._sHandler = GetDOAHandler(roleCode); break; case "B": //BY LINE找固定簽核人 pdLine = dtHead.Rows[0]["ZPLINE"].ToString().Trim().ToUpper(); if (pdLine.Length > 0) { oDOAHandler._sHandler = GetDOAHandler(roleCode, pdLine); } else { GetHandlerErrAlarm(dtHead, "線體信息為空,無法獲取簽核人"); } break; case "C": //HARD CODE GetDOABySpeicalRule(roleCode, dtHead, dtDetail); break; case "D": //by buyer code 找固定簽核人 buyerCode = dtDetail.Rows[0]["EKGRP"].ToString().Trim().ToUpper(); if (buyerCode.Length > 0) { oDOAHandler._sHandler = GetDOAHandlerByBuyerCode(buyerCode); } else { GetHandlerErrAlarm(dtHead, "物料BUYER CODE缺失,無法獲取簽核人"); } break; default: break; } } else { GetHandlerErrAlarm(dtHead, "Role信息缺失,無法獲取簽核人,請聯繫IT"); } }
/// <summary> /// 獲取設定 DOA OPTION /// </summary> /// <param name="roleCode"></param> /// <returns></returns> protected Model_DOAOption GetDOAOption(string roleCode) { Model_DOAOption DOAOption = new Model_DOAOption(); sql = "SELECT * FROM TB_GDS_DOA with(nolock) WHERE RoleCode = @RoleCode"; opc.Clear(); opc.Add(DataPara.CreateDataParameter("@RoleCode", SqlDbType.VarChar, roleCode)); DataTable dt = sdb.GetDataTable(sql, opc); DOAOption._sRoleCode = roleCode; if (dt.Rows.Count > 0) { DOAOption._bExist = true; DataRow dr = dt.Rows[0]; DOAOption._sJumpOption = dr["JumpOption"].ToString(); DOAOption._sCheckOption = dr["CheckOption"].ToString(); } return(DOAOption); }