Ejemplo n.º 1
0
        //返回计划创建人员
        public ActionResult AddUser()
        {
            var temp = T_SczzDanjuService.LoadEntities(x => x.del == 0);
            var tem  = from a in temp
                       select new
            {
                MyTexts = a.UserInfo.PerSonName,
                ID      = a.AddUser
            };
            var tem_sd = tem.Distinct();

            return(Json(tem_sd, JsonRequestBehavior.AllowGet));
        }
        //创建详细数据
        public ActionResult AddTableone()
        {
            T_CanPan tcp    = new T_CanPan();
            var      thisID = Request["ID"].ToString().Trim().Length <= 0 ? 0 : Convert.ToInt64(Request["ID"]);

            if (thisID == 0)
            {
                tcp.SczzDanjuID = Convert.ToInt64(Request["TextNameID"]);
                var tscdj = T_SczzDanjuService.LoadEntities(x => x.ID == tcp.SczzDanjuID).FirstOrDefault();
                if (tscdj == null)
                {
                    return(Json(new { result = "no", msg = "数据错误请联系管理员" }, JsonRequestBehavior.AllowGet));
                }
                else if (tscdj.ZhuangTai != 0)
                {
                    return(Json(new { result = "no", msg = "已审核的信息不可在次添加信息!" }, JsonRequestBehavior.AllowGet));
                }
                tcp.Cpname   = Request["Cpname"];
                tcp.ImageInt = Request["ImageInt"];
                if (Request["CpShuliang"].ToString().Trim().Length <= 0)
                {
                    return(Json(new { result = "no", msg = "数量不可为空" }, JsonRequestBehavior.AllowGet));
                }
                tcp.CpShuliang = Convert.ToDecimal(Request["CpShuliang"]);
                tcp.SczzItemID = Convert.ToInt64(Request["SczzItemID"]);
                tcp.Bak        = Request["Bak"];
                tcp.DEL        = 0;
                tcp.AddTime    = MvcApplication.GetT_time();
                tcp.AddUserID  = LoginUser.ID;
                if (Request["overtime"] == null && Request["overtime"].ToString().Trim().Length == 0)
                {
                    return(Json(new { result = "no", msg = "完工时间不可为空!" }, JsonRequestBehavior.AllowGet));
                }
                if (Request["overtime"] != null && Request["overtime"].ToString().Trim().Length > 0)
                {
                    tcp.OverTime   = Convert.ToDateTime(Request["overtime"]);
                    tcp.OverUserID = LoginUser.ID;
                }


                T_CanPanService.AddEntity(tcp);
                var temp = HuoquXLS((long)tcp.SczzDanjuID);
                return(Json(new { result = "ok", temp = temp }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                T_CanPanService.EditEntity(tcp);
                return(Json(new { result = false, ex = "" }, JsonRequestBehavior.AllowGet));
            }
        }
        //获取详细数据信息
        public ActionResult DanjuXiangXi()
        {
            var id  = Convert.ToInt64(Request["id"]);
            var tdj = T_SczzDanjuService.LoadEntities(x => x.ID == id && x.del == 0).DefaultIfEmpty();

            var dj = from a in tdj
                     select new
            {
                ID        = a.ID,
                textname  = a.T_ShengChanZhiZhaoTopName.TopText,
                zhuangtai = a.ZhuangTai,
                jhtcr     = a.UserInfo.PerSonName,
                sccjr     = a.UserInfo3.PerSonName,
                jhzdr     = a.UserInfo2.PerSonName,
                jhpzr     = a.UserInfo4.PerSonName,
                jgcj      = a.UserInfo1.PerSonName,
                panduan   = a.UserInfo.QuXian == 0 ? LoginUser.QuXian == 0?false: true : false
            };

            if (tdj == null)
            {
                return(Json(new { ret = "ison" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var temolist = from a in tdj.FirstOrDefault().T_CanPan
                               where a.DEL == 0
                               select new
                {
                    ID         = a.ID,
                    Text       = a.T_SczzItem.Text,
                    Cpname     = a.Cpname,
                    CpShuliang = a.CpShuliang,
                    ImageInt   = a.ImageInt,
                    AddTime    = a.AddTime,
                    OverTime   = a.OverTime,
                    Bak        = a.Bak
                };
                temolist = temolist.OrderByDescending(x => x.AddTime);
                return(Json(new { ret = "ok", temp = temolist, fristtp = dj }, JsonRequestBehavior.AllowGet));
            }
        }
        //删除单据显示信息 丢到垃圾回收站
        public ActionResult DelDanjiu()
        {
            var id       = Convert.ToInt64(Request["delid"]);
            var edittemp = T_SczzDanjuService.LoadEntities(x => x.ID == id && x.AddUser == LoginUser.ID).FirstOrDefault();

            if (edittemp.ZhuangTai != 0)
            {
                return(Json(new { ret = "no", tmp = "已经审核信息不可删除!" }, JsonRequestBehavior.AllowGet));
            }
            edittemp.del = 1;

            if (T_SczzDanjuService.EditEntity(edittemp))
            {
                return(Json(new { ret = "ok", tmp = "" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { ret = "no", tmp = "操作未成功!" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 5
0
        //返回查看详细列表
        public ActionResult GetOne()
        {
            var id   = int.Parse(Request["id"]);
            var tmp  = T_SczzDanjuService.LoadEntities(x => x.ID == id && x.del == 0);
            var temp = Fromnew(tmp);

            var Schanpin = tmp.FirstOrDefault().T_CanPan.Where(x => x.DEL == 0);

            var chanpin = from a in Schanpin
                          select new {
                ID         = a.ID,
                Cpname     = a.Cpname,
                CpShuliang = a.CpShuliang,
                SczzItem   = a.T_SczzItem.Text,
                OverTime   = a.OverTime,
                Bak        = a.Bak,
                ImageInt   = a.ImageInt
            };

            return(Json(new { temp = temp, chanpin = chanpin }, JsonRequestBehavior.AllowGet));
        }
        //审核操作方法
        public ActionResult ShenHe()
        {
            var id = int.Parse(Request["shid"]);

            var temp = T_SczzDanjuService.LoadEntities(x => x.ID == id && x.del == 0).FirstOrDefault();

            if (temp == null)
            {
                return(Json(new { ret = "no", tmp = "数据库无你要审核的信息,数据ID错误" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                if (LoginUser.QuXian == 0)
                {
                    #region MyRegion
                    if (temp.ShenChanShenHe != null)
                    {
                        return(Json(new { ret = "no", tmp = "已审核!不可重复审核!" }, JsonRequestBehavior.AllowGet));
                    }
                    temp.ShenChanShenHe     = LoginUser.ID;
                    temp.ShenChanShenHetime = MvcApplication.GetT_time();
                    //判断 所有人员是否已经审核
                    if (ShiFuAllShenhe(temp))
                    {
                        temp.ZhuangTai = 2;
                    }

                    if (T_SczzDanjuService.EditEntity(temp))
                    {
                        return(Json(new { ret = "ok", tmp = "" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { ret = "no", tmp = "审核失败" }, JsonRequestBehavior.AllowGet));
                    }
                    #endregion
                }
                else
                if (LoginUser.QuXian == 1)
                {
                    #region MyRegion
                    if (temp.Jhzdr != null)
                    {
                        return(Json(new { ret = "no", tmp = "已审核!不可重复审核!" }, JsonRequestBehavior.AllowGet));
                    }
                    if (temp.T_CanPan.Where(x => x.DEL == 0).All(x => x.OverTime != null))
                    {
                        temp.Jhzdr = LoginUser.ID;

                        temp.JhzdrTime  = MvcApplication.GetT_time();
                        temp.TextNameID = 2;
                        temp.ZhuangTai  = 1;
                        if (T_SczzDanjuService.EditEntity(temp))
                        {
                            return(Json(new { ret = "ok", tmp = "" }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            return(Json(new { ret = "no", tmp = "审核失败" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        return(Json(new { ret = "no", tmp = "完工时间必须全部添加才可审核!" }, JsonRequestBehavior.AllowGet));
                    }

                    #endregion
                }
                else if (LoginUser.QuXian > 1)
                {
                    if (LoginUser.QuXian == 3)
                    {
                        if (temp.UpShenHe != null)
                        {
                            return(Json(new { ret = "no", tmp = "已审核!不可重复审核!" }, JsonRequestBehavior.AllowGet));
                        }
                        temp.UpShenHe     = LoginUser.ID;
                        temp.UPshenhetime = MvcApplication.GetT_time();
                        //判断 所有人员是否已经审核
                        if (ShiFuAllShenhe(temp))
                        {
                            temp.ZhuangTai = 2;
                        }
                        if (T_SczzDanjuService.EditEntity(temp))
                        {
                            return(Json(new { ret = "ok", tmp = "" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else if (LoginUser.QuXian == 4)
                    {
                        if (temp.CheJianShenHe != null)
                        {
                            return(Json(new { ret = "no", tmp = "已审核!不可重复审核!" }, JsonRequestBehavior.AllowGet));
                        }
                        temp.CheJianShenHe     = LoginUser.ID;
                        temp.CheJianShenHetime = MvcApplication.GetT_time();
                        //判断 所有人员是否已经审核
                        if (ShiFuAllShenhe(temp))
                        {
                            temp.ZhuangTai = 2;
                        }
                        if (T_SczzDanjuService.EditEntity(temp))
                        {
                            return(Json(new { ret = "ok", tmp = "" }, JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                return(Json(new { ret = "no", tmp = "审核失败" }, JsonRequestBehavior.AllowGet));
            }
        }