This commit is contained in:
李鹏飞 2023-06-27 22:03:52 +08:00
commit 0741fadfb0
7 changed files with 221 additions and 7 deletions

View File

@ -0,0 +1,2 @@
alter table [dbo].[ActionPlan_ActionPlanListApprove] add [IsPushOa] int null
GO

View File

@ -6,6 +6,7 @@ namespace BLL
{
public class ActionPlanListApproveService
{
public const string ActionPlanListEdit = "ActionPlanListEdit";
public static Model.ActionPlan_ActionPlanListApprove GetActionPlanListApproveByActionPlanListApproveId(string ActionPlanListApproveId)
{
Model.SGGLDB db = Funs.DB;
@ -37,6 +38,16 @@ namespace BLL
}
}
/// <summary>
/// 获取未推送oa 的审批记录
/// </summary>
/// <returns></returns>
public static List<Model.ActionPlan_ActionPlanListApprove> GetApproves_NopushOa()
{
var q = (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.IsPushOa == 0 && x.ApproveMan != "" select x).ToList();
return q;
}
/// <summary>
/// 部门评审小组审批信息
/// </summary>
@ -47,6 +58,16 @@ namespace BLL
return (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.ActionPlanListId == ActionPlanListId && x.ApproveType == BLL.Const.ActionPlanList_Reviewing && x.Edition == edtion select x).ToList();
}
/// <summary>
/// 公司部门评审小组审批信息
/// </summary>
/// <param name="MainPlanId"></param>
/// <returns></returns>
public static List<Model.ActionPlan_ActionPlanListApprove> GetDepartReviewings(string ActionPlanListId, int edtion)
{
return (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.ActionPlanListId == ActionPlanListId && x.ApproveType == BLL.Const.ActionPlanList_DepartReview && x.Edition == edtion select x).ToList();
}
/// <summary>
/// 部门评审小组审批信息
/// </summary>
@ -57,6 +78,16 @@ namespace BLL
return (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.ActionPlanListId == ActionPlanListId && x.ApproveType == BLL.Const.ActionPlanList_Reviewing && x.Edition == edtion && x.ApproveDate != null select x).ToList();
}
/// <summary>
/// 公司部门评审小组审批信息
/// </summary>
/// <param name="MainPlanId"></param>
/// <returns></returns>
public static List<Model.ActionPlan_ActionPlanListApprove> GetDepartReviewingEnds(string ActionPlanListId, int edtion)
{
return (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.ActionPlanListId == ActionPlanListId && x.ApproveType == BLL.Const.ActionPlanList_DepartReview && x.Edition == edtion && x.ApproveDate != null select x).ToList();
}
/// <summary>
/// 部门评审小组审批人员Id集合
/// </summary>
@ -192,11 +223,11 @@ namespace BLL
/// <param name="satartRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static IList<Model.ActionPlan_ActionPlanListApprove> getDepartListData(string ActionPlanListId)
public static IList<Model.ActionPlan_ActionPlanListApprove> getDepartListData(string ActionPlanListId, int? edition)
{
Model.SGGLDB db = Funs.DB;
var res = from x in db.ActionPlan_ActionPlanListApprove
where x.ActionPlanListId == ActionPlanListId && x.DepartId != null
where x.ActionPlanListId == ActionPlanListId && x.DepartId != null && x.Edition == edition
orderby x.ApproveDate
select x;
@ -278,7 +309,7 @@ namespace BLL
{
Model.SGGLDB db = Funs.DB;
var q = (from x in Funs.DB.ActionPlan_ActionPlanListApprove where x.ActionPlanListApproveId == ActionPlanListApproveId select x).FirstOrDefault();
if (q!=null)
if (q != null)
{
db.ActionPlan_ActionPlanListApprove.DeleteOnSubmit(q);
db.SubmitChanges();
@ -332,6 +363,7 @@ namespace BLL
newApprove.DepartId = approve.DepartId;
newApprove.SignType = approve.SignType;
newApprove.Edition = approve.Edition;
newApprove.IsPushOa = approve.IsPushOa;
db.ActionPlan_ActionPlanListApprove.InsertOnSubmit(newApprove);
db.SubmitChanges();
}
@ -357,6 +389,7 @@ namespace BLL
newApprove.ApproveType = approve.ApproveType;
newApprove.SignType = approve.SignType;
newApprove.Edition = approve.Edition;
newApprove.IsPushOa = approve.IsPushOa;
db.ActionPlan_ActionPlanListApprove.InsertOnSubmit(newApprove);
db.SubmitChanges();
}

View File

@ -30,6 +30,10 @@ namespace BLL
case PHTGL_ApproveService.ContractReview:
PHTUrl = string.Format("PHTUrl=PHTGL/ContractCompile/{0}Detail.aspx?ContractReviewId={1}", formname, ID);
break;
case ActionPlanListApproveService.ActionPlanListEdit:
PHTUrl = string.Format("PHTUrl=ZHGL/Plan/ActionPlanListEdit.aspx?ActionPlanListId={0}", ID);
break;
}
url = url + PHTUrl;
return url;
@ -389,6 +393,68 @@ namespace BLL
}
public static void PushoaActionPlan()
{
// return;
string strjson = "";
string returnjson = "";
OAWebService.OfsTodoDataWebServicePortTypeClient OAWeb = new OAWebService.OfsTodoDataWebServicePortTypeClient();
OAWebJson webJson = new OAWebJson();
webJson.syscode = "shigong";
webJson.workflowname = "审批";
webJson.appurl = "";
webJson.receivedatetime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
webJson.createdatetime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
var users = ActionPlanListApproveService.GetApproves_NopushOa();
if (users.Count > 0)
{
for (int i = 0; i < users.Count; i++)
{
try
{
var ActionPlanList = BLL.ActionPlanListService.GetActionPlanListById(users[i].ActionPlanListId);
if (ActionPlanList != null)
{
var geCreatUser = BLL.Person_PersonsService.GetPerson_PersonsById(ActionPlanList.CompileMan);
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(users[i].ApproveMan);
var project = BLL.ProjectService.GetProjectByProjectId(ActionPlanList.ProjectId);
string shortProjectName = string.Empty;
if (project != null)
{
shortProjectName = project.ShortName;
}
webJson.flowid = users[i].ActionPlanListApproveId;
webJson.requestname = "安全实施计划审批 " + shortProjectName;
webJson.nodename = "公司部门审批";
webJson.creator = geCreatUser.JobNum;
webJson.receiver = gereceiver.JobNum;
webJson.pcurl = geturl(ActionPlanList.ProjectId, ActionPlanListApproveService.ActionPlanListEdit, ActionPlanList.ActionPlanListId, users[i].ApproveMan);
webJson.appurl = getAppurl(ActionPlanList.ProjectId, ActionPlanListApproveService.ActionPlanListEdit, ActionPlanList.ActionPlanListId, users[i].ApproveMan);
}
strjson = JsonConvert.SerializeObject(webJson);
returnjson = OAWeb.receiveTodoRequestByJson(strjson);
APICommonService.SaveSysHttpLog("OA_Push", strjson, returnjson);
ReviceReturn reviceReturn = JsonConvert.DeserializeObject<ReviceReturn>(returnjson);
if (reviceReturn.operResult == "1")
{
var Approve = ActionPlanListApproveService.GetActionPlanListApproveByActionPlanListApproveId(users[i].ActionPlanListApproveId);
Approve.IsPushOa = 1;
ActionPlanListApproveService.UpdateActionPlanListApprove(Approve);
}
}
catch (Exception ex)
{
strjson += "----" + users[i].ActionPlanListApproveId;
returnjson = ex.ToString();
APICommonService.SaveSysHttpLog("OA_Push", strjson, returnjson);
ErrLogInfo.WriteLog(ex.ToString());
}
}
}
}
/// <summary>
/// 处理待办流程(变为已办)
/// </summary>
@ -444,6 +510,41 @@ namespace BLL
}
/// <summary>
/// 处理待办流程(变为已办)
/// </summary>
/// <param name="id"></param>
public static void DoneRequestActionPlan(string id)
{
// return;
OAWebService.OfsTodoDataWebServicePortTypeClient OAWeb = new OAWebService.OfsTodoDataWebServicePortTypeClient();
var Approve = ActionPlanListApproveService.GetActionPlanListApproveByActionPlanListApproveId(id);
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(Approve.ApproveMan);
OaDoneJson webJson = new OaDoneJson();
webJson.syscode = "shigong";
webJson.workflowname = "审批";
webJson.flowid = Approve.ActionPlanListApproveId;
webJson.nodename = Approve.ApproveType;
webJson.receiver = gereceiver.JobNum;
webJson.requestname = "安全实施计划审批";
string strjson = JsonConvert.SerializeObject(webJson);
var returnjson = OAWeb.processDoneRequestByJson(strjson);
APICommonService.SaveSysHttpLog("OA_Done", strjson, returnjson);
ReviceReturn reviceReturn = JsonConvert.DeserializeObject<ReviceReturn>(returnjson);
if (reviceReturn.operResult == "1")
{
Approve.IsPushOa = 2;
ActionPlanListApproveService.UpdateActionPlanListApprove(Approve);
}
if (Approve.IsPushOa == 0)
{
Approve.IsPushOa = 2;
ActionPlanListApproveService.UpdateActionPlanListApprove(Approve);
}
}
}
public class OAWebJson
{

View File

@ -183,7 +183,7 @@ namespace FineUIPro.Web.ZHGL.Plan
return;
}
}
else if (actionPlanList.States == Const.ActionPlanList_Review || actionPlanList.States == Const.ActionPlanList_Reviewing || actionPlanList.States == Const.ActionPlanList_ReCompile || actionPlanList.States == Const.ActionPlanList_Review2)
else if (actionPlanList.States == Const.ActionPlanList_Review || actionPlanList.States == Const.ActionPlanList_Reviewing || actionPlanList.States == Const.ActionPlanList_ReCompile || actionPlanList.States == Const.ActionPlanList_Review2 || actionPlanList.States == Const.ActionPlanList_DepartReview)
{
Model.ActionPlan_ActionPlanListApprove approve = ActionPlanListApproveService.GetActionPlanListApproveByApproveMan(id, CurrUser.PersonId);
if (approve != null || CurrUser.PersonId == Const.sysglyId)

View File

@ -222,6 +222,10 @@ namespace FineUIPro.Web.ZHGL.Plan
rblIsCompanyReview.SelectedValue = "False";
}
ContactImg = -1;
this.btnNew.Hidden = true;
this.btnMenuEdit.Hidden = true;
this.btnMenuDelete.Hidden = true;
this.gvDepart.EnableRowDoubleClickEvent = false;
}
//提交版本人多次修改
if (actionPlanList.CompileMan.Equals(CurrUser.PersonId))
@ -443,7 +447,17 @@ namespace FineUIPro.Web.ZHGL.Plan
{
if (rblIsCompanyReview.SelectedValue == "True") //公司部门评审
{
OAWebSevice.PushoaActionPlan(); //推送OA待办
Model.ActionPlan_ActionPlanListApprove approve = ActionPlanListApproveService.GetConstructSoluAppByApproveMan(ActionPlanListId, CurrUser.PersonId, Convert.ToInt32(actionPlanList1.Edition));
if (type == BLL.Const.BtnSubmit)
{
approve.ApproveDate = DateTime.Now;
}
approve.Edition = Convert.ToInt32(edtion);
approve.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
approve.ApproveIdea = txtOptions.Text.Trim();
ActionPlanListApproveService.UpdateActionPlanListApprove(approve);
actionPlanList.States = Const.ActionPlanList_DepartReview;
}
else //备案
{
@ -459,6 +473,41 @@ namespace FineUIPro.Web.ZHGL.Plan
actionPlanList.States = Const.ActionPlanList_Complete;
}
}
else if (actionPlanList1.States == Const.ActionPlanList_DepartReview)
{
actionPlanList.States = Const.ActionPlanList_DepartReview;
Model.ActionPlan_ActionPlanListApprove approve = ActionPlanListApproveService.GetConstructSoluAppByApproveMan(ActionPlanListId, CurrUser.PersonId, Convert.ToInt32(actionPlanList1.Edition));
if (approve != null)
{
approve.ApproveDate = DateTime.Now;
approve.ApproveIdea = this.txtOptions.Text.Trim();
approve.IsAgree = Convert.ToBoolean(this.rblIsAgree.SelectedValue);
BLL.ActionPlanListApproveService.UpdateActionPlanListApprove(approve);
OAWebSevice.DoneRequestActionPlan(approve.ActionPlanListApproveId); //处理待办流程
}
List<Model.ActionPlan_ActionPlanListApprove> approve3s = BLL.ActionPlanListApproveService.GetDepartReviewings(ActionPlanListId, edtion); //审批集合
List<Model.ActionPlan_ActionPlanListApprove> approve3Ends = BLL.ActionPlanListApproveService.GetDepartReviewingEnds(ActionPlanListId, edtion); //审批完成集合
int okNum = approve3Ends.Count(x => x.IsAgree == true); //审批同意数量
if (approve3s.Count == approve3Ends.Count)
{
if (approve3s.Count == okNum) //全部同意,审批完成
{
actionPlanList.States = Const.ActionPlanList_Complete;
}
else //有人不同意,(编制人)修改
{
Model.ActionPlan_ActionPlanListApprove reApprove = new Model.ActionPlan_ActionPlanListApprove();
reApprove.ActionPlanListId = actionPlanList.ActionPlanListId;
reApprove.ApproveMan = actionPlanList1.CompileMan;
reApprove.ApproveType = Const.ActionPlanList_ReCompile;
edtion++;
reApprove.Edition = edtion;
ActionPlanListApproveService.AddActionPlanListApprove(reApprove);
actionPlanList.States = Const.ActionPlanList_ReCompile;
actionPlanList.Edition = edtion;
}
}
}
}
else
{
@ -645,7 +694,8 @@ namespace FineUIPro.Web.ZHGL.Plan
private void BindDepart()
{
var list = ActionPlanListApproveService.getDepartListData(ActionPlanListId);
Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId);
var list = ActionPlanListApproveService.getDepartListData(ActionPlanListId, actionPlanList.Edition);
gvDepart.DataSource = list;
gvDepart.DataBind();
}
@ -716,7 +766,7 @@ namespace FineUIPro.Web.ZHGL.Plan
string rowID = gvDepart.DataKeys[rowIndex][0].ToString();
BLL.ActionPlanListApproveService.DeleteActionPlanListApprovesByActionPlanListApproveId(rowID);
}
//BindGrid();
BindDepart();
ShowNotify("删除数据成功!(表格数据已重新绑定)", MessageBoxIcon.Success);
}
}

