using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; namespace DBUtility { public class ClsPub:Pub_Class.ClsPub { // #region 其他处理 //多审审核状态 public static int Xt_BillCheckFlowStatus(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName) { // Pub_Class.ClsPub.HCheckStatus = -1; Xt_BillCheckFlowStatusNow(mvarItemKey, lngBillKey, sBillNo, HCheckFlowID, "", 1, HBillName); return Pub_Class.ClsPub.HCheckStatus; // } //多审审核 public static int Xt_BillCheckFlowStatus(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HCheckNote, string HBillName) { DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); string sWhere = ""; sWhere = sWhere + "," + HCheckFlowID + ""; sWhere = sWhere + ",'" + mvarItemKey + "'"; sWhere = sWhere + "," + lngBillKey + ""; //sWhere = sWhere + ",'" + sBillNo + "'"; sWhere = sWhere + ",'" + HCheckNote + "'"; sWhere = sWhere + ",'" + ClsPub.CurUserName + "'"; if (sWhere.Trim().Length > 0) { sWhere = sWhere.Substring(1, sWhere.Length - 1); } Ds = oCn.RunProcReturn("exec h_p_Xt_BillCheckFlowStatus " + sWhere, "h_p_Xt_BillCheckFlowStatus"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { MessageBox.Show("判断审核状态失败!"); return -1; } else { if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -1) //异常 没有权限 { MessageBox.Show(Ds.Tables[0].Rows[0]["sMsg"].ToString()); return -1; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -2) //没有审批流 { MessageBox.Show("全部审核完毕!没有审核流!"); oCn.RunProc("update " + HBillName + " set HBillStatus=2 Where HinterID=" + lngBillKey.ToString()); return -2; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -3) //多审核完毕,不需要再审核 { MessageBox.Show("全部审核完毕!不需要再审核!"); return -3; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == 1) //终审核完毕 { oCn.RunProc("update " + HBillName + " set HBillStatus=2 Where HinterID=" + lngBillKey.ToString()); return 1; } else //返回 0 正在审核中,审核成功。 { oCn.RunProc("update " + HBillName + " set HBillStatus=6 Where HinterID=" + lngBillKey.ToString()); return 0; } } } //多审反审状态 public static int Xt_BillCheckFlowStatusback1(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName) { ClsPub.HCheckStatus = -1; ClsPub.Xt_BillCheckFlowStatusNow(mvarItemKey, lngBillKey, sBillNo, HCheckFlowID, "", 2, HBillName); return HCheckStatus; } //多审反审核 public static int Xt_BillCheckFlowStatusback(Int64 lngBillKey, string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName) { DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); string sWhere = ""; sWhere = sWhere + "," + HCheckFlowID + ""; sWhere = sWhere + "," + mvarItemKey + ""; sWhere = sWhere + "," + lngBillKey + ""; //sWhere = sWhere + ",'" + sBillNo + "'"; sWhere = sWhere + "," + ClsPub.CurUserName; if (sWhere.Trim().Length > 0) { sWhere = sWhere.Substring(1, sWhere.Length - 1); } Ds = oCn.RunProcReturn("exec h_p_Xt_BillCheckFlowStatusback " + sWhere, "h_p_Xt_BillCheckFlowStatus"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { MessageBox.Show("判断审核状态失败!"); return -1; } else { if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -1)//没反审权限 { MessageBox.Show(Ds.Tables[0].Rows[0]["sMsg"].ToString()); return -1; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -2)//没有审批流 { MessageBox.Show("全部反审完毕!"); oCn.RunProc("update " + HBillName + " set HBillStatus=1 Where HinterID=" + lngBillKey.ToString()); return -2; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -3)// 还未开始审核,不需要反审核 { MessageBox.Show("还没有审核,不需要反审核!"); return -3; } else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == 1) //全部反审完毕 { oCn.RunProc("update " + HBillName + " set HBillStatus=1 Where HinterID=" + lngBillKey.ToString()); return 1; } else //反审核中 0 { oCn.RunProc("update " + HBillName + " set HBillStatus=6 Where HinterID=" + lngBillKey.ToString()); return 0; } } } //查看审核状态 public static void Xt_BillCheckFlowStatusNow(string HBillTypeID, Int64 HBillInterID,string sBillNo, Int64 HCheckFlowID, string sMsg, int sStatus, string HBillName) { Xt_BillCheckFlowStatusNow oCheck = new Xt_BillCheckFlowStatusNow(); oCheck.HBillTypeID = HBillTypeID; oCheck.HBillInterID = HBillInterID; oCheck.HCheckFlowID = HCheckFlowID; oCheck.sBillNo = sBillNo; oCheck.lblMsg.Text = sMsg; oCheck.HBillName = HBillName; oCheck.sStatus = sStatus; if (sStatus == 1) { oCheck.button1.Text = "审核"; } else if (sStatus == 2) { oCheck.button1.Text = "反审"; } else if (sStatus == 0) { oCheck.button1.Text = "确定"; oCheck.button1.Visible = false; } oCheck.ShowDialog(); return; } #endregion } }