예제 #1
0
 public ActionResult GetFormJson(string keyValue)
 {
     try
     {
         Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();
         var      data = suppliesacceptbll.GetEntity(keyValue);
         if (data.Status == 1)
         {
             ManyPowerCheckBLL    bll   = new ManyPowerCheckBLL();
             ManyPowerCheckEntity power = bll.GetListByModuleNo(user.OrganizeCode, "YJWZLYSP").OrderByDescending(t => t.SERIALNUM).FirstOrDefault();
             ManyPowerCheckEntity flow  = bll.GetEntity(data.FlowId);
             if (power != null && power.SERIALNUM == flow.SERIALNUM)
             {
                 data.IsLastAudit = true;
             }
             else
             {
                 data.IsLastAudit = false;
             }
         }
         else
         {
             data.IsLastAudit = false;
         }
         return(ToJsonResult(data));
     }
     catch (System.Exception ex)
     {
         return(Error(ex.ToString()));
     }
 }
예제 #2
0
        public ActionResult GetFormJson(string keyValue)
        {
            var data = manyPowerCheckbll.GetEntity(keyValue);
            //返回值
            var josnData = new
            {
                data = data
            };

            return(Content(josnData.ToJson()));
        }
예제 #3
0
        public ActionResult ApporveForm(string keyValue, AptitudeinvestigateauditEntity aentity)
        {
            Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current();

            FivesafetycheckEntity entity = fivesafetycheckbll.GetEntity(keyValue);

            string state = string.Empty;

            string moduleName = "五定安全检查";

            ManyPowerCheckEntity mpcEntity = peoplereviewbll.CheckAuditPower(curUser, out state, moduleName, "", false, entity.FLOWID);

            #region                                                                                                                                 //审核信息表
            AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity();
            aidEntity.AUDITRESULT   = aentity.AUDITRESULT;                                                                                          //通过
            aidEntity.AUDITTIME     = Convert.ToDateTime(aentity.AUDITTIME.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss")); //审核时间
            aidEntity.AUDITPEOPLE   = aentity.AUDITPEOPLE;                                                                                          //审核人员姓名
            aidEntity.AUDITPEOPLEID = aentity.AUDITPEOPLEID;                                                                                        //审核人员id
            aidEntity.APTITUDEID    = keyValue;                                                                                                     //关联的业务ID
            aidEntity.AUDITDEPTID   = aentity.AUDITDEPTID;                                                                                          //审核部门id
            aidEntity.AUDITDEPT     = aentity.AUDITDEPT;                                                                                            //审核部门
            aidEntity.AUDITOPINION  = aentity.AUDITOPINION;                                                                                         //审核意见
            aidEntity.FlowId        = entity.FLOWID;                                                                                                //流程步骤
            if (null != mpcEntity)
            {
                aidEntity.REMARK = (mpcEntity.AUTOID.Value - 1).ToString(); //备注 存流程的顺序号
            }
            else
            {
                aidEntity.REMARK = "7";
            }


            aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity);
            #endregion

            #region  保存
            //审核通过
            if (aentity.AUDITRESULT == "0")
            {
                //判断是否走的会签,走会签就要判断是不是所有的部门都有签到,未完成的会签只添加审核记录
                var checkstep = powerCheckbll.GetEntity(entity.FLOWID);

                int hqresult = 0;                                                            // 0:会签完成,走后续流程 1:会签未完成
                if (checkstep.SERIALNUM == 1)                                                // 脚本会签
                {
                    var deptauditlist = fivesafetycheckbll.GetStepDept(checkstep, keyValue); //获取未会签的部门
                    foreach (UserEntity userinfp in deptauditlist)
                    {
                        if (userinfp.DepartmentId != curUser.DeptId)
                        {
                            hqresult = 1;
                        }
                        else //更新当前人会签记录
                        {
                            if (entity.CHECKDEPTALL == "" || entity.CHECKDEPTALL == null)
                            {
                                entity.CHECKDEPTALL = curUser.DeptId;
                                entity.CHECKUSERALL = curUser.UserId;
                            }
                            else
                            {
                                entity.CHECKDEPTALL += "," + curUser.DeptId;
                                entity.CHECKUSERALL += "," + curUser.UserId;
                            }
                        }
                    }
                }

                if (hqresult == 0) // 会签完成,走后续流程
                {
                    //0表示流程未完成,1表示流程结束 会签走完了才执行后面的代码
                    if (null != mpcEntity)
                    {
                        entity.ISOVER       = 0;
                        entity.FLOWID       = mpcEntity.ID;
                        entity.FLOWDEPT     = mpcEntity.CHECKDEPTID;
                        entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME;
                        entity.FLOWROLE     = mpcEntity.CHECKROLEID;
                        entity.FLOWROLENAME = mpcEntity.CHECKROLENAME;
                        entity.FLOWNAME     = mpcEntity.FLOWNAME;
                    }
                    else
                    {
                        entity.ISOVER = 1;
                        entity.FLOWID = "";

                        entity.FLOWDEPT     = "";
                        entity.FLOWDEPTNAME = "";
                        entity.FLOWROLE     = "";
                        entity.FLOWROLENAME = "";
                        entity.FLOWNAME     = "";
                    }
                }
            }
            else //审核不通过
            {
                entity.ISSAVED      = 0;
                entity.ISOVER       = 0;
                entity.CHECKDEPTALL = "";
                entity.CHECKUSERALL = "";
                entity.FLOWID       = "";

                // 审批不通过,将历史审批记录打标(为流程图)
                //获取当前业务对象的所有审核记录
                var shlist = aptitudeinvestigateauditbll.GetAuditList(keyValue);
                //批量更新审核记录关联ID
                foreach (AptitudeinvestigateauditEntity mode in shlist)
                {
                    mode.REMARK = "-1"; //历史审批记录改成-1
                    aptitudeinvestigateauditbll.SaveForm(mode.ID, mode);
                }
            }
            fivesafetycheckbll.SaveForm(keyValue, entity);

            #endregion


            return(Success("操作成功!"));
        }
