Пример #1
0
        public void FollowPivotAndMuteMore(long unsignedTargetCount)
        {
            long possibleContractedCount = Math.Abs(_data.GetSignedPossibleContractedCount());

            long diff = unsignedTargetCount - possibleContractedCount;

            if (diff <= 0)
            {
                // 새로 들어갈 것이 없다.
                return;
            }

            Detail.ProductType dpt = ProductUtil.Ins().GetProductType(_data.Code);
            long count = ProductUtil.Ins().RoundProductCount(diff, dpt);

            if (count > 0)
            {
                TradingDirection longShort = _data.LongShort;
                String code = _data.Code;
                long reqCount = count;
                double reqPrice = _data.InitTargetPrice;
                RawMarketData rmd = _data.Board.GetData(code);
                RawMarketData rmdClone = rmd.Clone() as RawMarketData;

                POrder o = new POrder(longShort, code, reqCount, reqPrice, _data.Account, rmdClone);
                POrderUtil.RequestOrder(o, _data.Orders);

                _timer.Reset();
            }
        }
Пример #2
0
        public ActionResult PorderCreateRefill([Bind(Include = "POrderId,PrescriptId,PharmacyId,DateOrdered,Note,Fill,Deny,Accept")] POrder pOrder)
        {
            pOrder.DateOrdered = System.DateTime.Now;
            pOrder.Deny        = false;
            pOrder.Fill        = false;
            pOrder.Accept      = false;

            POrderFill pOrderFillCheck = new POrderFill();

            pOrderFillCheck = db.POrderFills.Where(p => p.POrder.PrescriptId == pOrder.PrescriptId).First();
            pOrder.Refill   = true;
            int pharmacy = pOrderFillCheck.POrder.PharmacyId;


            if (ModelState.IsValid)
            {
                var prectiptToUpdate = db.Prescripts.Find(pOrder.PrescriptId);
                prectiptToUpdate.Sent            = true;
                db.Entry(prectiptToUpdate).State = EntityState.Modified;
                db.POrders.Add(pOrder);
                pOrder.Prescript.Ordered = false;
                pOrder.PharmacyId        = pharmacy;
                db.SaveChanges();
                return(RedirectToAction("PatientsIndex"));
            }

            ViewBag.PharmacyId  = new SelectList(db.Pharmacies, "PharmacyId", "Name", pOrder.PharmacyId);
            ViewBag.PrescriptId = new SelectList(db.Prescripts, "PrescriptId", "DispType", pOrder.PrescriptId);
            return(View(pOrder));
        }
