Esempio n. 1
0
        protected override void CreateInventoryEx(DXInfo.Models.Inventory inv)
        {
            //if (this.SelectedInventory != null)
            //{
            InventoryEx inventoryEx = Mapper.Map <DXInfo.Models.InventoryEx>(inv);

            inventoryEx.IsCupType  = this.IsCupType;
            inventoryEx.IsInvPrice = this.IsInvPrice;
            inventoryEx.lTasteEx   = this.lTasteEx.Clone() as DXInfo.Models.TasteExList;
            inventoryEx.Quantity   = 1;
            inventoryEx.IsDiscount = JudgeIsDiscount(inv.Id);

            inventoryEx.IsInvDynamicPrice = this.IsInvDynamicPrice;
            inventoryEx.Discount          = 100;
            inventoryEx.AgreementPrice    = inventoryEx.SalePrice;
            this.SetCupType(inventoryEx);
            this.SetInvPrice(inventoryEx);
            if (inventoryEx.IsDiscount)
            {
                this.SetInvDynamicPrice(inventoryEx);
            }
            //this.SetCurrentStock(inventoryEx);
            this.SetOCInventoryEx();
            this.OCInventoryEx.Add(inventoryEx);
            //}
        }
Esempio n. 2
0
 public InvPriceSetWindow(IFairiesMemberManageUow uow, InventoryEx d)
 {
     this.uow = uow;
     InitializeComponent();
     this.DataContext = new CardConsumeSetViewModel(uow, d);
     iex = d;
 }
        private void CreateInventoryEx()
        {
            if (this.SelectedInventory != null)
            {
                //分2种创建冷饮店的、西餐厅的
                InventoryEx inventoryEx = Mapper.Map <DXInfo.Models.InventoryEx>(this.SelectedInventory);
                inventoryEx.lTasteEx   = this.lTasteEx.Clone() as DXInfo.Models.TasteExList;
                inventoryEx.dSalePrice = this.GetdSalePrice(this.SelectedInventory);
                inventoryEx.dSalePoint = this.GetdSalePoint(this.SelectedInventory);
                inventoryEx.lCupType   = this.lCupType;
                inventoryEx.CupType    = inventoryEx.lCupType.Find(f => f.Id == (int)DXInfo.Models.CupType.Standard);
                inventoryEx.Quantity   = 1;
                inventoryEx.IsDiscount = true;
                this.OCInventoryEx.Add(inventoryEx);

                CardConsumeSetWindow csw = new CardConsumeSetWindow(Uow, inventoryEx);
                csw.ShowDialog();
            }
        }
 public static void InventoryExPatch(ref InventoryEx __instance)
 {
     if (fixWeaponSlots.Value)
     {
         try
         {
             var equipInventoryItem = __instance.Item as EquipInventoryItem;
             if (equipInventoryItem.ParentType == InventoryType.Weapon)
             {
                 __instance.QuenchHoleCount = GetHoleCount(__instance.Level);
                 __instance.QuenchEffect    = new List <string>
                 {
                     null,
                     null
                 };
             }
         }
         catch
         {
         }
     }
 }
