Exemplo n.º 1
0
        public ActionResult gjcqDetails(int gjid)
        {
            HTYGjSearchModel model = new HTYGjSearchModel {
                gjid = gjid
            };
            var Datas    = zjSvc.GetHTYGjData(model);
            var SubDatas = gjcqRep.GetByCondition(w => w.gjid == gjid);
            HTYGjcqDetailViewModel viewModel = new HTYGjcqDetailViewModel();

            if (Datas != null && Datas.Count > 0)
            {
                var Data              = Datas.First();
                var tjjdSysDict       = sysDictService.GetDictsByKey("TJJD");
                var jzmSysDict        = sysDictService.GetDictsByKey("JZM");
                var bsfsSysDict       = sysDictService.GetDictsByKey("BSFS");
                HTYGjDTOViewModel Dto = Data.ConvertTo <HTYGjDTOViewModel>();
                if (Data.tjjd.HasValue)
                {
                    Dto.tjjd = SysDictUtility.GetKeyFromDic(tjjdSysDict, Data.tjjd.ToString());
                }
                if (Data.jzm.HasValue)
                {
                    Dto.jzm = SysDictUtility.GetKeyFromDic(jzmSysDict, Data.jzm.ToString());
                }
                if (Data.bsfs.HasValue)
                {
                    Dto.bsfs = SysDictUtility.GetKeyFromDic(bsfsSysDict, Data.bsfs.ToString());
                }
                viewModel.Data     = Dto;
                viewModel.SubDatas = SubDatas;
            }

            return(View(viewModel));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取回弹仪构件数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <HTYGjViewModel> GetHTYGjData(HTYGjSearchModel model)
        {
            string SqlWhere = string.Empty;

            List <HTYGjViewModel> Datas = new List <HTYGjViewModel>();

            using (var db = dbFactory.Open())
            {
                List <IDbDataParameter> Params = new List <IDbDataParameter>();
                if (model.gjid.HasValue)
                {
                    SqlWhere += " AND gj.id=@id ";
                    Params.Add(db.CreateParam("id", model.gjid, dbType: DbType.Int32));
                }
                if (!string.IsNullOrEmpty(model.CustomId))
                {
                    SqlWhere += " AND prog.unitcode=@unitcode ";
                    Params.Add(db.CreateParam("unitcode", model.CustomId, dbType: DbType.String));
                }
                if (!string.IsNullOrEmpty(model.AreaName))
                {
                    SqlWhere += " AND prog.area=@area ";
                    Params.Add(db.CreateParam("area", model.AreaName, dbType: DbType.String));
                }
                if (!string.IsNullOrEmpty(model.ProjectName))
                {
                    SqlWhere += " AND prog.projectname=@ProjectName ";
                    Params.Add(db.CreateParam("ProjectName", model.ProjectName, dbType: DbType.String));
                }


                string strSql = @"SELECT prog.checknum,prog.unitcode,proj.PROJECTNAME,prog.area,proj.PROJECTADDRESS,prog.testingpeople,gj.id,gj.gjcqNum,gj.gjNo,gj.gjName,gj.tjjd,gj.jzm,gj.bsfs,gj.cqqxNo,gj.thms,gj.maxTh,gj.checkTime,gj.htyType,gj.htyNo,gj.minTd,gj.gjqdTd,gj.Floor,gj.BuildingNum,gj.hnttdz,gj.hntbh,gj.hg,gj.ShiGongDuiName,gj.avgth,COUNT(img.Id) AS imgcount
FROM tab_hty_gj gj
JOIN tab_hty_programme prog ON gj.checknum=prog.checknum 
LEFT JOIN dbo.t_bp_project proj ON prog.projectnum=proj.PROJECTNUM AND prog.unitcode=proj.UNITCODE
LEFT JOIN dbo.t_hty_Image img ON  prog.checknum=img.CheckNum AND gj.gjNo=img.gjNo
WHERE 1=1 {0} 
GROUP BY prog.id,prog.checknum,prog.unitcode,proj.PROJECTNAME,prog.area,proj.PROJECTADDRESS,prog.testingpeople,gj.id,gj.gjcqNum,gj.gjNo,gj.gjName,gj.tjjd,gj.jzm,gj.bsfs,gj.cqqxNo,gj.thms,gj.maxTh,gj.checkTime,gj.htyType,gj.htyNo,gj.minTd,gj.gjqdTd,gj.Floor,gj.BuildingNum,gj.hnttdz,gj.hntbh,gj.hg,gj.ShiGongDuiName,gj.avgth";
                strSql = string.Format(strSql, SqlWhere);
                Datas  = db.Select <HTYGjViewModel>(strSql, Params).Skip(0).Take(30).ToList();
            }
            return(Datas);
        }
Exemplo n.º 3
0
        public ActionResult Searchgj(HTYGjSearchModel model)
        {
            int pos      = model.posStart.HasValue ? model.posStart.Value : 0;
            int count    = model.count.HasValue ? model.count.Value : 30;
            int pageSize = pos * count;

            DhtmlxGrid grid  = new DhtmlxGrid();
            var        Datas = zjSvc.GetHTYGjData(model);

            if (Datas.Count > 0)
            {
                var tjjdSysDict = sysDictService.GetDictsByKey("TJJD");
                var jzmSysDict  = sysDictService.GetDictsByKey("JZM");
                var bsfsSysDict = sysDictService.GetDictsByKey("BSFS");

                var allInsts = checkUnitServce.GetAllCheckUnit();
                int index    = 0;
                foreach (var item in Datas)
                {
                    DhtmlxGridRow row = new DhtmlxGridRow(item.id.ToString());
                    //row.AddCell("/ZNHTY/SearchGjcq?gjId={0}".Fmt(item.id));
                    row.AddCell((pageSize + (++index)).ToString());
                    row.AddCell(checkUnitServce.GetCheckUnitByIdFromAll(allInsts, item.unitcode));
                    row.AddCell(item.PROJECTNAME);
                    row.AddCell(item.checknum);
                    row.AddCell(item.gjNo);
                    row.AddCell(item.gjName);
                    row.AddCell(item.gjcqNum);
                    if (item.tjjd.HasValue)
                    {
                        row.AddCell(SysDictUtility.GetKeyFromDic(tjjdSysDict, item.tjjd.ToString()));
                    }
                    else
                    {
                        row.AddCell("");
                    }
                    if (item.jzm.HasValue)
                    {
                        row.AddCell(SysDictUtility.GetKeyFromDic(jzmSysDict, item.jzm.ToString()));
                    }
                    else
                    {
                        row.AddCell("");
                    }
                    if (item.bsfs.HasValue)
                    {
                        row.AddCell(SysDictUtility.GetKeyFromDic(bsfsSysDict, item.bsfs.ToString()));
                    }
                    else
                    {
                        row.AddCell("");
                    }

                    row.AddCell(item.cqqxNo);
                    row.AddCell(item.thms.HasValue ? item.thms.Value.ToString() : "");
                    row.AddCell(GetUIDtString(item.checkTime));
                    row.AddCell(item.htyNo);
                    var imgcount = item.imgcount.HasValue ? item.imgcount.Value : 0;
                    if (imgcount > 0)
                    {
                        row.AddLinkJsCell(imgcount.ToString(), "showimg(\"{0}\",\"{1}\")".Fmt(item.checknum, item.gjNo));
                    }
                    else
                    {
                        row.AddCell("0");
                    }

                    row.AddCell(new DhtmlxGridCell("编辑", false).AddCellAttribute("title", "编辑"));
                    grid.AddGridRow(row);
                }
            }
            string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

            return(Content(str, "text/xml"));
        }