Beispiel #1
0
        private void Srv_OrderStateChangeEvent(OrderItem arg1, OrderServiceEnum arg2, int arg3)
        {
            Redis.RedisHelper <OrderItem> redisHelper = new Redis.RedisHelper <OrderItem>();

            if (arg1 == null)
            {
                var count = redisHelper.GetAll().Count(d => d.State == OrderItemStateEnum.DOWORK);
                if (count >= 2)
                {
                    var obj = redisHelper.GetAll().Where(d => d.State == OrderItemStateEnum.DOWORK).OrderBy(d => d.CreateDateTime).FirstOrDefault();

                    if (obj != null)
                    {
                        obj.State = OrderItemStateEnum.DONE;
                        redisHelper.Update(obj);
                        redisHelper.Push(obj.Id);
                        logger.Info("【OrderStateChange】=>DoWork=>DONE" + obj.ToString());
                        ShowMessageEvent?.Invoke("【OrderStateChange】=>DoWork=>DONE" + obj.ToString());
                    }
                }
                return;
            }
            redisHelper.Update(arg1);
            redisHelper.Push(arg1.Id);
            logger.Info("【OrderStateChange】=" + arg1.ToString());
            ShowMessageEvent?.Invoke("【OrderStateChange】" + arg1.ToString());
        }
Beispiel #2
0
        private static OrderItem Srv_GetFirstOrderEvent(OrderServiceEnum arg)
        {
            Console.WriteLine($"==============GetFirstOrder==============Start============={DateTime.Now.ToString()}");

            var ram   = new Random();
            var count = ram.Next(10, 50);

            return(new OrderItem {
                Id = "test", CreateDateTime = DateTime.Now, Type = 1, State = OrderItemStateEnum.NEW, Quantity = count
            });
        }
Beispiel #3
0
        private OrderItem Srv_GetFirstOrderEvent(OrderServiceEnum arg)
        {
            Redis.RedisHelper <OrderItem> redisHelper = new Redis.RedisHelper <OrderItem>();
            var obj = redisHelper.GetAll().Where(d => d.State == OrderItemStateEnum.NEW).OrderBy(d => d.CreateDateTime).FirstOrDefault();

            if (obj != null)
            {
                logger.Info("【GetFirstOrder】" + obj.ToString());
                ShowMessageEvent?.Invoke("【GetFirstOrder】" + obj.ToString());
            }

            return(obj);
        }
Beispiel #4
0
        private void Srv_UpdateOrderActualQuantityEvent(OrderServiceEnum arg1, int arg2)
        {
            Redis.RedisHelper <OrderItem> redisHelper = new Redis.RedisHelper <OrderItem>();
            var obj = redisHelper.GetAll().Where(d => d.State == OrderItemStateEnum.DOWORK).OrderBy(d => d.CreateDateTime).FirstOrDefault();

            if (obj != null && obj.ActualQuantity != arg2)
            {
                obj.ActualQuantity = arg2;
                redisHelper.Update(obj);
                redisHelper.Push(obj.Id);
                logger.Info("【UpdateOrderActualQuantity】" + obj.ToString());
                ShowMessageEvent?.Invoke("【UpdateOrderActualQuantity】" + obj.ToString());
            }
        }
Beispiel #5
0
 public BaseOrderService(OrderServiceEnum orderServiceEnum)
 {
     ServiceEnum = orderServiceEnum;
 }
Beispiel #6
0
 public TestOrderService(OrderServiceEnum serviceEnum) : base(serviceEnum)
 {
 }
Beispiel #7
0
 public OrderRobotDistributionService(OrderServiceEnum serviceEnum) : base(serviceEnum)
 {
 }