Esempio n. 1
0
        public ActionResult EditForm(string formNo)
        {
            //取得表单序号,查看表单存放的实体类
            var formType = new Applying().GetFormByFormNo(formNo).FormType;


            ViewBag.DropCustomer = Task.Run(() => new TpaCustomerBll().GetCustomerDropList(null)).Result;
            ViewBag.DropSupplier = Task.Run(() => new TpaSupplierBll().GetSupplierDropList()).Result;
            ViewBag.FormType     = formType;



            ////创建一个临时cshtml文件
            //string file = $"~/Areas/eForm/Views/formtemp/{formType.FormName}A.cshtml";
            //if (!System.IO.File.Exists(file))
            //{
            //    System.IO.File.WriteAllText(Server.MapPath(file), formType.EditHtml, Encoding.UTF8);
            //}


            //return PartialView(file,new Applying().GetFormEntityByFormNo(formNo, formType));


            return(PartialView($"~/Areas/eForm/Views/{formType.FormPage.Substring(4)}.cshtml",
                               new Applying().GetFormEntityByFormNo(formNo, formType)));
        }
Esempio n. 2
0
        public ActionResult FormComm(int formId = 0, string formNo = "", string method = "Add")
        {
            //ViewData["Method"] = method;

            F model = new FormTest();

            if (formId > 0)
            {
                model.Form = new Form {
                    FormType = new BaseServices <FormType>().LoadEntities(c => c.FormId == formId).First()
                };
                model.Form.FormType.FormId = formId;
            }
            else
            {
                if (!string.IsNullOrEmpty(formNo))
                {
                    var formType = new Applying().GetFormByFormNo(formNo).FormType;
                    var formbody = new Applying().GetFormEntityByFormNo(formNo);
                    model = formType.IsModel ? formbody : ((IEnumerable <F>)formbody).First();
                }
            }


            return(PartialView($"~/Areas/eForm/Views/FormComm/FormComm{method}.cshtml", model));
        }
