Exemple #1
0
 private void btnBillModify_Click(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow != null && _salesOrder != null && _salesOrder.order != null)
     {
         if (_salesOrder.order.Status == 1)
         {
             int             selectedIndex = dataGridView1.CurrentRow.Index;
             FormModifyOrder form          = new FormModifyOrder(_salesOrder);
             form.ShowDialog();
             if (form.IsChanged)
             {
                 Guid       orderId    = new Guid(dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value.ToString());
                 SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrderByBillSearch(orderId);
                 _salesOrder = salesOrder;
                 //更新账单信息
                 dataGridView1.Rows[selectedIndex].Cells["TotalSellPrice"].Value  = salesOrder.order.TotalSellPrice.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["ActualSellPrice"].Value = salesOrder.order.ActualSellPrice.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["DiscountPrice"].Value   = salesOrder.order.DiscountPrice.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["CutOffPrice"].Value     = salesOrder.order.CutOffPrice.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["ServiceFee"].Value      = salesOrder.order.ServiceFee.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["PaymentMoney"].Value    = salesOrder.order.PaymentMoney.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["NeedChangePay"].Value   = salesOrder.order.NeedChangePay.ToString("f2");
                 dataGridView1.Rows[selectedIndex].Cells["MoreOrLess"].Value      = (salesOrder.order.ActualSellPrice + salesOrder.order.ServiceFee - (salesOrder.order.PaymentMoney - salesOrder.order.NeedChangePay)).ToString("f2");
                 BindDataGridView2(salesOrder);
                 BindDataGridView3(salesOrder);
             }
         }
     }
 }
        public SaleController GetController()
        {
            ISaleRepository       saleRepository       = new SaleRepository();
            ISaleRemarkRepository saleRemarkRepository = new SaleRemarkRepository();
            IAccountRepository    accountRepository    = new AccountRepository();
            IOrgInfoRepository    orgInfoRepository    = new OrgInfoRepository();
            IRoleUserRepository   roleUserRepository   = new RoleUserRepository();
            ISectionRepository    sectionRepository    = new SectionRepository();
            IStoreRepository      storeRepository      = new StoreRepository();
            IAccountService       accountService       = new AccountService(accountRepository, orgInfoRepository, roleUserRepository, sectionRepository, storeRepository);
            ISaleService          saleService          = new SaleService(saleRepository, saleRemarkRepository, accountService);
            //IBrandRepository brandRepository = new BrandRepository();

            IShippingSaleRepository shippingSaleRepository = new ShippingSaleRepository();
            IOrderRepository        orderRepository        = new OrderRepository();
            //IOrderRemarkRepository orderRemarkRepository = new OrderRemarkRepository();
            //IOrderItemRepository orderItemRepository = new OrderItemRepository();
            //ISaleDetailRepository saleDetailRepository = new SaleDetailRepository();
            ISaleRMARepository saleRmaRepository = new SaleRMARepository();
            // IOrderService orderService = new OrderService(orderRepository, orderRemarkRepository, orderItemRepository, brandRepository, accountService, saleDetailRepository, saleRmaRepository);
            IShippingSaleService shippingSaleService = new ShippingSaleService(shippingSaleRepository, orderRepository, saleRmaRepository, accountService);
            ISaleRepository      saleOrderRepository = new SaleRepository();
            ISalesOrderService   saleOrderService    = new SalesOrderService(saleOrderRepository);

            _controller = new SaleController(saleService, shippingSaleService, saleOrderService);

            _controller.Request = new HttpRequestMessage();
            _controller.Request.SetConfiguration(new HttpConfiguration());

            return(_controller);
        }
