Beispiel #1
0
        public ActionResult ManageRemoveForm(string keyValue)
        {
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();

            try
            {
                tasksharebll.RemoveForm(keyValue);
                var single = new
                {
                    taskshareid = keyValue,
                    tasklevel   = 1
                };
                List <StaffInfoEntity> slist = new StaffInfoBLL().GetList(JsonConvert.SerializeObject(single)).ToList();
                //写入日志文件
                string fileName = DateTime.Now.ToString("yyyyMMdd") + ".log";
                System.IO.File.AppendAllText(HttpContext.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + user.UserName + "分配任务删除成功,用户信息" + Newtonsoft.Json.JsonConvert.SerializeObject(user) + "人员任务:" + Newtonsoft.Json.JsonConvert.SerializeObject(slist) + "\r\n");
            }
            catch (Exception ex)
            {
                //写入日志文件
                string fileName = DateTime.Now.ToString("yyyyMMdd") + ".log";
                System.IO.File.AppendAllText(HttpContext.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + user.UserName + "分配任务删除失败,用户信息" + Newtonsoft.Json.JsonConvert.SerializeObject(user) + ",异常信息:" + ex.Message + "\r\n");
                return(Success("操作失败,错误信息:" + ex.Message));
            }
            return(Success("删除成功。"));
        }
Beispiel #2
0
        public ActionResult ManageDelForm(string keyValue)
        {
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            var      dept = new DepartmentBLL().GetEntity(keyValue);

            try
            {
                var taskshareid = "";
                var teamentity  = teamsinfobll.GetEntity(keyValue);
                if (teamentity != null)
                {
                    taskshareid = teamentity.TaskShareId;
                    new TeamsInfoBLL().RemoveForm(keyValue);
                    var single = new
                    {
                        taskshareid = teamentity.TaskShareId,
                        teamid      = teamentity.TeamId
                    };
                    List <StaffInfoEntity> slist = new StaffInfoBLL().GetList(JsonConvert.SerializeObject(single)).ToList();
                    foreach (var item in slist)
                    {
                        staffinfobll.RemoveForm(item.Id);
                    }
                    //写入日志文件
                    string fileName = DateTime.Now.ToString("yyyyMMdd") + ".log";
                    System.IO.File.AppendAllText(HttpContext.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + user.UserName + "删除" + dept.FullName + "分配任务成功,用户信息" + Newtonsoft.Json.JsonConvert.SerializeObject(user) + ",班组信息:" + Newtonsoft.Json.JsonConvert.SerializeObject(teamentity) + ",人员任务:" + Newtonsoft.Json.JsonConvert.SerializeObject(slist.Where(t => t.TaskLevel == "1")) + "\r\n");
                }
            }
            catch (Exception ex)
            {
                //写入日志文件
                string fileName = DateTime.Now.ToString("yyyyMMdd") + ".log";
                System.IO.File.AppendAllText(HttpContext.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":" + user.UserName + "删除" + dept.FullName + "分配任务失败,用户信息" + Newtonsoft.Json.JsonConvert.SerializeObject(user) + ",异常信息:" + ex.Message + "\r\n");
                return(Success("操作失败,错误信息:" + ex.Message));
            }
            return(Success("删除成功。"));
        }
