Пример #1
0
    public static void PunchAppdOperation_UpdatePunchRemedyLog(Punch_Confirm_Remedy_Bean model, ref CommandHelper sb, bool isReset = false)
    {
        string UpdatePunchRemedyLog_ = "UpdatePunchRemedyLog_";

        if (isReset)
        {
            sb.Reset();
        }
        sb.AppendStatement(" Update PunchRemedyLog set ");

        //下一關審核主管
        sb.Append(" ValidDateTime=").AppendParameter(UpdatePunchRemedyLog_ + "ValidDateTime", model.ValidDateTime).Append(",");
        sb.Append(" ValidCompID=").AppendParameter(UpdatePunchRemedyLog_ + "ValidCompID", model.ValidCompID).Append(",");
        sb.Append(" ValidID=").AppendParameter(UpdatePunchRemedyLog_ + "ValidID", model.ValidID).Append(",");
        sb.Append(" ValidName=").AppendParameter(UpdatePunchRemedyLog_ + "ValidName", model.ValidName).Append(",");
        sb.Append(" PORemedyStatus=").AppendParameter(UpdatePunchRemedyLog_ + "PORemedyStatus", model.PORemedyStatus).Append(",");

        //LastChange
        sb.Append(" LastChgComp=").AppendParameter(UpdatePunchRemedyLog_ + "LastChgComp", model.LastChgComp).Append(",");
        sb.Append(" LastChgID=").AppendParameter(UpdatePunchRemedyLog_ + "LastChgID", model.LastChgID).Append(",");
        sb.Append(" LastChgDate=").AppendParameter(UpdatePunchRemedyLog_ + "LastChgDate", model.LastChgDate);
        //Where
        sb.Append(" where ");
        sb.Append(" CompID=").AppendParameter(UpdatePunchRemedyLog_ + "CompID", model.CompID);
        sb.Append(" and EmpID=").AppendParameter(UpdatePunchRemedyLog_ + "EmpID", model.EmpID);
        sb.Append(" and PunchDate=").AppendParameter(UpdatePunchRemedyLog_ + "PunchDate", model.PunchDate);
        sb.Append(" and PunchRemedySeq=").AppendParameter(UpdatePunchRemedyLog_ + "PunchRemedySeq", model.PunchRemedySeq);
    }
Пример #2
0
 public static bool PunchAppdOperation_EXEC_PunchCheckData(Punch_Confirm_Remedy_Bean model, out string ConfirmStatus, out string AbnormalType)
 {
     ConfirmStatus = "";
     AbnormalType  = "";
     try
     {
         DbHelper  db = new DbHelper(_attendantDBName);
         DbCommand dbcmd;
         dbcmd             = db.GetSqlStringCommand("PunchCheckData");
         dbcmd.CommandType = CommandType.StoredProcedure;
         dbcmd.Parameters.Add(new SqlParameter("@CompID", model.CompID));
         dbcmd.Parameters.Add(new SqlParameter("@EmpID", model.EmpID));
         dbcmd.Parameters.Add(new SqlParameter("@PunchDate", model.PunchDate));
         dbcmd.Parameters.Add(new SqlParameter("@PunchTime", model.PunchTime));
         dbcmd.Parameters.Add(new SqlParameter("@PunchType", model.ConfirmPunchFlag));
         dbcmd.Parameters.Add(new SqlParameter("@OtherPunchTime", model.PunchTime));
         dbcmd.Parameters.Add(new SqlParameter("@DutyTime", model.DutyTime));
         dbcmd.Parameters.Add(new SqlParameter("@RestBeginTime", model.RestBeginTime));
         dbcmd.Parameters.Add(new SqlParameter("@RestEndTime", model.RestEndTime));
         SqlParameter SqlConfirmStatus = new SqlParameter("@ConfirmStatus", SqlDbType.Char, 1, ParameterDirection.Output, false, 1, 0, "", DataRowVersion.Current, 0);
         dbcmd.Parameters.Add(SqlConfirmStatus);
         SqlParameter SqlAbnormalType = new SqlParameter("@AbnormalType", SqlDbType.Char, 1, ParameterDirection.Output, false, 1, 0, "", DataRowVersion.Current, 0);
         dbcmd.Parameters.Add(SqlAbnormalType);
         db.ExecuteNonQuery(dbcmd);
         ConfirmStatus = SqlConfirmStatus.Value.ToString();
         AbnormalType  = SqlAbnormalType.Value.ToString();
     }
     catch (Exception ex)
     {
         ConfirmStatus = "";
         AbnormalType  = "";
         return(false);
     }
     return(true);
 }
Пример #3
0
    public static Punch_Confirm_Remedy_Bean Punch_Confirm_Remedy_DicToBean(Dictionary <string, string> dic)
    {
        Punch_Confirm_Remedy_Bean Bean = new Punch_Confirm_Remedy_Bean();

        Bean.CompID                  = dic["CompID"];
        Bean.EmpID                   = dic["EmpID"];
        Bean.EmpName                 = dic["EmpName"];
        Bean.DutyDate                = dic["DutyDate"];
        Bean.DutyTime                = dic["DutyTime"];
        Bean.PunchDate               = dic["PunchDate"];
        Bean.PunchTime               = dic["PunchTime"];
        Bean.PunchConfirmSeq         = dic["PunchConfirmSeq"];
        Bean.DeptID                  = dic["DeptID"];
        Bean.DeptName                = dic["DeptName"];
        Bean.OrganID                 = dic["OrganID"];
        Bean.OrganName               = dic["OrganName"];
        Bean.FlowOrganID             = dic["FlowOrganID"];
        Bean.FlowOrganName           = dic["FlowOrganName"];
        Bean.Sex                     = dic["Sex"];
        Bean.ConfirmPunchFlag        = dic["ConfirmPunchFlag"];
        Bean.MAFT10_FLAG             = dic["MAFT10_FLAG"];
        Bean.PunchRemedySeq          = dic["PunchRemedySeq"];
        Bean.RemedyReasonID          = dic["RemedyReasonID"];
        Bean.RemedyReasonCN          = dic["RemedyReasonCN"];
        Bean.RemedyPunchTime         = dic["RemedyPunchTime"];
        Bean.AbnormalFlag            = dic["AbnormalFlag"];
        Bean.AbnormalReasonID        = dic["AbnormalReasonID"];
        Bean.AbnormalReasonCN        = dic["AbnormalReasonCN"];
        Bean.AbnormalDesc            = dic["AbnormalDesc"];
        Bean.Remedy_MAFT10_FLAG      = dic["Remedy_MAFT10_FLAG"];
        Bean.Remedy_AbnormalFlag     = dic["Remedy_AbnormalFlag"];
        Bean.Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"];
        Bean.Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"];
        Bean.Remedy_AbnormalDesc     = dic["Remedy_AbnormalDesc"];
        Bean.LastChgComp             = dic["LastChgComp"];
        Bean.LastChgID               = dic["LastChgID"];
        Bean.LastChgDate             = dic["LastChgDate"];
        //Remedy
        Bean.RemedyPunchFlag = dic["RemedyPunchFlag"];
        Bean.BatchFlag       = dic["BatchFlag"];
        Bean.PORemedyStatus  = dic["PORemedyStatus"];
        Bean.RejectReason    = dic["RejectReason"];
        Bean.RejectReasonCN  = dic["RejectReasonCN"];
        Bean.ValidDateTime   = dic["ValidDateTime"];
        //Bean.ValidTime = dic["ValidTime"];
        Bean.ValidCompID         = dic["ValidCompID"];
        Bean.ValidID             = dic["ValidID"];
        Bean.ValidName           = dic["ValidName"];
        Bean.FlowCaseID          = dic["FlowCaseID"];
        Bean.AbnormalReasonGCN   = dic["AbnormalReasonGCN"];
        Bean.ConfirmPunchFlagGCN = dic["ConfirmPunchFlagGCN"];
        Bean.ConfirmStatusGCN    = dic["ConfirmStatusGCN"];
        Bean.SourceGCN           = dic["SourceGCN"];
        return(Bean);
    }
Пример #4
0
 private void subGetData()
 {
     if (Session["Punch_Confirm_Remedy_Bean"] == null)
     {
         //Response.Redirect("PunchUpdateInquire.aspx");
     }
     else
     {
         Dictionary <string, string> dic = (Dictionary <string, string>)Session["Punch_Confirm_Remedy_Bean"];
         ViewState["Punch_Confirm_Remedy_Bean"] = Session["Punch_Confirm_Remedy_Bean"];
         Quire_to_Modify = PunchUpdate.Punch_Confirm_Remedy_DicToBean(dic);
         DoClear();
         //Session["Quire_to_Modify"] = null;
     }
 }