Exemple #3
0
        public static byte[] GetSalesOrder(byte[] itemBuffer)
        {
            byte[] objRet  = null;
            string orderID = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.ORDER_ID).Trim('\0');

            SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(new Guid(orderID));

            if (salesOrder == null || salesOrder.orderDetailsList == null || salesOrder.orderDetailsList.Count == 0)
            {
                //获取单子失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //成功
                string json     = JsonConvert.SerializeObject(salesOrder);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
Exemple #4
0
        public virtual Task <IAppSalesOrder> Create()
        {
            var crmService = StartupHelper.CreateCrmService();
            ISalesOrderRepository salesorderrepository = new SalesOrderRepository();
            ISalesOrderService    salesorderservice    = new SalesOrderService(crmService, salesorderrepository);
            IAppSalesOrder        app = new AppSalesOrder(salesorderservice);

            return(Task.FromResult(app));;
        }
        /// <summary>
        /// 查询需要生成发货单的销售单
        /// </summary>
        private void OnSalesOrderForDeliveryQuery()
        {
            var salesOrders = SalesOrderService.QueryAll(_queryCriteriaForDeliveryOrder);

            SalesOrdersForDelivery = salesOrders.ToObservableCollection();
            if (salesOrders.Count == 0)
            {
                MvvmUtility.ShowMessageAsync("没有符合条件的销售单", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public void Delete()
        {
            // Arrange
            SalesOrderService controller = _container.Resolve <SalesOrderService>();

            // Act
            //controller.Delete(5);


            // Assert
            Assert.Fail();
        }
        public void Put()
        {
            // Arrange
            SalesOrderService controller = _container.Resolve <SalesOrderService>();

            // Act
            //controller.Put(5, "value");

            // Assert

            // Assert
            Assert.Fail();
        }
        public void Get()
        {
            // Arrange
            SalesOrderService controller = _container.Resolve <SalesOrderService>();

            // Act
            IEnumerable <string> result = controller.Get();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual("value1", result.ElementAt(0));
            Assert.AreEqual("value2", result.ElementAt(1));
        }
Exemple #9
0
        public static byte[] CreateSalesOrder(byte[] itemBuffer)
        {
            byte[]     objRet     = null;
            string     strReceive = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
            SalesOrder salesOrder = JsonConvert.DeserializeObject <SalesOrder>(strReceive);
            //返回流水号
            Int32 tranSequence = SalesOrderService.GetInstance().CreateSalesOrder(salesOrder);
            int   transCount   = BasicTypeLength.INT32 + BasicTypeLength.INT32 + BasicTypeLength.INT32;

            objRet = new byte[transCount];
            Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            Array.Copy(BitConverter.GetBytes(tranSequence), 0, objRet, 2 * BasicTypeLength.INT32, BasicTypeLength.INT32);
            return(objRet);
        }
Exemple #10
0
        /// <summary>
        /// 补录收银流水号
        /// </summary>
        private async void OnPaymentNumberApply()
        {
            //如果是迷你银商品
            var cashNumber = await MvvmUtility.ShowInputDialogAsync("补录收银流水号", "收银流水号", SaleSelected.CashNum);

            //用户点击取消按钮
            if (cashNumber == null)
            {
                return;
            }

            SalesOrderService.ReceivePayment(new OPC_Sale {
                SaleOrderNo = SaleSelected.SaleOrderNo
            }, cashNumber);
            SaleSelected.CashNum = cashNumber;
        }
        static async Task Main(string[] args)
        {
            var options           = new Microsoft.EntityFrameworkCore.DbContextOptions <SalesOrderContext>();
            var salesOrderContext = new SalesOrderContext(options);

            var serviceBusHelper     = new StorageQueueHelper();
            var testFileHelper       = new TextFileHelper();
            var productRepository    = new ProductRepository(testFileHelper);
            var productService       = new ProductService(productRepository);
            var salesOrderRepository = new SalesOrderRepository(salesOrderContext);
            var salesOrderService    = new SalesOrderService(salesOrderRepository);

            var salesOrderProcessor = new SalesOrderProcessor(
                serviceBusHelper, productService, salesOrderService);

            await salesOrderProcessor.Run();
        }
Exemple #12
0
        public static byte[] SubmitOrderInAndroid(byte[] itemBuffer)
        {
            byte[]         objRet         = null;
            string         strReceive     = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
            OrderInAndroid orderInAndroid = JsonConvert.DeserializeObject <OrderInAndroid>(strReceive);

            //返回操作结果
            Employee employee = null;
            int      result   = EmployeeService.GetInstance().GetEmployee(orderInAndroid.EmployeeNo, orderInAndroid.Password, out employee);

            if (result == 1)
            {
                bool isSuccess = SalesOrderService.GetInstance().CreateOrderInAndroid(orderInAndroid.DeskName, orderInAndroid.PeopleNum, employee.EmployeeID, employee.EmployeeNo, orderInAndroid.OrderDetailList);
                if (isSuccess)
                {
                    //成功
                    objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                    Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                    Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                }
                else
                {
                    //创建Android订单失败
                    objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                    Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                    Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                }
            }
            else if (result == 2)
            {
                //账号或者密码错误
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_AUTHENTICATION), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //数据库操作失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            return(objRet);
        }
Exemple #13
0
        public void CreateSalesOrder_RepositorySaveInvoked()
        {
            // Arrange
            var salesOrderRepository = Substitute.For <ISalesOrderRepository>();
            var salesOrderService    = new SalesOrderService(salesOrderRepository);
            var salesOrder           = new Models.SalesOrder()
            {
                ProductCode = "NAIL12IN",
                UnitPrice   = 0.23M,
                Quantity    = 3,
                Reference   = new Guid("d0d12bc2-5a1b-4147-8acb-49228ef11411")
            };

            // Act
            salesOrderService.Create(salesOrder);

            // Assert
            salesOrderRepository.Received(1).Create(Arg.Is <SalesOrderEntity>(a => a.Reference == salesOrder.Reference));
        }
Exemple #14
0
        public static byte[] SplitSalesOrder(byte[] itemBuffer)
        {
            byte[]          objRet          = null;
            string          strReceive      = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, itemBuffer.Length - ParamFieldLength.PACKAGE_HEAD).Trim('\0');
            SalesSplitOrder salesSplitOrder = JsonConvert.DeserializeObject <SalesSplitOrder>(strReceive);

            bool result = SalesOrderService.GetInstance().SplitSalesOrder(salesSplitOrder);

            if (result)
            {
                //成功
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //分单操作失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            return(objRet);
        }
Exemple #15
0
 public JE_SalesOrder(ISalesOrderApp ISalesOrderApp)
 {
     _salesOrderApp = ISalesOrderApp;
     _soService     = new SalesOrderService(_salesOrderApp);
 }
Exemple #16
0
 public IN_SalesOrder(ISalesOrderApp SalesOrderApp)
 {
     _salesOrderApp = SalesOrderApp;
     soService      = new SalesOrderService(_salesOrderApp);
 }
Exemple #17
0
        private void btnDesk_Click(object sender, EventArgs e)
        {
            if (_operateType == ButtonOperateType.NONE)
            {
                return;
            }
            CrystalButton btnDesk = sender as CrystalButton;

            if (btnDesk == null)
            {
                return;
            }
            BizDesk tempDesk = btnDesk.Tag as BizDesk;

            if (tempDesk == null)
            {
                return;
            }

            _currentFormActivate = false;
            //重新获取Desk信息
            BizDesk desk = DeskService.GetInstance().GetBizDeskByName(tempDesk.DeskName);

            if (_operateType == ButtonOperateType.ORDER)
            {
                if (desk.Status == (int)DeskButtonStatus.IDLE_MODE)
                {
                    //人数
                    Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad();
                    keyForm.DisplayText = "请输入就餐人数";
                    keyForm.ShowDialog();
                    if (!string.IsNullOrEmpty(keyForm.KeypadValue) && keyForm.KeypadValue != "0" && keyForm.KeypadValue.IndexOf('.') == -1)
                    {
                        _formOrder.PersonNum = int.Parse(keyForm.KeypadValue);
                    }
                    else
                    {
                        return;
                    }
                    //更新桌况为占用状态
                    const int status = (int)DeskButtonStatus.OCCUPIED;
                    if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status))
                    {
                        desk.Status                = status;
                        btnDesk.BackColor          = GetColorByStatus(status, ConstantValuePool.BizSettingConfig.DeviceNo);
                        _formOrder.CurrentDeskName = desk.DeskName;
                        _formOrder.PlaceSalesOrder = null;
                        _formOrder.VisibleShow     = true;
                        _formOrder.Show();
                    }
                }
                else if (desk.Status == (int)DeskButtonStatus.OCCUPIED)
                {
                    if (string.IsNullOrEmpty(desk.DeviceNo) || desk.DeviceNo == ConstantValuePool.BizSettingConfig.DeviceNo)
                    {
                        //更新桌况为占用状态
                        const int status = (int)DeskButtonStatus.OCCUPIED;
                        if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status))
                        {
                            //获取桌子的订单列表
                            IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName);
                            if (orderList != null && orderList.Count > 0)
                            {
                                Guid orderId = Guid.Empty;
                                if (orderList.Count == 1)
                                {
                                    orderId = orderList[0].OrderID;
                                }
                                else
                                {
                                    Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList);
                                    form.ShowDialog();
                                    if (form.SelectedOrder != null)
                                    {
                                        orderId = form.SelectedOrder.OrderID;
                                    }
                                }
                                SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(orderId);
                                if (salesOrder != null)
                                {
                                    if (salesOrder.order.Status == 3)   //已预结
                                    {
                                        //open check out form
                                        FormCheckOut checkForm = new FormCheckOut(salesOrder, desk.DeskName);
                                        checkForm.ShowDialog();
                                    }
                                    else
                                    {
                                        //open order form
                                        _formOrder.CurrentDeskName = desk.DeskName;
                                        _formOrder.PlaceSalesOrder = salesOrder;
                                        _formOrder.VisibleShow     = true;
                                        _formOrder.Show();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (_operateType == ButtonOperateType.CLEAR)
            {
                if (desk.Status == (int)DeskButtonStatus.OCCUPIED && !string.IsNullOrEmpty(desk.DeviceNo))
                {
                    //更新桌况为非占用状态
                    const int status = (int)DeskButtonStatus.OCCUPIED;
                    if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, string.Empty, status))
                    {
                        btnDesk.BackColor = GetColorByStatus(status, string.Empty);
                    }
                }
            }
            else if (_operateType == ButtonOperateType.CHANGE_DESK)
            {
                if (string.IsNullOrEmpty(_deskName1St))
                {
                    //获取桌子的订单列表
                    IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName);
                    if (orderList != null && orderList.Count > 0)
                    {
                        if (orderList.Count > 1)
                        {
                            Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList);
                            form.ShowDialog();
                            if (form.SelectedOrder != null)
                            {
                                _deskName1St          = desk.DeskName;
                                _orderId1St           = form.SelectedOrder.OrderID;
                                _firstDeskSingleOrder = false;
                            }
                            else
                            {
                                _currentFormActivate = true; //使线程重新活跃
                                return;
                            }
                        }
                        else
                        {
                            _deskName1St          = desk.DeskName;
                            _orderId1St           = orderList[0].OrderID;
                            _firstDeskSingleOrder = true;
                        }
                    }
                    else
                    {
                        _currentFormActivate = true; //使线程重新活跃
                        return;                      //空桌
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(_deskName1St))
                    {
                        if (desk.DeskName == _deskName1St)
                        {
                            _currentFormActivate = true; //使线程重新活跃
                            return;                      //点击相同的第一张桌子
                        }
                        //获取桌子的订单列表
                        IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName);
                        if (orderList != null && orderList.Count > 0)
                        {
                            DeskChange deskChange = new DeskChange();
                            deskChange.DeskName   = desk.DeskName;
                            deskChange.OrderID1st = _orderId1St;
                            deskChange.OrderID2nd = Guid.Empty;
                            Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList, deskChange);
                            form.ShowDialog();
                            if (form.SelectedOrder != null)
                            {
                                int status = 0;
                                if (_firstDeskSingleOrder)
                                {
                                    //更新桌况为空闲状态
                                    status = (int)DeskButtonStatus.IDLE_MODE;
                                    if (!DeskService.GetInstance().UpdateDeskStatus(_deskName1St, string.Empty, status))
                                    {
                                        MessageBox.Show("更新桌况失败!");
                                    }
                                }
                                status = (int)DeskButtonStatus.OCCUPIED;
                                if (!DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status))
                                {
                                    MessageBox.Show("更新桌况失败!");
                                }

                                _deskName1St          = string.Empty;
                                _orderId1St           = Guid.Empty;
                                _firstDeskSingleOrder = false;
                            }
                            else
                            {
                                _deskName1St          = string.Empty;
                                _orderId1St           = Guid.Empty;
                                _firstDeskSingleOrder = false;
                            }
                        }
                        else
                        {
                            //直接转台
                            DeskChange deskChange = new DeskChange();
                            deskChange.DeskName   = desk.DeskName;
                            deskChange.OrderID1st = _orderId1St;
                            deskChange.OrderID2nd = Guid.Empty;
                            if (OrderService.GetInstance().OrderDeskOperate(deskChange))
                            {
                                int status = 0;
                                if (_firstDeskSingleOrder)
                                {
                                    //更新桌况为空闲状态
                                    status = (int)DeskButtonStatus.IDLE_MODE;
                                    if (!DeskService.GetInstance().UpdateDeskStatus(_deskName1St, string.Empty, status))
                                    {
                                        MessageBox.Show("更新桌况失败!");
                                    }
                                }
                                status = (int)DeskButtonStatus.OCCUPIED;
                                if (!DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status))
                                {
                                    MessageBox.Show("更新桌况失败!");
                                }

                                _deskName1St          = string.Empty;
                                _orderId1St           = Guid.Empty;
                                _firstDeskSingleOrder = false;
                            }
                        }
                    }
                }
            }
            else if (_operateType == ButtonOperateType.CHECKOUT)
            {
                if (desk.Status == (int)DeskButtonStatus.OCCUPIED)
                {
                    if (string.IsNullOrEmpty(desk.DeviceNo) || desk.DeviceNo == ConstantValuePool.BizSettingConfig.DeviceNo)
                    {
                        //更新桌况为占用状态
                        const int status = (int)DeskButtonStatus.OCCUPIED;
                        if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status))
                        {
                            //获取桌子的订单列表
                            IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName);
                            if (orderList != null && orderList.Count > 0)
                            {
                                Guid orderId = Guid.Empty;
                                if (orderList.Count == 1)
                                {
                                    orderId = orderList[0].OrderID;
                                }
                                else
                                {
                                    Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList);
                                    form.ShowDialog();
                                    if (form.SelectedOrder != null)
                                    {
                                        orderId = form.SelectedOrder.OrderID;
                                    }
                                }
                                SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(orderId);
                                if (salesOrder != null)
                                {
                                    FormCheckOut checkForm = new FormCheckOut(salesOrder, desk.DeskName);
                                    checkForm.ShowDialog();
                                }
                            }
                        }
                    }
                }
            }
            _currentFormActivate = true;
        }