Beispiel #3
0
        public string SupervisionTask()
        {
            string fileName = DateTime.Now.ToString("yyyyMMdd") + ".log";
            List <PushMessageData> listmessage = new List <PushMessageData>();

            try
            {
                string  json = HttpContext.Current.Request.Params["json"];
                dynamic dy   = JsonConvert.DeserializeObject <ExpandoObject>(json);

                StaffInfoEntity entity = new StaffInfoBLL().GetEntity(dy.JobId);
                if (entity != null)
                {
                    string userid = "";
                    //班组中班前会选择人员和时间
                    if (dy.state == "0")
                    {
                        entity.PStartTime   = dy.StartTime;
                        entity.PEndTime     = dy.EndTime;
                        entity.TaskUserId   = dy.TaskUserId;
                        entity.TaskUserName = dy.TaskUserName;
                        entity.DataIsSubmit = "1";
                        new StaffInfoBLL().SaveForm(entity.Id, entity);//修改旁站监督人员

                        PushMessageData messagedata = new PushMessageData();
                        //推送消息到待监管旁站监督
                        messagedata.SendCode = "ZY015";
                        messagedata.EntityId = entity.Id;
                        listmessage.Add(messagedata);

                        string[] arrid   = dy.TaskUserId.Split(',');
                        string[] arrname = dy.TaskUserName.Split(',');
                        for (int i = 0; i < arrid.Length; i++)
                        {
                            if (!userid.Contains(arrid[i]))
                            {
                                userid += userid + ",";
                            }
                            StaffInfoEntity staff = new StaffInfoEntity();
                            staff.PTeamName          = entity.PTeamName;
                            staff.PTeamCode          = entity.PTeamCode;
                            staff.PTeamId            = entity.PTeamId;
                            staff.TaskUserId         = arrid[i];
                            staff.TaskUserName       = arrname[i];
                            staff.PStartTime         = entity.PStartTime;
                            staff.PEndTime           = entity.PEndTime;
                            staff.WorkInfoId         = entity.WorkInfoId;
                            staff.WorkInfoName       = entity.WorkInfoName;
                            staff.SumTimeStr         = 0;
                            staff.DataIsSubmit       = "0";
                            staff.SuperviseState     = "0";//监督状态
                            staff.TaskShareId        = entity.TaskShareId;
                            staff.TaskLevel          = "2";
                            staff.StaffId            = entity.Id;
                            staff.CreateUserId       = entity.CreateUserId;
                            staff.CreateUserName     = entity.CreateUserName;
                            staff.CreateUserDeptCode = entity.CreateUserDeptCode;
                            staff.CreateUserOrgCode  = entity.CreateUserOrgCode;
                            staff.Create();
                            new StaffInfoBLL().SaveForm("", staff);
                        }

                        PushMessageData message = new PushMessageData();
                        //推送消息到待执行旁站监督
                        message.UserId   = string.IsNullOrEmpty(userid) ? "" : userid.TrimEnd(',');
                        message.SendCode = "ZY016";
                        message.EntityId = entity.Id;
                        listmessage.Add(message);
                        //推送
                        new TaskShareBLL().PushSideMessage(listmessage);
                    }
                    //班后会
                    else if (dy.state == "1")
                    {
                        var newdata = new
                        {
                            taskshareid = entity.TaskShareId,
                            staffid     = entity.Id
                        };
                        //SuperviseState 2:未完成 3:已完成
                        var strstate = "0";
                        if (dy.SuperviseState == "3")
                        {
                            strstate = "1";
                        }
                        new StaffInfoBLL().GetList(Newtonsoft.Json.JsonConvert.SerializeObject(newdata)).ToList().ForEach(t =>
                        {
                            t.DataIsSubmit   = "1";
                            t.SuperviseState = strstate;
                            new StaffInfoBLL().SaveForm(t.Id, t);//修改下级任务
                        });
                        entity.SuperviseState = strstate;
                        new StaffInfoBLL().SaveForm(entity.Id, entity);
                    }
                    System.IO.File.AppendAllText(HttpContext.Current.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " ,修改成功,参数为:" + json + "\r\n");
                }
                else
                {
                    System.IO.File.AppendAllText(HttpContext.Current.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " ,实体为空,参数为:" + json + "\r\n");
                }
                return("success");
            }
            catch (Exception ex)
            {
                System.IO.File.AppendAllText(HttpContext.Current.Server.MapPath("~/logs/" + fileName), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " ,修改失败,异常信息:" + ex.Message + "\r\n");
                return(ex.Message);
            }
        }