Ejemplo n.º 1
0
        public DTOResponse InsertTaskStat(INF_JOBFEEDBACKEntity jobFeedBack)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                TaskStatEntity projTaskstatEntity = new TaskStatEntity();
                projTaskstatEntity.TASKNO        = jobFeedBack.JOBID;
                projTaskstatEntity.STATITEMNAME  = jobFeedBack.FEEDBACKSTATUS;
                projTaskstatEntity.STATITEMDESC  = jobFeedBack.FEEDBACKSTATUS;
                projTaskstatEntity.STATITEMVALUE = "0";
                projTaskstatEntity.CREATETIME    = Utils.GetDatetime();
                projTaskstatEntity.P01           = jobFeedBack.ENTERDATE;
                projTaskstatEntity.P02           = Utils.GetDatetime();
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                    dbConn.Save <TaskStatEntity>(projTaskstatEntity, false);
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "保存 PROJ_TASKSTAT成功!";
                DCSInfService.logger.Info((object)dtoResponse);
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                DCSInfService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 2
0
        public DTOResponse SetP01(LocationStnRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConnection = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    using (IDbTransaction trans = dbConnection.OpenTransaction())
                    {
                        request.CONTROLMODE = 1;
                        dtoResponse         = this.SetP01(request, dbConnection, trans);
                        if (dtoResponse.IsSuccess)
                        {
                            trans.Commit();
                        }
                        else
                        {
                            trans.Rollback();
                        }
                        return(dtoResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 3
0
        public DTOResponse GetList(MsgRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                string   str1 = (string)null;
                string   str2 = (string)null;
                DateTime dt1;
                DateTime dt2;
                if (!string.IsNullOrEmpty(request.datetimerange) && request.datetimerange.Length > 10)
                {
                    string s1 = request.datetimerange.Substring(0, 10);
                    string s2 = request.datetimerange.Substring(13, 10);
                    DateTime.TryParse(s1, out dt1);
                    DateTime.TryParse(s2, out dt2);
                    str1 = dt1.ToString("yyyy-MM-dd HH:mm:ss");
                    str2 = dt2.ToString("yyyy-MM-dd HH:mm:ss");
                }
                else
                {
                    DateTime today = DateTime.Today;
                    dt1   = today.AddDays(-7.0);
                    today = DateTime.Today;
                    dt2   = today.AddDays(1.0);
                    str1  = dt1.ToString("yyyy-MM-dd HH:mm:ss");
                    str2  = dt2.ToString("yyyy-MM-dd HH:mm:ss");
                }
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <SysAlterInfoEntity> expression = dbConn.From <SysAlterInfoEntity>();
                    expression.And((Expression <Func <SysAlterInfoEntity, bool> >)(x => x.CREATEDATETIME >= dt1 && x.CREATEDATETIME <= dt2));
                    if (!string.IsNullOrEmpty(request.MSGTEXT))
                    {
                        expression.And((Expression <Func <SysAlterInfoEntity, bool> >)(x => x.MSGTEXT.Contains(request.MSGTEXT)));
                    }
                    if (!string.IsNullOrEmpty(request.MSGTYPE) && request.MSGTYPE != "0")
                    {
                        expression.And((Expression <Func <SysAlterInfoEntity, bool> >)(x => x.MSGTYPE == request.MSGTYPE));
                    }
                    if (!string.IsNullOrEmpty(request.MSGSTATE))
                    {
                        expression.And((Expression <Func <SysAlterInfoEntity, bool> >)(x => x.MSGSTATE == request.MSGSTATE));
                    }
                    long num = dbConn.Count <SysAlterInfoEntity>(expression);
                    List <SysAlterInfoEntity> list = dbConn.Select <SysAlterInfoEntity>(expression).OrderByDescending <SysAlterInfoEntity, long>((Func <SysAlterInfoEntity, long>)(x => x.ID)).ToList <SysAlterInfoEntity>().Skip <SysAlterInfoEntity>((request.page - 1) * request.limit).Take <SysAlterInfoEntity>(request.limit).ToList <SysAlterInfoEntity>();
                    dtoResponse.TotalCount   = num;
                    dtoResponse.ResultObject = (object)list;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                MsgService.logger.Error((object)ex);
            }
            return(dtoResponse);
        }
Ejemplo n.º 4
0
        public static bool CheckSysScenceOrderDcsState()
        {
            bool ifOrder = false;

            try
            {
                SysSceneEntity sysScene = null;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    sysScene = dbConn.Select <SysSceneEntity>(x => x.SCENESTATE == "1").FirstOrDefault();
                }
                if (sysScene != null)
                {
                    if (sysScene.ORDERDCSSTATE == 1)
                    {
                        ifOrder = true;
                    }
                }
                return(ifOrder);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public DTOResponse SaveSysparams(BasicRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                SysParams entity = HelperSerializer.GetObjectFromJsonString <SysParams>(request.PostData);
                if (entity == null)
                {
                    throw new Exception("传入的参数无法解析!");
                }

                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <SysParams> expression1 = dbConn.From <SysParams>();
                    expression1.Where(x => x.ID == entity.ID);
                    expression1.UpdateFields.Add("PARAVALUE");

                    int count1 = dbConn.UpdateOnly <SysParams>(entity, expression1);
                    dtoResponse.TotalCount = count1;
                    dtoResponse.IsSuccess  = count1 == 1 ? true : false;

                    //dtoResponse.IsSuccess = dbConn.Update<SysParams>(entity);
                    dtoResponse.MessageText = "操作完成:" + dtoResponse.IsSuccess;
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 6
0
        public DTOResponse OrderSenceMode(SceneRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConnection = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    using (IDbTransaction trans = dbConnection.OpenTransaction())
                    {
                        dtoResponse = this.OrderSenceMode(request, dbConnection, trans);
                        if (dtoResponse.IsSuccess)
                        {
                            trans.Commit();
                        }
                        else
                        {
                            trans.Rollback();
                        }
                        SysSceneService.logger.Info((object)dtoResponse.ToString());
                        return(dtoResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                SysSceneService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 7
0
        public DTOResponse SaveEntity(SceneRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                SysSceneEntity uldScene = JsonSerializer.DeserializeFromString <SysSceneEntity>(request.PostData);
                if (request.PostData == null)
                {
                    dtoResponse.IsSuccess   = false;
                    dtoResponse.MessageText = "传入的数据为空!";
                    return(dtoResponse);
                }
                int num = 0;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                    num = dbConn.Update <SysSceneEntity>(uldScene, (Action <IDbCommand>)null);
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "保存数据操作成功!" + num.ToString();
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                SysSceneService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 8
0
        Product IProductDataService.GetProduct(int productID)
        {
            using (var connection = new SqlConnection(HelperConnection.Connection()))
            {
                Product product = new Product();

                connection.Open();
                var command = new SqlCommand("[dbo].[usp_ProductById_GETI]", connection)
                {
                    CommandType = CommandType.StoredProcedure
                };

                command.Parameters.Add(new SqlParameter("@ProductId", productID));

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        product.ProductID       = Convert.ToInt32(reader["ProductID"]);
                        product.ProductName     = reader["ProductName"].ToString();
                        product.UnitPrice       = Convert.ToDecimal(reader["UnitPrice"]);
                        product.QuantityPerUnit = reader["QuantityPerUnit"].ToString();
                    }
                }
                return(product);
            }
        }
Ejemplo n.º 9
0
        public DTOResponse GetList(LocationStnRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <LocStationInfoEntity> expression = dbConn.From <LocStationInfoEntity>();
                    if (!string.IsNullOrEmpty(request.STATIONTYPE) && request.STATIONTYPE != "0")
                    {
                        expression.And(x => x.STATIONTYPE == request.STATIONTYPE);
                    }

                    if (!string.IsNullOrEmpty(request.TECHNO) && request.TECHNO != "000")
                    {
                        expression.And(x => x.TECHNO == request.TECHNO);
                    }

                    List <LocStationInfoEntity> list = dbConn.Select <LocStationInfoEntity>(expression).OrderBy <LocStationInfoEntity, string>((Func <LocStationInfoEntity, string>)(x => x.ID)).ToList <LocStationInfoEntity>();

                    dtoResponse.ResultObject = (object)list;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
            }
            return(dtoResponse);
        }
Ejemplo n.º 10
0
        public DTOResponse GetList(PalletRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <PalletEntity> expression = dbConn.From <PalletEntity>();

                    if (!string.IsNullOrEmpty(request.STOCKNO))
                    {
                        expression.And(x => x.STOCKNO == request.STOCKNO);
                    }
                    if (!string.IsNullOrEmpty(request.GROUPNO))
                    {
                        expression.And(x => x.GROUPNO == request.GROUPNO);
                    }
                    if (!string.IsNullOrEmpty(request.LOCATIONNO))
                    {
                        expression.And(x => x.LOCATIONNO == request.LOCATIONNO);
                    }
                    if (!string.IsNullOrEmpty(request.PALLETNO))
                    {
                        expression.And(x => x.PALLETNO == request.PALLETNO);
                    }

                    if (!string.IsNullOrEmpty(request.STATE))
                    {
                        expression.And(x => x.STATE == int.Parse(request.STATE));
                    }

                    if (!string.IsNullOrEmpty(request.PLANNO))
                    {
                        expression.And(x => x.PLANNO == request.PLANNO);
                    }

                    long count = dbConn.Count <PalletEntity>(expression);
                    List <PalletEntity> entityList = dbConn.Select <PalletEntity>(expression)
                                                     .OrderBy(x => x.ID)
                                                     .Skip((request.page - 1) * request.limit)
                                                     .Take(request.limit)
                                                     .ToList();
                    dtoResponse.TotalCount   = count;
                    dtoResponse.ResultObject = (object)entityList;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 11
0
        public DTOResponse GetList <T>(DCSInfRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    string str1 = typeof(T).Name.Replace("Entity", "");
                    string str2 = "SELECT * FROM " + str1;
                    string str3 = " WHERE 1=1";
                    if (!string.IsNullOrEmpty(request.EQUIPMENTID) && str1 != "INF_JOBFEEDBACK")
                    {
                        str3 += string.Format(" AND EQUIPMENTID='{0}'", (object)request.EQUIPMENTID);
                    }
                    if (!string.IsNullOrEmpty(request.STATUS))
                    {
                        str3 += string.Format(" AND STATUS={0}", (object)request.STATUS);
                    }
                    if (!string.IsNullOrEmpty(request.JOBID))
                    {
                        str3 += string.Format(" AND JOBID='{0}'", (object)request.JOBID);
                    }
                    if (!string.IsNullOrEmpty(request.CREATEDATE))
                    {
                        DateTime dt1;
                        if (DateTime.TryParse(request.CREATEDATE, out dt1))
                        {
                            str3 += string.Format(" AND CREATEDATE LIKE '{0}%'", dt1.ToString("yyyy-MM-dd"));
                        }
                        else
                        {
                            dt1   = System.DateTime.Today;
                            str3 += string.Format(" AND CREATEDATE LIKE '{0}%'", dt1.ToString("yyyy-MM-dd"));
                        }
                    }

                    string str4 = " ORDER BY AUTOID DESC,CREATEDATE DESC";
                    long   num  = dbConn.Count <T>();
                    string sql  = str2 + str3 + str4;
                    DCSInfService.logger.Debug((object)sql);
                    List <T> list = Enumerable.ToList <T>(Enumerable.Take <T>(Enumerable.Skip <T>(dbConn.Select <T>(sql), (request.page - 1) * request.limit), request.limit));
                    dtoResponse.TotalCount   = num;
                    dtoResponse.ResultObject = (object)list;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                DCSInfService.logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 12
0
        public DTOResponse GetList(PlanDetailRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <PlanDetailEntity> expression = dbConn.From <PlanDetailEntity>();

                    if (request.LINESTATE != null)
                    {
                        expression.And(x => x.LINESTATE == request.LINESTATE);
                    }
                    if (request.PLANTYPE != null)
                    {
                        expression.And(x => x.PLANTYPE == request.PLANTYPE);
                    }

                    if (!string.IsNullOrEmpty(request.PRODUCTTYPE) && request.PRODUCTTYPE != "0")
                    {
                        expression.And(x => x.PRODUCTTYPE == request.PRODUCTTYPE);
                    }
                    if (!string.IsNullOrEmpty(request.PRODUCTNO) && request.PRODUCTNO != "0")
                    {
                        expression.And(x => x.PRODUCTNO == request.PRODUCTNO);
                    }
                    if (!string.IsNullOrEmpty(request.PRODUCTNAME))
                    {
                        expression.And(x => x.PRODUCTNAME.Contains(request.PRODUCTNAME));
                    }

                    long count = dbConn.Count <PlanDetailEntity>(expression);
                    List <PlanDetailEntity> entityList = dbConn.Select <PlanDetailEntity>(expression)
                                                         .OrderByDescending(x => x.ID)
                                                         .Skip <PlanDetailEntity>((request.page - 1) * request.limit)
                                                         .Take <PlanDetailEntity>(request.limit)
                                                         .ToList <PlanDetailEntity>();
                    dtoResponse.TotalCount   = count;
                    dtoResponse.ResultObject = (object)entityList;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 13
0
        public static void AddRepositories(this IServiceCollection services, IConfiguration configuration, bool isDev)
        {
            services.AddDbContext <APINEXOSContext>(options =>
            {
                options.UseSqlServer(HelperConnection.GetConnectionSQL(configuration, isDev), sqlOptions =>
                {
                    sqlOptions.EnableRetryOnFailure(3, TimeSpan.FromSeconds(30), null);
                    sqlOptions.CommandTimeout(60);
                });
            });

            services.AddScoped(typeof(IBaseRepository <>), typeof(BaseRepository <>));
            //services.AddTransient<IInvoiceRepository, InvoiceRepository>();
        }
Ejemplo n.º 14
0
        public static void InsertAlterInfo(string msgType, string msg, string msgState = "1")
        {
            SysAlterInfoEntity projAlertinfo = new SysAlterInfoEntity();

            projAlertinfo.MSGSTATE       = msgState;
            projAlertinfo.MSGTYPE        = msgType;
            projAlertinfo.MSGTEXT        = msg;
            projAlertinfo.CREATEDATE     = Utils.GetDatetime();
            projAlertinfo.CREATEDATETIME = Utils.GetTodayDateTimeNow();
            using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
            {
                dbConn.Save <SysAlterInfoEntity>(projAlertinfo, false);
            }
        }
Ejemplo n.º 15
0
 void IProductDataService.UpdateProduct(Product product)
 {
     using (var connection = new SqlConnection(HelperConnection.Connection()))
     {
         connection.Open();
         var command = new SqlCommand("[dbo].[usp_UpdateProduct]", connection)
         {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.Add(new SqlParameter("@ProductID", product.ProductID));
         command.Parameters.Add(new SqlParameter("@ProductName", product.ProductName));
         command.Parameters.Add(new SqlParameter("@QuantityPerUnit", product.QuantityPerUnit));
         command.Parameters.Add(new SqlParameter("@UnitPrice", product.UnitPrice));
         command.ExecuteNonQuery();
     }
 }
Ejemplo n.º 16
0
        public DTOResponse GetDataFromDCS(List <long> jobidList)
        {
            DTOResponse dTOResponse = new DTOResponse();

            try
            {
                string        arg  = jobidList.ToInString();
                List <object> list = null;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory("DCS").OpenDbConnection())
                {
                    string sql = $"select wjid,rid,sc,tg,paid,st,ts,et,sct from sm_wcs_jb_ts_od where wjid in ({arg}) order by wjid,et";
                    list = dbConn.Select <object>(sql);
                }
                List <TaskStatEntity> list2 = new List <TaskStatEntity>();
                foreach (dynamic item in list)
                {
                    TaskStatEntity pROJ_TASKSTATEntity = new TaskStatEntity();
                    pROJ_TASKSTATEntity.TASKNO       = item.wjid;
                    pROJ_TASKSTATEntity.STATITEMNAME = item.paid;
                    pROJ_TASKSTATEntity.STATITEMDESC = item.rid;
                    DateTime d  = Convert.ToDateTime(item.et);
                    DateTime d2 = Convert.ToDateTime(item.sct);
                    pROJ_TASKSTATEntity.STATITEMVALUE = (d2 - d).Seconds.ToString();
                    pROJ_TASKSTATEntity.P01           = item.et;
                    pROJ_TASKSTATEntity.P02           = item.sct;
                    pROJ_TASKSTATEntity.CREATETIME    = Utils.GetDatetime();
                    list2.Add(pROJ_TASKSTATEntity);
                }
                long num = 0L;
                using (IDbConnection dbConn2 = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    num = dbConn2.SaveAll(list2);
                }
                dTOResponse.IsSuccess   = true;
                dTOResponse.MessageText = "获取tsorder成功!" + num.ToString();
                logger.Info(dTOResponse);
                return(dTOResponse);
            }
            catch (Exception ex)
            {
                dTOResponse.IsSuccess   = false;
                dTOResponse.MessageText = ex.Message;
                logger.Error(ex);
                return(dTOResponse);
            }
        }
Ejemplo n.º 17
0
        public DTOResponse SetSTATIONSTATE(LocationStnRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                int num = 0;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    using (IDbTransaction dbTransaction = dbConn.OpenTransaction())
                    {
                        LocStationInfoEntity stationinfoEntity = OrmLiteReadExpressionsApi.Single <LocStationInfoEntity>(dbConn, (Expression <Func <LocStationInfoEntity, bool> >)(x => x.STATIONNO == request.STATIONNO));
                        if (stationinfoEntity == null)
                        {
                            throw new Exception("未查询到" + request.STATIONNO + "的信息");
                        }
                        stationinfoEntity.STATIONSTATE = request.STATIONSTATE;
                        stationinfoEntity.OPBY         = SysInfo.CurrentUserName;
                        stationinfoEntity.OPDATE       = Utils.GetTodayNow();
                        stationinfoEntity.OPMESSAGE    = "设置状态!";

                        SqlExpression <LocStationInfoEntity> sqlExpression = dbConn.From <LocStationInfoEntity>();
                        sqlExpression.Where(x => x.ID == stationinfoEntity.ID);
                        sqlExpression.UpdateFields.Add("STATIONSTATE");

                        sqlExpression.UpdateFields.Add("OPBY");
                        sqlExpression.UpdateFields.Add("OPDATE");
                        sqlExpression.UpdateFields.Add("OPMESSAGE");

                        num = dbConn.UpdateOnly <LocStationInfoEntity>(stationinfoEntity, sqlExpression);

                        dbTransaction.Commit();
                    }
                }
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "设置状态成功!" + num.ToString();
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 18
0
 public static void InsertOplog(string opMessage, string keyValue = "")
 {
     try
     {
         SysOplogEntity oplog = new SysOplogEntity();
         oplog.CREATEDATE = System.DateTime.Now;
         oplog.ENTERDATE  = Utils.GetDatetime();
         oplog.KEYVALUE   = keyValue;
         oplog.OPMESSAGE  = opMessage;
         using (IDbConnection dbCon = HelperConnection.GetConnectionFactory().OpenDbConnection())
         {
             dbCon.Insert <SysOplogEntity>(oplog);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message, ex);
     }
 }
Ejemplo n.º 19
0
        public EstatisticaGestaoFamiliaViewModel GetEstatisticasByEquipes(string ibge, string sqlFiltros, int competencia)
        {
            try
            {
                string sql = _command.GetEstatisticasByEquipes;

                sql = sql.Replace(@"@filtros", sqlFiltros);
                sql = sql.Replace(@"@competencia", competencia.ToString());

                var item = HelperConnection.ExecuteCommand(ibge, conn =>
                                                           conn.QueryFirstOrDefault <EstatisticaGestaoFamiliaViewModel>(sql)
                                                           );

                return(item);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 20
0
        List <Product> IProductDataService.GetProducts(int currentPageNumber, int pageSize, string sortExpression, string sortDirection, out int totalRows)
        {
            List <Product> list = new List <Product>();
            int            i    = 0;

            using (var connection = new SqlConnection(HelperConnection.Connection()))
            {
                connection.Open();
                var command = new SqlCommand("[dbo].[usp_ProductALL_GETI]", connection)
                {
                    CommandType = CommandType.StoredProcedure
                };

                command.Parameters.Add(new SqlParameter("@PageSize", pageSize));
                command.Parameters.Add(new SqlParameter("@PageNumber", currentPageNumber - 1));
                command.Parameters.Add(new SqlParameter("@sortExpression", sortExpression));
                command.Parameters.Add(new SqlParameter("@sortDirection", sortDirection));

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            list.Add(new Product
                            {
                                ProductID       = Convert.ToInt32(reader["ProductID"]),
                                ProductName     = reader["ProductName"].ToString(),
                                UnitPrice       = Convert.ToDecimal(reader["UnitPrice"]),
                                QuantityPerUnit = reader["QuantityPerUnit"].ToString()
                            }
                                     );
                            i++;
                        }
                    }
                }
            }
            totalRows = i;
            return(list);
        }
Ejemplo n.º 21
0
        public DTOResponse GetCurrent(SceneRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    List <SysSceneEntity> uldSceneList = dbConn.Select <SysSceneEntity>((Expression <Func <SysSceneEntity, bool> >)(x => x.SCENESTATE == "1"));
                    dtoResponse.ResultObject = (object)uldSceneList;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                SysSceneService.logger.Error((object)ex);
            }
            return(dtoResponse);
        }
Ejemplo n.º 22
0
 public void Install()
 {
     try
     {
         Installer.logger.Debug((object)"创建数据库表……");
         using (IDbConnection dbCon = HelperConnection.GetConnectionFactory().OpenDbConnection())
         {
             using (IDbTransaction dbTransaction = dbCon.OpenTransaction())
             {
                 dbCon.CreateTableIfNotExists <Entitys.INVENTORY>();
                 dbTransaction.Commit();
             }
             dbCon.Close();
         }
         Installer.logger.Debug((object)"创建表结束!");
     }
     catch (Exception ex)
     {
         Installer.logger.Error((object)ex.ToString());
         throw ex;
     }
 }
Ejemplo n.º 23
0
        public DTOResponse GetList(LedInfoRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    List <INF_LEDINFOEntity> list = dbConn.Select <INF_LEDINFOEntity>().OrderBy <INF_LEDINFOEntity, int>((Func <INF_LEDINFOEntity, int>)(x => x.ID)).ToList <INF_LEDINFOEntity>();
                    dtoResponse.ResultObject = (object)list;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                LedInfoService.logger.Error((object)ex);
            }
            return(dtoResponse);
        }
Ejemplo n.º 24
0
        public DTOResponse BatchChangeUseState(LocationRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <LocDetailEntity> sqlExpression = dbConn.From <LocDetailEntity>();
                    sqlExpression.Where(x => request.ListLocatioNo.Contains(x.LOCATIONNO));
                    sqlExpression.UpdateFields.Add("USESTATE");
                    sqlExpression.UpdateFields.Add("OPBY");
                    sqlExpression.UpdateFields.Add("OPDATE");
                    sqlExpression.UpdateFields.Add("OPMESSAGE");

                    LocDetailEntity locDetailEntity = new LocDetailEntity();
                    locDetailEntity.USESTATE  = request.USESTATE;
                    locDetailEntity.OPBY      = SysInfo.GetCurrentUserInfo();
                    locDetailEntity.OPDATE    = Utils.GetTodayNow();
                    locDetailEntity.OPMESSAGE = "修改使用状态!";

                    int count = dbConn.UpdateOnly <LocDetailEntity>(locDetailEntity, sqlExpression);

                    dtoResponse.IsSuccess   = count > 0 ? true : false;
                    dtoResponse.MessageText = "操作完成,修改记录" + count.ToString() + "条 " + dtoResponse.IsSuccess.ToString();
                    HelperOplog.InsertOplog("位置使用状态更改:" + request.USESTATE + "/" + request.ListLocatioNo.ToJson());
                    HelperOplog.InsertOplog(dtoResponse);
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 25
0
        public DTOResponse GetSysparamsList(BasicRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    List <SysParams> list = dbConn.Select <SysParams>().OrderBy(x => x.ID).ToList();
                    dtoResponse.ResultObject = list;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "操作完成:" + dtoResponse.IsSuccess;
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 26
0
        public DTOResponse GetDetailList(PalletRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <PalletDetailEntity> expression = dbConn.From <PalletDetailEntity>();

                    if (request.PALLETID > -1)
                    {
                        expression.And(x => x.PALLETID == request.PALLETID);
                    }

                    long count = dbConn.Count <PalletDetailEntity>(expression);
                    List <PalletDetailEntity> entityList = dbConn.Select <PalletDetailEntity>(expression)
                                                           .OrderBy(x => x.ID)
                                                           .Skip((request.page - 1) * request.limit)
                                                           .Take(request.limit)
                                                           .ToList();

                    dtoResponse.TotalCount   = count;
                    dtoResponse.ResultObject = (object)entityList;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 27
0
        private DTOResponse GetHistoryList(TaskRequest request)
        {
            using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
            {
                DTOResponse dtoResponse = new DTOResponse();
                SqlExpression <ZHISTaskEntity> expression = dbConn.From <ZHISTaskEntity>();
                if (!string.IsNullOrEmpty(request.TASKTCLASS) && request.TASKTCLASS != "0")
                {
                    expression.And((Expression <Func <ZHISTaskEntity, bool> >)(x => x.TASKTCLASS == request.TASKTCLASS));
                }
                if (!string.IsNullOrEmpty(request.PALLETNO))
                {
                    expression.And((Expression <Func <ZHISTaskEntity, bool> >)(x => x.PALLETNO == request.PALLETNO));
                }
                if (!string.IsNullOrEmpty(request.RelateNo))
                {
                    expression.And((Expression <Func <ZHISTaskEntity, bool> >)(x => x.RELATENO == request.RelateNo));
                }

                if (!string.IsNullOrEmpty(request.SourceNo))
                {
                    expression.And((Expression <Func <ZHISTaskEntity, bool> >)(x => x.SOURCE02 == request.SourceNo));
                }
                if (!string.IsNullOrEmpty(request.DescNo))
                {
                    expression.And((Expression <Func <ZHISTaskEntity, bool> >)(x => x.DESTINATION02 == request.DescNo));
                }

                long num = dbConn.Count <ZHISTaskEntity>(expression);
                List <ZHISTaskEntity> list = dbConn.Select <ZHISTaskEntity>(expression).OrderByDescending <ZHISTaskEntity, long>((Func <ZHISTaskEntity, long>)(x => x.ID)).Skip <ZHISTaskEntity>((request.page - 1) * request.limit).Take <ZHISTaskEntity>(request.limit).ToList <ZHISTaskEntity>();
                dtoResponse.TotalCount   = num;
                dtoResponse.ResultObject = (object)list;
                dtoResponse.IsSuccess    = true;
                dtoResponse.MessageText  = "查询操作成功!";
                return(dtoResponse);
            }
        }
Ejemplo n.º 28
0
        public DTOResponse SwitchEmexitState(LocationStnRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                int num = 0;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    using (IDbTransaction dbTransaction = dbConn.OpenTransaction())
                    {
                        LocStationInfoEntity stationinfoEntity = OrmLiteReadExpressionsApi.Single <LocStationInfoEntity>(dbConn, (Expression <Func <LocStationInfoEntity, bool> >)(x => x.STATIONNO == request.STATIONNO));
                        if (stationinfoEntity == null)
                        {
                            throw new Exception("未查询到" + request.STATIONNO + "的信息");
                        }
                        stationinfoEntity.EMEXIT    = request.EMEXIT;
                        stationinfoEntity.OPBY      = SysInfo.CurrentUserName;
                        stationinfoEntity.OPDATE    = Utils.GetTodayNow();
                        stationinfoEntity.OPMESSAGE = "设置紧急出口成功!";
                        num = dbConn.Update <LocStationInfoEntity>(stationinfoEntity, (Action <IDbCommand>)null);

                        dbTransaction.Commit();
                    }
                }
                dtoResponse.IsSuccess   = true;
                dtoResponse.MessageText = "设置状态成功!" + num.ToString();
                return(dtoResponse);
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 29
0
        public DTOResponse ChangeGroupUseState(LocationRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    LocGroupEntity entity = dbConn.Select <LocGroupEntity>(x => x.GROUPNO == request.GROUPNO).FirstNonDefault();
                    if (entity == null)
                    {
                        throw new Exception(request.LOCATIONNO + "位置不存在!");
                    }
                    entity.USESTATE  = int.Parse(request.USESTATE);
                    entity.OPBY      = SysInfo.GetCurrentUserInfo();
                    entity.OPDATE    = Utils.GetTodayNow();
                    entity.OPMESSAGE = "修改使用状态!";
                    int count = dbConn.UpdateOnly <LocGroupEntity>(
                        entity,
                        new string[4] {
                        "USESTATE", "OPBY", "OPDATE", "OPMESSAGE"
                    },
                        (x => x.GROUPNO == request.GROUPNO));
                    dtoResponse.IsSuccess   = count > 0 ? true : false;
                    dtoResponse.MessageText = "操作成功!" + count.ToString();
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Ejemplo n.º 30
0
        public DTOResponse GetkanbanInfo(LedInfoRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();
            string      reportno    = request.REPORTNO;
            Report      report      = HelperDbOperation.Select <Report>((Expression <Func <Report, bool> >)(x => x.REPORTNO == reportno)).First <Report>();

            if (report != null)
            {
                string datasource = report.DATASOURCE;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    List <object> objectList = dbConn.Select <object>(datasource);
                    dtoResponse.ResultObject = (object)objectList;
                    dtoResponse.IsSuccess    = true;
                    dtoResponse.MessageText  = "查询操作成功!";
                    return(dtoResponse);
                }
            }
            else
            {
                dtoResponse.IsSuccess = false;
                return(dtoResponse);
            }
        }