コード例 #1
0
ファイル: LEDData.cs プロジェクト: zeqp/ZEQP.LED
        public static List <V_InOrder> GetInOrder()
        {
            var       connStr = ConfigurationManager.ConnectionStrings["oracle"].ConnectionString;
            DataTable dt      = new DataTable();

            using (var conn = new OracleConnection(connStr))
            {
                var adp = new OracleDataAdapter("select * from v_inorder", conn);
                adp.Fill(dt);
            }
            var result = new List <V_InOrder>();

            foreach (DataRow row in dt.Rows)
            {
                var item = new V_InOrder();
                item.Seq       = int.Parse(row["序号"].ToString());
                item.Type      = row["类型"].ToString();
                item.Code      = row["物料编号"].ToString();
                item.ProjectNo = row["项目号"].ToString();
                item.Count     = int.Parse(row["入库数量"].ToString());
                item.Total     = int.Parse(row["库存数量"].ToString());
                item.BoxNo     = row["箱号"].ToString();
                item.OrderTime = DateTime.Parse(row["入库时间"].ToString());
                result.Add(item);
            }
            return(result);
        }
コード例 #2
0
ファイル: LEDService.cs プロジェクト: zeqp/ZEQP.LED
 private void GetData()
 {
     try
     {
         var rand          = new Random();
         var now           = DateTime.Now;
         var listProjectNo = new List <string>();
         for (int i = 0; i < 3; i++)
         {
             listProjectNo.Add($"{rand.Next(now.Year - 2, now.Year + 1).ToString().Substring(2)}CTSF0{rand.Next(1, 99).ToString().PadLeft(2, '0')}");
         }
         var listInOrder = new List <V_InOrder>();
         for (int i = 0; i < 18; i++)
         {
             var inData = new V_InOrder()
             {
                 Seq = i, Type = "入库", Code = $"A01202090{rand.Next(101, 379)}", ProjectNo = listProjectNo[i % 3], Count = 1, Total = rand.Next(1, 5), BoxNo = $"B01-020{rand.Next(1, 7)}{rand.Next(1, 16).ToString().PadLeft(2, '0')}", OrderTime = DateTime.Now.AddHours(-2).AddMinutes(rand.Next(1, 80))
             };
             listInOrder.Add(inData);
         }
         //var inOrder = LEDData.GetInOrder();
         //this.Log.Info("入库数据:\r\n" + JsonConvert.SerializeObject(inOrder));
         var inGroup = LEDData.Convert(listInOrder);
         foreach (var item in inGroup)
         {
             this.QueueData.Enqueue(item);
         }
         //var outOrder = LEDData.GetOutOrder();
         //this.Log.Info("出库数据:\r\n" + JsonConvert.SerializeObject(outOrder));
         var listOutOrder = new List <V_OutOrder>();
         for (int i = 0; i < 18; i++)
         {
             var outData = new V_OutOrder()
             {
                 Seq = i, Type = "出库", Code = $"A01202090{rand.Next(101, 379)}", ProjectNo = listProjectNo[i % 3], Count = 1, Total = rand.Next(1, 5), BoxNo = $"B01-020{rand.Next(1, 7)}{rand.Next(1, 16).ToString().PadLeft(2, '0')}", OrderTime = DateTime.Now.AddHours(-2).AddMinutes(rand.Next(1, 80))
             };
             listOutOrder.Add(outData);
         }
         var outGroup = LEDData.Convert(listOutOrder);
         foreach (var item in outGroup)
         {
             this.QueueData.Enqueue(item);
         }
     }
     catch (Exception ex)
     {
         this.Log.Error("获取数据出错", ex);
     }
 }