Exemple #18
0
 public HomeController()
 {
     _salesOrderService = new SalesOrderService();
 }
        public IActionResult GetOrdersByPage(int pageSize = 10, int pageNumber = 1)
        {
            var data = new SalesOrderService(_connectionString);

            return(View(data.GetAllSalesOrder(pageSize, pageNumber)));
        }
        public IActionResult GetOrderById(string id)
        {
            var data = new SalesOrderService(_connectionString);

            return(View(data.GetSalesOrderByID(id)));
        }
        public IActionResult GetOrders()
        {
            var data = new SalesOrderService(_connectionString);

            return(View(data.GetAllSalesOrder()));
        }
 public WithPagedListController()
 {
     _salesOrderService = new SalesOrderService();
 }
Exemple #23
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (dgvGoodsOrder2.Rows.Count > 0)
     {
         string personNum = this.btnPeopleNum.Text;
         if (personNum.IndexOf(':') > 0)
         {
             personNum = personNum.Substring(personNum.IndexOf(':') + 1);
         }
         //原先单子的价格
         decimal totalPrice, actualPayMoney, discountPrice, cutOff;
         if (dgvGoodsOrderSum.Rows.Count == 2)
         {
             totalPrice     = Convert.ToDecimal(dgvGoodsOrderSum.Rows[0].Cells[1].Value);
             actualPayMoney = Convert.ToDecimal(dgvGoodsOrderSum.Rows[1].Cells[1].Value);
             discountPrice  = 0;
             cutOff         = totalPrice - actualPayMoney - discountPrice;
         }
         else
         {
             totalPrice     = Convert.ToDecimal(dgvGoodsOrderSum.Rows[0].Cells[1].Value);
             discountPrice  = Convert.ToDecimal(dgvGoodsOrderSum.Rows[1].Cells[1].Value);
             actualPayMoney = Convert.ToDecimal(dgvGoodsOrderSum.Rows[2].Cells[1].Value);
             cutOff         = totalPrice - actualPayMoney - Math.Abs(discountPrice);
         }
         Order originalOrder = new Order();
         originalOrder.OrderID         = m_SalesOrder.order.OrderID;
         originalOrder.TotalSellPrice  = totalPrice;
         originalOrder.ActualSellPrice = actualPayMoney;
         originalOrder.DiscountPrice   = discountPrice;
         originalOrder.CutOffPrice     = cutOff;
         int remainPeopleNum = m_SalesOrder.order.PeopleNum - int.Parse(personNum);
         if (remainPeopleNum <= 0)
         {
             remainPeopleNum = 1;
         }
         originalOrder.PeopleNum = remainPeopleNum;
         List <OrderDetails> subOrderDetailsList = new List <OrderDetails>();
         foreach (DataGridViewRow dr in dgvGoodsOrder2.Rows)
         {
             string orderDetailsID = dr.Cells[4].Value.ToString();
             //填充OrderDetails
             OrderDetails orderDetails = new OrderDetails();
             orderDetails.OrderDetailsID = new Guid(orderDetailsID);
             orderDetails.TotalSellPrice = Convert.ToDecimal(dr.Cells[2].Value);
             orderDetails.TotalDiscount  = GetDiscountFromDic(orderDetailsID);
             orderDetails.ItemQty        = Convert.ToDecimal(dr.Cells[0].Value);
             subOrderDetailsList.Add(orderDetails);
         }
         //新单子
         decimal newTotalPrice, newActualPayMoney, newDiscountPrice, newCutOff;
         if (dgvGoodsOrderSum2.Rows.Count == 2)
         {
             newTotalPrice     = Convert.ToDecimal(dgvGoodsOrderSum2.Rows[0].Cells[1].Value);
             newActualPayMoney = Convert.ToDecimal(dgvGoodsOrderSum2.Rows[1].Cells[1].Value);
             newDiscountPrice  = 0;
             newCutOff         = newTotalPrice - newActualPayMoney - newDiscountPrice;
         }
         else
         {
             newTotalPrice     = Convert.ToDecimal(dgvGoodsOrderSum2.Rows[0].Cells[1].Value);
             newDiscountPrice  = Convert.ToDecimal(dgvGoodsOrderSum2.Rows[1].Cells[1].Value);
             newActualPayMoney = Convert.ToDecimal(dgvGoodsOrderSum2.Rows[2].Cells[1].Value);
             newCutOff         = newTotalPrice - newActualPayMoney - Math.Abs(newDiscountPrice);
         }
         Order newOrder = new Order();
         newOrder.OrderID         = Guid.NewGuid();
         newOrder.TotalSellPrice  = newTotalPrice;
         newOrder.ActualSellPrice = newActualPayMoney;
         newOrder.DiscountPrice   = newDiscountPrice;
         newOrder.CutOffPrice     = newCutOff;
         newOrder.ServiceFee      = 0;
         newOrder.DeviceNo        = ConstantValuePool.BizSettingConfig.DeviceNo;
         newOrder.DeskName        = m_SalesOrder.order.DeskName;
         newOrder.EatType         = m_SalesOrder.order.EatType;
         newOrder.Status          = 0;
         newOrder.PeopleNum       = int.Parse(personNum);
         newOrder.EmployeeID      = ConstantValuePool.CurrentEmployee.EmployeeID;
         newOrder.EmployeeNo      = ConstantValuePool.CurrentEmployee.EmployeeNo;
         List <OrderDetails> newOrderDetailsList = new List <OrderDetails>();
         foreach (DataGridViewRow dr in dgvGoodsOrder2.Rows)
         {
             string goodsName      = dr.Cells[1].Value.ToString();
             string orderDetailsID = dr.Cells[4].Value.ToString();
             int    itemType       = Convert.ToInt32(dr.Cells[5].Value);
             //填充OrderDetails
             OrderDetails orderDetails = new OrderDetails();
             orderDetails.OrderDetailsID = Guid.NewGuid();
             orderDetails.OrderID        = newOrder.OrderID;
             orderDetails.DeviceNo       = ConstantValuePool.BizSettingConfig.DeviceNo;
             orderDetails.TotalSellPrice = Convert.ToDecimal(dr.Cells[2].Value);
             orderDetails.TotalDiscount  = 0;
             orderDetails.ItemQty        = Convert.ToDecimal(dr.Cells[0].Value);
             orderDetails.EmployeeID     = ConstantValuePool.CurrentEmployee.EmployeeID;
             foreach (OrderDetails item in m_SalesOrder.orderDetailsList)
             {
                 if (item.OrderDetailsID.ToString() == orderDetailsID)
                 {
                     orderDetails.Wait              = item.Wait;
                     orderDetails.ItemType          = item.ItemType;
                     orderDetails.GoodsID           = item.GoodsID;
                     orderDetails.GoodsNo           = item.GoodsNo;
                     orderDetails.GoodsName         = item.GoodsName;
                     orderDetails.CanDiscount       = item.CanDiscount;
                     orderDetails.Unit              = item.Unit;
                     orderDetails.SellPrice         = item.SellPrice;
                     orderDetails.PrintSolutionName = item.PrintSolutionName;
                     orderDetails.DepartID          = item.DepartID;
                     orderDetails.ItemLevel         = item.ItemLevel;
                     break;
                 }
             }
             newOrderDetailsList.Add(orderDetails);
         }
         SalesSplitOrder salesSplitOrder = new SalesSplitOrder();
         salesSplitOrder.OriginalOrder       = originalOrder;
         salesSplitOrder.SubOrderDetailsList = subOrderDetailsList;
         salesSplitOrder.NewOrder            = newOrder;
         salesSplitOrder.NewOrderDetailsList = newOrderDetailsList;
         if (SalesOrderService.GetInstance().SplitSalesOrder(salesSplitOrder))
         {
             m_SplitOrderSuccess = true;
             this.Close();
         }
     }
 }