Пример #5
0
    public static void Select_Punch_Confirm_Remedy_OpenLog(Punch_Confirm_Remedy_Bean Bean, ref StringBuilder sb, bool isReset = false)
    {
        if (isReset)
        {
            sb.Clear();
        }

        sb.AppendLine(" SELECT ");
        //PunchConfirm
        sb.AppendLine(" PC.CompID ,PC.EmpID ,PC.EmpName ,CONVERT(VARCHAR, PC.DutyDate,111) as DutyDate ,PC.DutyTime ,CONVERT(VARCHAR, PC.PunchDate,111) as PunchDate ,CONVERT(CHAR(5),PC.PunchTime) as PunchTime ,PC.PunchConfirmSeq ,PC.DeptID ,PC.DeptName ,PC.OrganID ,PC.OrganName ,PC.FlowOrganID ,PC.FlowOrganName ,");

        sb.AppendLine(" PC.PunchFlag ,PC.WorkTypeID ,PC.WorkType ,PC.MAFT10_FLAG ,");
        sb.AppendLine(" PC.AbnormalType ,");
        sb.AppendLine(" PC.AbnormalReasonCN ,");
        sb.AppendLine(" PC.PunchSeq ,PC.PunchRemedySeq ,PR.RemedyReasonID ,PR.RemedyReasonCN ,CONVERT(CHAR(5),PR.RemedyPunchTime) as RemedyPunchTime,PC.AbnormalFlag ,PC.AbnormalReasonID ,");
        sb.AppendLine(" PC.AbnormalDesc ,PR.Remedy_AbnormalFlag ,PR.Remedy_AbnormalReasonID ,PR.Remedy_AbnormalReasonCN ,PR.Remedy_AbnormalDesc ,");
        sb.AppendLine(" PC.APPContent ,PC.LastChgComp ,PC.LastChgID ,PC.LastChgDate ,");

        //性別-gridview用
        sb.AppendLine(" PC.Sex , case PC.Sex  when '1' then '男' when '2' then '女' else '不明' end as SexGCN ,");
        //狀態-gridview用
        sb.AppendLine(" PC.ConfirmStatus ,case PC.ConfirmStatus when'0' then '正常' when'1'then ('異常'+AbnormalType) when '2' then '送簽中' when '3' then '異常不控管' else '資料錯誤' end as ConfirmStatusGCN ,");
        //類型-gridview用
        sb.AppendLine(" PC.ConfirmPunchFlag ,case PC.ConfirmPunchFlag when '1' then '上班' when '2' then '下班' when '3' then '午休開始' when '4' then '午休結束'  end as ConfirmPunchFlagGCN,");
        //原因-gridview用
        sb.AppendLine(" case PC.AbnormalFlag when '0' then '無異常' when '1' then '公務' when '2' then '非公務-'+PC.AbnormalReasonCN else '資料錯誤' end as AbnormalReasonGCN ,");
        //來源-gridview用
        sb.AppendLine(" PC.Source ,case PC.Source when 'A' then 'APP' when 'B' then '永豐雲' else '資料錯誤' end as SourceGCN ,");
        //特殊人員註記,午休開始時間,午休結束時間-gridview用
        sb.AppendLine(" isnull(SpecialFlag,'0') as SpecialFlag , ISNULL(WT.RestBeginTime,'') as RestBeginTime , ISNULL(WT.RestEndTime,'') as RestEndTime ,");

        //PunchRemedyLog 因為是Join過來的,所以可能會有Null,要加上isnull
        sb.AppendLine(" isnull(PR.FlowCaseID,'') as FlowCaseID, isnull(PR.RemedyPunchFlag,'') as RemedyPunchFlag, isnull(PR.BatchFlag ,'') as BatchFlag, isnull(PR.PORemedyStatus ,'') as PORemedyStatus , isnull(PR.RejectReason ,'') as RejectReason , isnull(PR.RejectReasonCN ,'') as RejectReasonCN , isnull(PR.ValidDateTime,'') as ValidDateTime , isnull(PR.ValidCompID ,'') as ValidCompID , isnull(PR.ValidID ,'') as ValidID , isnull(PR.ValidName  ,'') as ValidName , isnull(PR.Remedy_MAFT10_FLAG,'') as Remedy_MAFT10_FLAG ");

        sb.AppendLine(" FROM PunchConfirm PC ");
        sb.AppendLine(" left join PunchRemedyLog PR ");
        sb.AppendLine(" on PC.CompID=PR.CompID and PC.EmpID=PR.EmpID and PC.DutyDate=PR.DutyDate and PC.PunchConfirmSeq=PR.PunchConfirmSeq and PC.PunchRemedySeq=PR.PunchRemedySeq ");
        sb.AppendLine(" left join dbo.PunchUpdate_ITRDFlowOpenLog OL ");
        sb.AppendLine(" on OL.FlowCaseID=PR.FlowCaseID ");
        sb.AppendLine(" left join dbo.PunchSpecialUnitDefine PS  ");
        sb.AppendLine(" on PS.CompID=PC.CompID and PS.OrganID=PC.OrganID and PS.DeptID=PC.DeptID and PS.SpecialFlag='1' ");
        sb.AppendLine(" left join dbo.EmpWorkTime EWT  ");
        sb.AppendLine(" on EWT.CompID=PC.CompID and EWT.EmpID=PC.EmpID ");
        sb.AppendLine(" left join eHRMSDB_ITRD.dbo.WorkTime WT  ");
        sb.AppendLine(" on EWT.WTCompID=WT.CompID and EWT.WTID=WT.WTID ");
        sb.AppendLine(" Where PC.ConfirmStatus in ('2') ");
        sb.AppendLine(" and OL.AssignTo=").AppendFormat("@ValidID", Bean.ValidID);
    }
Пример #6
0
    public static Dictionary <string, string> Punch_Confirm_Remedy_BeanToDic(Punch_Confirm_Remedy_Bean Bean)
    {
        Dictionary <string, string> dic = new Dictionary <string, string>();

        dic.Add("CompID", Bean.CompID);
        dic.Add("EmpID", Bean.EmpID);
        dic.Add("EmpName", Bean.EmpName);
        dic.Add("DutyDate", Bean.DutyDate);
        dic.Add("DutyTime", Bean.DutyTime);
        dic.Add("PunchDate", Bean.PunchDate);
        dic.Add("PunchTime", Bean.PunchTime);
        dic.Add("DeptID", Bean.DeptID);
        dic.Add("DeptName", Bean.DeptName);
        dic.Add("OrganID", Bean.OrganID);
        dic.Add("OrganName", Bean.OrganName);
        dic.Add("FlowOrganID", Bean.FlowOrganID);
        dic.Add("FlowOrganName", Bean.FlowOrganName);
        dic.Add("MAFT10_FLAG", Bean.MAFT10_FLAG);
        dic.Add("PunchRemedySeq", Bean.PunchRemedySeq);
        dic.Add("RemedyReasonID", Bean.RemedyReasonID);
        dic.Add("RemedyReasonCN", Bean.RemedyReasonCN);
        dic.Add("RemedyPunchTime", Bean.RemedyPunchTime);
        dic.Add("AbnormalFlag", Bean.AbnormalFlag);
        dic.Add("AbnormalReasonID", Bean.AbnormalReasonID);
        dic.Add("AbnormalReasonCN", Bean.AbnormalReasonCN);
        dic.Add("AbnormalDesc", Bean.AbnormalDesc);
        dic.Add("Remedy_AbnormalFlag", Bean.Remedy_AbnormalFlag);
        dic.Add("Remedy_AbnormalReasonID", Bean.Remedy_AbnormalReasonID);
        dic.Add("Remedy_AbnormalReasonCN", Bean.Remedy_AbnormalReasonCN);
        dic.Add("Remedy_AbnormalDesc", Bean.Remedy_AbnormalDesc);
        dic.Add("LastChgComp", Bean.LastChgComp);
        dic.Add("LastChgID", Bean.LastChgID);
        dic.Add("LastChgDate", Bean.LastChgDate);
        //Remedy
        dic.Add("RemedyPunchFlag", Bean.RemedyPunchFlag);
        dic.Add("BatchFlag", Bean.BatchFlag);
        dic.Add("PORemedyStatus", Bean.PORemedyStatus);
        dic.Add("RejectReason", Bean.RejectReason);
        dic.Add("RejectReasonCN", Bean.RejectReasonCN);
        dic.Add("ValidDateTime", Bean.ValidDateTime);
        //dic.Add("ValidTime", Bean.ValidTime);
        dic.Add("ValidCompID", Bean.ValidCompID);
        dic.Add("ValidID", Bean.ValidID);
        dic.Add("ValidName", Bean.ValidName);
        dic.Add("FlowCaseID", Bean.FlowCaseID);
        return(dic);
    }
