From 837654f24753ce9c00ca7587d075bef137028c64 Mon Sep 17 00:00:00 2001 From: sunliang <593170460@qq.com> Date: Mon, 4 Mar 2024 09:52:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=BB=E4=BA=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CCFlow/Components/BP.WF/Template/FlowSort.cs | 8 +- CCFlow/Components/BP.WF/Template/PushMsg.cs | 8 ++ CCFlow/Components/BP.WF/WF/ShiftWork.cs | 101 +++++++++++++++---- 3 files changed, 96 insertions(+), 21 deletions(-) diff --git a/CCFlow/Components/BP.WF/Template/FlowSort.cs b/CCFlow/Components/BP.WF/Template/FlowSort.cs index be913312..b6662234 100644 --- a/CCFlow/Components/BP.WF/Template/FlowSort.cs +++ b/CCFlow/Components/BP.WF/Template/FlowSort.cs @@ -312,9 +312,11 @@ namespace BP.WF.Template { //if (BP.Web.WebUser.No.Equals("admin") == true) // return this.RetrieveAll(FlowSortAttr.Idx); - - if (BP.Web.WebUser.IsAdmin == false) - throw new Exception("err@您不是管理员."); + if (Glo.CCBPMRunModel != CCBPMRunModel.Single) { + if (BP.Web.WebUser.IsAdmin == false) + throw new Exception("err@您不是管理员."); + } + //if (Glo.CCBPMRunModel != CCBPMRunModel.Single) //{ diff --git a/CCFlow/Components/BP.WF/Template/PushMsg.cs b/CCFlow/Components/BP.WF/Template/PushMsg.cs index 8c977325..3a9294ba 100644 --- a/CCFlow/Components/BP.WF/Template/PushMsg.cs +++ b/CCFlow/Components/BP.WF/Template/PushMsg.cs @@ -52,6 +52,14 @@ namespace BP.WF.Template /// public class PushMsgAttr { + /// + /// NodeID + /// + public const string NodeID = "NodeID"; + /// + /// EventNo + /// + public const string EventNo = "EventNo"; /// /// 流程编号 /// diff --git a/CCFlow/Components/BP.WF/WF/ShiftWork.cs b/CCFlow/Components/BP.WF/WF/ShiftWork.cs index 2188d69f..ef91e133 100644 --- a/CCFlow/Components/BP.WF/WF/ShiftWork.cs +++ b/CCFlow/Components/BP.WF/WF/ShiftWork.cs @@ -33,6 +33,38 @@ namespace BP.WF Node nd = new Node(gwf.NodeID); Work work = nd.HisWork; work.OID = workID; + work.RetrieveFromDBSources(); + DateTime dtOfShould = DateTime.Now; + + if (nd.HisCHWay == CHWay.ByTime) + { + //按天、小时考核 + if (nd.GetParaInt("CHWayOfTimeRole") == 0) + { + //增加天数. 考虑到了节假日. + //判断是修改了节点期限的天数 + int timeLimit = nd.TimeLimit; + dtOfShould = Glo.AddDayHoursSpan(DateTime.Now, timeLimit, + nd.TimeLimitHH, nd.TimeLimitMM, nd.TWay); + } + //按照节点字段设置 + if (nd.GetParaInt("CHWayOfTimeRole") == 1) + { + //获取设置的字段、 + string keyOfEn = nd.GetParaString("CHWayOfTimeRoleField"); + if (DataType.IsNullOrEmpty(keyOfEn) == true) + nd.HisCHWay = CHWay.None; + else + dtOfShould = DataType.ParseSysDateTime2DateTime(work.GetValByKey(keyOfEn).ToString()); + + } + + } + string sdt = ""; + if (nd.HisCHWay == CHWay.None) + sdt = "无"; + else + sdt = DataType.SysDateTimeFormat(dtOfShould); //检查被移交人是否在当前的待办列表里否? GenerWorkerList gwl = new GenerWorkerList(); i = gwl.Retrieve(GenerWorkerListAttr.FK_Emp, emp.UserID, @@ -74,7 +106,7 @@ namespace BP.WF item.DeptName = WebUser.DeptName; item.ItIsRead = false; - + item.SDT = sdt; item.Insert(); //执行插入. break; } @@ -88,16 +120,13 @@ namespace BP.WF //移交后事件 string atPara1 = "@SendToEmpIDs=" + emp.UserID; string info = "@" + ExecEvent.DoNode(EventListNode.ShitAfter, nd, work, null, atPara1); - + if (info == null || info.Equals("@null")) info = ""; //处理移交后发送的消息事件,发送消息. PushMsgs pms1 = new PushMsgs(); - pms1.Retrieve(PushMsgAttr.FK_Node, nd.NodeID, PushMsgAttr.FK_Event, EventListNode.ShitAfter); + pms1.Retrieve(PushMsgAttr.NodeID, nd.NodeID, PushMsgAttr.EventNo, EventListNode.ShitAfter); foreach (PushMsg pm in pms1) pm.DoSendMessage(nd, nd.HisWork, null, null, null, emp.UserID); - string emps = gwf.Emps; - emps += WebUser.No+","+WebUser.Name+"@"; - gwf.Emps = emps; gwf.WFState = WFState.Shift; gwf.TodoEmpsNum = 1; gwf.TodoEmps = emp.UserID + "," + emp.Name + ";"; @@ -107,16 +136,19 @@ namespace BP.WF //非协作模式. gwl = new GenerWorkerList(); - gwl.Retrieve(GenerWorkerListAttr.FK_Node, gwf.NodeID, GenerWorkerListAttr.WorkID, gwf.WorkID, GenerWorkerListAttr.FK_Emp, WebUser.No); - //删除当前人的待办 - gwl.Delete(); - //增加移交人的待办 - gwl.EmpNo = emp.UserID; - gwl.EmpName = emp.Name; - gwl.ItIsEnable = true; - gwl.ItIsRead = false; - gwl.Insert(); - + i = gwl.Retrieve(GenerWorkerListAttr.FK_Node, gwf.NodeID, GenerWorkerListAttr.WorkID, gwf.WorkID); + if (i == 1) { + string sql = "UPDATE WF_GenerWorkerlist SET IsRead=0, FK_Emp='" + emp.UserID + "', EmpName='" + emp.Name + "' WHERE FK_Emp='" + gwl.EmpNo + "' AND FK_Node=" + gwf.NodeID + " AND WorkID=" + workID; + DBAccess.RunSQL(sql); + } else { + gwl.Delete(GenerWorkerListAttr.WorkID, gwf.WorkID, GenerWorkerListAttr.FK_Node, gwf.NodeID); + gwl.EmpNo = emp.UserID; + gwl.EmpName = emp.Name; + gwl.ItIsEnable = true; + gwl.ItIsRead = false; + gwl.SDT = sdt; + gwl.Insert(); + } gwf.WFState = WFState.Shift; gwf.TodoEmpsNum = 1; gwf.TodoEmps = gwf.TodoEmps.Replace(WebUser.No + "," + WebUser.Name + ";", "") + emp.UserID + "," + emp.Name + ";"; @@ -154,14 +186,45 @@ namespace BP.WF gwls.Retrieve(GenerWorkerListAttr.FK_Node, gwf.NodeID, GenerWorkerListAttr.WorkID, workID); //定义变量. - GenerWorkerList gwl = null; + GenerWorkerList gwl = new GenerWorkerList(); int i = 0; //人员. Node nd = new Node(gwf.NodeID); Work work = nd.HisWork; work.OID = workID; + work.RetrieveFromDBSources(); + DateTime dtOfShould = DateTime.Now; + + if (nd.HisCHWay == CHWay.ByTime) + { + //按天、小时考核 + if (nd.GetParaInt("CHWayOfTimeRole") == 0) + { + //增加天数. 考虑到了节假日. + //判断是修改了节点期限的天数 + int timeLimit = nd.TimeLimit; + dtOfShould = Glo.AddDayHoursSpan(DateTime.Now, timeLimit, + nd.TimeLimitHH, nd.TimeLimitMM, nd.TWay); + } + //按照节点字段设置 + if (nd.GetParaInt("CHWayOfTimeRole") == 1) + { + //获取设置的字段、 + string keyOfEn = nd.GetParaString("CHWayOfTimeRoleField"); + if (DataType.IsNullOrEmpty(keyOfEn) == true) + nd.HisCHWay = CHWay.None; + else + dtOfShould = DataType.ParseSysDateTime2DateTime(work.GetValByKey(keyOfEn).ToString()); + } + + } + string sdt = ""; + if (nd.HisCHWay == CHWay.None) + sdt = "无"; + else + sdt = DataType.SysDateTimeFormat(dtOfShould); string info = null; string[] strs = toEmps.Split(','); string empNames = ""; @@ -192,6 +255,7 @@ namespace BP.WF gwl.EmpNo = emp.UserID; gwl.EmpName = emp.Name; gwl.PassInt = 0; + gwl.SDT = sdt; gwl.Insert(); //记录日志. @@ -204,7 +268,7 @@ namespace BP.WF //处理移交后发送的消息事件,发送消息. PushMsgs pms1 = new PushMsgs(); - pms1.Retrieve(PushMsgAttr.FK_Node, nd.NodeID, PushMsgAttr.FK_Event, EventListNode.ShitAfter); + pms1.Retrieve(PushMsgAttr.NodeID, nd.NodeID, PushMsgAttr.EventNo, EventListNode.ShitAfter); foreach (PushMsg pm in pms1) pm.DoSendMessage(nd, nd.HisWork, null, null, null, emp.UserID); @@ -218,6 +282,7 @@ namespace BP.WF gwl.EmpNo = emp.UserID; gwl.EmpName = emp.Name; gwl.PassInt = 0; + gwl.SDT = sdt; gwl.Insert(); }