Пример #3
0
        private void btnPOInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                int[]       selRows   = ((GridView)grdPOrders.MainView).GetSelectedRows();
                DataRowView oPOrderID = (DataRowView)(((GridView)grdPOrders.MainView).GetRow(selRows[0]));
                int         nPOrderID = Convert.ToInt32(oPOrderID["POrderID"]);


                if (nPOrderID <= 0)
                {
                    MessageBox.Show("select an item for BC Generate", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                POrder oPOr = null;
                if (nPOrderID > 0)
                {
                    oPOr = db.POrders.FirstOrDefault(po => po.POrderID == nPOrderID);
                }

                if (oPOr != null)
                {
                    fPurchaseOrder fPO = new fPurchaseOrder();
                    fPO.PrintPOInvoice(oPOr);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
 /// <summary>
 /// 向客户端发送命令
 /// </summary>
 /// <param name="Player">目标客户端扮演的玩家</param>
 /// <param name="order">命令</param>
 public void TellClient(PPlayer Player, POrder order)
 {
     if (Player.IsUser)
     {
         TellClient(Player.IPAddress, order);
     }
 }
Пример #5
0
        public void RequestOrderIfExist()
        {
            if (IsDataCrash())
            {
                String ex = "데이터가 깨졌다.";
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
            else
            {
                LongShortCount lsc = GetLongShortCount();
                if (lsc == null)
                {
                    return;
                }

                TradingDirection longShort = lsc.LongShort;
                String code = _data.Code;
                long reqCount = (long)lsc.Count;
                RawMarketData rmd = _data.Board.GetData(code);
                RawMarketData rmdClone = rmd.Clone() as RawMarketData;
                double reqPrice = GetReqPrice(longShort, rmdClone, _data.InitTargetPrice, _data.Aging);

                POrder order = new POrder(longShort, code, reqCount, reqPrice, _data.Account, rmdClone);

                // 주문한다.
                POrderUtil.RequestOrder(order, _data.Orders);

                //aging
                _data.Aging++;
            }
        }
Пример #6
0
        public POrder GetOrder(SweepMember_Share share)
        {
            // 1. aging을 점검하고 초기 주문인지 여부를 확인한다.
            long aging = share.Aging;

            if (aging == 0)
            {
                // 최초 주문이다. InitPrice와 CodeEnterSweep을 이용하여 주문을 한다.
                ReqOrderInput_BondArb reqOrderInput = share.OrderGenInput as ReqOrderInput_BondArb;
                String code = reqOrderInput.CodeForEnterSweep;
                double reqPrice = reqOrderInput.InitReqPrice;
                long reqCount = share.TargetCount - share.ContractedCount;
                TradingDirection longShort = reqOrderInput.LongShort;
                Account account = reqOrderInput.TargetAccount;
                RawMarketData rmdClone = RmdManager.Ins().GetData(code).Clone() as RawMarketData;

                POrder order = new POrder(longShort, code, reqCount, reqPrice, account, rmdClone,
                    BondUtil.GetMarketType(code), false);

                return order;
            }
            else
            {
                logger.Warn("아직 작업중인 곳입니다.");
            }
            return null;
        }
Пример #7
0
    private void ProcessMessage(string message)
    {
        PLogger.Log("接收信息:" + message);
        List <string> messages = new List <string>(message.Split(' '));

        messages.RemoveAll((string x) => x.Equals(string.Empty));
        string[] MessageList = messages.ToArray();
        if (MessageList.Length < 1)
        {
            return;
        }
        string OrderName = MessageList[0].Split('\'')[0];

        try {
            int OrderIndex = Convert.ToInt32(MessageList[0].Split('\'')[1]);
            if (OrderIndex <= CurrentIndex)
            {
                PLogger.Log("不正当的信息:" + message);
                return;
            }
            else
            {
                CurrentIndex = OrderIndex;
            }
            POrder Order = POrder.GetOrder(OrderName);
            Order.ClientResponseAction(MessageList);
        } catch (Exception e) {
            PLogger.Log("客户端处理信息时发生错误:" + message);
            PLogger.Log(e.ToString());
        }
    }
Пример #8
0
        // GET: POrderFills/PharmacyCreate
        public ActionResult PharmacyCreate(int?id)
        {
            var manager     = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());

            var pOrders = db.POrders.Include(p => p.Pharmacy).Include(p => p.Prescript).Where(p => p.PharmacyId == currentUser.Pharmacist.PharmacyId).Where(p => p.Accept == true);

            POrder     porder = db.POrders.Find(id);
            POrderFill model  = new POrderFill();

            ViewData["porder"] = porder;

            var inventories = db.Inventories.Where(i => i.PharmacyId == currentUser.Pharmacist.PharmacyId).Where(i => i.ItemId == porder.Prescript.ItemId).Where(i => i.Amount >= porder.Prescript.Disp).ToList();

            IEnumerable <SelectListItem> selectList = from i in inventories
                                                      select new SelectListItem
            {
                Value = i.InventoryId.ToString(),
                Text  = string.Format("{0} {1} {2}", i.Brand, i.item.Name, i.DispType)
            };

            ViewBag.InventoryId = new SelectList(selectList, "Value", "Text");
            model.POrderId      = porder.POrderId;
            return(View(model));
        }
        public Boolean Contract_CallBack(POrder order)
        {
            Trace.Assert(_data.LiveOrder == order);

            if (IsOrderContracted(order) &&
                _data.CurEDoorOrderState ==
                EDoorEachMonitorEnterData.EDoorOrderState.ActiveWithoutSweeper)
            {
                // sweeper 생성하고 sweeper에게 나머지 모든일을 맡긴다.
                // 본인은 MonitorState로 간다.

                // centerData를 이렇게 가지고 오는 것이 좋지는 않지만 별수 없다.
                // sweeper를 생성해서 sweeper controller에 넣어준다.
                EDoorEachSweeperController sweeper =
                    new EDoorEachSweeperController(
                        order,
                        Parent.Parent.GetCenterData());

                // sweeper 등록
                Parent.Parent.GetSweeperController().Add(sweeper);

                _data.ClearLiveOrder();
                _monitorEnter = new MonitorState(this);
            }

            return true;
        }
Пример #10
0
 public void RemoveSweepStateOrder(POrder o)
 {
     // order가 sweeper로 가는 경우 여기서 없애준다.
     if (_liveOrders.Contains(o))
     {
         _liveOrders.Remove(o);
     }
 }
Пример #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            POrder pOrder = db.POrders.Find(id);

            db.POrders.Remove(pOrder);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #12
0
        public ActionResult Create(int?id)
        {
            Prescript prescript = db.Prescripts.Find(id);
            POrder    model     = new POrder();

            ViewBag.PharmacyId = new SelectList(db.Pharmacies, "PharmacyId", "Name");
            model.PrescriptId  = prescript.PrescriptId;
            return(View(model));
        }
Пример #13
0
 public ActionResult Edit([Bind(Include = "OrderID,OrderNo,OrderDate,Description")] POrder pOrder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pOrder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pOrder));
 }
Пример #14
0
 /// <summary>
 /// 向所有的客户端发送命令
 /// </summary>
 /// <param name="order">命令</param>
 public void TellClients(POrder order)
 {
     foreach (PClientCommander commander in CommanderList)
     {
         commander.Send(order);
     }
     if (CommanderList.Count > 0)
     {
         PThread.Delay(Config.SendDelay);
     }
 }
Пример #15
0
        public ActionResult Create([Bind(Include = "OrderID,OrderNo,OrderDate,Description")] POrder pOrder)
        {
            if (ModelState.IsValid)
            {
                db.POrders.Add(pOrder);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pOrder));
        }
