public List<WorkDetailInfoEntity> GetAllWorkOrder(OrderClause clause)
        {
            var schem = ConfigureManager.Logsever.ProvinceConfig.DefaultSchem;

            if (GetFilter().ProvinceId != 0)
            {
                var helperDal = new HelperDal();
                schem = helperDal.GetDbUser(Convert.ToInt32(GetFilter().ProvinceId));
            }
            var subGroups =
                QueryBySql<WorkSubItemGroupEntity>(GetPageSql(string.Format(
                    @" select distinct t.id,t.work_id,t.group_name,t.create_date,r.build_auid,count(1) over() recordCount  from {0}.work_sub_item_group t left join work_report_building r on t.work_id=r.work_id and t.id=r.s_group_id where t.WORK_ID like '%{1}%'
              group by t.work_id,t.group_name,t.create_date,t.id,r.build_auid order by t.create_date desc", schem, clause.WorkId),
                    clause));
            if (subGroups.Count > 0)
            {
                var workOrders =
                    QueryBySql<WorkDetailInfoEntity>(
                        string.Format("select * from {1}.work_detail_info t where t.work_id in ({0})",
                            string.Join(",", subGroups.GroupBy(d => d.WorkId).Select(d => d.Key)), schem));

                foreach (var workSubItemGroupEntity in subGroups)
                {
                    WorkSubItemGroupEntity entity = workSubItemGroupEntity;
                    var orders = workOrders.Where(d => d.WorkId == entity.WorkId);
                    if (orders.Any())
                    {
                        var order = orders.First();
                        if (order != null && order.WorkSubItemGroup != null)
                        {
                            LogManager.Instance.Log.Info("sss"+order.WorkId);
                            order = DeepCopy.DeepCopyEntity(order);
                            workOrders.Add(order);
                        }
                        order.WorkSubItemGroup = entity;
                        if (entity.BuildingId != null)
                        {
                            order.HaveQuality = true;
                        }
                    }
                }
                return workOrders.ToList();
            }
            return new List<WorkDetailInfoEntity>();
        }
        private string GetSchem()
        {
            var schem = ConfigureManager.Logsever.ProvinceConfig.DefaultSchem;

            if (GetFilter().ProvinceId != 0)
            {
                var helperDal = new HelperDal();
                schem = helperDal.GetDbUser(Convert.ToInt32(GetFilter().ProvinceId));
            }
            return schem;
        }
Example #3
0
 public List <string> GetTableColumns(string tablename)
 {
     return(HelperDal.GetTableColumns(tablename));
 }
Example #4
0
 public List <string> GetDBNameList()
 {
     return(HelperDal.GetDBTableName());
 }