Esempio n. 3
0
        /// <summary>
        /// 打开签核详细信息
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult SignDetails(string p)
        {
            try
            {
                string[] para = p.Decrypt().Split(',');
                ViewBag.Item = int.Parse(para[1]);


                ViewBag.Signed = DataFactory.Database().FindList <FormSign>("FormNo", para[0]).Where(c => c.AuditingFileGroup != Guid.Empty).ToList();


                //(formModel.FormType.Handler != null && formModel.FormType.Handler.Contains(base.EmpNo)



                //对副本抄送时帐号的特珠处理
                if ((Signing.GetSignDataList(EmpNo).Count(c =>
                                                          c.FormNo == para[0] &&
                                                          c.RowId.ToString(CultureInfo.InvariantCulture) == para[1] &&
                                                          c.SignResult == (int)FormSign.SignResultEnum.Watting) > 0))
                {
                    var formEntity = new Applying().GetFormByFormNo(para[0]);

                    ViewBag.IsHander = (formEntity.FormType.Handler != null && formEntity.FormType.Handler.Contains(base.EmpNo));

                    return(View("~/Areas/eForm/Views/Signing/SignDetails.cshtml", formEntity));
                }

                return(Link.ErrorBy(new Exception("这张表单不属于您,或者表单已被签核,请返回重试!!!"), this.GetType()));
            }
            catch
            {
                return(Link.ErrorBy(new Exception("系统参数解析错误,请不要随意修改系统参数"), this.GetType()));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 前台搜索主体界面
        /// </summary>
        /// <param name="formNo"></param>
        /// <returns></returns>
        public ActionResult GetSearchBody(string formNo)
        {
            var apply = new Applying();

            var formType = apply.GetFormByFormNo(formNo).FormType;

            return(PartialView($"cent/{formType.Method}Body", apply.GetFormEntityByFormNo(formNo, formType)));
        }
Esempio n. 5
0
        public ActionResult SavePart(FormNcrPart part, string abnormalImage, string abnormalAttribution)
        {
            if (!string.IsNullOrEmpty(abnormalImage) || !string.IsNullOrEmpty(abnormalAttribution))
            {
                var upNcrMain = new BaseServices <FormNcr>();
                //保存描述
                var ncrMain = upNcrMain.Single(c => c.FormNo == part.ParentFormNo);
                ncrMain.AbnormalImage       = abnormalImage;
                ncrMain.AbnormalAttribution = abnormalAttribution;
                upNcrMain.UpdateEntity(ncrMain);
            }


            //return Content("111");
            string empNo = ManageProvider.Provider.Current().UserId;
            Dictionary <string, object> dictionary = Request.Form.Cast <object>().ToDictionary <object, string, object>(para => para.ToString(), para => Request.Form[para.ToString()]);

            var formId    = int.Parse(dictionary["formid"].ToString());
            var employees = new Applying().GetSignListByFormId(dictionary, formId, empNo);
            var form      = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = empNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = 0,
                IsEmergents = true,
            };



            FormNcrPart partA = new FormNcrPart()
            {
                Mark = part.Mark, ReplyType = formId, ParentFormNo = part.ParentFormNo, Reviewer = empNo, ReviewTime = DateTime.Now
            };
            var result = new F <FormNcrPart>().SaveData(new List <FormNcrPart>()
            {
                partA
            }, form);


            //送签
            if (!result)
            {
                return(Link.ErrorBy(new Exception("数据更新失败,请检查填写是否完整"), this.GetType()));
            }
            new Applying().Send(form.FormNo, empNo);


            var daiqian = new BaseServices <FormSign>().LoadEntities(c => c.FormNo == form.FormNo).Last();
            var signed  = new Signing().Agree(daiqian.FormNo, daiqian.RowId, daiqian.SignEmpNo);

            Console.Write(signed);

            return(Content("success"));
        }
 // Events appling
 internal void ApplyEvent(Event @event)
 {
     Applying?.Invoke(this, new EventArgs <Event>(@event));
     Validate(@event);
     Validated?.Invoke(this, new EventArgs <Event>(@event));
     Handle(@event);
     Handled?.Invoke(this, new EventArgs <Event>(@event));
     pendingEvents.Push(@event);
     Pendent?.Invoke(this, new EventArgs <Event>(@event));
 }
Esempio n. 7
0
        public ActionResult Addapplying(Applying applying)
        {
            if (ModelState.IsValid)
            {
                cont.Applyings.Add(applying);
                cont.SaveChanges();
                TempData["message"] = string.Format("Применение товара '{0}' сохранено", applying.Name);
            }

            return(RedirectToAction("Addapplying"));
        }
Esempio n. 8
0
        public ActionResult DelApplying(int applyingId)
        {
            Applying deletedApplying = cont.Applyings.Find(applyingId);

            if (deletedApplying != null)
            {
                TempData["message"] = string.Format("Применение товара '{0}' удалено", deletedApplying.Name);
                cont.Applyings.Remove(deletedApplying);
                cont.SaveChanges();
            }
            return(RedirectToAction("Allapplying"));
        }
Esempio n. 9
0
        public ActionResult Details(string p)
        {
            try
            {
                string[] para   = p.Decrypt().Split(',');
                string   formno = para[0];
                string   type   = para[1];

                string empNo     = base.EmpNo;
                var    formModel = new Applying().GetFormByFormNo(formno);
                if (formModel != null)
                {
                    switch (type)
                    {
                    case "applyed":
                        if (formModel.CreateEmpNo != empNo)
                        {
                            Link.ErrorBy(new Exception("此表单不属于您,若有问题请联系管理员"), this.GetType());
                        }
                        break;

                    case "signed":
                        //申请人可以看
                        if (formModel.CreateEmpNo == empNo)
                        {
                            break;
                        }
                        //签核人才可以看
                        if (new Signing().GetSignRecoredsByFormNo(formno).Count(c => c.SignEmpNo == empNo || c.ActualSignEmpNo == empNo) <= 0)
                        {
                            Link.ErrorBy(new Exception("您没有签核过此表单。不允许查看"), this.GetType());
                        }
                        break;
                    }
                }
                else
                {
                    Link.ErrorBy(new Exception("系统内部错误"), this.GetType());
                }

                ViewBag.RequestType = type == "applyed" ? "<a href='/eForm/Tracking/Applyed' />追寻申请</a>" : "<a href='/eForm/Tracking/Signed' />追寻签核</a>";
                return(View("TrackingDetails", formModel));
            }
            catch (Exception)
            {
                return(Link.ErrorBy(new Exception("对不起,您无权限查看此表单,如果您是该表单的申请者或签核者,请联系管理员"), this.GetType()));
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 表单查询后操作
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult ApplyOperators(string p)
        {
            string[] para   = p.Decrypt().Split(',');
            string   method = para[0];
            string   formNo = para[1];

            bool result = false;

            switch (method)
            {
            case "urge":
                result = _tracking.Urge(formNo, base.EmpNo);
                break;

            case "cancel":
                result = _tracking.Cancel(formNo, base.EmpNo);
                break;

            case "send":
                result = _tracking.Send(formNo, base.EmpNo);
                break;

            case "del":
                result = _tracking.Delete(formNo, base.EmpNo);
                break;

            case "edit":
                //检查合法性

                var formModel = new Applying().GetFormByFormNo(formNo);


                if (formModel.CreateEmpNo == base.EmpNo || (formModel.FormType.Handler != null && formModel.FormType.Handler.Contains(base.EmpNo)))
                {
                    string url = string.Empty;

                    if (Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath != "/Login/Default")
                    {
                        url = Request.UrlReferrer.ToString();
                    }

                    WebHelper.WriteCookie("url", url);
                    return(View("EditForm", formModel));
                }
                return(ResponseToClient());
            }
            return(Json(result ? "success" : "fail"));
        }
Esempio n. 11
0
        /// <summary>
        /// 表单详细信息页面
        /// </summary>
        /// <param name="formNo"></param>
        /// <returns></returns>
        public ActionResult TrackingForm(string formNo)
        {
            //取得表单序号,查看表单存放的实体类
            var formType = new Applying().GetFormByFormNo(formNo).FormType;
            var model    = new Applying().GetFormEntityByFormNo(formNo, formType);



            //string file = $"~/Areas/eForm/Views/formtemp/{formType.FormName}D.cshtml";
            //if (!System.IO.File.Exists(file))
            //{
            //    System.IO.File.WriteAllText(Server.MapPath(file), formType.DetailsHtml, Encoding.UTF8);
            //}


            return(PartialView($"~/Areas/eForm/Views/{formType.FormPage.Substring(4)}Details.cshtml", model));
        }
Esempio n. 12
0
        /// <summary>
        /// 发行文件预览页
        /// </summary>
        /// <param name="publishKey"></param>
        /// <param name="md5"></param>
        /// <returns></returns>
        public ActionResult PdfViews(Guid publishKey, string md5)
        {
            //update visit
            Task.Run(() => new Quality().PdfView(publishKey, md5));

            var publish = new BaseServices <Published>().LoadEntities(c => c.PubishedGuid == publishKey).FirstOrDefault();

            if (publish != null)
            {
                var          formType = new Applying().GetFormByFormNo(publish.FormNo).FormType;
                DrawingsBase bBase    = new Applying().GetFormEntityByFormNo(publish.FormNo, formType);



                //  var file = BaseServices<Files>().LoadEntities(c => c.Md5 == md5).FirstOrDefault();

                var file = new FilesBll().SignFiles(md5);

                if (file == null || file.FileType != ".pdf")
                {
                    return(Link.ErrorBy(new Exception("暂不支持此文件在线查看"), GetType()));
                }


                var oldRecord = Task.Run(() => new BaseServices <Published>().LoadEntities(
                                             c => c.Identity == publish.Identity && c.PubishedGuid != publish.PubishedGuid).ToList());

                var contiguous = Task.Run(() => new BaseServices <Published>().LoadEntities(
                                              c => c.PublishVer == publish.PublishVer && c.ProductNo == publish.ProductNo && c.PubishedGuid != publish.PubishedGuid).ToList());


                ViewBag.DrawType   = formType.FormName;
                ViewBag.PublishKey = publishKey;
                ViewBag.Md5        = md5;
                ViewBag.File       = file.FileName;
                ViewBag.Base       = bBase;
                ViewBag.OldRecord  = oldRecord.Result;
                ViewBag.Contiguous = contiguous.Result;
            }

            return(View("/Areas/eSystem/Views/Pdm/PdfViews.cshtml", publish));
        }
Esempio n. 13
0
        private Form CreateForm(Dictionary <string, object> dictionary, out List <BaseEmployee> employees)
        {
            int formId = int.Parse(dictionary["formid"].ToString());

            employees = new Applying().GetSignListByFormId(dictionary, formId, EmpNo);

            var form = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = EmpNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = (int)Form.StatusEnum.未送出,
                IsEmergents = dictionary.ContainsKey("isemergents")
                              //Explain = dictionary["Form.Explain"].ToString()
            };

            FormNo = form.FormNo;
            return(form);
        }
Esempio n. 14
0
        /// <summary>
        /// 表单发行
        /// </summary>
        /// <param name="formNo"></param>
        /// <param name="item"></param>
        /// <param name="empNo"></param>
        /// <param name="publishTime"></param>
        /// <param name="isPass"></param>
        /// <returns></returns>
        public bool Published(string formNo, int item, string empNo, DateTime?publishTime, bool isPass)
        {
            //将表单改为 已发行
            var formType = new Applying().GetFormByFormNo(formNo).FormType;

            bool result;



            switch (formType.Method)
            {
            case "DrawingsEcn":
                var ecnEntity = new BaseServices <FormDrawingsEcn>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(ecnEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == ecnEntity.CustomerNo &&
                                     c.ProductNo == ecnEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);


                break;

            case "DrawingsCustomer":
                var customerEntity = new BaseServices <FormDrawingsCustomer>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(customerEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == customerEntity.CustomerNo &&
                                     c.ProductNo == customerEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsInside":
                var insideEntity = new BaseServices <FormDrawingsInside>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(insideEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == insideEntity.CustomerNo &&
                                     c.ProductNo == insideEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsProfile":
                var profileEntity = new BaseServices <FormDrawingsProfile>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(profileEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == profileEntity.CustomerNo &&
                                     c.ProfileNo == profileEntity.ProfileNo
                                     //  && c.ProductNo == profileEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsProcess":
                var processEntity = new BaseServices <FormDrawingsProcess>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(processEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == processEntity.CustomerNo &&
                                     c.ProductNo == processEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsPackage":
                var packageEntity = new BaseServices <FormDrawingsPackage>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(packageEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == packageEntity.CustomerNo &&
                                     c.ProductNo == packageEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsBom":
                var bomEntity = new BaseServices <FormDrawingsBom>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(bomEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == bomEntity.CustomerNo &&
                                     c.ProductNo == bomEntity.ProductNo,
                                     item, empNo, formType, publishTime, isPass); break;

            case "DrawingsSop":
                var sopEntity = new BaseServices <FormDrawingsSop>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(sopEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == sopEntity.CustomerNo &&
                                     c.DrawPartNo == sopEntity.DrawPartNo &&
                                     c.Tag == sopEntity.Tag
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsFqc":
                var fqcEntity = new BaseServices <FormDrawingsFqc>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(fqcEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == fqcEntity.CustomerNo &&
                                     c.ProductNo == fqcEntity.ProductNo &&
                                     c.DrawPartNo == fqcEntity.DrawPartNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsProgram":

                var programEntity = new BaseServices <FormDrawingsProgram>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(programEntity, c =>
                                     c.IsPublished &&
                                     c.FileType == programEntity.FileType &&
                                     c.FileName == programEntity.FileName &&
                                     c.FileCode == programEntity.FileCode

                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsExternal":
                var externalEntity = new BaseServices <FormDrawingsExternal>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(externalEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == externalEntity.CustomerNo &&
                                     c.FileCode == externalEntity.FileCode &&
                                     c.MinicutCode == externalEntity.MinicutCode
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsControlPlan":
                var controlPlanEntity = new BaseServices <FormDrawingsControlPlan>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(controlPlanEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == controlPlanEntity.CustomerNo &&
                                     c.ProductNo == controlPlanEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsFmea":
                var fmeaEntity = new BaseServices <FormDrawingsFmea>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(fmeaEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == fmeaEntity.CustomerNo &&
                                     c.ProductNo == fmeaEntity.ProductNo
                                     , item, empNo, formType, publishTime, isPass);
                break;

            case "DrawingsSopDewell":

                var sopDewellEntity = new BaseServices <FormDrawingsSopDewell>().LoadEntities(c => c.FormNo == formNo).First();
                result = PublishPara(sopDewellEntity, c =>
                                     c.IsPublished &&
                                     c.CustomerNo == sopDewellEntity.CustomerNo &&
                                     c.ProductNo == sopDewellEntity.ProductNo &&
                                     c.Tag == sopDewellEntity.Tag
                                     , item, empNo, formType, publishTime, isPass);
                break;

            default:
                throw new Exception("没有发现卡类型");
            }


            ////发邮件
            //if (result)
            //{
            //    //   new Applying().GetFormEntityByFormNo(formNo, formType.Method);

            //    //通知签核人
            //    var modelTwo = new Model.Email();
            //    modelTwo.SdEmail += new BLL.EmailDetails().Pdm;
            //    modelTwo.Sending(new SendEmailEventArgs()
            //    {
            //        To = new Dictionary<string, string>
            //        {
            //            { "*****@*****.**", "Sales" },
            //            { "*****@*****.**", "Purchasing" },
            //            { "*****@*****.**", "Engineering" },
            //            { "*****@*****.**", "Production" },
            //            { "*****@*****.**", "Quality" },
            //        },
            //        Subject = "文件发行通知[" + formType.FormName + "]",
            //        NickName = "all",
            //        Title = "文件发行通知[" + formType.FormName + "]",
            //        From = "PDM",
            //        Content = "<p>文件已正式发行:" + formNo + "</p>" +
            //        "<p>客户名称:six</p>" +
            //        "<p>产品编号:" + productNo + "</p>",
            //        Date = DateTime.Now,
            //        Link = "点击查看表单详细内容:<a href='" + HttpContext.Current.Request.Url.Authority + "/Default/Index/' >查图纸</a>",

            //    });
            //}

            return(result);
        }