Пример #7
0
    /// <summary>
    /// 取得DB資料
    /// 個人班表
    /// </summary>
    /// <param name="model">畫面model</param>
    /// <param name="datas">回傳資料</param>
    /// <param name="msg">回傳訊息</param>
    /// <returns>bool</returns>
    public static bool PunchUpdateInquire_DoQuery(Punch_Confirm_Remedy_Model model, out List <Punch_Confirm_Remedy_Bean> datas, out string msg)
    {
        bool result = false;

        msg   = "";
        datas = new List <Punch_Confirm_Remedy_Bean>();
        try
        {
            using (var conn = new SqlConnection()
            {
                ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString
            })
            {
                Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
                {
                    EmpID            = model.EmpID,
                    ConfirmStatus    = model.ConfirmStatus,
                    AbnormalFlag     = model.AbnormalFlag,
                    RemedyPunchFlag  = model.RemedyPunchFlag,
                    ConfirmPunchFlag = model.ConfirmPunchFlag,
                    StartPunchDate   = model.StartPunchDate,
                    EndPunchDate     = model.EndPunchDate
                };
                StringBuilder sb = new StringBuilder();
                SqlCommand.Select_Punch_Confirm_Remedy(dataBean, ref sb, true);
                try
                {
                    datas = conn.Query <Punch_Confirm_Remedy_Bean>(sb.ToString(), dataBean).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                if (datas == null)
                {
                    throw new Exception("查無資料!");
                }
            }
            result = true;
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }
Пример #8
0
    /// <summary>
    /// 取得DB資料
    /// 個人班表
    /// </summary>
    /// <param name="model">畫面model</param>
    /// <param name="datas">回傳資料</param>
    /// <param name="msg">回傳訊息</param>
    /// <returns>bool</returns>
    public static bool PunchAppdOperation_DoQuery(Punch_Confirm_Remedy_Model model, out List <Punch_Confirm_Remedy_Bean> datas, out string msg)
    {
        bool result = false;

        msg   = "";
        datas = new List <Punch_Confirm_Remedy_Bean>();
        try
        {
            using (var conn = new SqlConnection()
            {
                ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString
            })
            {
                Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
                {
                    ValidCompID   = model.ValidCompID,
                    ValidID       = model.ValidID,
                    ConfirmStatus = model.ConfirmStatus
                };
                StringBuilder sb = new StringBuilder();
                SqlCommand.Select_Punch_Confirm_Remedy_OpenLog(dataBean, ref sb, true);
                try
                {
                    datas = conn.Query <Punch_Confirm_Remedy_Bean>(sb.ToString(), dataBean).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
                if (datas == null)
                {
                    throw new Exception("查無資料!");
                }
            }
            result = true;
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }
Пример #9
0
    /// <summary>
    /// 取得簽核人員資料
    /// </summary>
    /// <param name="model">畫面model</param>
    /// <param name="datas">回傳資料</param>
    /// <param name="msg">回傳訊息</param>
    /// <returns>bool</returns>
    public static bool GetValidInfo(Punch_Confirm_Remedy_Model model, out Punch_Confirm_Remedy_Bean datas, out string msg)
    {
        bool result = false;

        msg   = "";
        datas = new Punch_Confirm_Remedy_Bean();
        try
        {
            using (var conn = new SqlConnection()
            {
                ConnectionString = DbHelper.getConnectionStrings(_attendantDBName).ConnectionString
            })
            {
                Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
                {
                    CompID = model.CompID,
                    EmpID  = model.EmpID,
                };
                StringBuilder sb = new StringBuilder();
                SqlCommand.SelectPersonValid(ref sb);
                try
                {
                    datas = conn.Query <Punch_Confirm_Remedy_Bean>(sb.ToString(), dataBean).FirstOrDefault();
                }
                catch (Exception)
                {
                    throw;
                }
                if (datas == null)
                {
                    throw new Exception("查無資料!");
                }
            }
            result = true;
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }
Пример #10
0
    public static void PunchAppdOperation_UpdatePunchConfirm_New(Punch_Confirm_Remedy_Bean model, ref CommandHelper sb, bool isReset = false)
    {
        string UpdatePunchConfirm_ = "UpdatePunchConfirm_";

        if (isReset)
        {
            sb.Reset();
        }
        if (model.ConfirmStatus == "3" || model.ConfirmStatus == "4")
        {
            sb.AppendStatement(" update PunchConfirm SET ");
            //狀態
            sb.Append(" ConfirmStatus=").AppendParameter(UpdatePunchConfirm_ + "ConfirmStatus", model.ConfirmStatus).Append(",");
            //Remedy(無修改前欄位,此為原生欄位)
            if (model.ConfirmStatus == "3")
            {
                sb.Append(" RemedyReasonID=").AppendParameter(UpdatePunchConfirm_ + "RemedyReasonID", model.RemedyReasonID).Append(",");
                sb.Append(" RemedyReasonCN=").AppendParameter(UpdatePunchConfirm_ + "RemedyReasonCN", model.RemedyReasonCN).Append(",");
                //Remedy(有修改前的相對應欄位)
                sb.Append(" RemedyPunchTime=").AppendParameter(UpdatePunchConfirm_ + "RemedyPunchTime", model.RemedyPunchTime).Append(",");
                sb.Append(" Remedy_MAFT10_FLAG=").AppendParameter(UpdatePunchConfirm_ + "Remedy_MAFT10_FLAG", model.Remedy_MAFT10_FLAG).Append(",");
                sb.Append(" Remedy_AbnormalFlag=").AppendParameter(UpdatePunchConfirm_ + "Remedy_AbnormalFlag", model.Remedy_AbnormalFlag).Append(",");
                sb.Append(" Remedy_AbnormalReasonID=").AppendParameter(UpdatePunchConfirm_ + "Remedy_AbnormalReasonID", model.Remedy_AbnormalReasonID).Append(",");
                sb.Append(" Remedy_AbnormalReasonCN=").AppendParameter(UpdatePunchConfirm_ + "Remedy_AbnormalReasonCN", model.Remedy_AbnormalReasonCN).Append(",");
                sb.Append(" Remedy_AbnormalDesc=").AppendParameter(UpdatePunchConfirm_ + "Remedy_AbnormalDesc", model.Remedy_AbnormalDesc).Append(",");
            }
            //LastChange
            sb.Append(" LastChgComp=").AppendParameter(UpdatePunchConfirm_ + "LastChgComp", model.LastChgComp).Append(",");
            sb.Append(" LastChgID=").AppendParameter(UpdatePunchConfirm_ + "LastChgID", model.LastChgID).Append(",");
            sb.Append(" LastChgDate=").AppendParameter(UpdatePunchConfirm_ + "LastChgDate", model.LastChgDate);
            //Where
            sb.Append(" where ");
            sb.Append(" CompID=").AppendParameter(UpdatePunchConfirm_ + "CompID", model.CompID);
            sb.Append(" and EmpID=").AppendParameter(UpdatePunchConfirm_ + "EmpID", model.EmpID);
            sb.Append(" and DutyDate=").AppendParameter(UpdatePunchConfirm_ + "DutyDate", model.DutyDate);
            sb.Append(" and PunchConfirmSeq=").AppendParameter(UpdatePunchConfirm_ + "PunchConfirmSeq", model.PunchConfirmSeq);
        }
    }
    protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow clickedRow = ((ImageButton)e.CommandSource).NamingContainer as GridViewRow;

        switch (e.CommandName)
        {
        case "Detail":
            string flowCode = "", flowSN = "", msg = "", btnName = "";
            Dictionary <string, string> dic = new Dictionary <string, string>();
            Dictionary <string, string> toUserData;
            PunchUpdate.GridViewToDictionary(gvMain, out dic, clickedRow.RowIndex, strDataKeyNames);
            FlowExpress oFlow = new FlowExpress(FlowCustDB, dic["FlowCaseID"], false);
            Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean()
            {
                //跟共用條件
                CompID      = dic["CompID"],
                EmpID       = dic["EmpID"],
                EmpName     = dic["EmpName"],
                LastChgComp = UserInfo.getUserInfo().CompID.Trim(),
                LastChgID   = UserInfo.getUserInfo().UserID.Trim(),
                LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),

                //預存所需資料
                PunchTime        = dic["PunchTime"],
                ConfirmPunchFlag = dic["ConfirmPunchFlag"],
                DutyTime         = dic["DutyTime"],
                RestBeginTime    = dic["RestBeginTime"],
                RestEndTime      = dic["RestEndTime"],
                //Remedy所需資料
                PunchDate      = dic["PunchDate"],
                PunchRemedySeq = dic["PunchRemedySeq"],
                FlowCaseID     = dic["FlowCaseID"],
                ValidDateTime  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                ValidCompID    = UserInfo.getUserInfo().CompID.Trim(),
                ValidID        = UserInfo.getUserInfo().UserID.Trim(),
                ValidName      = UserInfo.getUserInfo().UserName.Trim(),

                //Confirm所需資料
                DutyDate                = dic["DutyDate"],
                PunchConfirmSeq         = dic["PunchConfirmSeq"],
                RemedyReasonID          = dic["RemedyReasonID"],
                RemedyReasonCN          = dic["RemedyReasonCN"],
                RemedyPunchTime         = dic["RemedyPunchTime"],
                Remedy_MAFT10_FLAG      = dic["Remedy_MAFT10_FLAG"],
                Remedy_AbnormalFlag     = dic["Remedy_AbnormalFlag"],
                Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"],
                Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"],
                Remedy_AbnormalDesc     = dic["Remedy_AbnormalDesc"]
            };
            //按鈕清單
            ClearBtn(model.FlowCaseID);

            //下一關邏輯判斷,產生審核按鈕資訊,給出Ken流程相關資訊
            if (!nextFlowBtn(model, out flowCode, out flowSN, ref btnName, out toUserData, out msg))       //判斷審核按鈕
            {
                Util.MsgBox(msg);
                return;
            }
            CustVerify.setFlowSignID_CompID(toUserData["SignID"].ToString() + "," + toUserData["SignIDComp"].ToString());
            //傳給審核畫面-單筆審核使用
            Session["PunchAppdOperation_toUserData"] = toUserData;
            Session["PunchAppdOperation_GridView"]   = dic;
            //產生審核按鈕
            FlowExpress.getFlowTodoList(FlowExpress.TodoListAssignKind.All, model.ValidID.Trim(), FlowCustDB.Split(','), "".Split(','), false, "", "");
            //跳轉畫面
            Response.Redirect(string.Format(FlowExpress._FlowPageVerifyURL + "?FlowID={0}&FlowLogID={1}&ProxyType={2}&IsShowBtnComplete={3}&IsShowCheckBoxList={4}&ChkMaxKeyLen={5}", oFlow.FlowID, oFlow.FlowCurrLastLogID, "Self", "N", "N", ""));
            break;
        }
    }
Пример #12
0
    private bool SaveData()
    {
        Dictionary <string, string> dic = (Dictionary <string, string>)ViewState["Punch_Confirm_Remedy_Bean"];

        Quire_to_Modify = PunchUpdate.Punch_Confirm_Remedy_DicToBean(dic);
        int    Seq          = 0;
        bool   result       = false;
        long   seccessCount = 0;
        string msg          = ""; //因為Exception用ShowMsg會不能顯示,所以取得msg後不使用(這就是沒用的變數)
        int    PunchTimeHH  = 0;

        if (!int.TryParse(ucRemedyPunchTime.ucDefaultSelectedHH, out PunchTimeHH))
        {
            PunchTimeHH = 0;
        }

        Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean()
        {
            //跟Confirm一樣的內容,不修改
            FlowCaseID       = "",
            CompID           = Quire_to_Modify.CompID.Trim(),
            EmpID            = Quire_to_Modify.EmpID.Trim(),
            EmpName          = Quire_to_Modify.EmpName.Trim(),
            DutyDate         = Quire_to_Modify.DutyDate.Trim(),
            DutyTime         = Quire_to_Modify.DutyTime.Replace(":", "").Trim(),
            PunchDate        = Quire_to_Modify.PunchDate.Trim(),
            PunchTime        = Quire_to_Modify.PunchTime.Trim(),
            PunchConfirmSeq  = Quire_to_Modify.PunchConfirmSeq.Trim(),
            DeptID           = Quire_to_Modify.DeptID.Trim(),
            DeptName         = Quire_to_Modify.DeptName.Trim(),
            OrganID          = Quire_to_Modify.OrganID.Trim(),
            OrganName        = Quire_to_Modify.OrganName.Trim(),
            FlowOrganID      = Quire_to_Modify.FlowOrganID.Trim(),
            FlowOrganName    = Quire_to_Modify.FlowOrganName.Trim(),
            MAFT10_FLAG      = Quire_to_Modify.MAFT10_FLAG.Trim(),
            AbnormalFlag     = Quire_to_Modify.AbnormalFlag.Trim(),
            AbnormalReasonID = Quire_to_Modify.AbnormalReasonID.Trim(),
            AbnormalReasonCN = Quire_to_Modify.AbnormalReasonCN.Trim(),
            AbnormalDesc     = Quire_to_Modify.AbnormalDesc.Trim(),

            //Remedy修改項目
            PunchRemedySeq = (int.TryParse(Quire_to_Modify.PunchRemedySeq, out Seq) ? Seq + 1 : 1).ToString().Trim(),

            RemedyReasonID  = ddlRemedyReasonID.SelectedValue.Trim(),
            RemedyReasonCN  = ddlRemedyReasonID.SelectedValue.Trim() == "" ? "" : ddlRemedyReasonID.SelectedItem.Text.Trim(),
            RemedyPunchTime = ucRemedyPunchTime.ucSelectedTime.Trim(),

            Remedy_MAFT10_FLAG      = (Quire_to_Modify.Sex.Trim() == "2" && (PunchTimeHH >= 22)) ? "1" : "0",
            Remedy_AbnormalFlag     = rdoRemedy_AbnormalFlag1.Checked ? "1" : "2", //待John檢核公用
            Remedy_AbnormalReasonID = ddlRemedy_AbnormalReasonID.SelectedValue.Trim(),
            Remedy_AbnormalReasonCN = ddlRemedy_AbnormalReasonID.SelectedValue.Trim() == "" ? "" : ddlRemedy_AbnormalReasonID.SelectedItem.Text.Trim(),
            Remedy_AbnormalDesc     = txtRemedy_AbnormalDesc.Text.Trim(),

            LastChgComp = UserInfo.getUserInfo().CompID.Trim(),
            LastChgID   = UserInfo.getUserInfo().UserID.Trim(),
            LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),

            //Remedy特有
            RemedyPunchFlag = Quire_to_Modify.ConfirmPunchFlag.Trim(), //補登檔RemedyPunchFlag=確認檔ConfirmPunchFlag=紀錄檔PunchFlag
            BatchFlag       = Quire_to_Modify.BatchFlag.Trim(),        //批次更新確認檔處理註記,0:未處理,1:已處理。(保留暫定)
            PORemedyStatus  = "2",
            RejectReason    = "",
            RejectReasonCN  = "",
            ValidDateTime   = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
            //ValidTime = "",
            ValidCompID = UserInfo.getUserInfo().CompID.Trim(),
            ValidID     = UserInfo.getUserInfo().UserID.Trim(),
            ValidName   = UserInfo.getUserInfo().UserName.Trim()
        };

        result = PunchUpdate.PunchUpdateModify_SaveData(model, out seccessCount, out msg);
        if (!result)
        {
            msg = "送簽失敗!!-" + msg;
            return(false);
        }
        if (seccessCount == 0)
        {
            msg = "送簽失敗!!";
            return(false);
        }
        msg = "送簽成功!!";
        return(true);
    }
Пример #13
0
    private void DoSubmit()
    {
        if (Session["FlowVerifyInfo"] != null)
        {
            Dictionary <string, string> oVerifyInfo = (Dictionary <string, string>)Session["FlowVerifyInfo"];
            Dictionary <string, string> dic         = (Dictionary <string, string>)Session["PunchAppdOperation_GridView"];
            Dictionary <string, string> toUserData  = (Dictionary <string, string>)Session["PunchAppdOperation_toUserData"];
            Util.setJSContent(oVerifyInfo["FlowVerifyJS"]);
            Session["FlowVerifyInfo"] = null;
            Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean()
            {
                //跟共用條件
                CompID      = dic["CompID"],
                EmpID       = dic["EmpID"],
                EmpName     = dic["EmpName"],
                LastChgComp = UserInfo.getUserInfo().CompID.Trim(),
                LastChgID   = UserInfo.getUserInfo().UserID.Trim(),
                LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),

                //預存所需資料
                PunchTime        = dic["PunchTime"],
                ConfirmPunchFlag = dic["ConfirmPunchFlag"],
                DutyTime         = dic["DutyTime"],
                RestBeginTime    = dic["RestBeginTime"],
                RestEndTime      = dic["RestEndTime"],

                //Remedy所需資料
                PunchDate      = dic["PunchDate"],
                PunchRemedySeq = dic["PunchRemedySeq"],
                FlowCaseID     = dic["FlowCaseID"],
                ValidDateTime  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                ValidCompID    = UserInfo.getUserInfo().CompID.Trim(),
                ValidID        = UserInfo.getUserInfo().UserID.Trim(),
                ValidName      = UserInfo.getUserInfo().UserName.Trim(),

                //Confirm所需資料
                DutyDate                = dic["DutyDate"],
                PunchConfirmSeq         = dic["PunchConfirmSeq"],
                RemedyReasonID          = dic["RemedyReasonID"],
                RemedyReasonCN          = dic["RemedyReasonCN"],
                RemedyPunchTime         = dic["RemedyPunchTime"],
                Remedy_MAFT10_FLAG      = dic["Remedy_MAFT10_FLAG"],
                Remedy_AbnormalFlag     = dic["Remedy_AbnormalFlag"],
                Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"],
                Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"],
                Remedy_AbnormalDesc     = dic["Remedy_AbnormalDesc"]
            };

            switch (oVerifyInfo["FlowStepBtnID"].ToString())
            {
            //PORemedyStatus。0:未處理,1:未送簽,2:送簽中,3:核准,4:駁回
            //ConfirmStatus。0:正常,1:異常,2:送簽中,3:異常不控管
            case "btnClose":
                model.PORemedyStatus = "3";
                string strConfirmStatus = "", strAbnormalType = "";
                if (!PunchUpdate.PunchAppdOperation_EXEC_PunchCheckData(model, out strConfirmStatus, out strAbnormalType))
                {
                    Util.MsgBox("打卡異常檢核失敗!!");
                    return;
                }
                model.ConfirmStatus = strConfirmStatus;     //0 or 1記得用John的TSQL
                model.AbnormalType  = strAbnormalType;
                break;

            case "btnApprove":
            case "btnReApprove":
                model.PORemedyStatus = "2";
                model.ConfirmStatus  = "2";
                break;

            case "btnReject":
                model.PORemedyStatus = "4";
                model.ConfirmStatus  = "1";
                break;
            }
            Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]);
            DataTable LastHROtherFlowLog        = PunchUpdate.HROtherFlowLog(model.FlowCaseID, true);
            long      seccessCount = 0;
            string    msg          = "";
            bool      result       = false;
            result = PunchUpdate.PunchAppdOperation_SaveData(model, oAssDic, oVerifyInfo["FlowStepBtnID"].ToString(), oVerifyInfo["FlowStepOpinion"].ToString().Replace("'", "''"), out seccessCount, out msg, LastHROtherFlowLog.Rows[0]["FlowCode"].ToString(), LastHROtherFlowLog.Rows[0]["FlowSN"].ToString(), LastHROtherFlowLog.Rows[0]["FlowSeq"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogBatNo"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogID"].ToString(), toUserData);

            if (result)
            {
                labMsg.Text = Util.getHtmlMessage(Util.HtmlMessageKind.Succeed, "審核成功!");
            }
            else
            {
                labMsg.Text       = Util.getHtmlMessage(Util.HtmlMessageKind.Error, "審核失敗");
                txtErrMsg.Text    = msg;
                txtErrMsg.Visible = true;
            }
        }
    }
