Example #1
0
        public MerchantTypes GetMerchantTypes()
        {
            var merchantType = MerchantTypeHelper.GetMerchantType(Mid);

            if (merchantType != null)
            {
                return(merchantType.TypeId);
            }
            return(MerchantTypes.Food);
        }
Example #2
0
        public static bool SendOrdersMsgToPrint(Orders orders)
        {
            var merchant = MerchantHelper.GetMerchant(orders.SellerId);

            if (merchant == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(merchant.MachineCode) || string.IsNullOrEmpty(merchant.MachineKey))
            {
                return(false);
            }
            var merchanttype = MerchantTypeHelper.GetMerchantType(merchant.Mid);

            if (merchanttype == null)
            {
                return(false);
            }
            StringBuilder sb            = new StringBuilder(string.Empty);
            var           ordertypename = orders.OrderType == OrderType.Shop ? "到店" : "送餐";

            sb.AppendFormat("【{0}】{1}\n", merchanttype.Name, ordertypename);

            sb.AppendFormat("订单号:{0}\n", orders.Id);
            if (merchant.MerType == MerchantTypes.Food)
            {
                sb.AppendFormat("订单类型:{0}\n", ordertypename);
            }
            sb.AppendFormat("订单时间:{0}\n", orders.CreateTime.ToString("yyyy-MM-dd hh:mm:ss"));
            if (orders.OrderType == OrderType.Shop)
            {
                sb.AppendFormat("到店时间:{0}\n", orders.OrderTime.ToString("yyyy-MM-dd hh:mm:ss"));
            }

            sb.Append("【收货信息】\n");
            sb.AppendFormat("联系人:{0}\n", orders.LinkMan);
            sb.AppendFormat("联系电话:{0}\n", orders.Mobile);
            if ((merchant.MerType == MerchantTypes.Food && orders.OrderType != OrderType.Shop) ||
                merchant.MerType == MerchantTypes.Company)
            {
                sb.AppendFormat("地址:{0}\n", orders.Address);
            }
            else if (merchant.MerType == MerchantTypes.Night)
            {
                sb.AppendFormat("包厢号:{0}\n", orders.Boxno);
            }

            sb.Append("【订单详情】\n");
            sb.Append("******************************\n");
            var i = 0;

            foreach (var order in orders.GidList)
            {
                sb.AppendFormat("{0}   {1}份   {2}元\n"
                                , orders.TitleList[i], orders.NumList[i], orders.NumList[i] * orders.NowPriceList[i]);
                i++;
            }
            sb.Append("******************************\n");
            sb.AppendFormat("总计数量:{0}\n", orders.NumList.Sum(o => o));
            sb.AppendFormat("总金额:{0}\n", orders.TotalPrice);

            sb.AppendFormat("【备注】:{0}\n", orders.Remark);

            return(SendPrinterData(sb.ToString(), merchant));
        }