Exemple #24
0
 private void dataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentRow != null)
     {
         int selectedIndex = dataGridView1.CurrentRow.Index;
         if (dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value != null)
         {
             Guid       orderId    = new Guid(dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value.ToString());
             SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrderByBillSearch(orderId);
             if (salesOrder != null)
             {
                 _salesOrder = salesOrder;
                 //更新账单信息
                 Order order = salesOrder.order;
                 this.lbOrderNo.Text  = order.OrderNo;
                 this.lbDeskName.Text = order.DeskName;
                 string billType = string.Empty;
                 if (order.Status == 0 || order.Status == 3)
                 {
                     billType = "未结账";
                 }
                 else if (order.Status == 1)
                 {
                     billType = "已结账";
                 }
                 else if (order.Status == 2)
                 {
                     billType = "已删除";
                 }
                 this.lbBillType.Text = billType;
                 string eatType = string.Empty;
                 if (order.EatType == (int)EatWayType.DineIn)
                 {
                     eatType = "堂食";
                 }
                 else if (order.EatType == (int)EatWayType.Takeout)
                 {
                     eatType = "外卖";
                 }
                 else if (order.EatType == (int)EatWayType.OutsideOrder)
                 {
                     eatType = "外送";
                 }
                 this.lbEatType.Text    = eatType;
                 this.lbEmployeeNo.Text = order.EmployeeNo;
                 this.lbCashier.Text    = order.PayEmployeeNo;
                 this.lbDeviceNo.Text   = order.DeviceNo;
                 int startIndex = selectedIndex + 1;
                 int index      = this.lbBillIndex.Text.IndexOf('/');
                 this.lbBillIndex.Text = startIndex + this.lbBillIndex.Text.Substring(index);
                 BindDataGridView2(salesOrder);
                 BindDataGridView3(salesOrder);
             }
         }
         else
         {
             _salesOrder            = null;
             this.lbOrderNo.Text    = string.Empty;
             this.lbBillType.Text   = string.Empty;
             this.lbDeskName.Text   = string.Empty;
             this.lbEatType.Text    = string.Empty;
             this.lbEmployeeNo.Text = string.Empty;
             this.lbCashier.Text    = string.Empty;
             this.lbDeviceNo.Text   = string.Empty;
             this.dataGridView2.Rows.Clear();
             this.dataGridView3.Rows.Clear();
         }
     }
 }