Пример #16
0
 /// <summary>
 /// 向客户端发送命令
 /// </summary>
 /// <param name="IPAddress">目标客户端的IP地址</param>
 /// <param name="order">命令</param>
 public void TellClient(string IPAddress, POrder order)
 {
     foreach (PClientCommander commander in CommanderList)
     {
         if (commander.RemoteIPAddress.Equals(IPAddress))
         {
             commander.Send(order);
             break;
         }
     }
     PThread.Delay(Config.SendDelay);
 }
Пример #17
0
        public PassiveSweepState(POrder o, EDoorCenterData centerData)
        {
            _enterOrder = o;
            _enterOrder.ShortCutTargetOfContractCallBack = this;

            // 주문을 취소한다.
            _enterOrder.CancelRemains();

            // 채널을 하나 사용한다.
            // 여기서 등록한 채널은 centerData에서 알아서 완료되면 처리한다.
            centerData.IncreaseUsedChannelCount(_enterOrder);
        }
Пример #18
0
 public Boolean Contract_CallBack(POrder order)
 {
     if (this.Share.Orders.Contains(order))
     {
         // 최초 시도일 때에만 BalanceSweepUnits를 진행한다.
         if (this.Share.Aging == 0)
         {
             this.Parent.BalanceSweepUnits();
         }
         return true;
     }
     return false;
 }
Пример #19
0
        public ActionResult Create([Bind(Include = "POrderId,PrescriptId,PharmacyId,DateOrdered,Note,Fill,Deny,Accept")] POrder pOrder)
        {
            if (ModelState.IsValid)
            {
                db.POrders.Add(pOrder);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PharmacyId  = new SelectList(db.Pharmacies, "PharmacyId", "Name", pOrder.PharmacyId);
            ViewBag.PrescriptId = new SelectList(db.Prescripts, "PrescriptId", "DispType", pOrder.PrescriptId);
            return(View(pOrder));
        }
Пример #20
0
        // GET: POrders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            POrder pOrder = db.POrders.Find(id);

            if (pOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(pOrder));
        }
Пример #21
0
 /// <summary>
 /// 根据命令名返回命令
 /// </summary>
 /// <param name="OrderName">命令名</param>
 /// <returns>所查询的命令,如果命令名不存在返回null</returns>
 public static POrder GetOrder(string OrderName)
 {
     foreach (Type SubType in typeof(POrder).Assembly.GetTypes().Where((Type TempType) => TempType.IsSubclassOf(typeof(POrder))))
     {
         try {
             POrder OrderInstance = (POrder)Activator.CreateInstance(SubType);
             if (OrderInstance.Name.Equals(OrderName))
             {
                 return(OrderInstance);
             }
         } catch {
             continue;
         }
     }
     return(null);
 }