Esempio n. 5
0
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            #region 菜品入库
            Hashtable htAdd = new Hashtable();
            Hashtable htSub = new Hashtable();
            if (GridSelected.ItemsSource == null)
            {
                ocSelDesks = new ObservableCollection <DXInfo.Models.OrderMenuEx>();
            }
            else
            {
                ocSelDesks = GridSelected.ItemsSource as ObservableCollection <DXInfo.Models.OrderMenuEx>;
            }
            if (desk != null && order != null && ocSelDesks.Count > 0)
            {
                using (TransactionScope transaction = new TransactionScope())
                {
                    int addmenu = 0;
                    foreach (DXInfo.Models.OrderMenuEx selDesk in ocSelDesks)
                    {
                        if (selDesk.Id != Guid.Empty)
                        {
                            DXInfo.Models.OrderMenus orderMenu = uow.OrderMenus.GetById(selDesk.Id);//.Where(w => w.Id == selDesk.Id).FirstOrDefault();
                            if (orderMenu != null)
                            {
                                if (orderMenu.Status == 2 && orderMenu.Quantity != selDesk.Quantity)
                                {
                                    DXInfo.Models.Inventory inv = uow.Inventory.GetById(orderMenu.InventoryId);//.Where(w => w.Id == orderMenu.InventoryId).FirstOrDefault();
                                    if (!string.IsNullOrEmpty(inv.Printer))
                                    {
                                        if (orderMenu.Quantity > selDesk.Quantity)
                                        {
                                            if (htSub.Contains(inv.Printer))
                                            {
                                                List <InventoryEx> confirmmenu = htSub[inv.Printer] as List <InventoryEx>;
                                                InventoryEx        si          = new InventoryEx();
                                                si.Category = inv.Category;
                                                //si.Quantity = orderMenu.Quantity - selDesk.Quantity;
                                                si.SalePrice = inv.SalePrice;
                                                //si.Amount = inv.SalePrice * (orderMenu.Quantity - selDesk.Quantity);
                                                si.Quantity = orderMenu.Quantity - selDesk.Quantity;
                                                si.Name     = inv.Name;
                                                si.Comment  = orderMenu.Comment;
                                                confirmmenu.Add(si);
                                                htSub[inv.Printer] = confirmmenu;
                                            }
                                            else
                                            {
                                                List <InventoryEx> confirmmenu = new List <InventoryEx>();
                                                InventoryEx        si          = new InventoryEx();
                                                si.Category = inv.Category;
                                                //si.Amount = inv.SalePrice * (orderMenu.Quantity - selDesk.Quantity);
                                                //si.Quantity = orderMenu.Quantity - selDesk.Quantity;
                                                si.SalePrice = inv.SalePrice;
                                                si.Quantity  = orderMenu.Quantity - selDesk.Quantity;
                                                si.Name      = inv.Name;
                                                si.Comment   = orderMenu.Comment;
                                                confirmmenu.Add(si);
                                                htSub.Add(inv.Printer, confirmmenu);
                                            }
                                        }
                                        else
                                        {
                                            if (htAdd.Contains(inv.Printer))
                                            {
                                                List <InventoryEx> confirmmenu = htAdd[inv.Printer] as List <InventoryEx>;
                                                InventoryEx        si          = new InventoryEx();
                                                si.Category = inv.Category;
                                                //si.Amount = inv.SalePrice*(selDesk.Quantity-orderMenu.Quantity);
                                                //si.Quantity = orderMenu.Quantity - selDesk.Quantity;
                                                si.SalePrice = inv.SalePrice;
                                                si.Quantity  = selDesk.Quantity - orderMenu.Quantity;
                                                si.Name      = inv.Name;
                                                si.Comment   = orderMenu.Comment;
                                                confirmmenu.Add(si);
                                                htAdd[inv.Printer] = confirmmenu;
                                            }
                                            else
                                            {
                                                List <InventoryEx> confirmmenu = new List <InventoryEx>();
                                                InventoryEx        si          = new InventoryEx();
                                                si.Category = inv.Category;
                                                //si.Amount = inv.SalePrice * (selDesk.Quantity - orderMenu.Quantity);
                                                si.SalePrice = inv.SalePrice;
                                                si.Quantity  = selDesk.Quantity - orderMenu.Quantity;
                                                si.Name      = inv.Name;
                                                si.Comment   = orderMenu.Comment;
                                                confirmmenu.Add(si);
                                                htAdd.Add(inv.Printer, confirmmenu);
                                            }
                                        }
                                    }
                                }
                                orderMenu.Quantity = selDesk.Quantity;
                                orderMenu.Amount   = selDesk.Quantity * orderMenu.Price;
                                orderMenu.Comment  = selDesk.Comment;

                                DXInfo.Models.OrderMenusHis menuHis = new DXInfo.Models.OrderMenusHis();
                                menuHis.LinkId      = orderMenu.Id;
                                menuHis.OrderId     = orderMenu.OrderId;
                                menuHis.InventoryId = orderMenu.InventoryId;
                                menuHis.Price       = orderMenu.Price;
                                menuHis.Quantity    = orderMenu.Quantity;
                                menuHis.Amount      = orderMenu.Amount;
                                menuHis.UserId      = App.MyIdentity.oper.UserId;
                                menuHis.CreateDate  = DateTime.Now;
                                menuHis.Status      = orderMenu.Status;
                                menuHis.Comment     = orderMenu.Comment;
                                uow.OrderMenusHis.Add(menuHis);
                            }
                        }
                        else
                        {
                            DXInfo.Models.OrderMenus orderMenu = new DXInfo.Models.OrderMenus();
                            orderMenu.OrderId     = order.Id;
                            orderMenu.InventoryId = selDesk.InventoryId;
                            orderMenu.Price       = selDesk.Price;
                            orderMenu.Quantity    = selDesk.Quantity;
                            orderMenu.Amount      = selDesk.Amount;
                            orderMenu.Comment     = selDesk.Comment;
                            orderMenu.CreateDate  = DateTime.Now;
                            orderMenu.UserId      = App.MyIdentity.user.UserId;
                            uow.OrderMenus.Add(orderMenu);

                            uow.Commit();

                            DXInfo.Models.OrderMenusHis menuHis = new DXInfo.Models.OrderMenusHis();
                            menuHis.LinkId      = orderMenu.Id;
                            menuHis.OrderId     = orderMenu.OrderId;
                            menuHis.InventoryId = orderMenu.InventoryId;
                            menuHis.Price       = orderMenu.Price;
                            menuHis.Quantity    = orderMenu.Quantity;
                            menuHis.Amount      = orderMenu.Amount;
                            menuHis.UserId      = App.MyIdentity.oper.UserId;
                            menuHis.CreateDate  = DateTime.Now;
                            menuHis.Status      = orderMenu.Status;
                            menuHis.Comment     = orderMenu.Comment;
                            uow.OrderMenusHis.Add(menuHis);
                            addmenu++;
                        }
                    }
                    if (addmenu > 0)
                    {
                        DXInfo.Models.OrderDishes odish = uow.OrderDishes.GetById(order.Id);//.Where(w => w.Id == order.Id).FirstOrDefault();
                        odish.Status = 0;
                    }
                    uow.Commit();
                    transaction.Complete();
                }
            }
            #endregion
            string deskCodes = "";
            DXInfo.Restaurant.DeskManageFacade dmf = new DXInfo.Restaurant.DeskManageFacade(uow, Guid.Empty, Guid.Empty);
            deskCodes = dmf.GetOrderDeskCodes(uow, order.Id);

            if (htAdd.Count > 0)
            {
                foreach (DictionaryEntry de in htAdd)
                {
                    List <InventoryEx> confirmmenu = de.Value as List <InventoryEx>;
                    decimal            dsum        = confirmmenu.Sum(s => s.Amount);
                    decimal            dcount      = confirmmenu.Sum(s => s.Quantity);
                    if (confirmmenu.Count > 0)
                    {
                        var ctx = new
                        {
                            DeskNo     = deskCodes + "(加单)",
                            Sum        = dsum,
                            Count      = dcount,
                            lSelInv    = confirmmenu,
                            CreateDate = DateTime.Now,
                            DeptName   = App.MyIdentity.dept.DeptName,
                        };
                        System.Printing.LocalPrintServer lp = new System.Printing.LocalPrintServer();
                        System.Printing.PrintQueue       pq = new System.Printing.PrintQueue(lp, de.Key.ToString());
                        DeskConfirmWindow dcw = new DeskConfirmWindow(ctx, pq);
                        if (dcw.ShowDialog().GetValueOrDefault())
                        {
                        }
                    }
                }
            }
            if (htSub.Count > 0)
            {
                foreach (DictionaryEntry de in htSub)
                {
                    List <InventoryEx> confirmmenu = de.Value as List <InventoryEx>;
                    decimal            dsum        = confirmmenu.Sum(s => s.Amount);
                    decimal            dcount      = confirmmenu.Sum(s => s.Quantity);
                    if (confirmmenu.Count > 0)
                    {
                        var ctx = new
                        {
                            DeskNo     = deskCodes + "(减单)",
                            Sum        = dsum,
                            Count      = dcount,
                            lSelInv    = confirmmenu,
                            CreateDate = DateTime.Now,
                            DeptName   = App.MyIdentity.dept.DeptName,
                        };
                        System.Printing.LocalPrintServer lp = new System.Printing.LocalPrintServer();
                        System.Printing.PrintQueue       pq = new System.Printing.PrintQueue(lp, de.Key.ToString());
                        DeskConfirmWindow dcw = new DeskConfirmWindow(ctx, pq);
                        if (dcw.ShowDialog().GetValueOrDefault())
                        {
                        }
                    }
                }
            }
            this.DialogResult = true;
        }
 public InvDynamicPriceWindow(IFairiesMemberManageUow uow, InventoryEx iex)
 {
     InitializeComponent();
     this.DataContext = new InvDynamicPriceViewModel(uow, iex);
 }