Example #1
0
        public SalesOrder GetSalesOrder(Guid orderId)
        {
            SalesOrder salesOrder = null;

            try
            {
                _daoManager.OpenConnection();
                Order order = _orderDao.GetOrder(orderId);
                if (order != null)
                {
                    IList <OrderDetails> orderDetailsList = _orderDetailsDao.GetOrderDetailsList(orderId);
                    salesOrder = new SalesOrder
                    {
                        order            = order,
                        orderDetailsList = orderDetailsList
                    };
                }
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[GetSalesOrder]参数:orderId_{0}", orderId), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(salesOrder);
        }
Example #2
0
        public bool DeleteWholeOrder(DeletedOrder deletedOrder)
        {
            bool returnValue = false;

            _daoManager.BeginTransaction();
            try
            {
                SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo();
                if (systemConfig.IncludeKitchenPrint)
                {
                    //获取打印任务列表
                    Order order = _orderDao.GetOrder(deletedOrder.OrderID);
                    IList <OrderDetails> orderDetailsList = _orderDetailsDao.GetOrderDetailsList(deletedOrder.OrderID);
                    SalesOrder           salesOrder       = new SalesOrder
                    {
                        order            = order,
                        orderDetailsList = orderDetailsList
                    };
                    IList <PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 2, deletedOrder.CancelReasonName);
                    foreach (PrintTask printTask in printTaskList)
                    {
                        printTask.ItemQty = -printTask.ItemQty; //数量应该为负数
                        _printTaskDao.InsertPrintTask(printTask);
                    }
                }
                //删除账单
                if (_orderDao.DeleteWholeOrder(deletedOrder))
                {
                    if (_orderDetailsDao.DeleteWholeOrderDetails(deletedOrder))
                    {
                        //该订单可能不包含折扣
                        _orderDiscountDao.DeleteOrderDiscount(deletedOrder.OrderID);
                        returnValue = true;
                    }
                }
                _daoManager.CommitTransaction();
            }
            catch (Exception exception)
            {
                _daoManager.RollBackTransaction();
                returnValue = false;
                LogHelper.GetInstance().Error(string.Format("[DeleteWholeOrder]参数:deletedOrder_{0}", JsonConvert.SerializeObject(deletedOrder)), exception);
            }
            return(returnValue);
        }
Example #3
0
        public IList <OrderDetails> GetOrderDetails(Guid orderId)
        {
            IList <OrderDetails> orderDetailsList = null;

            try
            {
                _daoManager.OpenConnection();
                orderDetailsList = _orderDetailsDao.GetOrderDetailsList(orderId);
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error("[GetOrderDetails]参数:orderId_" + orderId, exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(orderDetailsList);
        }
Example #4
0
        public bool CreateReminderOrder(ReminderOrder reminderOrder)
        {
            if (reminderOrder == null || reminderOrder.OrderDetailsIDList == null || reminderOrder.OrderDetailsIDList.Count <= 0)
            {
                return(false);
            }
            bool returnValue = false;

            try
            {
                _daoManager.OpenConnection();
                //添加打印任务
                SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo();
                if (systemConfig.IncludeKitchenPrint)
                {
                    Order order = _orderDao.GetOrder(reminderOrder.OrderID);
                    if (order != null)
                    {
                        SalesOrder salesOrder = new SalesOrder
                        {
                            order            = order,
                            orderDetailsList = _orderDetailsDao.GetOrderDetailsList(reminderOrder.OrderDetailsIDList)
                        };
                        IList <PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 3, reminderOrder.ReasonName);
                        foreach (PrintTask printTask in printTaskList)
                        {
                            _printTaskDao.InsertPrintTask(printTask);
                        }
                    }
                }
                returnValue = true;
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[CreateReminderOrder]参数:reminderOrder_{0}", JsonConvert.SerializeObject(reminderOrder)), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(returnValue);
        }