Example #1
0
        public object SelectOrder([FromBody] SelectOrderModel sm)
        {
            try
            {
                var addr = Server.GetUserIp(Request.HttpContext);
                if (Server.IpHandle(addr) == 0)
                {
                    return(new[] { "your ip can't using our api , please contact administrator" });
                }

                var account = HttpContext.Session.GetString("user_account");

                if (account == null)
                {
                    return(new
                    {
                        result = 401,
                        msg = "not login"
                    });
                }

                var re = OrderServer.SelectOrder(sm);

                return(re);
            }
            catch (Exception e)
            {
                return(new
                {
                    result = e.HResult,
                    msg = e.Message
                });
            }
        }
Example #2
0
 public async Task <List <Orders> > GetAllOrder()
 {
     using (IOrderServer server = new OrderServer())
     {
         return(await server.QueryAll().ToListAsync());
     }
 }
 public void Init()
 {
     orderServer    = new OrderServer();
     badBook        = new OrderItem("《如何统治非洲大地》", 10, 99.8);
     goodBook       = new OrderItem("《如何不停学习》", 1, 233);
     MateBookX_2020 = new OrderItem("MateBook 991系列 9i 771 独立显卡 32G内存 ", 199999, 1);
     cjqOrder       = new Order("陈家棋", badBook, goodBook);
     cxhOrder       = new Order("陈心慧", MateBookX_2020);
     orderServer.AddOrder(cjqOrder);
 }
Example #4
0
        /// <summary>
        /// 订单条件查询
        /// </summary>
        /// <param name="PageIndex">页数(0开始为第一页)</param>
        /// <param name="PageSize">每页条数</param>
        /// <param name="strColor">颜色</param>
        /// <param name="strMaterial">材质</param>
        /// <param name="strOrderTime">订单下单时间</param>
        /// <param name="strDeliveryTime">交货时间</param>
        /// <param name="strCustomer">客户</param>
        /// <param name="strExpCountries">国家</param>
        /// [{"ID_Order":2,"OrderID":"18-35-12-1","OrderN":1847,"Size":42,"Material":4,"BaoTouL":1.2,"WeiTiaoW":1.3,"HuChiW":1.4,"XingTiN":15,"Color":3,"Customer":1,"ExpCountries":1,"KRXTM":1,"XTDH":1}]
        /// Material  1:色织布,2:帆布,3:尼龙,4:皮革,5:反毛皮,6:其他
        /// Color 1:黑色,2:白色,3:红色,4:黄,5:绿,6:紫,7:其他
        /// <returns></returns>
        /// 测试数据:/order/GetOrderByPara?PageIndex=0&PageSize=1&strColor=1&strMaterial=2&strStartOrderTime=2010-01-01&strEndOrderTime=2018-03-01&strStartDeliveryTime=2010-01-01&strEndDeliveryTime=2018-03-01&strCustomer=鳄鱼&strExpCountries=非洲
        public string GetOrderByPara(string strColor,
                                     string strMaterial, string strStartOrderTime, string strEndOrderTime,
                                     string strStartDeliveryTime, string strEndDeliveryTime, string Customer, string ExpCountries, string KeyWord, int?PageIndex = 0, int?PageSize = 5)
        {
            OrderServer oServer = new OrderServer();

            return(oServer.GetAllOrderMessageWithParameter(strColor,
                                                           strMaterial, strStartOrderTime, strEndOrderTime,
                                                           strStartDeliveryTime, strEndDeliveryTime, Customer, ExpCountries, KeyWord, PageIndex, PageSize));
        }
        public void deleteTest()
        {
            Order deleteObj = new Order("001", "A", "a", 11000);

            OrderServer.delete(deleteObj);
            List <Order> Inf2 = new List <Order>()
            {
                new Order("002", "B", "b", 9000),
                new Order("003", "C", "c", 15000),
            };

            Assert.AreEqual(Inf2, Inf2);
        }
        public void addGuestTest2()
        {
            OrderServer.addGuest("", "", "", 0);
            List <Order> Inf2 = new List <Order>()
            {
                new Order("001", "A", "a", 11000),
                new Order("002", "B", "b", 9000),
                new Order("003", "C", "c", 15000),
                new Order("", "", "", 0)
            };

            Assert.AreEqual(Inf2, Inf2);
        }
        public void modifyOrderTest2()
        {
            Order modifyObj = new Order("", "", "", 0);

            OrderServer.modifyOrder(modifyObj, "dsg", "fsd", "sdf", 10000000);
            List <Order> Inf2 = new List <Order>()
            {
                new Order("001", "A", "a", 11000),
                new Order("002", "B", "b", 9000),
                new Order("003", "C", "c", 15000),
            };

            Assert.AreEqual(Inf2, Inf2);
        }
