Example #1
0
        public ActionResult Add(Epm_Draw model)
        {
            ResultView <int> view = new ResultView <int>();

            //上传图纸
            string            fileDataJson = Request.Form["fileDataJsonFile"];                                 //获取上传图片json字符串
            List <Base_Files> fileListFile = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符

            //表单校验
            //if (string.IsNullOrEmpty(model.Name))
            //{
            //    view.Flag = false;
            //    view.Message = "名称不能为空";
            //    return Json(view);
            //}
            //if (string.IsNullOrEmpty(model.VersionOrder))
            //{
            //    view.Flag = false;
            //    view.Message = "版本号不能为空";
            //    return Json(view);
            //}
            Result <int> result = new Result <int>();

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddDraw(model, fileListFile);

                //var project = proxy.GetProject(model.ProjectId.Value).Data;
                //DateTime time = DateTime.Now;
                //if (fileListFile != null)
                //{
                //    foreach (var item in fileListFile)
                //    {
                //        if (string.IsNullOrEmpty(item.ImageType))
                //        {
                //            Bp_SendDate send = new Bp_SendDate();
                //            send.IsSend = false;
                //            send.Key = "2002040005";
                //            send.Value = "{\"FDFS_NAME\":\"" + item.Url + "\",\"FDFS_GROUP\":\"" + item.Group + "\",\"NAME\":\"" + item.Name + "\",\"WJLX\":\"" + ListExtensionMethod.GetFileType(item.Name) + "\",\"SIZE\":\"" + ListExtensionMethod.GetByteLength(item.Size) + "\",\"USER\":\"" + CurrentUser.UserCode + "\"}";
                //            send.Type = "12";
                //            send.Project = "BIM";
                //            send.KeyValue = project.ObjeId;
                //            send.UserName = CurrentUser.UserCode;
                //            send.CreateTime = time;
                //            send.OperateTime = time;
                //            send.OperateUserId = CurrentUser.UserId;
                //            send.OperateUserName = CurrentUser.UserName;
                //            send.CreateUserId = CurrentUser.UserId;
                //            send.CreateUserName = CurrentUser.UserName;
                //            proxy.AddSendDate(send);
                //        }
                //    }
                //}
            }
            return(Json(result.ToResultView()));
        }