View File

@ -91,6 +91,7 @@ namespace FineUIPro.Web.ZHGL.Plan
Alert.ShowInTop("请选择办理人!", MessageBoxIcon.Warning);
return;
}
Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId);
Model.ActionPlan_ActionPlanListApprove approve = new Model.ActionPlan_ActionPlanListApprove
{
ActionPlanListId = this.ActionPlanListId
@ -103,6 +104,9 @@ namespace FineUIPro.Web.ZHGL.Plan
{
approve.ApproveMan = this.drpApproveMan.SelectedValue;
}
approve.ApproveType = BLL.Const.ActionPlanList_DepartReview;
approve.Edition = actionPlanList.Edition;
approve.IsPushOa = 0;
if (!string.IsNullOrEmpty(this.ActionPlanListApproveId))
{
approve.ActionPlanListApproveId = this.ActionPlanListApproveId;

View File

@ -11278,6 +11278,8 @@ namespace Model
private string _DepartId;
private System.Nullable<int> _IsPushOa;
private EntityRef<ActionPlan_ActionPlanList> _ActionPlan_ActionPlanList;
private EntityRef<Person_Persons> _Person_Persons;
@ -11308,6 +11310,8 @@ namespace Model
partial void OnEditionChanged();
partial void OnDepartIdChanging(string value);
partial void OnDepartIdChanged();
partial void OnIsPushOaChanging(System.Nullable<int> value);
partial void OnIsPushOaChanged();
#endregion
public ActionPlan_ActionPlanListApprove()
@ -11545,6 +11549,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsPushOa", DbType="Int")]
public System.Nullable<int> IsPushOa
{
get
{
return this._IsPushOa;
}
set
{
if ((this._IsPushOa != value))
{
this.OnIsPushOaChanging(value);
this.SendPropertyChanging();
this._IsPushOa = value;
this.SendPropertyChanged("IsPushOa");
this.OnIsPushOaChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_ActionPlan_ActionPlanListApprove_ActionPlan_ActionPlanList", Storage="_ActionPlan_ActionPlanList", ThisKey="ActionPlanListId", OtherKey="ActionPlanListId", IsForeignKey=true)]
public ActionPlan_ActionPlanList ActionPlan_ActionPlanList
{