Example #8
0
 public static int InsertOrder(string OrderID, int Table)
 {
     return(OrderServer.InsertOrder(OrderID, Table));
 }
Example #9
0
 public static object SelectFNumBer(string OrderId, string FName)
 {
     return(OrderServer.SelectFNumBer(OrderId, FName));
 }
Example #10
0
 public static int InsertSpicyInfo(string OrderId, string FName, int FNumber, string Spicy)
 {
     return(OrderServer.InsertSpicyInfo(OrderId, FName, FNumber, Spicy));
 }
        public Boolean SendOrder(OrderServer orderServer)
        {
            if (IsDone())
            {
                return true;
            }

            if (!IsSendAgainCondition())
            {
                return false;
            }
            ResetConditions();

            // cancel again
            String code = _order.Code;

            if (_order.TargetAccount.LineType == Account.OrderLineType.FutureOptionSpreadLine)
            {
                orderServer.SendCancel_FO(_accountName, _password, code, "" + _order.OrderNumber, "" + _order.ReqCount);
                _sendCount++;
                logger.Debug("SendCancel_FO {0}, {1}, Order#({2}), {3}, send count({4})",
                    _accountName,
                    code,
                    _order.OrderNumber,
                    _order.ReqCount,
                    _sendCount);

                SoundManager.Ins().PlayContractSound();

            }
            else if (_order.TargetAccount.LineType == Account.OrderLineType.StockSpotLine)
            {
                orderServer.SendCancel(_accountName, _password, code, "" + _order.OrderNumber, "0");
                _sendCount++;
                logger.Debug("SendCancel {0}, {1}, Order#({2}), {3}, send count({4})",
                    _accountName,
                    code,
                    _order.OrderNumber,
                    "0",
                    _sendCount);

                SoundManager.Ins().PlayContractSound();
            }
            else
            {
                logger.Error("Unknown type");
                Util.KillWithNotice("Unknown type");
            }
            return false;
        }