Exemple #25
0
 private void BindDataGridView1(IList <Order> orderList)
 {
     this.dataGridView1.SelectionChanged -= new System.EventHandler(this.dataGridView1_SelectionChanged);
     this.dataGridView1.Rows.Clear();
     if (orderList != null && orderList.Count > 0)
     {
         foreach (Order order in orderList)
         {
             string billType = string.Empty;
             if (order.Status == 0)
             {
                 billType = "未结账";
             }
             else if (order.Status == 1)
             {
                 billType = "已结账";
             }
             else if (order.Status == 2)
             {
                 billType = "已删除";
             }
             else if (order.Status == 3)
             {
                 billType = "已预结";
             }
             else if (order.Status == 4)
             {
                 billType = "已并桌";
             }
             int index = dataGridView1.Rows.Add();
             dataGridView1.Rows[index].Cells["TranSequence"].Value    = order.TranSequence.ToString();
             dataGridView1.Rows[index].Cells["BillType"].Value        = billType;
             dataGridView1.Rows[index].Cells["TotalSellPrice"].Value  = order.TotalSellPrice.ToString("f2");
             dataGridView1.Rows[index].Cells["ActualSellPrice"].Value = order.ActualSellPrice.ToString("f2");
             dataGridView1.Rows[index].Cells["DiscountPrice"].Value   = order.DiscountPrice.ToString("f2");
             dataGridView1.Rows[index].Cells["CutOffPrice"].Value     = (-order.CutOffPrice).ToString("f2");
             dataGridView1.Rows[index].Cells["ServiceFee"].Value      = order.ServiceFee.ToString("f2");
             dataGridView1.Rows[index].Cells["PaymentMoney"].Value    = order.PaymentMoney.ToString("f2");
             dataGridView1.Rows[index].Cells["NeedChangePay"].Value   = order.NeedChangePay.ToString("f2");
             dataGridView1.Rows[index].Cells["MoreOrLess"].Value      = (order.ActualSellPrice + order.ServiceFee - (order.PaymentMoney - order.NeedChangePay)).ToString("f2");
             dataGridView1.Rows[index].Cells["OrderID"].Value         = order.OrderID;
         }
         //设置第一行选中
         int selectedIndex = 0;
         if (dataGridView1.RowCount > 0)
         {
             dataGridView1.Rows[selectedIndex].Selected = true;
         }
         this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
         //默认加载第一行数据
         Guid       orderID    = new Guid(dataGridView1.Rows[selectedIndex].Cells["OrderID"].Value.ToString());
         SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrderByBillSearch(orderID);
         _salesOrder = salesOrder;
         //更新账单信息
         this.lbOrderNo.Text  = salesOrder.order.OrderNo;
         this.lbDeskName.Text = salesOrder.order.DeskName;
         this.lbBillType.Text = dataGridView1.Rows[selectedIndex].Cells["BillType"].Value.ToString();
         string eatType = string.Empty;
         if (salesOrder.order.EatType == (int)EatWayType.DineIn)
         {
             eatType = "堂食";
         }
         else if (salesOrder.order.EatType == (int)EatWayType.Takeout)
         {
             eatType = "外卖";
         }
         else if (salesOrder.order.EatType == (int)EatWayType.OutsideOrder)
         {
             eatType = "外送";
         }
         this.lbEatType.Text    = eatType;
         this.lbEmployeeNo.Text = salesOrder.order.EmployeeNo;
         this.lbCashier.Text    = salesOrder.order.PayEmployeeNo;
         this.lbDeviceNo.Text   = salesOrder.order.DeviceNo;
         BindDataGridView2(salesOrder);
         BindDataGridView3(salesOrder);
     }
 }