コード例 #1
0
        public IQueryable GetSCZZdanju(out int totalCount)
        {
            int pageIndex = Request["page"] != null ? Request["page"].ToString().Trim().Length <= 0?1:int.Parse(Request["page"]) : 1;
            int pageSize  = Request["rows"] != null?int.Parse(Request["rows"]) : 10;

            int zt             = Request["zt"] == null?0: Request["zt"].ToString().Trim().Length <= 0?0: int.Parse(Request["zt"]);
            var actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt, a => a.AddTime, false);

            //根据LoginUser.Umoney 判断浏览权限
            if (LoginUser.QuXian == 0)
            {
                actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt, a => a.AddTime, false);
            }
            else if (LoginUser.QuXian == 3)
            {
                if (zt < 2)
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt && a.UpShenHe == null, a => a.AddTime, false);
                }
                else if (zt == 2)
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt, a => a.AddTime, false);
                }
                else
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.UpShenHe == LoginUser.ID && a.ZhuangTai != 2, a => a.AddTime, false);
                }
            }
            else if (LoginUser.QuXian == 4)
            {
                if (zt < 2)
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt && a.CheJianShenHe == null, a => a.AddTime, false);
                }
                else if (zt == 2)
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.ZhuangTai == zt, a => a.AddTime, false);
                }
                else
                {
                    actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.del == 0 && a.CheJianShenHe == LoginUser.ID && a.ZhuangTai != 2, a => a.AddTime, false);
                }
            }

            var temp = from a in actioninfolist
                       select new
            {
                ID        = a.ID,
                text      = a.T_ShengChanZhiZhaoTopName.TopText,
                time      = a.AddTime,
                Zhuangtai = a.ZhuangTai
            };

            return(temp);
        }
コード例 #2
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));
        }
コード例 #3
0
        //创建详细数据
        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));
            }
        }
コード例 #4
0
        //创建制造计划单
        public ActionResult AddTable()
        {
            T_SczzDanju tsd = new T_SczzDanju();

            tsd.TextNameID = Convert.ToInt64(Request["topnameid"]);
            tsd.AddTime    = MvcApplication.GetT_time();
            tsd.ZhuangTai  = 0;
            tsd.AddUser    = LoginUser.ID;
            tsd.del        = 0;
            T_SczzDanjuService.AddEntity(tsd);
            int totalCount = 0;
            var temp       = GetSCZZdanju(out totalCount);

            return(Json(new { result = true, temp = temp, total = totalCount }, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        //获取信息列表
        public ActionResult GetHref()
        {
            int pageIndex = Request["page"] != null ? Request["page"].ToString().Trim().Length <= 0?1: int.Parse(Request["page"]) : 1;
            int pageSize  = Request["rows"] != null?int.Parse(Request["rows"]) : 10;

            string MyColums = Request["MyColums"];
            int    totalCount;

            if (MyColums == "CPlist")
            {
                var actioninfolist = T_SczzDanjuService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.AddUser == LoginUser.ID && a.del != 1, a => a.AddTime, false);
                var temp           = from a in actioninfolist
                                     select new
                {
                };
                return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet));
            }
            else
            if (MyColums == "CPxinghao")//规格型号
            {
                var actioninfolist = T_SczzItemService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.Del != 1, a => a.AddTime, false);
                var temp           = from a in actioninfolist
                                     select new
                {
                    a.ID,
                    a.AddTime,
                    a.Text
                };
                return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet));
            }
            if (MyColums == "JiHuaName")//单据
            {
                var actioninfolist = T_ShengChanZhiZhaoTopNameService.LoadPageEntities <DateTime?>(pageIndex, pageSize, out totalCount, a => a.Del != 1, a => a.addtime, false);
                var temp           = from a in actioninfolist
                                     select new
                {
                    a.ID,
                    a.TopText,
                    a.addtime
                };
                return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        //获取详细数据信息
        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));
            }
        }
コード例 #7
0
        //删除单据显示信息 丢到垃圾回收站
        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));
            }
        }
コード例 #8
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));
        }
コード例 #9
0
        public ActionResult getdata()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 25;

            UserInfoParam uim = new UserInfoParam();

            uim.Uptime     = Convert.ToDateTime(Request["UpTime"]);
            uim.Dwtime     = Convert.ToDateTime(Request["DwTime"]);
            uim.Jhname     = Request["Jhname"] == null ? 0 : Request["Jhname"].Length <= 0 ? 0 : int.Parse(Request["Jhname"]);
            uim.adduser    = Request["addUser"] == null ? 0 : Request["addUser"].Length <= 0 ? 0 : int.Parse(Request["addUser"]);
            uim.SHuser     = Request["SHuser"] == null ? 0 : Request["SHuser"].Length <= 0 ? 0 : int.Parse(Request["SHuser"]);
            uim.CPtext     = Request["CPtext"] == null ? 0 : Request["CPtext"].Length <= 0 ? 0 : int.Parse(Request["CPtext"]);
            uim.zt         = Request["shzt"] == null ? 0 : Request["shzt"].Length <= 0 ? -1 : int.Parse(Request["shzt"]);
            uim.PageIndex  = pageIndex;
            uim.PageSize   = pageSize;
            uim.TotalCount = 0;
            var temp  = T_SczzDanjuService.LoadSearchEntities(uim);
            var Rtemp = Fromnew(temp);

            return(Json(new { rows = Rtemp, total = uim.TotalCount }, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        //审核操作方法
        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));
            }
        }