Example #12
0
 public static int InsertPayInfo(int TableId, string OrderId, decimal Price, DateTime PayTime, string Remarks, bool IsPay)
 {
     return(OrderServer.InsertPayInfo(TableId, OrderId, Price, PayTime, Remarks, IsPay));
 }
        private void Ex()
        {
            string lightIsAlwaysOnString = string.Empty;

            var terminalInfo = this.Argu as Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase;

            if (terminalInfo == null)
            {
                LogInfo.Log("无法执行关灯命令,参数错误....");
                return;
            }
            //西安 特殊功能   城市代号为5 lvf 2018年4月12日13:07:15
            if (Wlst.Sr.EquipmentInfoHolding.Services.Others.CityNum == 5)
            {
                var areaId = Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(terminalInfo.RtuId);

                if (LoopId == 0)
                {
                    for (int i = 1; i < 9; i++)
                    {
                        var tmp =
                            Wlst.Sr.TimeTableSystem.Services.WeekTimeTableInfoService.
                            GetTmlLoopBandTimeTableTodayOpenCloseTimex
                                (areaId, terminalInfo.RtuId, i);

                        if (tmp != null)
                        {
                            if (tmp.TimeOnOff[0].Item2 == 1500)
                            {
                                lightIsAlwaysOnString = terminalInfo.RtuName + " 有长明灯K" + i + "回路 " + terminalInfo.GetLoopName(i);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    var tmp =
                        Wlst.Sr.TimeTableSystem.Services.WeekTimeTableInfoService.
                        GetTmlLoopBandTimeTableTodayOpenCloseTimex
                            (areaId, terminalInfo.RtuId, LoopId);

                    if (tmp != null)
                    {
                        if (tmp.TimeOnOff[0].Item2 == 1500)
                        {
                            lightIsAlwaysOnString = terminalInfo.RtuName + " 有长明灯K" + LoopId + "回路 " +
                                                    terminalInfo.GetLoopName(LoopId);
                        }
                    }
                }
            }


            if (Wlst.Sr.EquipmentInfoHolding.Services.Others.CloseLightSecondConfirm == 0)
            {
                if (lightIsAlwaysOnString != string.Empty)
                {
                    if (
                        Cr.MessageBoxOverride.MessageBoxOverride.WlstMessageBox.View.WlstMessageBox.Show(
                            "您将要对 (" + terminalInfo.RtuPhyId + " - " + terminalInfo.RtuName + ") 进行关灯操作,是否继续?\n" + lightIsAlwaysOnString, WlstMessageBoxType.YesNo) ==
                        WlstMessageBoxResults.No)
                    {
                        return;
                    }
                }
            }
            else if (Wlst.Sr.EquipmentInfoHolding.Services.Others.CloseLightSecondConfirm == 1)
            {
                if (
                    Cr.MessageBoxOverride.MessageBoxOverride.WlstMessageBox.View.WlstMessageBox.Show(
                        "您将要对 (" + terminalInfo.RtuPhyId + " - " + terminalInfo.RtuName + ") 进行关灯操作,是否继续?\n" + lightIsAlwaysOnString, WlstMessageBoxType.YesNo) ==
                    WlstMessageBoxResults.No)
                {
                    return;
                }
            }
            else if (Wlst.Sr.EquipmentInfoHolding.Services.Others.CloseLightSecondConfirm == 2)
            {
                var sss = UMessageBoxWantPassWord.Show("密码验证", "请输入您的用户密码\n" + lightIsAlwaysOnString, "");
                if (sss == UMessageBoxWantPassWord.CancelReturn)
                {
                    return;
                }
                if (sss != UserInfo.UserLoginInfo.UserPassword)
                {
                    UMessageBox.Show("验证失败", "您输入的密码与本用户密码不匹配,请检查......",
                                     UMessageBoxButton.Yes);
                    return;
                }
            }


            var rtuId = terminalInfo.RtuId;

            if (rtuId < 1)
            {
                return;
            }
            OrderServer.CloseLight(terminalInfo.RtuId, LoopId, lightIsAlwaysOnString != string.Empty ? true : false);

            //var args = new PublishEventArgs
            //{
            //    EventType = PublishEventType.Core,
            //    EventId = Sr.EquipmentInfoHolding.Services.EventIdAssign.UserOperateRtu,
            //};
            //args.AddParams(rtuId);
            //args.AddParams(OpType.RtuClose);
            //args.AddParams(LoopId);
            //args.AddParams(terminalInfo.RtuModel);
            //args.AddParams(null);
            //EventPublish.PublishEvent(args);

            //var arg = new List<int>();
            //arg.Add(rtuId);
            //var data = new OpenCloseLightData();
            //data.Open = 0; //# 开关灯指令 0 关 1 开
            //data.Loops.Add(LoopId);
            //int gid = Infrastructure.UtilityFunction.TickCount.EnvironmentTickCount;
            //SndOrderServer .OrderSnd(PPProtocol.EventIdAssign.CloseLight, arg, data, gid);
            //Wlst.Cr.Core.UtilityFunction.LogInfo.Log(terminalInfo .RtuName  + "  关K" + LoopId + ",关灯命令已经发送");
            // Wlst.Cr.CoreMims.ShowMsgInfo.ShowNewMsg.AddNewShowMsg(rtuId, terminalInfo.RtuName, LoopId,
            //                                                               PPProtocol.EventIdAssign.CloseLight , "关灯",
            //                                                               "等待", 1, null);
        }
Example #14
0
 public static int UpdateSpicyFNumber(int FNumber, string OrderId, string FName, int oldFNumber)
 {
     return(OrderServer.UpdateSpicyFNumber(FNumber, OrderId, FName, oldFNumber));
 }
Example #15
0
 public static object selectFName(string OrderId, string FName)
 {
     return(OrderServer.selectFName(OrderId, FName));
 }
Example #16
0
        public Order GetOrder()
        {
            Order o = new Order();

            if (!IsNullOrEmpty(OrderUser))
            {
                try
                {
                    if (DB.CurrentDB != DataBases.OrientDB)//This if only for OrientDB
                    {
                        o.UID = Convert.ToInt32(OrderUser);
                    }
                    else
                    {
                        if (!new Regex(@"-?\d+:-?\d+").IsMatch(OrderUser))
                        {
                            throw new Exception();
                        }
                        var arr = OrderUser.Split(new[] { ':' });
                        o.UID     = Convert.ToInt32(arr[0]);
                        o.UID_pos = Convert.ToInt32(arr[1]);
                    }
                }
                catch (Exception)
                {
                    ShowErrorMessage("User ID is not valid!");
                    return(null);
                }
            }
            else
            {
                o.UID = null;
            }
            if (!IsNullOrEmpty(OrderServer))
            {
                try
                {
                    if (DB.CurrentDB != DataBases.OrientDB)//This if only for OrientDB
                    {
                        o.SID = Convert.ToInt32(OrderServer);
                    }
                    else
                    {
                        if (!new Regex(@"-?\d+:-?\d+").IsMatch(OrderServer))
                        {
                            throw new Exception();
                        }
                        var arr = OrderServer.Split(new[] { ':' });
                        o.SID     = Convert.ToInt32(arr[0]);
                        o.SID_pos = Convert.ToInt32(arr[1]);
                    }
                }
                catch (Exception)
                {
                    ShowErrorMessage("Server ID is not valid!");
                    return(null);
                }
            }
            else
            {
                o.SID = null;
            }

            if (IsOrderFromSelected)
            {
                o.DateFrom = OrderFrom;
            }
            else
            {
                o.DateFrom = null;
            }

            if (IsOrderToSelected)
            {
                o.DateTo = OrderTo;
            }
            else
            {
                o.DateTo = null;
            }

            return(o);
        }
Example #17
0
        void InitOrderServer()
        {
            while (true)
            {
                _orderServer = new OrderServer();
                _orderServer.SetMainDir("C:\\PowerBase");
                _orderServer.ConnectDataCenter("", "");

                if (_orderServer.IsConnected())
                {
                    break;
                }
                else
                {
                    logger.Warn("OrderServer false!!!!");
                    System.Threading.Thread.Sleep(1);
                }
            }
        }
        public Boolean SendOrder(OrderServer orderServer)
        {
            if (IsDone())
            {
                return true;
            }

            if (!IsSendAgainCondition())
            {
                return false;
            }
            ResetConditions();

            if (_sendCount >= 3)
            {
                // 3번 넘게 했다? 분명 이상하다. 그냥 멈춰버리자.
                logger.Error("Same order 3 times");
                Util.KillWithNotice("Same order 3 times");
                return false;
            }
            _sendCount++;

            // 최종적으로 한 번만 더 확인한다.
            if (!_order.TargetAccount.IsValidOrder(_order))
            {
                return false;
            }

            _order.RequestTime = DateTime.Now;

            Boolean bLongPosition = _order.LongShort == TradingDirection.Long ? true : false;

            if (_order.TargetAccount.LineType == Account.OrderLineType.FutureOptionSpreadLine)
            {
                String price = Convert.ToString(Math.Round(_order.ReqPrice, 2));
                String code = _order.Code;
                String quantity = Convert.ToString(_order.ReqCount);
                String traceKind = "03"; // 기타
                String callCondition = "00"; // 지정가

                if (bLongPosition)
                {
                    orderServer.SendBuy_FO(_accountName, _password, code, callCondition, traceKind, price, quantity);
                    logger.Debug("SendBuy_FO {0}, {1}, {2}, {3}, price({4:n2}), count({5:n0})",
                        _accountName,
                        code,
                        callCondition,
                        traceKind,
                        price,
                        quantity);

                    SoundManager.Ins().PlayContractSound();
                }
                else
                {
                    orderServer.SendSell_FO(_accountName, _password, code, callCondition, traceKind, price, quantity);
                    logger.Debug("SendSell_FO {0}, {1}, {2}, {3}, price({4:n2}), count({5:n0})",
                        _accountName,
                        code,
                        callCondition,
                        traceKind,
                        price,
                        quantity);

                    SoundManager.Ins().PlayContractSound();
                }
            }
            else if (_order.TargetAccount.LineType == Account.OrderLineType.StockSpotLine)
            {
                String price = Convert.ToString(Math.Round(_order.ReqPrice, 0));
                String code = _order.Code;
                String quantity = Convert.ToString(_order.ReqCount);
                String callCondition = "00"; // 지정가

                if (bLongPosition)
                {
                    orderServer.SendBuy(_accountName, _password, code, "0", callCondition, quantity, price);
                    logger.Debug("SendBuy {0}, {1}, {2}, {3}, price({4:n0}), count({5:n0})",
                        _accountName,
                        code,
                        "0",
                        callCondition,
                        price,
                        quantity);

                    SoundManager.Ins().PlayContractSound();

                }
                else
                {
                    orderServer.SendSell(_accountName, _password, code, "0", callCondition, quantity, price);
                    logger.Debug("SendSell {0}, {1}, {2}, {3}, price({4:n0}), count({5:n0})",
                        _accountName,
                        code,
                        "0",
                        callCondition,
                        price,
                        quantity);

                    SoundManager.Ins().PlayContractSound();
                }
            }
            else
            {
                logger.Error("Unknown type");
                Util.KillWithNotice("Unknown type");
            }
            return false;
        }
Example #19
0
 public static List <Order> SelectSpicy(string OrderId, string FName)
 {
     return(OrderServer.SelectSpicy(OrderId, FName));
 }
Example #20
0
 public static object selectOrderId(string OrderId)
 {
     return(OrderServer.selectOrderId(OrderId));
 }
Example #21
0
 public static int DeleteSpicy(string OrderId, string FName, int FNumber)
 {
     return(OrderServer.DeleteSpicy(OrderId, FName, FNumber));
 }
Example #22
0
 public static int DeleteOrder(string OrderId, string FName)
 {
     return(OrderServer.DeleteOrder(OrderId, FName));
 }
Example #23
0
 public static int InsertOrderInfo(int TableId, string OrderId, string FName, decimal FPrice, int FNumber)
 {
     return(OrderServer.InsertOrderInfo(TableId, OrderId, FName, FPrice, FNumber));
 }
        private void Ex()
        {
            var terminalInfo = this.Argu as Wlst.Sr.EquipmentInfoHolding.Model.WjParaBase;

            if (terminalInfo == null)
            {
                LogInfo.Log("无法执行开灯命令,参数错误....");
                return;
            }

            if (Wlst.Sr.EquipmentInfoHolding.Services.Others.OpenCloseLightSecondConfirm == 1)
            {
                if (
                    Cr.MessageBoxOverride.MessageBoxOverride.WlstMessageBox.View.WlstMessageBox.Show(
                        "您将要对 (" + terminalInfo.RtuPhyId + " - " + terminalInfo.RtuName + ") 进行开灯操作,是否继续?", WlstMessageBoxType.YesNo) == WlstMessageBoxResults.No)
                {
                    return;
                }
            }
            else if (Wlst.Sr.EquipmentInfoHolding.Services.Others.OpenCloseLightSecondConfirm == 2)
            {
                var sss = UMessageBoxWantPassWord.Show("密码验证", "请输入您的用户密码", "");
                if (sss == UMessageBoxWantPassWord.CancelReturn)
                {
                    return;
                }
                if (sss != UserInfo.UserLoginInfo.UserPassword)
                {
                    UMessageBox.Show("验证失败", "您输入的密码与本用户密码不匹配,请检查......",
                                     UMessageBoxButton.Yes);
                    return;
                }
            }
            var rtuId = terminalInfo.RtuId;

            if (rtuId < 1)
            {
                return;
            }

            OrderServer.OpenLight(rtuId, LoopId);

            //var args = new PublishEventArgs
            //{
            //    EventType = PublishEventType.Core,
            //    EventId = Sr.EquipmentInfoHolding.Services.EventIdAssign.UserOperateRtu,
            //};
            //args.AddParams(rtuId);
            //args.AddParams(OpType.RtuOpen );
            //args.AddParams(LoopId);
            //args.AddParams(terminalInfo.RtuModel);
            //args.AddParams(null);
            //EventPublish.PublishEvent(args);


            //var arg = new List<int>();
            //arg.Add(rtuId);

            //var data = new OpenCloseLightData();
            //data.Open = 1; //# 开关灯指令 0 关 1 开
            //data.Loops.Add(LoopId);
            //int gid = Infrastructure.UtilityFunction.TickCount.EnvironmentTickCount;
            //SndOrderServer .OrderSnd(PPProtocol.EventIdAssign.OpenLight, arg, data, gid);
            //Wlst.Cr.Core.UtilityFunction.LogInfo.Log(terminalInfo.RtuName + "  开K" + LoopId + ",开灯命令已经发送");
            // Wlst.Cr.CoreMims.ShowMsgInfo.ShowNewMsg.AddNewShowMsg(rtuId, terminalInfo.RtuName, LoopId,
            //                                                               PPProtocol.EventIdAssign.OpenLight, "开灯",
            //                                                               "等待", 1, null);
        }
Example #25
0
 public static int UpdateMinusFNumber(string FName, string OrderId)
 {
     return(OrderServer.UpdateMinusFNumber(FName, OrderId));
 }
Example #26
0
        /// <summary>
        /// 返回订单所有数据
        /// </summary>
        /// <returns></returns>
        /// [{"ID_Order":2,"OrderID":"18-35-12-1","OrderN":1847,"Size":42,"Material":4,"BaoTouL":1.2,"WeiTiaoW":1.3,"HuChiW":1.4,"XingTiN":15,"Color":3,"Customer":1,"ExpCountries":1,"KRXTM":1,"XTDH":1}]
        /// Material  1:色织布,2:帆布,3:尼龙,4:皮革,5:反毛皮,6:其他
        /// Color 1:黑色,2:白色,3:红色,4:黄,5:绿,6:紫,7:其他
        ///  /// 测试数据:/order/GetOrder
        public string GetOrder(int PageIndex, int PageSize)
        {
            OrderServer oServer = new OrderServer();

            return(oServer.GetAllOrderMessage(PageIndex, PageSize));
        }
Example #27
0
 public static List <Order> SelectOrderInfo(string OrderId)
 {
     return(OrderServer.SelectOrderInfo(OrderId));
 }
Example #28
0
 public static int DeletePay()
 {
     return(OrderServer.DeletePay());
 }
Example #29
0
 public static int DeleteOrderAll()
 {
     return(OrderServer.DeleteOrderAll());
 }
Example #30
0
 public static object SelectIsPay(string PayId)
 {
     return(OrderServer.SelectIsPay(PayId));
 }
Example #31
0
 public static int InsertPay(string OrderId, DateTime PayTime, bool IsPay)
 {
     return(OrderServer.InsertPay(OrderId, PayTime, IsPay));
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="goodsServer"></param>
 /// <param name="mapper"></param>
 /// <param name="orderServer"></param>
 public OrderController(GoodsServer goodsServer, IMapper mapper, OrderServer orderServer)
 {
     _goodsServer = goodsServer;
     _mapper      = mapper;
     _orderServer = orderServer;
 }