Пример #14
0
 /// <summary>
 /// InesrtPunchRemedyLogSend
 /// 申請 > 送簽
 /// </summary>
 /// <param name="sb">傳入之前組好Command</param>
 /// <param name="isReset">StringBuilder Reset or not</param>
 public static void PunchUpdateModify_InsertPunchRemedyLog(Punch_Confirm_Remedy_Bean model, ref CommandHelper sb, bool isReset = false)
 {
     if (isReset)
     {
         sb.Reset();
     }
     sb.Append(" INSERT INTO PunchRemedyLog ( ");
     sb.Append(" CompID , EmpID , EmpName , PunchDate , PunchTime , PunchRemedySeq , FlowCaseID , DeptID , DeptName , OrganID , OrganName , PunchConfirmSeq , RemedyPunchFlag , DutyDate , DutyTime , MAFT10_FLAG , AbnormalFlag , AbnormalReasonID , AbnormalReasonCN , AbnormalDesc , BatchFlag , PORemedyStatus , RejectReason , RejectReasonCN , ValidDateTime , ValidCompID , ValidID , ValidName , RemedyReasonID , RemedyReasonCN , RemedyPunchTime , Remedy_MAFT10_FLAG , Remedy_AbnormalFlag , Remedy_AbnormalReasonID , Remedy_AbnormalReasonCN , Remedy_AbnormalDesc , LastChgComp , LastChgID , LastChgDate");//3
     //sb.Append(" CompID , EmpID , EmpName , PunchDate , PunchTime , PunchRemedySeq , FlowCaseID , DeptID , DeptName , OrganID , OrganName , PunchConfirmSeq , RemedyPunchFlag , DutyDate , DutyTime , MAFT10_FLAG , AbnormalFlag , AbnormalReasonID , AbnormalReasonCN , AbnormalDesc , BatchFlag , PORemedyStatus , RejectReason , RejectReasonCN , ValidDateTime , ValidTime , ValidCompID , ValidID , ValidName , RemedyReasonID , RemedyReasonCN , RemedyPunchTime , Remedy_MAFT10_FLAG , Remedy_AbnormalFlag , Remedy_AbnormalReasonID , Remedy_AbnormalReasonCN , Remedy_AbnormalDesc , LastChgComp , LastChgID , LastChgDate");//3
     sb.Append(" ) VALUES ( ");
     sb.Append("'" + model.CompID + "'").Append(",");
     sb.Append("'" + model.EmpID + "'").Append(",");
     sb.Append("'" + model.EmpName + "'").Append(",");
     sb.Append("'" + model.PunchDate + "'").Append(",");
     sb.Append("'" + model.PunchTime + "'").Append(",");
     sb.Append("'" + model.PunchRemedySeq + "'").Append(",");
     sb.Append("'" + model.FlowCaseID + "'").Append(",");
     sb.Append("'" + model.DeptID + "'").Append(",");
     sb.Append("'" + model.DeptName + "'").Append(",");
     sb.Append("'" + model.OrganID + "'").Append(",");
     sb.Append("'" + model.OrganName + "'").Append(",");
     sb.Append("'" + model.PunchConfirmSeq + "'").Append(",");
     sb.Append("'" + model.RemedyPunchFlag + "'").Append(","); //SET RemedyPunchFlag=實際是ConfirmPunchFlag的值
     sb.Append("'" + model.DutyDate + "'").Append(",");
     sb.Append("'" + model.DutyTime + "'").Append(",");
     sb.Append("'" + model.MAFT10_FLAG + "'").Append(",");
     sb.Append("'" + model.AbnormalFlag + "'").Append(",");
     sb.Append("'" + model.AbnormalReasonID + "'").Append(",");
     sb.Append("'" + model.AbnormalReasonCN + "'").Append(",");
     sb.Append("'" + model.AbnormalDesc + "'").Append(",");
     sb.Append("'" + model.BatchFlag + "'").Append(",");
     sb.Append("'" + model.PORemedyStatus + "'").Append(",");
     sb.Append("'" + model.RejectReason + "'").Append(",");
     sb.Append("'" + model.RejectReasonCN + "'").Append(",");
     sb.Append("'" + model.ValidDateTime + "'").Append(",");
     //sb.Append("'"+ model.ValidTime+"'").Append(",");
     sb.Append("'" + model.ValidCompID + "'").Append(",");
     sb.Append("'" + model.ValidID + "'").Append(",");
     sb.Append("'" + model.ValidName + "'").Append(",");
     sb.Append("'" + model.RemedyReasonID + "'").Append(",");
     sb.Append("'" + model.RemedyReasonCN + "'").Append(",");
     sb.Append("'" + model.RemedyPunchTime + "'").Append(",");
     sb.Append("'" + model.Remedy_MAFT10_FLAG + "'").Append(",");
     sb.Append("'" + model.Remedy_AbnormalFlag + "'").Append(",");
     sb.Append("'" + model.Remedy_AbnormalReasonID + "'").Append(",");
     sb.Append("'" + model.Remedy_AbnormalReasonCN + "'").Append(",");
     sb.Append("'" + model.Remedy_AbnormalDesc + "'").Append(",");
     sb.Append("'" + model.LastChgComp + "'").Append(",");
     sb.Append("'" + model.LastChgID + "'").Append(",");
     sb.Append("'" + model.LastChgDate + "'");
     sb.Append(" ); ");
     sb.AppendStatement(" update PunchConfirm SET ");
     sb.Append(" ConfirmStatus='2'").Append(",");
     sb.Append(" PunchRemedySeq=").AppendParameter("PunchRemedySeq", model.PunchRemedySeq).Append(",");
     sb.Append(" LastChgComp=").AppendParameter("LastChgComp", model.LastChgComp).Append(",");
     sb.Append(" LastChgID=").AppendParameter("LastChgID", model.LastChgID).Append(",");
     sb.Append(" LastChgDate=").AppendParameter("LastChgDate", model.LastChgDate);
     sb.Append(" where ");
     sb.Append(" CompID=").AppendParameter("CompID", model.CompID);
     sb.Append(" and EmpID=").AppendParameter("EmpID", model.EmpID);
     sb.Append(" and DutyDate=").AppendParameter("DutyDate", model.DutyDate);
     sb.Append(" and PunchConfirmSeq=").AppendParameter("PunchConfirmSeq", model.PunchConfirmSeq);
 }