예제 #4
0
        /// <summary>
        /// 导出审批单
        /// </summary>
        /// <param name="keyValue"></param>
        public void ExportData(string keyValue)
        {
            Operator     user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            HttpResponse resp = System.Web.HttpContext.Current.Response;
            //报告对象
            string fileName = Server.MapPath("~/Resource/ExcelTemplate/应急物资领用单模板.docx");

            Aspose.Words.Document doc     = new Aspose.Words.Document(fileName);
            DocumentBuilder       builder = new DocumentBuilder(doc);
            DataTable             dt      = new DataTable();

            dt.Columns.Add("applydept");   //申请部门
            dt.Columns.Add("applyperson"); //申请人
            dt.Columns.Add("applytime");   //申请时间
            dt.Columns.Add("reason");      //申请原因
            dt.Columns.Add("idea1");       //部门负责人意见
            dt.Columns.Add("person1");     //部门负责人
            dt.Columns.Add("time1");       //部门负责人审批时间
            dt.Columns.Add("idea2");       //安环部负责人意见
            dt.Columns.Add("person2");     //安环部负责人
            dt.Columns.Add("time2");       //安环部负责人审批时间
            dt.Columns.Add("idea3");       //物料部负责人意见
            dt.Columns.Add("person3");     //物料部负责人
            dt.Columns.Add("time3");       //物料部负责人审批时间
            dt.Columns.Add("idea4");       //分管领导意见
            dt.Columns.Add("person4");     //分管领导签名
            dt.Columns.Add("time4");       //分管领导时间
            dt.Columns.Add("idea5");       //应急物资出库人审批意见
            dt.Columns.Add("person5");     //应急物资出库人
            dt.Columns.Add("time5");       //应急物资出库人审批时间
            DataRow row = dt.NewRow();

            SuppliesacceptEntity entity = suppliesacceptbll.GetEntity(keyValue);

            row["applydept"]   = entity.ApplyDept;
            row["applyperson"] = entity.ApplyPerson;
            row["applytime"]   = entity.ApplyDate.Value.ToString("yyyy年MM月dd日HH时mm分");
            row["reason"]      = entity.AcceptReason;


            //物资信息
            DataTable dt1 = new DataTable("A");

            dt1.Columns.Add("num");
            dt1.Columns.Add("suppliesname");
            dt1.Columns.Add("models");
            dt1.Columns.Add("acceptnum");

            SuppliesAcceptDetailBLL suppliesacceptdetailbll = new SuppliesAcceptDetailBLL();

            var list = suppliesacceptdetailbll.GetList("").Where(t => t.RecId == keyValue).ToList();

            for (int i = 0; i < list.Count; i++)
            {
                DataRow row1 = dt1.NewRow();
                row1["num"]          = i + 1;
                row1["suppliesname"] = list[i].SuppliesName;
                row1["models"]       = list[i].Models;
                row1["acceptnum"]    = list[i].AcceptNum;
                dt1.Rows.Add(row1);
            }
            doc.MailMerge.ExecuteWithRegions(dt1);


            //审核记录
            AptitudeinvestigateauditBLL aptitudeinvestigateauditbll = new AptitudeinvestigateauditBLL();
            ManyPowerCheckBLL           manypowercheckbll           = new ManyPowerCheckBLL();
            var data = aptitudeinvestigateauditbll.GetAuditRecList(keyValue);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                try
                {
                    var power = manypowercheckbll.GetEntity(data.Rows[i]["flowid"].ToString());
                    row["idea" + power.SERIALNUM] = data.Rows[i]["auditopinion"].ToString();
                    if (string.IsNullOrWhiteSpace(data.Rows[i]["auditsignimg"].ToString()))
                    {
                        row["person" + power.SERIALNUM] = Server.MapPath("~/content/Images/no_1.png");
                    }
                    else
                    {
                        var filepath = Server.MapPath("~/") + data.Rows[i]["auditsignimg"].ToString().Replace("../../", "").ToString();
                        if (System.IO.File.Exists(filepath))
                        {
                            row["person" + power.SERIALNUM] = filepath;
                        }
                        else
                        {
                            row["person" + power.SERIALNUM] = Server.MapPath("~/content/Images/no_1.png");
                        }
                    }
                    row["time" + power.SERIALNUM] = Convert.ToDateTime(data.Rows[i]["audittime"].ToString()).ToString("yyyy年MM月dd日");
                }
                catch (System.Exception ex)
                {
                }
            }
            dt.Rows.Add(row);
            doc.MailMerge.Execute(dt);
            doc.MailMerge.DeleteFields();
            doc.Save(resp, Server.UrlEncode("应急物资领用单" + DateTime.Now.ToString("yyyyMMdd") + ".docx"), ContentDisposition.Attachment, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Docx));
        }