Пример #22
0
        public ActionResult Edit(POrder pOrder)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pOrder).State = EntityState.Modified;
                db.SaveChanges();

                var state = this.db.StatusOrder.Find(pOrder.IdStatusOrder);
                return(RedirectToAction("Index"));
            }

            ViewBag.IdProvider         = new SelectList(db.Provider, "Id", "Name", pOrder.IdProvider);
            ViewBag.IdPaymentCondition = new SelectList(db.PaymentCondition, "IdPaymentCondition", "ConditionName");
            ViewBag.IdStatusOrder      = new SelectList(db.StatusOrder, "IdStatusOrder", "StatusName");
            return(View(pOrder));
        }
Пример #23
0
        // GET: POrders/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            POrder pOrder = db.POrders.Find(id);

            if (pOrder == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PharmacyId  = new SelectList(db.Pharmacies, "PharmacyId", "Name", pOrder.PharmacyId);
            ViewBag.PrescriptId = new SelectList(db.Prescripts, "PrescriptId", "DispType", pOrder.PrescriptId);
            return(View(pOrder));
        }
Пример #24
0
        public ActionResult PharmacyIndex(int?id)
        {
            if (id != null)
            {
                POrder pOrder = db.POrders.Find(id);
                pOrder.Accept          = true;
                db.Entry(pOrder).State = EntityState.Modified;

                db.SaveChanges();
            }
            var manager     = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());

            var pOrders = db.POrders.Include(p => p.Pharmacy).Include(p => p.Prescript).Where(p => p.PharmacyId == currentUser.Pharmacist.PharmacyId);

            return(View(pOrders.ToList()));
        }
Пример #25
0
        public async Task <IActionResult> OnPostDropBg(string Size)
        {
            var Lisa    = Request.Form["big"];
            var orderid = int.Parse(Request.Form["orderid"]);

            int Count = 1;

            if (_context.POrders != null)
            {
                Count = _context.POrders.ToList().Last().Id;
                POrder order = _context.POrders.Single(x => x.Id == Count);
                order.Size = PizzaSize.Big;
            }

            await _context.SaveChangesAsync();

            return(Redirect("./PizzaSettings?pOrderId=" + Count + (orderid != 0 ? "&orderId=" + orderid : "")));
        }
Пример #26
0
        /// <summary>
        /// 事前オーダー登録
        /// </summary>
        /// <param name="order">事前登録オーダー情報クラス</param>
        /// <returns>処理結果クラス</returns>
        public ResultData SetPreOrder_Serv(PreOrder order)
        {
            var ret = new ResultData();

            try
            {
                if (order.Key == 0)
                {
                    Search search = new Search();

                    search.HospID = order.HospID;
                    search.PatID  = order.PatID;

                    Patient[] tmpList = Pat.GetPatientList(search);

                    if (tmpList == null || tmpList.Length == 0)
                    {
                        order.Key = Pat.SetPatient(order);
                    }
                }
                else
                {
                    Pat.SetPatient(order);
                }


                // 事前オーダー登録メソッド呼び出し(内部関数)
                if (!POrder.SetPreOrder(order))
                {
                    ret.Message = "オーダー登録失敗:" + order.PatID + ":" + order.Modality + ":" + order.Date;
                }
                else
                {
                    ret.Result = true;
                }
            }
            catch (Exception e)
            {
                LogControl.WriteLog(LogType.ERR, "SetPreOrder_Serv", e.Message);
                ret.Message = e.Message;
            }

            return(ret);
        }
Пример #27
0
        // GET: POrders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            POrder pOrder = db.PurchaseOrder.Find(id);
            var    list   = this.db.OrderDetailsCompras.Where(od => od.PurchaseNumber == pOrder.PurchaseNumber).ToList();

            var     nList = new List <DetailsOrderDetailViewModel>();
            decimal total = 0;

            foreach (var item in list)
            {
                var nE = new DetailsOrderDetailViewModel();
                nE.Discount = item.Discount.Value;
                var pN = this.db.Product.Find(item.IdProduct);
                nE.ProductName = pN.ProductName;
                nE.Quantity    = item.Quantity;
                nE.TotalAmount = item.TotalAmount;
                nE.UnitPrice   = item.UnitPrice;
                total         += item.TotalAmount;
                nList.Add(nE);
            }

            var Show = new POrderDetail
            {
                DetailsOrderDetailViewModels = nList,
                PurchaseNumber   = pOrder.PurchaseNumber,
                PaymentCondition = this.db.PaymentCondition.Find(pOrder.IdPaymentCondition).ConditionName,
                ProviderName     = this.db.Provider.Find(pOrder.IdProvider).Name,
                CreatedDate      = pOrder.CreatedDate,
                PlaceOfEntry     = pOrder.PlaceOfEntry,
                TotalAmount      = total,
                StatusOrder      = this.db.StatusOrder.Find(pOrder.IdStatusOrder).StatusName
            };

            if (pOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(Show));
        }
