Example #1
0
        // GET: Schedule
        public ActionResult Index()
        {
            PqJbszModel model = jbszService.GetModel(GLYadmin.YYID);

            model = model == null ? new PqJbszModel() : model;
            return(View(model));
        }
 public PqJbszModel GetModel(string tjjgid)
 {
     using (IDbConnection conn = new DapperConnection().DbConnection)
     {
         string      sql   = "SELECT * FROM dbo.pq_jbsz WHERE tjjgid=@tjjgid";
         PqJbszModel model = conn.Query <PqJbszModel>(sql, new { tjjgid = tjjgid }).FirstOrDefault();
         return(model);
     }
 }
        public int Add(PqJbszModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into pq_jbsz(");
            strSql.Append("tjjgid,zdjd,skyl,qtyl,tjyl,xxr,tsky,ztyy,qdyl)");
            strSql.Append(" values (");
            strSql.Append("@tjjgid,@zdjd,@skyl,@qtyl,@tjyl,@xxr,@tsky,@ztyy,@qdyl)");
            strSql.Append(";select @@IDENTITY");
            using (IDbConnection conn = new DapperConnection().DbConnection)
            {
                int id = Convert.ToInt32(conn.ExecuteScalar(strSql.ToString(), model));
                return(id);
            }
        }
Example #4
0
        public ActionResult Index(PqJbszModel request)
        {
            PqJbszModel model = jbszService.GetModel(GLYadmin.YYID);

            request.tjjgid = GLYadmin.YYID;
            request.skyl   = request.zdjd - request.qtyl - request.tjyl - request.qdyl;
            request.xxr    = string.IsNullOrEmpty(Request["xxr"]) ? "" : Request["xxr"].Replace(",", "|");
            if (model == null)
            {
                jbszService.Add(request);
            }
            else
            {
                jbszService.Update(request);
            }
            return(Json(new { code = 200, msg = "成功" }));
        }
        public bool Update(PqJbszModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update pq_jbsz set ");
            strSql.Append("zdjd=@zdjd,");
            strSql.Append("skyl=@skyl,");
            strSql.Append("qtyl=@qtyl,");
            strSql.Append("tjyl=@tjyl,");
            strSql.Append("xxr=@xxr,");
            strSql.Append("tsky=@tsky,");
            strSql.Append("ztyy=@ztyy,");
            strSql.Append("qdyl=@qdyl");
            strSql.Append(" where tjjgid=@tjjgid");
            using (IDbConnection conn = new DapperConnection().DbConnection)
            {
                int num = conn.Execute(strSql.ToString(), model);
                return(num > 0);
            }
        }
Example #6
0
        public ActionResult QyDetail(string bh = "")
        {
            var qyModel = qyjbxxService.GetModel(bh, GLYadmin.YYID);

            if (qyModel == null)
            {
                return(Content("参数错误"));
            }

            var qypqModel = qypqszService.GetModelByQybh(bh, GLYadmin.YYID);//渠道排期基本设置

            if (qypqModel == null)
            {
                PqJbszModel jbszModel = jbszService.GetModel(GLYadmin.YYID);
                jbszModel      = jbszModel == null ? new PqJbszModel() : jbszModel;
                qypqModel      = new PqQyszModel();
                qypqModel.qybh = bh;
                qypqModel.yybh = qyModel.yybh;
            }
            var plszjlModel = plszjlService.GetModelByQybh(bh);

            plszjlModel        = plszjlModel == null ? new PqPlszjlModel() : plszjlModel;
            plszjlModel.mxList = JsonConvert.DeserializeObject <List <PlszMxModel> >(plszjlModel.mx);
            if (plszjlModel.mxList.Count == 0)
            {
                plszjlModel.mxList.Add(new PlszMxModel {
                    kssj = "07:30", jssj = "08:30", tjrs = 10
                });
                plszjlModel.mxList.Add(new PlszMxModel {
                    kssj = "08:30", jssj = "09:30", tjrs = 10
                });
            }
            ViewBag.qy     = qyModel;
            ViewBag.jbsz   = qypqModel;   //基本设置
            ViewBag.plszjl = plszjlModel; //批量设置

            return(View());
        }