Example #2
0
        public bool drawingToDraw(Epm_TzConDrawing model, List <Base_Files> fileListFile)
        {
            Epm_Draw ed = new Epm_Draw();

            SetCreateUser(ed);
            ed.ProjectId   = model.ProjectId;
            ed.ProjectName = model.ProjectName;
            // ed.Name = model.;
            //ed.Desciption = model.
            //ed.VersionOrder = model.Desciption;
            ed.VersionNo         = "FirstVersion";
            ed.VersionName       = "首版本";
            ed.SubmitUserId      = CurrentUser.Id;
            ed.SubmitUserName    = CurrentUser.UserName;
            ed.SubmitCompanyId   = CurrentCompanyID.ToLongReq();
            ed.SubmitCompanyName = CurrentCompanyName;
            ed.SubmitDate        = DateTime.Now;
            ed.DesignCompanyId   = model.CompanyId;
            ed.DesignCompanyName = model.CompanyName;
            ed.IsNew             = true;
            ed.State             = (int)ApprovalState.ApprSuccess; //设置状态为已审核
            ed.Remark            = model.Remark;
            ed.CrtCompanyId      = model.CompanyId;
            ed.CrtCompanyName    = model.CompanyName;
            ed.IsDelete          = false;
            ed.OperateTime       = DateTime.Now;
            ed.OperateUserId     = CurrentUser.Id;
            ed.OperateUserName   = CurrentUser.UserName;
            ed.IsValidate        = false;
            ed.CrtCompanyId      = CurrentCompanyID.ToLongReq();
            ed.CrtCompanyName    = CurrentCompanyName;

            var result = AddDraw(ed, fileListFile);//调用图纸管理新增服务-同步数据

            if (result.Data < 1)
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddDraw(Epm_Draw model, List <Base_Files> fileListFile)
        {
            Result <int> result = new Result <int>();

            try
            {
                model = base.SetCurrentUser(model);
                model.CrtCompanyId   = CurrentCompanyID.ToLongReq();
                model.CrtCompanyName = CurrentCompanyName;

                //bool dConfig = DataOperateBusiness<Epm_Draw>.Get().Count(i => i.Name == model.Name && i.ProjectId == model.ProjectId && i.VersionNo == model.VersionNo) > 0;
                //if (dConfig)
                //{
                //    throw new Exception("该图纸名称已经存在");
                //}
                var rows = DataOperateBusiness <Epm_Draw> .Get().Add(model);

                //上传图纸
                if (fileListFile != null)
                {
                    AddFilesByTable(model, fileListFile);
                }
                result.Data = rows;
                result.Flag = EResultFlag.Success;
                WriteLog(BusinessType.Draw.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id);
                if ((ApprovalState)model.State == ApprovalState.WaitAppr)
                {
                    #region 生成待办
                    var project = DataOperateBusiness <Epm_Project> .Get().GetModel(model.ProjectId.Value);

                    List <Epm_Approver> list = new List <Epm_Approver>();
                    Epm_Approver        app  = new Epm_Approver();
                    app.Title            = CurrentUserName + "上传了项目图纸,待审核";
                    app.Content          = CurrentUserName + "上传了项目图纸,待审核";
                    app.SendUserId       = CurrentUserID.ToLongReq();
                    app.SendUserName     = CurrentUserName;
                    app.SendTime         = DateTime.Now;
                    app.LinkURL          = string.Empty;
                    app.BusinessTypeNo   = BusinessType.Draw.ToString();
                    app.Action           = SystemRight.Add.ToString();
                    app.BusinessTypeName = BusinessType.Draw.GetText();
                    app.BusinessState    = (int)(ApprovalState.WaitAppr);
                    app.BusinessId       = model.Id;
                    app.ApproverId       = project.ContactUserId;
                    app.ApproverName     = project.ContactUserName;
                    app.ProjectId        = model.ProjectId;
                    app.ProjectName      = project.Name;
                    list.Add(app);
                    AddApproverBatch(list);
                    WriteLog(BusinessType.Draw.GetText(), SystemRight.Add.GetText(), "提交图纸生成待办: " + model.Id);
                    #endregion

                    #region 消息
                    var waitSend = GetWaitSendMessageList(model.ProjectId.Value);
                    foreach (var send in waitSend)
                    {
                        Epm_Massage modelMsg = new Epm_Massage();
                        modelMsg.ReadTime     = null;
                        modelMsg.RecId        = send.Key;
                        modelMsg.RecName      = send.Value;
                        modelMsg.RecTime      = DateTime.Now;
                        modelMsg.SendId       = CurrentUserID.ToLongReq();
                        modelMsg.SendName     = CurrentUserName;
                        modelMsg.SendTime     = DateTime.Now;
                        modelMsg.Title        = CurrentUserName + "上传了项目图纸,待审核";
                        modelMsg.Content      = CurrentUserName + "上传了项目图纸,待审核";
                        modelMsg.Type         = 2;
                        modelMsg.IsRead       = false;
                        modelMsg.BussinessId  = model.Id;
                        modelMsg.BussinesType = BusinessType.Draw.ToString();
                        modelMsg.ProjectId    = model.ProjectId;
                        modelMsg.ProjectName  = model.ProjectName;
                        modelMsg = base.SetCurrentUser(modelMsg);
                        modelMsg = base.SetCreateUser(modelMsg);
                        DataOperateBusiness <Epm_Massage> .Get().Add(modelMsg);
                    }
                    #endregion

                    #region 发送短信
                    //Dictionary<string, string> parametersms = new Dictionary<string, string>();
                    //parametersms.Add("UserName", CurrentUserName);
                    //WriteSMS(project.ContactUserId.Value, project.CompanyId, MessageStep.DrawAdd, parametersms);
                    #endregion
                }
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddDraw");
            }
            return(result);
        }