Пример #15
0
    public static void Select_Punch_Confirm_Remedy(Punch_Confirm_Remedy_Bean Bean, ref StringBuilder sb, bool isReset = false)
    {
        if (isReset)
        {
            sb.Clear();
        }

        sb.AppendLine(" SELECT ");
        //PunchConfirm
        sb.AppendLine(" PC.CompID ,PC.EmpID ,PC.EmpName ,CONVERT(VARCHAR, PC.DutyDate,111) as DutyDate ,PC.DutyTime ,CONVERT(VARCHAR, PC.PunchDate,111) as PunchDate ,CONVERT(CHAR(5),PC.PunchTime) as PunchTime ,PC.PunchConfirmSeq ,PC.DeptID ,PC.DeptName ,PC.OrganID ,PC.OrganName ,PC.FlowOrganID ,PC.FlowOrganName ,PC.PunchFlag ,PC.WorkTypeID ,PC.WorkType ,PC.MAFT10_FLAG ,");
        //sb.AppendLine(" PC.CompID ,PC.EmpID ,PC.EmpName ,CONVERT(VARCHAR, PC.DutyDate,111) as DutyDate ,PC.DutyTime ,CONVERT(VARCHAR, PC.PunchDate,111) as PunchDate ,CONVERT(CHAR(5),PC.PunchTime) as PunchTime ,PC.PunchConfirmSeq ,PC.DeptID ,PC.DeptName ,PC.OrganID ,PC.OrganName ,PC.FlowOrganID ,PC.FlowOrganName ,PC.Sex ,PC.PunchFlag ,PC.WorkTypeID ,PC.WorkType ,PC.MAFT10_FLAG ,");
        sb.AppendLine(" PC.AbnormalType ,");
        sb.AppendLine(" PC.AbnormalReasonCN ,");
        sb.AppendLine(" PC.PunchSeq ,PC.PunchRemedySeq ,PC.RemedyReasonID ,PC.RemedyReasonCN ,PC.RemedyPunchTime ,PC.AbnormalFlag ,PC.AbnormalReasonID ,");
        sb.AppendLine(" PC.AbnormalDesc ,PC.Remedy_AbnormalFlag ,PC.Remedy_AbnormalReasonID ,PC.Remedy_AbnormalReasonCN ,PC.Remedy_AbnormalDesc ,");
        sb.AppendLine(" PC.APPContent ,PC.LastChgComp ,PC.LastChgID ,PC.LastChgDate ,");

        //狀態-gridview用
        sb.AppendLine(" PC.Sex , case PC.Sex  when '1' then '男' when '2' then '女' else '不明' end as SexGCN ,");
        //狀態-gridview用
        sb.AppendLine(" PC.ConfirmStatus ,case PC.ConfirmStatus when'0' then '正常' when'1'then ('異常'+AbnormalType) when '2' then '送簽中' when '3' then '異常不控管' else '資料錯誤' end as ConfirmStatusGCN ,");
        //類型-gridview用
        sb.AppendLine(" PC.ConfirmPunchFlag ,case PC.ConfirmPunchFlag when '1' then '上班' when '2' then '下班' when '3' then '午休開始' when '4' then '午休結束'  end as ConfirmPunchFlagGCN,");
        //原因-gridview用
        sb.AppendLine(" case PC.AbnormalFlag when '0' then '無異常' when '1' then '公務' when '2' then '非公務-'+PC.AbnormalReasonCN else '資料錯誤' end as AbnormalReasonGCN ,");
        //來源-gridview用
        sb.AppendLine(" PC.Source ,case PC.Source when 'A' then 'APP' when 'B' then '永豐雲' else '資料錯誤' end as SourceGCN ,");

        //PunchRemedyLog 因為是Join過來的,所以可能會有Null,要加上isnull
        sb.AppendLine(" isnull(FlowCaseID,'') as FlowCaseID, isnull(PR.RemedyPunchFlag,'') as RemedyPunchFlag, isnull(PR.BatchFlag ,'') as BatchFlag, isnull(PR.PORemedyStatus ,'') as PORemedyStatus , isnull(PR.RejectReason ,'') as RejectReason , isnull(PR.RejectReasonCN ,'') as RejectReasonCN , isnull(PR.ValidDateTime,'') as ValidDateTime , isnull(PR.ValidCompID ,'') as ValidCompID , isnull(PR.ValidID ,'') as ValidID , isnull(PR.ValidName  ,'') as ValidName , isnull(PR.Remedy_MAFT10_FLAG,'') as Remedy_MAFT10_FLAG ");
        //sb.AppendLine(" isnull(PR.RemedyPunchFlag,'') , isnull(PR.BatchFlag ,'') , isnull(PR.PORemedyStatus ,'') , isnull(PR.RejectReason ,'') , isnull(PR.RejectReasonCN ,'') , isnull(PR.ValidDateTime,'') ,  isnull(CONVERT(CHAR(5),PR.ValidTime),'') as ValidTime , isnull(PR.ValidCompID ,'') , isnull(PR.ValidID ,'') , isnull(PR.ValidName  ,'') , isnull(PR.Remedy_MAFT10_FLAG,'') ");

        sb.AppendLine(" FROM PunchConfirm PC ");
        sb.AppendLine(" left join PunchRemedyLog PR ");
        sb.AppendLine(" on PC.CompID=PR.CompID and PC.EmpID=PR.EmpID and PC.DutyDate=PR.DutyDate and PC.PunchConfirmSeq=PR.PunchConfirmSeq and PC.PunchRemedySeq=PR.PunchRemedySeq ");
        sb.AppendLine(" Where PC.ConfirmStatus in ('1','2') ");
        if (!string.IsNullOrEmpty(Bean.EmpID))
        {
            sb.AppendLine(" and PC.EmpID=").AppendFormat("@EmpID", Bean.EmpID);
        }
        if (!string.IsNullOrEmpty(Bean.ConfirmPunchFlag))
        {
            sb.AppendLine(" and PC.ConfirmPunchFlag=").AppendFormat("@ConfirmPunchFlag", Bean.ConfirmPunchFlag);
        }
        if (!string.IsNullOrEmpty(Bean.ConfirmStatus))
        {
            sb.AppendLine(" and PC.ConfirmStatus=").AppendFormat("@ConfirmStatus", Bean.ConfirmStatus);
        }
        if (!string.IsNullOrEmpty(Bean.AbnormalFlag))
        {
            sb.AppendLine(" and PC.AbnormalFlag=").AppendFormat("@AbnormalFlag", Bean.AbnormalFlag);
        }

        if (!string.IsNullOrEmpty(Bean.StartPunchDate))
        {
            sb.AppendLine(" and PC.PunchDate>=").AppendFormat("@StartPunchDate", Bean.StartPunchDate);
        }
        if (!string.IsNullOrEmpty(Bean.EndPunchDate))
        {
            sb.AppendLine(" and PC.PunchDate<=").AppendFormat("@EndPunchDate", Bean.EndPunchDate);
        }
        //PR
        if (!string.IsNullOrEmpty(Bean.ValidCompID))
        {
            sb.AppendLine(" and PR.ValidCompID=").AppendFormat("@ValidCompID", Bean.ValidCompID);
        }
        if (!string.IsNullOrEmpty(Bean.ValidID))
        {
            sb.AppendLine(" and PR.ValidID=").AppendFormat("@ValidID", Bean.ValidID);
        }
    }
    private bool nextFlowBtn(Punch_Confirm_Remedy_Bean Bean, out string flowCode, out string flowSN, ref string btnName, out Dictionary <string, string> toUserData, out string msg)
    {
        flowCode   = ""; flowSN = ""; msg = "";
        toUserData = new Dictionary <string, string>();
        string OTEmpID    = Bean.EmpID,
               AssignTo   = Bean.ValidID,
               CompID     = Bean.CompID,
               PunchDate  = Bean.PunchDate,
               FlowCaseID = Bean.FlowCaseID;

        bool IsUpValidRankID = true;
        bool IsUpEmpRankID   = false;

        bool   isLastFlow, nextIsLastFlow;
        string signLineDefine = "", meassge = "";
        string SignOrganID = "", SignID = "", SignIDComp = "";

        string        FlowStepID = "";
        DbHelper      db         = new DbHelper(Aattendant._AattendantDBName);
        CommandHelper sb         = db.CreateCommandHelper();

        sb.Reset();
        sb.Append("SELECT FlowStepID from " + FlowCustDB + "FlowOpenLog ");
        sb.Append(" where FlowCaseID=").AppendParameter("FlowCaseID", FlowCaseID);
        try
        {
            FlowStepID = db.ExecuteScalar(sb.BuildCommand()).ToString();
        }
        catch (Exception)
        {
            FlowStepID = "";
            msg        = "永豐流程查無資料";
            return(false);
        }
        //讀取現在關卡與下一關相關資料,因為不論回傳是否,我還是要資料,所以沒檢核return與meassge
        OBFlowUtility.QueryFlowDataAndToUserData(CompID, AssignTo, PunchDate, FlowCaseID, "P",
                                                 out toUserData, out flowCode, out flowSN, out signLineDefine, out isLastFlow, out nextIsLastFlow, out meassge, "PO");

        //如果QueryFlowDataAndToUserData出錯(HR關與改派容易出現沒有下一關卻無法判定現在是最後一關的狀況),會找不到現在是否為最後一關,這裡單獨再找一次
        isLastFlow = isLastFlowNow(Bean.CompID, FlowCaseID, "P", "PO");

        //如果沒有下一關資料,則用現在關卡資料取代(對應上述QueryFlowDataAndToUserData問題 )
        if (toUserData.Count == 0)
        {
            //取[最近的行政or功能]資料 取代 [現在關卡]資料
            DataTable dtHROtherFlowLog_toUD = PunchUpdate.HROtherFlowLog(FlowCaseID, true);
            toUserData.Add("SignLine", dtHROtherFlowLog_toUD.Rows[0]["SignLine"].ToString());
            toUserData.Add("SignIDComp", dtHROtherFlowLog_toUD.Rows[0]["SignIDComp"].ToString());
            toUserData.Add("SignID", AssignTo);
            toUserData.Add("SignOrganID", dtHROtherFlowLog_toUD.Rows[0]["SignOrganID"].ToString());
            toUserData.Add("SignFlowOrganID", dtHROtherFlowLog_toUD.Rows[0]["SignFlowOrganID"].ToString());
        }

        //如果下一關主管與現在主管相同,則再往上階找下一關主管資料
        if (toUserData["SignID"] == AssignTo && signLineDefine != "3")
        {
            switch (toUserData["SignLine"])
            {
            //HR線 或 行政線
            case "4":
            case "1":
                if (EmpInfo.QueryOrganData(Bean.CompID, toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                {
                    toUserData["SignID"]          = SignID;
                    toUserData["SignIDComp"]      = SignIDComp;
                    toUserData["SignOrganID"]     = SignOrganID;
                    toUserData["SignFlowOrganID"] = "";
                }
                break;

            //功能線
            case "2":
                if (EmpInfo.QueryFlowOrganData(toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                {
                    toUserData["SignID"]          = SignID;
                    toUserData["SignIDComp"]      = SignIDComp;
                    toUserData["SignOrganID"]     = "";
                    toUserData["SignFlowOrganID"] = SignOrganID;
                }
                break;

            //原本switch的是signLineDefine,現在改成toUserData["SignLine"]後,
            //case "3"裏頭的if基本只會用到else[非功能線一律走行政線],以防萬一先保留。
            //改派
            case "3":
                if (toUserData["SignLine"] == "2")
                {
                    if (EmpInfo.QueryFlowOrganData(toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                    {
                        toUserData["SignID"]          = SignID;
                        toUserData["SignIDComp"]      = SignIDComp;
                        toUserData["SignOrganID"]     = "";
                        toUserData["SignFlowOrganID"] = SignOrganID;
                    }
                }
                else
                {
                    if (EmpInfo.QueryOrganData(Bean.CompID, toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                    {
                        toUserData["SignID"]          = SignID;
                        toUserData["SignIDComp"]      = SignIDComp;
                        toUserData["SignOrganID"]     = SignOrganID;
                        toUserData["SignFlowOrganID"] = "";
                    }
                }
                break;
            }
        }

        RankIDCheck(CompID, FlowCaseID, out IsUpValidRankID, out IsUpEmpRankID);
        if (signLineDefine == "4")           //HR特別關(後台沒有送簽功能的話,這裡不會用到)
        {
            if (IsUpValidRankID)             //大於Rank16
            {
                Session["btnVisible"] = "2"; //給永豐流程按鈕隱藏判斷
                btnName = "btnClose";        //回傳按鈕名稱,給多筆審核組進DataTable傳給審核畫面
            }
            else
            {
                if (FlowStepID == "A10") //預防HR送錯關,本來資料上HR關是只有A20或A40等最後一關
                {
                    Session["btnVisible"] = "0";
                    btnName = "btnApprove";
                }
                else
                {
                    Session["btnVisible"] = "1";
                    btnName = "btnReApprove";
                }
            }
        }
        else if (!isLastFlowNow(CompID, FlowCaseID, "P", "PO")) //非最後一關
        {
            if (IsUpEmpRankID)                                  //大於Rank19
            {
                Session["btnVisible"] = "2";
                btnName = "btnClose";
            }
            else
            {
                if (nextIsLastFlow) //下一關是否進入A40最後一關
                {
                    Session["btnVisible"] = "0";
                    btnName = "btnApprove";
                }
                else
                {
                    Session["btnVisible"] = "1";
                    btnName = "btnReApprove";
                }
            }
        }
        else//最後一關
        {
            if (OTEmpID.Trim().Equals(UserInfo.getUserInfo().UserID.Trim()))//當加班人是自己主管的代理人並審自己的加班單
            {
                if (IsUpEmpRankID)//加班人RankID>19
                {
                    Session["btnVisible"] = "2";
                    btnName = "btnClose";
                }
                else
                {
                    Session["btnVisible"] = "1";
                    btnName = "btnReApprove";
                }
            }
            else if (IsUpValidRankID)//大於Rank16
            {
                Session["btnVisible"] = "2";
                btnName = "btnClose";
            }
            else
            {
                Session["btnVisible"] = "1";
                btnName = "btnReApprove";
            }
        }

        //如果找不到下一關主管資料,彈跳視窗並且return false
        if (toUserData["SignID"] == "")
        {
            toUserData["SignIDComp"] = UserInfo.getUserInfo().CompID.Trim();
            toUserData["SignID"]     = UserInfo.getUserInfo().UserID.Trim();
            //Util.MsgBox("查無下一關主管資料");
            if (isLastFlow) //最後一關不用找下一關主管
            {
                return(true);
            }
            else
            {
                msg = "查無下一關主管資料";
                return(false);
            }
        }
        return(true);
    }
Пример #17
0
    /// <summary>
    /// 檢核所有東西,並將下一關相關資訊回傳
    /// </summary>
    public static bool nextAssignTo(Punch_Confirm_Remedy_Bean Bean, out Dictionary <string, string> toUserData)
    {
        string
            CompID      = Bean.CompID,
            AssignTo    = Bean.ValidID,
            OTStartDate = Bean.PunchDate,
            FlowCaseID  = Bean.FlowCaseID;

        bool   isLastFlow, nextIsLastFlow;
        string flowCode = "", flowSN = "", signLineDefine = "", meassge = "";

        string SignOrganID = "", SignID = "", SignIDComp = "";

        //讀取現在關卡與下一關相關資料,因為不論回傳是否,我還是要資料,所以沒檢核回傳值與錯誤訊息
        OBFlowUtility.QueryFlowDataAndToUserData(CompID, AssignTo, OTStartDate, FlowCaseID, "P",
                                                 out toUserData, out flowCode, out flowSN, out signLineDefine, out isLastFlow, out nextIsLastFlow, out meassge, "PO");

        //若是後台HR送簽依照填單人公司,否則用加班人公司
        //string HRLogCompID = signLineDefine == "4" || flowCode.Trim() == "" ?Bean.CompID :Bean.CompID;
        string HRLogCompID = Bean.CompID;

        //如果沒有下一關資料,則用現在關卡資料取代
        if (toUserData.Count == 0)
        {
            //取[最近的行政or功能]資料 取代 [現在關卡]資料
            DataTable dtHROtherFlowLog_toUD = PunchUpdate.HROtherFlowLog(FlowCaseID, true);
            toUserData.Add("SignLine", dtHROtherFlowLog_toUD.Rows[0]["SignLine"].ToString());
            toUserData.Add("SignIDComp", dtHROtherFlowLog_toUD.Rows[0]["SignIDComp"].ToString());
            toUserData.Add("SignID", AssignTo);
            toUserData.Add("SignOrganID", dtHROtherFlowLog_toUD.Rows[0]["SignOrganID"].ToString());
            toUserData.Add("SignFlowOrganID", dtHROtherFlowLog_toUD.Rows[0]["SignFlowOrganID"].ToString());
        }

        //如果下一關主管與現在主管相同,則再往上階找下一關主管資料
        if (toUserData["SignID"] == AssignTo && signLineDefine != "3")
        {
            switch (toUserData["SignLine"])
            {
            //HR線 或 行政線
            case "4":
            case "1":
                if (EmpInfo.QueryOrganData(HRLogCompID, toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                {
                    toUserData["SignID"]          = SignID;
                    toUserData["SignIDComp"]      = SignIDComp;
                    toUserData["SignOrganID"]     = SignOrganID;
                    toUserData["SignFlowOrganID"] = "";
                }
                break;

            //功能線
            case "2":
                if (EmpInfo.QueryFlowOrganData(toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                {
                    toUserData["SignID"]          = SignID;
                    toUserData["SignIDComp"]      = SignIDComp;
                    toUserData["SignOrganID"]     = "";
                    toUserData["SignFlowOrganID"] = SignOrganID;
                }
                break;

            //原本switch的是signLineDefine,現在改成toUserData["SignLine"]後,
            //case "3"裏頭的if基本只會用到else[非功能線一律走行政線],以防萬一先保留。
            //改派
            case "3":
                if (toUserData["SignLine"] == "2")
                {
                    if (EmpInfo.QueryFlowOrganData(toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                    {
                        toUserData["SignID"]          = SignID;
                        toUserData["SignIDComp"]      = SignIDComp;
                        toUserData["SignOrganID"]     = "";
                        toUserData["SignFlowOrganID"] = SignOrganID;
                    }
                }
                else
                {
                    if (EmpInfo.QueryOrganData(HRLogCompID, toUserData["SignOrganID"], Bean.PunchDate, out SignOrganID, out SignID, out SignIDComp))
                    {
                        toUserData["SignID"]          = SignID;
                        toUserData["SignIDComp"]      = SignIDComp;
                        toUserData["SignOrganID"]     = SignOrganID;
                        toUserData["SignFlowOrganID"] = "";
                    }
                }
                break;
            }
        }

        //如果找不到下一關主管資料,彈跳視窗並且return false
        if (toUserData["SignID"] == "")
        {
            toUserData["SignIDComp"] = UserInfo.getUserInfo().CompID.Trim();
            toUserData["SignID"]     = UserInfo.getUserInfo().UserID.Trim();
            //Util.MsgBox("查無下一關主管資料");
            if (isLastFlow) //最後一關不用找下一關主管
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        return(true);
    }
    private void SaveData()
    {
        string ErrorIndex = "";

        for (int index = 0; index < gvMain.Rows.Count; index++)
        {
            CheckBox objchk = (CheckBox)gvMain.Rows[index].FindControl("chkChoiced");
            if (objchk.Checked == true)
            {
                bool   result = false;
                long   seccessCount = 0;
                string msg = "", flowCode = "", flowSN = "";
                string btnName = "";

                RadioButton rdoApp    = (RadioButton)gvMain.Rows[index].FindControl("rbnApproved");
                RadioButton rdoRej    = (RadioButton)gvMain.Rows[index].FindControl("rbnReject");
                TextBox     txtReason = (TextBox)gvMain.Rows[index].FindControl("txtReason");

                Dictionary <string, string> dic        = new Dictionary <string, string>();
                Dictionary <string, string> toUserData = new Dictionary <string, string>();
                PunchUpdate.GridViewToDictionary(gvMain, out dic, index, strDataKeyNames);
                Punch_Confirm_Remedy_Bean model = new Punch_Confirm_Remedy_Bean()
                {
                    //跟共用條件
                    CompID      = dic["CompID"],
                    EmpID       = dic["EmpID"],
                    EmpName     = dic["EmpName"],
                    LastChgComp = UserInfo.getUserInfo().CompID.Trim(),
                    LastChgID   = UserInfo.getUserInfo().UserID.Trim(),
                    LastChgDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),

                    //預存所需資料
                    PunchTime        = dic["PunchTime"],
                    ConfirmPunchFlag = dic["ConfirmPunchFlag"],
                    DutyTime         = dic["DutyTime"],
                    RestBeginTime    = dic["RestBeginTime"],
                    RestEndTime      = dic["RestEndTime"],
                    //Remedy所需資料
                    PunchDate      = dic["PunchDate"],
                    PunchRemedySeq = dic["PunchRemedySeq"],
                    FlowCaseID     = dic["FlowCaseID"],
                    ValidDateTime  = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                    ValidCompID    = UserInfo.getUserInfo().CompID.Trim(),
                    ValidID        = UserInfo.getUserInfo().UserID.Trim(),
                    ValidName      = UserInfo.getUserInfo().UserName.Trim(),

                    //Confirm所需資料
                    DutyDate                = dic["DutyDate"],
                    PunchConfirmSeq         = dic["PunchConfirmSeq"],
                    RemedyReasonID          = dic["RemedyReasonID"],
                    RemedyReasonCN          = dic["RemedyReasonCN"],
                    RemedyPunchTime         = dic["RemedyPunchTime"],
                    Remedy_MAFT10_FLAG      = dic["Remedy_MAFT10_FLAG"],
                    Remedy_AbnormalFlag     = dic["Remedy_AbnormalFlag"],
                    Remedy_AbnormalReasonID = dic["Remedy_AbnormalReasonID"],
                    Remedy_AbnormalReasonCN = dic["Remedy_AbnormalReasonCN"],
                    Remedy_AbnormalDesc     = dic["Remedy_AbnormalDesc"]
                };

                if (rdoApp.Checked == true)                                                                  //核准
                {
                    if (!nextFlowBtn(model, out flowCode, out flowSN, ref btnName, out toUserData, out msg)) //判斷審核按鈕
                    {
                        Util.MsgBox(msg);
                        return;
                    }
                    switch (btnName)
                    {
                    //PORemedyStatus。0:未處理,1:未送簽,2:送簽中,3:核准,4:駁回
                    //ConfirmStatus。0:正常,1:異常,2:送簽中,3:異常不控管
                    case "btnClose":
                        model.PORemedyStatus = "3";
                        string strConfirmStatus = "", strAbnormalType = "";
                        if (!PunchUpdate.PunchAppdOperation_EXEC_PunchCheckData(model, out strConfirmStatus, out strAbnormalType))
                        {
                            Util.MsgBox("打卡異常檢核失敗!!");
                            return;
                        }
                        model.ConfirmStatus = strConfirmStatus;     //0 or 1記得用John的TSQL
                        model.AbnormalType  = strAbnormalType;
                        break;

                    case "btnApprove":
                    case "btnReApprove":
                        model.PORemedyStatus = "2";
                        model.ConfirmStatus  = "2";
                        break;
                    }
                }
                else if (rdoRej.Checked == true)//駁回
                {
                    btnName = "btnReject";
                    model.PORemedyStatus = "4";
                    model.ConfirmStatus  = "1";
                }

                DataTable LastHROtherFlowLog        = PunchUpdate.HROtherFlowLog(model.FlowCaseID, true);
                Dictionary <string, string> oAssDic = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]);

                if (!string.IsNullOrEmpty(btnName))
                {
                    //審核動作
                    result = PunchUpdate.PunchAppdOperation_SaveData(model, oAssDic, btnName, txtReason.Text, out seccessCount, out msg, flowCode, flowSN, LastHROtherFlowLog.Rows[0]["FlowSeq"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogBatNo"].ToString(), LastHROtherFlowLog.Rows[0]["FlowLogID"].ToString(), toUserData);
                }
                else
                {
                    result = false;
                }

                if (!result)
                {
                    //Util.MsgBox(msg);
                    ErrorIndex += (index + 1).ToString() + ",";
                    continue;
                }
                if (seccessCount == 0)
                {
                    ErrorIndex += (index + 1).ToString() + ",";
                    continue;
                }
            }
        }
        if (ErrorIndex.Length > 0)
        {
            ErrorIndex = ErrorIndex.Substring(0, ErrorIndex.Length - 1);
            Util.MsgBox("第" + ErrorIndex + "筆審核失敗");
        }
        else
        {
            Util.MsgBox("審核成功");
        }
    }
Пример #19
0
    /// <summary>
    /// 申請後送簽流程
    /// </summary>
    /// <param name="model">畫面model</param>
    /// <param name="datas">回傳資料</param>
    /// <param name="msg">回傳訊息</param>
    /// <returns>bool</returns>
    public static bool PunchUpdateModify_SaveData(Punch_Confirm_Remedy_Bean model, out long seccessCount, out string msg)
    {
        bool result = false;

        seccessCount = 0;
        msg          = "";

        bool validResult = false;
        Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean();
        string validMsg = "";

        try
        {
            Dictionary <string, string> empData       = new Dictionary <string, string>();
            Dictionary <string, string> toUserData    = new Dictionary <string, string>();
            Dictionary <string, string> ValidUserData = new Dictionary <string, string>();
            string      flowCode       = "";
            string      flowSN         = "";
            bool        nextIsLastFlow = false;
            string      meassge        = "";
            FlowExpress flow           = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"));
            string      KeyValue       = "";//字串
            string      ShowValue      = "";
            string      strFlowCaseID  = "";

            DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
            CommandHelper sb = db.CreateCommandHelper();
            DbConnection  cn = db.OpenConnection();
            DbTransaction tx = cn.BeginTransaction();

            Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
            {
                FlowCaseID              = model.FlowCaseID,
                CompID                  = model.CompID,
                EmpID                   = model.EmpID,
                EmpName                 = model.EmpName,
                DutyDate                = model.DutyDate,
                DutyTime                = model.DutyTime,
                PunchDate               = model.PunchDate,
                PunchTime               = model.PunchTime,
                PunchConfirmSeq         = model.PunchConfirmSeq,
                DeptID                  = model.DeptID,
                DeptName                = model.DeptName,
                OrganID                 = model.OrganID,
                OrganName               = model.OrganName,
                FlowOrganID             = model.FlowOrganID,
                FlowOrganName           = model.FlowOrganName,
                MAFT10_FLAG             = model.MAFT10_FLAG,
                ConfirmStatus           = model.ConfirmStatus,
                PunchRemedySeq          = model.PunchRemedySeq,
                RemedyReasonID          = model.RemedyReasonID,
                RemedyReasonCN          = model.RemedyReasonCN,
                RemedyPunchTime         = model.RemedyPunchTime,
                AbnormalFlag            = model.AbnormalFlag,
                AbnormalReasonID        = model.AbnormalReasonID,
                AbnormalReasonCN        = model.AbnormalReasonCN,
                AbnormalDesc            = model.AbnormalDesc,
                Remedy_MAFT10_FLAG      = model.Remedy_MAFT10_FLAG,
                Remedy_AbnormalFlag     = model.Remedy_AbnormalFlag,
                Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID,
                Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN,
                Remedy_AbnormalDesc     = model.Remedy_AbnormalReasonID == "99" ? model.Remedy_AbnormalDesc : "",
                LastChgComp             = model.LastChgComp,
                LastChgID               = model.LastChgID,
                LastChgDate             = model.LastChgDate,
                //Remedy
                RemedyPunchFlag = model.RemedyPunchFlag,
                BatchFlag       = model.BatchFlag,
                PORemedyStatus  = model.PORemedyStatus,
                RejectReason    = model.RejectReason,
                RejectReasonCN  = model.RejectReasonCN,
                ValidDateTime   = model.ValidDateTime,
                //ValidTime = model.ValidTime,
                ValidCompID = model.ValidCompID,
                ValidID     = model.ValidID,
                ValidName   = model.ValidName
            };

            OBFlowUtility.QueryFlowDataAndToUserData_First(dataBean.CompID, dataBean.OrganID, dataBean.FlowOrganID, dataBean.EmpID, dataBean.EmpID, dataBean.PunchDate, out empData, out toUserData, out flowCode, out flowSN, out nextIsLastFlow, out meassge, "PO01", "PO");

            Punch_Confirm_Remedy_Model validInfo = new Punch_Confirm_Remedy_Model()
            {
                CompID = toUserData["SignIDComp"],
                EmpID  = toUserData["SignID"]
            };
            validResult = GetValidInfo(validInfo, out datas, out validMsg);
            if (!validResult)
            {
                throw new Exception(validMsg);
            }
            dataBean.ValidCompID = toUserData["SignIDComp"];
            dataBean.ValidID     = toUserData["SignID"];
            dataBean.ValidName   = datas.ValidName;

            KeyValue      = dataBean.CompID + "," + dataBean.EmpID + "," + dataBean.PunchDate + "," + dataBean.PunchRemedySeq;
            ShowValue     = dataBean.CompID + "," + dataBean.EmpID + "," + dataBean.PunchDate + "," + dataBean.PunchTime;
            ValidUserData = CustVerify.getEmpID_Name_Dictionary(toUserData["SignID"], toUserData["SignIDComp"]);

            if (FlowExpress.IsFlowInsVerify(flow.FlowID, KeyValue.Split(","), ShowValue.Split(","), nextIsLastFlow ? "btnSendLast" : "btnSend", ValidUserData, ""))
            {
                strFlowCaseID       = FlowExpress.getFlowCaseID(flow.FlowID, KeyValue);
                dataBean.FlowCaseID = strFlowCaseID;
                SqlCommand.PunchUpdateModify_InsertPunchRemedyLog(dataBean, ref sb);
                OBFlowUtility.ChangeFlowFlag(strFlowCaseID, flowCode, flowSN, dataBean.ValidCompID, dataBean.ValidID, "1", ref sb);
                OBFlowUtility.InsertHROtherFlowLogCommand(strFlowCaseID, "1", strFlowCaseID + "." + "1".PadLeft(5, '0'), "P", dataBean.EmpID, dataBean.OrganID,
                                                          dataBean.FlowOrganID, dataBean.ValidID, flowCode, flowSN, "1", "1", toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb);

                try
                {
                    //================
                    //sb.Append("錯誤製造");
                    //=================
                    seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制
                    tx.Commit();                                              //成功Transaction直接Commit
                }
                catch (Exception)
                {
                    FlowExpress.IsFlowCaseDeleted(flow.FlowID, strFlowCaseID, true); //送簽用IsFlowCaseDeleted //審核用IsFlowRollBack
                    tx.Rollback();                                                   //失敗Transaction Rollback
                    throw;
                }
                result = true;
            }
        }
        catch (Exception ex)
        {
            msg = ex.Message;
        }
        return(result);
    }
Пример #20
0
    public static bool PunchAppdOperation_SaveData(Punch_Confirm_Remedy_Bean model, Dictionary <string, string> oAssDic, string btnName, string FlowStepOpinion, out long seccessCount, out string msg, string flowCode = "", string flowSN = "", string flowSeq = "", string FlowLogBatNo = "", string FlowLogID = "", Dictionary <string, string> toUserData = null)
    {
        seccessCount = 0;
        msg          = "";
        Punch_Confirm_Remedy_Bean datas = new Punch_Confirm_Remedy_Bean();

        try
        {
            FlowExpress flow         = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID, false);
            string      strFlowLogID = flow.FlowCurrLastLogID;
            //string strFlowLogID=PunchUpdate.getFlowLogID(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID);
            //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), model.FlowCaseID);
            //FlowExpress flow = new FlowExpress(Util.getAppSetting("app://AattendantDB_PunchUpdate/"), strFlowLogID);
            DbHelper      db = new DbHelper(Aattendant._AattendantDBName);
            CommandHelper sb = db.CreateCommandHelper();
            DbConnection  cn = db.OpenConnection();
            DbTransaction tx = cn.BeginTransaction();

            Punch_Confirm_Remedy_Bean dataBean = new Punch_Confirm_Remedy_Bean()
            {
                FlowCaseID       = model.FlowCaseID,
                CompID           = model.CompID,
                EmpID            = model.EmpID,
                EmpName          = model.EmpName,
                DutyDate         = model.DutyDate,
                DutyTime         = model.DutyTime,
                PunchDate        = model.PunchDate,
                PunchTime        = model.PunchTime,
                PunchConfirmSeq  = model.PunchConfirmSeq,
                DeptID           = model.DeptID,
                DeptName         = model.DeptName,
                OrganID          = model.OrganID,
                OrganName        = model.OrganName,
                FlowOrganID      = model.FlowOrganID,
                FlowOrganName    = model.FlowOrganName,
                ConfirmStatus    = model.ConfirmStatus,
                PunchRemedySeq   = model.PunchRemedySeq,
                RemedyReasonID   = model.RemedyReasonID,
                RemedyReasonCN   = model.RemedyReasonCN,
                RemedyPunchTime  = model.RemedyPunchTime,
                AbnormalFlag     = model.AbnormalFlag,
                AbnormalReasonID = model.AbnormalReasonID,
                AbnormalReasonCN = model.AbnormalReasonCN,
                AbnormalDesc     = model.AbnormalDesc,

                Remedy_MAFT10_FLAG      = model.Remedy_MAFT10_FLAG,
                Remedy_AbnormalFlag     = model.Remedy_AbnormalFlag,
                Remedy_AbnormalReasonID = model.Remedy_AbnormalReasonID,
                Remedy_AbnormalReasonCN = model.Remedy_AbnormalReasonCN,
                Remedy_AbnormalDesc     = model.Remedy_AbnormalDesc,
                LastChgComp             = model.LastChgComp,
                LastChgID   = model.LastChgID,
                LastChgDate = model.LastChgDate,
                //Remedy
                RemedyPunchFlag = model.RemedyPunchFlag,
                BatchFlag       = model.BatchFlag,
                PORemedyStatus  = model.PORemedyStatus,
                RejectReason    = model.RejectReason,
                RejectReasonCN  = model.RejectReasonCN,
                ValidDateTime   = model.ValidDateTime,
                ValidCompID     = model.ValidCompID,
                ValidID         = model.ValidID,
                ValidName       = model.ValidName
            };
            try
            {
                SqlCommand.PunchAppdOperation_UpdatePunchRemedyLog(dataBean, ref sb);
                SqlCommand.PunchAppdOperation_UpdatePunchConfirm(dataBean, ref sb); //內部判定結案or駁回
                SqlCommand.PunchAppdOperation_UpdateHROtherFlowLog(dataBean.FlowCaseID, dataBean.ConfirmStatus == "4" ? "3" : "2", ref sb);

                if (dataBean.PORemedyStatus == "2")//沒結案(送簽中)
                {
                    OBFlowUtility.InsertHROtherFlowLogCommand(dataBean.FlowCaseID, CustVerify.addone(FlowLogBatNo), CustVerify.FlowLogIDadd(FlowLogID), "P", dataBean.EmpID, dataBean.OrganID, dataBean.FlowOrganID, UserInfo.getUserInfo().UserID, flowCode, flowSN, CustVerify.addone(flowSeq), toUserData["SignLine"], toUserData["SignIDComp"], toUserData["SignID"], toUserData["SignOrganID"], toUserData["SignFlowOrganID"], "1", false, ref sb);
                }
                else if (dataBean.PORemedyStatus == "3" || dataBean.PORemedyStatus == "4")//結案
                {
                    FlowUtility.ChangeFlowFlag(dataBean.FlowCaseID, flowCode, flowSN, UserInfo.getUserInfo().CompID, UserInfo.getUserInfo().UserID, "0", ref sb);
                }
                //======(test錯誤的存在)=======
                //sb.Append("test錯誤的存在");
                msg = "注定失敗";
                return(false);

                //======(test錯誤的存在)=======
                seccessCount = db.ExecuteNonQuery(sb.BuildCommand(), tx); //執行新增,成功筆數回傳,並做Transaction機制
                if (seccessCount > 0)
                {
                    if (FlowExpress.IsFlowVerify(flow.FlowID, flow.FlowCurrLastLogID, btnName, oAssDic, FlowStepOpinion))
                    {
                        tx.Commit(); //成功Transaction直接Commit
                    }
                    else
                    {
                        tx.Rollback(); //失敗Transaction Rollback
                        msg = "永豐流程寫入失敗";
                    }
                }
                else
                {
                    tx.Rollback(); //失敗Transaction Rollback
                    msg = "審核失敗,更新0筆資料";
                }
            }
            catch (Exception ex)
            {
                tx.Rollback(); //失敗Transaction Rollback
                msg = ex.Message;
                throw ex;
            }
        }
        catch (Exception ex)
        {
            //tx.Rollback(); //失敗Transaction Rollback
            msg = ex.Message;
            return(false);
        }
        return(true);
    }