Пример #28
0
        public ActionResult Create(CreatePurchaseOrderViewModel pOrder)
        {
            if (ModelState.IsValid)
            {
                var pnew = new POrder
                {
                    CreatedDate        = DateTime.Now,
                    IdProvider         = pOrder.IdProvider,
                    PlaceOfEntry       = pOrder.PlaceOfEntry,
                    IdPaymentCondition = pOrder.IdPaymentCondition,
                    IdStatusOrder      = pOrder.IdStatusOrder
                };
                var ordenG = db.PurchaseOrder.Add(pnew);
                db.SaveChanges();

                foreach (var item in pOrder.OrderDetailsCompras)
                {
                    var n = new OrderDetailsCompras
                    {
                        Discount       = item.Discount,
                        IdProduct      = item.IdProduct,
                        UnitPrice      = item.UnitPrice,
                        PurchaseNumber = ordenG.PurchaseNumber,
                        Quantity       = item.Quantity,
                        TotalAmount    = (item.UnitPrice * item.Quantity) * (item.Discount / 100)
                    };
                    this.db.OrderDetailsCompras.Add(n);
                    this.db.SaveChanges();
                }

                var state = this.db.StatusOrder.Find(pOrder.IdStatusOrder);
                if (state.StatusName.Equals("DISTRIBUIDO"))
                {
                    pOrder.PurchaseNumber = ordenG.PurchaseNumber;
                    return(this.AdProductToAlmacen(pOrder));
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.IdProvider = new SelectList(db.Provider, "Id", "Name", pOrder.IdProvider);
            return(View(pOrder));
        }
Пример #29
0
        public Boolean Contract_CallBack(POrder order)
        {
            Boolean bMine = IsMine(order);

            if (!bMine)
            {
                return false;
            }

            if (_pivotWing.GetState() == SweeperWingState.Request_Mute &&
                _targetWing.GetState() == SweeperWingState.Request_Mute)
            {
                // Request_Mute상태이고 Pivot의 주문이었다면 Target의 추가 주문을 내도록 한다.
                if (_pivotData.Orders.Contains(order))
                {
                    BalanceSweepUnits();
                }
            }
            return true;
        }
Пример #30
0
        public static void Create(POrder order)
        {
            IDbTransaction transaction = null;

            try
            {
                using (var con = DBHelper.OpenConnection())
                {
                    transaction = con.BeginTransaction();
                    //orderRepository.Create(order.Order, con, transaction);
                    orderDetailRepository.Create(order.DetailList, con, transaction);
                    transaction.Commit();
                }
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw;
            }
        }
Пример #31
0
        public JsonResult SaveOrder(ViewModels.OrderVM O)
        {
            bool status = false;
            if (ModelState.IsValid)
            {
                using (ApplicationDbContext dc = new ApplicationDbContext())
                {
                    POrder order = new POrder(O) { OrderNo = O.OrderNo, OrderDate = O.OrderDate, Description = O.Description };

                    dc.POrders.Add(order);
                    dc.SaveChanges();
                    order.SaveItems(order);
                    status = true;
                }
            }
            else
            {
                status = false;
            }
            return new JsonResult { Data = new { status = status } };
        }
Пример #32
0
        private void ctlCompany_SelectedItemChanged(object sender, EventArgs e)
        {
            try
            {
                _oSupplier = (Supplier)(db.Suppliers.FirstOrDefault(o => o.SupplierID == ctlCompany.SelectedID));

                if (_oSupplier != null)
                {
                    _POrder = db.POrders
                              .Where(c => c.SupplierID == ctlCompany.SelectedID && c.Status == 1)
                              .OrderByDescending(t => t.OrderDate)
                              .FirstOrDefault();

                    numTotalDue.Value = _oSupplier.TotalDue;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #33
0
        public ActionResult Edit([Bind(Include = "POrderFillId,POrderId,InventoryId,DateFilled,DatePicked,Note,PhamacistId,Ready")] POrderFill pOrderFill)
        {
            pOrderFill.DatePicked = System.DateTime.Now;
            pOrderFill.Ready      = false;

            POrder pOrder = db.POrders.Find(pOrderFill.POrderId);

            pOrder.Deny = true;
            pOrder.Prescript.Ordered = true;

            if (ModelState.IsValid)
            {
                db.Entry(pOrder).State     = EntityState.Modified;
                db.Entry(pOrderFill).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("PharmacyIndex", "Patients"));
            }
            ViewBag.InventoryId = new SelectList(db.Inventories, "InventoryId", "DispType", pOrderFill.InventoryId);
            ViewBag.POrderId    = new SelectList(db.POrders, "POrderId", "Note", pOrderFill.POrderId);
            return(View(pOrderFill));
        }
Пример #34
0
        /// <summary>
        /// 事前登録オーダーリスト取得
        /// </summary>
        /// <param name="search">検索項目クラス</param>
        /// <param name="orderList">o:事前登録オーダー情報クラス一覧</param>
        /// <returns></returns>
        public ResultData GetPreOrder_Serv(Search search, out PreOrder[] orderList)
        {
            var ret = new ResultData();

            orderList = null;

            try
            {
                // 事前登録オーダーリスト取得メソッド呼び出し(内部関数)
                orderList = POrder.GetPreOrderList(search);

                ret.Result = true;
            }
            catch (Exception e)
            {
                LogControl.WriteLog(LogType.ERR, "GetPreOrder_Serv", e.Message);
                ret.Message = e.Message;
            }

            return(ret);
        }
Пример #35
0
        // GET: POrders/PorderCreateRefill
        public ActionResult PorderCreateRefill(int?id)
        {
            Prescript prescript = db.Prescripts.Find(id);
            POrder    model     = new POrder();

            var pharmacies = db.Pharmacies.ToList();

            IEnumerable <SelectListItem> selectList = from p in pharmacies
                                                      select new SelectListItem
            {
                Value = p.PharmacyId.ToString(),
                Text  = string.Format("{0} - {1}, {2}", p.Name, p.Address, p.City)
            };



            ViewBag.PharmacyId    = new SelectList(selectList, "Value", "Text");
            ViewData["Prescript"] = prescript;
            model.PrescriptId     = prescript.PrescriptId;
            return(View(model));
        }
Пример #36
0
    private void ProcessMessage(string message, string IPAddress)
    {
        PLogger.Log("接收信息 (" + IPAddress + "):" + message);
        List <string> messages = new List <string>(message.Split(' '));

        messages.RemoveAll((string x) => x.Equals(string.Empty));
        string[] MessageList = messages.ToArray();
        if (MessageList.Length < 1)
        {
            return;
        }
        string OrderName = MessageList[0];

        try {
            POrder Order = POrder.GetOrder(OrderName);
            Order.ServerResponseAction(MessageList, IPAddress);
        } catch (Exception e) {
            PLogger.Log("服务器处理信息时发生错误:" + message);
            PLogger.Log(e.ToString());
        }
    }
Пример #37
0
        public ActionResult Edit([Bind(Include = "POrderId,PrescriptId,PharmacyId,DateOrdered,Note,Fill,Deny,Accept")] POrder pOrder)
        {
            pOrder.Accept = false;
            pOrder.Deny   = true;

            Prescript prescript = new Prescript();

            prescript = db.Prescripts.Find(pOrder.PrescriptId);

            prescript.Sent = false;

            if (ModelState.IsValid)
            {
                db.Entry(prescript).State = EntityState.Modified;
                db.Entry(pOrder).State    = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("PharmacyIndex"));
            }
            ViewBag.PharmacyId  = new SelectList(db.Pharmacies, "PharmacyId", "Name", pOrder.PharmacyId);
            ViewBag.PrescriptId = new SelectList(db.Prescripts, "PrescriptId", "DispType", pOrder.PrescriptId);
            return(View(pOrder));
        }
Пример #38
0
        public static void Create()
        {
            POrder pOrder = new POrder();

            pOrder.Order = new Order()
            {
                OrderNumber    = 109,
                Comments       = "from test program",
                CustomerNumber = 121,
                OrderDate      = DateTime.Now,
                RequiredDate   = DateTime.Now.AddDays(10),
                ShippedDate    = DateTime.Now.AddDays(5),
                Status         = "shipped"
            };

            pOrder.DetailList = new List <Model.OrderDetail>()
            {
                new Model.OrderDetail()
                {
                    OrderLineNumber = 1,
                    PNumbers        = pOrder.Order.OrderNumber,
                    PriceEach       = 100M,
                    ProductCode     = "S10_1678",
                    QuantityOrdered = 10
                },
                new Model.OrderDetail()
                {
                    OrderLineNumber = 1,
                    PNumbers        = pOrder.Order.OrderNumber,
                    PriceEach       = 100M,
                    ProductCode     = "S10_1949",
                    QuantityOrdered = 10
                }
            };



            POrderRepository.Create(pOrder);
        }
Пример #39
0
        public Boolean Contract_CallBack(POrder order)
        {
            Trace.Assert(_enterOrder == order);

            return true;
        }
 public void RequestOrderComplete(POrder order)
 {
     Trace.Assert(
         this.CurEDoorOrderState == EDoorOrderState.Idle);
     this.LiveOrder = order;
     this.CurEDoorOrderState = EDoorOrderState.ActiveWithoutSweeper;
 }
 public void ClearLiveOrder()
 {
     this.LiveOrder = null;
     this.CurEDoorOrderState = EDoorOrderState.Idle;
 }
Пример #42
0
 /// <summary>
 /// 将装配信息保存至数据库
 /// </summary>
 /// <param name="StationInfo"></param>
 private void SaveVehicleStationInfo(POrder StationInfo)
 {
     try
     {
         this.genericMgr.BulkInsert<ZPPORDCOMPONENT>("SAP_AssemblyList", StationInfo.body.ToList());
         this.genericMgr.BulkInsert<ZPPORDHEADER>("SAP_AssemblyHead", StationInfo.header.ToList());
     }
     catch (Exception errorex)
     {
         log.Error("保存出错", errorex);
     }
 }
Пример #43
0
    public void AddOrder(POrder order)
    {
        if (OrderList == null)
        {
            OrderList = new List<POrder>();
        }

        OrderList.Add(order);
    }
 Boolean IsOrderContracted(POrder order)
 {
     if (order.ContractedCount > 0)
     {
         return true;
     }
     return false;
 }
Пример #45
0
    public void LV_List_OnItemDataBound(object sender, ListViewItemEventArgs e)
    {
        Orders boundOrder = (Orders)((ListViewDataItem)(e.Item)).DataItem;

        PFlow flow = new PFlow();
        flowQueue.Enqueue(flow);

        flow.FlowCode = boundOrder.Flow.Code;
        flow.PartyFrom = boundOrder.Flow.PartyFrom;

        foreach (ItemFlow itemFlow in boundOrder.ItemFlows)
        {
            IList<string> orderedPOList = new List<string>();
            PItem item = new PItem();
            item.Code = itemFlow.Item;
            Item i = TheItemMgr.LoadItem(item.Code);
            item.Desc = i.Desc1;
            item.Spec = i.Spec;

            var demand = itemFlow.OrderTracers.Where(o => o.TracerType == LeanEngine.Utility.Enumerators.TracerType.Demand).ToList();
            if (demand.Count != null && demand.Count > 0)
            {
                item.SaveStock = demand[0].Qty;
            }

            var onhandInv = itemFlow.OrderTracers.Where(o => o.TracerType == LeanEngine.Utility.Enumerators.TracerType.OnhandInv).ToList();
            if (onhandInv.Count != null && onhandInv.Count > 0)
            {
                item.Inventory = onhandInv[0].Qty;
            }

            var orderIss = itemFlow.OrderTracers.Where(o => o.TracerType == LeanEngine.Utility.Enumerators.TracerType.OrderIss).ToList();
            if (orderIss != null && orderIss.Count > 0)
            {
                foreach (OrderTracer ot in orderIss)
                {
                    string hql = @"select od from OrderDetail od inner join od.OrderHead oh where od.Item.Code = ? and oh.OrderNo = ? '";

                    IList<OrderDetail> orderDetailList = this.TheCriteriaMgr.FindAllWithHql<OrderDetail>(hql, new object[] { ot.Item, ot.Code });

                    if (orderDetailList != null && orderDetailList.Count > 0)
                    {
                        OrderDetail orderDetail = orderDetailList[0];
                        OrderHead orderHead = orderDetail.OrderHead;
                        POrder pOrder = new POrder();

                        pOrder.OrderNo = orderHead.OrderNo;
                        pOrder.CustomerCode = orderHead.PartyTo.Code;
                        pOrder.CustomerName = orderHead.PartyTo.Name;
                        pOrder.NeedPrepayment = orderHead.PartyTo.BoolField1.HasValue ? orderHead.PartyTo.BoolField1.Value : false;
                        pOrder.HasPrepayed = orderHead.BoolField1;
                        pOrder.RequiredQty = orderDetail.OrderedQty;
                        pOrder.ShippedQty = orderDetail.ShippedQty.HasValue ? orderDetail.ShippedQty.Value : 0;
                        pOrder.DeliverDate = orderHead.WindowTime;


                        hql = @"select oh.OrderNo, ot.Qty from OrderTracer as ot, OrderLocationTransaction as olt inner join olt.OrderDetail as od inner join od.OrderHead as oh where olt.Id = ot.RefOrderLocTransId and ot.OrderDetail.Id = ?";
                        IList<object[]> qtyList = this.TheCriteriaMgr.FindAllWithHql<object[]>(hql, new object[] { orderDetail.Id });
                        if (qtyList != null && qtyList.Count > 0)
                        {
                            foreach (object[] obj in qtyList)
                            {
                                orderedPOList.Add((string)obj[0]);
                                pOrder.OrderedQty += (decimal)obj[1];
                            }
                        }
                        else
                        {
                            pOrder.OrderedQty = 0;
                        }

                        if (pOrder.RequiredQty > pOrder.ShippedQty && pOrder.RequiredQty > pOrder.OrderedQty)
                        {
                            item.AddOrder(pOrder);
                        }
                    }
                }
            }

            var orderRct = itemFlow.OrderTracers.Where(o => o.TracerType == LeanEngine.Utility.Enumerators.TracerType.OrderRct).ToList();
            if (orderRct != null && orderRct.Count > 0)
            {
                foreach (OrderTracer ot in orderRct)
                {
                    if (!orderedPOList.Contains(ot.Code))
                    {
                        item.OrderedQty += ot.Qty;
                    }
                }
            }

            if ((item.OrderList != null && item.OrderList.Count > 0) || (item.SaveStock > (item.Inventory + item.OrderedQty)))
            {
                flow.AddItem(item);
            }
        }
    }
Пример #46
0
        Boolean EnterNewPosition(EDoorCenterData centerData, 
            EDoorEachMonitorEnterData eachData, double reqPrice, long reqCount,
            RawMarketData rmdElw, RawMarketData rmdOption_0)
        {
            try
            {
                // 1. LiveOrder가 없는 상태인 것을 다시한번 확인한다.
                Trace.Assert(eachData.LiveOrder == null);
                Trace.Assert(eachData.CurEDoorOrderState ==
                    EDoorEachMonitorEnterData.EDoorOrderState.Idle);

                String elwCode = eachData.EI.Code;
                Account account = centerData.ElwAccount;

                POrder order = new POrder(TradingDirection.Long, elwCode,
                    reqCount, reqPrice, account, rmdElw);

                // 2. 주문을 넣는다.
                OrderLimitReferenceOOR limitReference =
                    new OrderLimitReferenceOOR(
                        OrderLimitReferenceOOR.OrderType.OOR, rmdOption_0);
                order.LimitOrderReference = limitReference;
                order.ShortCutTargetOfContractCallBack = _parent;
                POrderUtil.RequestOrder(order, null);

                // 3. eachData의 LiveOrder를 설정한다.
                eachData.RequestOrderComplete(order);

                // 4. centerData의 사용 수량을 늘린다.
                centerData.IncreaseUsedChannelCount(order);

                return true;
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
            return false;
        }
Пример #47
0
 public void IncreaseUsedChannelCount(POrder order)
 {
     _liveOrders.Add(order);
 }
Пример #48
0
 public Boolean Contract_CallBack(POrder order)
 {
     //TODO
     return false;
 }
Пример #49
0
 public TimeOutResumePolicy(POrder order)
 {
     _timer = new Timer(kTimeOutSec, "Time out");
     this._order = order;
 }
Пример #50
0
 Boolean IsMine(POrder order)
 {
     if (_pivotData.Orders.Contains(order))
     {
         return true;
     }
     if (_targetData.Orders.Contains(order))
     {
         return true;
     }
     return false;
 }