Exemple #1
0
        public ActionResult AuditCallback(string code)
        {
            var list = cInstance.GetCompHisList(string.Format("AND CH_CompCode='{0}'", code));

            Bse_CompHistory model = list.FirstOrDefault(o => o.CH_iType == "File");

            List <Bse_CompHistory> auditHis = list.Where(o => o.CH_iType != "File").ToList();

            if (model != null)
            {
                try
                {
                    var d = System.IO.Path.GetTempPath();
                    //var d = @"E:\运营方案";
                    string filename = Path.GetFileName(model.CH_FilePath);
                    string temp     = Server.MapPath(model.CH_FilePath);
                    string srcpath  = temp;
                    string despath  = Path.Combine(d, filename);

                    ThumNail.AddWaterWord(string.Format("{0} {1}", SessionConfig.UserName(), DateTime.Now.ToString("yy-MM-dd hh:mm")), srcpath, despath, 10, auditHis.Count * 30);
                    //如果存在则表示生成成功
                    if (System.IO.File.Exists(despath))
                    {
                        System.IO.File.Copy(despath, srcpath, true);
                        System.IO.File.Delete(despath);
                    }
                }
                catch (Exception ex)
                {
                    return(new JsonResult {
                        Data = new { result = "fail", Msg = ex.Message }
                    });
                }

                Bse_CompHistory newModel = new Bse_CompHistory();
                newModel.CH_Code        = cInstance.GenerateHistoryCode();
                newModel.CH_CompCode    = model.CH_CompCode;
                newModel.CH_FilePath    = model.CH_FilePath;
                newModel.CH_Auditor     = SessionConfig.UserId();
                newModel.CH_AuditorName = SessionConfig.UserName();
                newModel.CH_Date        = DateTime.Now;
                newModel.CH_iType       = "His";
                newModel.CH_Type        = "审核";
                cInstance.AddHis(newModel);

                return(new JsonResult {
                    Data = new { result = "success", Msg = "数据更新成功!" }
                });
            }
            else
            {
                return(new JsonResult {
                    Data = new { result = "fail", Msg = "请上传图纸文件图片!" }
                });
            }
        }
Exemple #2
0
        /// <summary>
        /// 零件图纸上传(图片上传)
        /// </summary>
        /// <param name="qqfile"></param>
        /// <returns></returns>
        public ActionResult Upload(string qqfile)
        {
            var    path  = Server.MapPath("~/Upload");
            var    dpath = Server.MapPath("~/Upload/Temp");
            string file  = Comm.FileUpload.UploadFile(qqfile, path, System.Web.HttpContext.Current);
            string dfile = Path.Combine(dpath, Path.GetFileName(file));

            //业务处理 已审人数*50作为高度

            if (string.IsNullOrEmpty(file))
            {
                return(Json(new { result = "fail", message = "上传失败!" }, "application/json"));
            }

            ThumNail.AddWaterWord(SessionConfig.UserName(), file, dfile, 100, 100);

            return(Json(new { result = "success", path = "/Upload/" + Path.GetFileName(file), message = "成功" }, "application/json"));
        }