Exemple #1
0
        public void SendLatter(Latter latter, IExpress messenger)
        {
            Console.WriteLine("呼叫信使...");
            Console.WriteLine("信使接受信件...");

            messenger.Express(latter);
        }
        public JsonResult GetConfig(string name)
        {
            IExpress express = ServiceHelper.Create <IExpressService>().GetExpress(name);
            ExpressTemplateConfig expressTemplateConfig = new ExpressTemplateConfig()
            {
                width  = express.Width,
                height = express.Height,
                data   = (
                    from item in ExpressPrintElement.AllPrintElements
                    select new Element()
                {
                    key = item.Key.ToString(),
                    @value = item.Value
                }).ToArray()
            };
            ExpressTemplateConfig expressTemplateConfig1 = expressTemplateConfig;

            if (express.Elements != null)
            {
                int num = 0;
                foreach (ExpressPrintElement element in express.Elements)
                {
                    Element element1 = ((IEnumerable <Element>)expressTemplateConfig1.data).FirstOrDefault((Element t) => t.key == element.PrintElementIndex.ToString());
                    int[]   x        = new int[] { element.LeftTopPoint.X, element.LeftTopPoint.Y };
                    element1.a = x;
                    int[] numArray = new int[] { element.RightBottomPoint.X, element.RightBottomPoint.Y };
                    element1.b        = numArray;
                    element1.selected = true;
                    num++;
                }
                expressTemplateConfig1.selectedCount = num;
            }
            return(Json(expressTemplateConfig1, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public void SendLatter(Latter latter, IExpress messenger)
        {
            Console.WriteLine("宅配便を呼び出す...");
            Console.WriteLine("宅配便受付郵便サービス...");

            messenger.Express(latter);
        }
Exemple #4
0
        public void testSimpleAddition()
        {
            var      five = Money.Dollar(5);
            IExpress sum  = five.Plus(five);
            var      bank = new Bank();

            Money reduced = bank.Reduce(sum, "USD");

            reduced.Should().Be(Money.Dollar(10));
        }
Exemple #5
0
        public void testPlusReturnsSum()
        {
            var five = Money.Dollar(5);

            IExpress result = five.Plus(five);

            Sum sum = (Sum)result;

            sum.Augend.Should().Be(five);
            sum.Addend.Should().Be(five);
        }
Exemple #6
0
        public void testMixedAddition()
        {
            IExpress fiveDollars = Money.Dollar(5);
            IExpress tenFrancs   = Money.Franc(10);
            var      bank        = new Bank();

            bank.AddRate("CHF", "USD", 2);

            var result = bank.Reduce(fiveDollars.Plus(tenFrancs), "USD");

            result.Should().Be(Money.Dollar(10));
        }
Exemple #7
0
        public void testSumPlusMoney()
        {
            IExpress fiveDollars = Money.Dollar(5);
            IExpress tenFrancs   = Money.Franc(10);
            var      bank        = new Bank();

            bank.AddRate("CHF", "USD", 2);
            IExpress sum = new Sum(fiveDollars, tenFrancs).Plus(fiveDollars);

            Money result = bank.Reduce(sum, "USD");

            result.Should().Be(Money.Dollar(15));
        }
Exemple #8
0
        public JsonResult Print(string orderIds, string expressName, string startNo, int regionId, string address, string senderName, string senderPhone)
        {
            IExpressService expressService = ServiceHelper.Create <IExpressService>();
            IExpress        express        = expressService.GetExpress(expressName);

            if (!express.CheckExpressCodeIsValid(startNo))
            {
                return(Json(new { success = false, msg = "起始快递单号无效" }));
            }
            ServiceHelper.Create <IShopService>().UpdateShopSenderInfo(base.CurrentSellerManager.ShopId, regionId, address, senderName, senderPhone);
            IEnumerable <int> elements =
                from item in express.Elements
                select item.PrintElementIndex;
            List <PrintModel> printModels = new List <PrintModel>();

            char[]             chrArray = new char[] { ',' };
            IEnumerable <long> nums     =
                from item in orderIds.Split(chrArray)
                select long.Parse(item);

            foreach (long num in nums)
            {
                PrintModel printModel = new PrintModel()
                {
                    Width    = express.Width,
                    Height   = express.Height,
                    FontSize = 11
                };
                PrintModel printModel1 = printModel;
                IDictionary <int, string> printElementIndexAndOrderValue = expressService.GetPrintElementIndexAndOrderValue(base.CurrentSellerManager.ShopId, num, elements);
                printModel1.Elements = printElementIndexAndOrderValue.Select <KeyValuePair <int, string>, PrintModel.PrintElement>((KeyValuePair <int, string> item) =>
                {
                    ExpressPrintElement expressPrintElement = express.Elements.FirstOrDefault((ExpressPrintElement t) => t.PrintElementIndex == item.Key);
                    return(new PrintModel.PrintElement()
                    {
                        X = expressPrintElement.LeftTopPoint.X,
                        Y = expressPrintElement.LeftTopPoint.Y,
                        Height = expressPrintElement.RightBottomPoint.Y - expressPrintElement.LeftTopPoint.Y,
                        Width = expressPrintElement.RightBottomPoint.X - expressPrintElement.LeftTopPoint.X,
                        Value = item.Value
                    });
                });
                printModels.Add(printModel1);
            }
            ServiceHelper.Create <IOrderService>().SetOrderExpressInfo(base.CurrentSellerManager.ShopId, expressName, startNo, nums);
            return(Json(new { success = true, data = printModels }));
        }
Exemple #9
0
        public IEnumerable <IExpress> GetAllExpress()
        {
            IEnumerable <PluginInfo> pluginInfos = Core.PluginsManagement.GetInstalledPluginInfos(Core.Plugins.PluginType.Express);

            IExpress[] plugins = new IExpress[pluginInfos.Count()];
            int        i       = 0;
            string     name;

            foreach (var pluginInfo in pluginInfos)
            {
                name = pluginInfo.ClassFullName.Split(',')[1];
                IExpress plugin = Core.Instance.Get <IExpress>(pluginInfo.ClassFullName);
                plugin.Logo            = RELATEIVE_PATH + name + "/" + plugin.Logo;
                plugin.BackGroundImage = RELATEIVE_PATH + name + "/" + plugin.BackGroundImage;
                plugins[i++]           = plugin;
            }
            return(plugins);
        }
Exemple #10
0
        public IEnumerable <IExpress> GetAllExpress()
        {
            IEnumerable <PluginInfo> installedPluginInfos = PluginsManagement.GetInstalledPluginInfos(PluginType.Express);

            IExpress[] expressArray = new IExpress[installedPluginInfos.Count()];
            int        num          = 0;

            foreach (PluginInfo installedPluginInfo in installedPluginInfos)
            {
                string   classFullName = installedPluginInfo.ClassFullName;
                char[]   chrArray      = new char[] { ',' };
                string   str           = classFullName.Split(chrArray)[1];
                IExpress express       = Instance.Get <IExpress>(installedPluginInfo.ClassFullName);
                express.Logo            = string.Concat("/Plugins/Express/", str, "/", express.Logo);
                express.BackGroundImage = string.Concat("/Plugins/Express/", str, "/", express.BackGroundImage);
                int num1 = num;
                num = num1 + 1;
                expressArray[num1] = express;
            }
            return(expressArray);
        }
Exemple #11
0
 public Sum(IExpress augend, IExpress addend)
 {
     Augend = augend;
     Addend = addend;
 }
Exemple #12
0
 public IExpress Plus(IExpress addend)
 {
     return(new Sum(this, addend));
 }
 public ExpressController(IExpress service) //构造注入
 {
     _service = service;
 }
Exemple #14
0
        public override Result AddOrderTrade(int orderSysno)
        {
            Result     result   = new Result();
            var        order    = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysno);
            CrCustomer customer = Hyt.BLL.CRM.CrCustomerBo.Instance.GetModel(order.CustomerSysNo);

            WhWarehouse warehouseMod       = Hyt.BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo);
            BsArea      wareDistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(warehouseMod.AreaSysNo);
            BsArea      wareCityEntity     = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo);
            BsArea      wareProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo);

            SoReceiveAddress srenity        = Hyt.BLL.Order.OutboundReturnBo.Instance.GetSoReceiveAddressBysoOrderSysNo(order.SysNo);
            BsArea           DistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(srenity.AreaSysNo);
            BsArea           CityEntity     = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(DistrictEntity.ParentSysNo);
            BsArea           ProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(CityEntity.ParentSysNo);

            var kuaidi = Hyt.BLL.Logistics.DeliveryTypeBo.Instance.GetKuaidi(orderSysno);


            IList <CBSoOrderItem> datao = SoOrderBo.Instance.GetCBOrderItemsByOrderId(order.SysNo);

            order.OrderItemList = new List <SoOrderItem>();
            int    ParcelNo  = 0;
            string GoodsName = "";

            foreach (CBSoOrderItem item in datao)
            {
                ParcelNo += item.Quantity;
                GoodsName = item.EasName;
                order.OrderItemList.Add(item);
            }

            CrossBorderParam cp = new CrossBorderParam();

            cp.Cost          = order.FreightAmount;
            cp.OrderDateTime = order.CreateDate;
            cp.OrderNo       = order.SysNo.ToString().Trim();
            cp.CustomerID    = 689;
            cp.S_Address     = warehouseMod.BackWarehouseName.Trim();
            cp.S_Province    = wareProvinceEntity.AreaName.Trim();
            cp.S_City        = wareCityEntity.AreaName.Trim();
            cp.S_County      = wareDistrictEntity.AreaName.Trim();
            cp.S_Name        = warehouseMod.WarehouseName.Trim();
            cp.S_Phone       = warehouseMod.Phone.Trim();
            if (!string.IsNullOrEmpty(srenity.IDCardNo))
            {
                cp.R_IDNo = srenity.IDCardNo.Trim().ToUpper();
            }
            cp.R_Name         = srenity.Name.Trim();
            cp.R_Phone        = srenity.MobilePhoneNumber.Trim();
            cp.R_Address      = srenity.StreetAddress.Trim();
            cp.R_Province     = ProvinceEntity.AreaName.Trim();
            cp.R_City         = CityEntity.AreaName.Trim();
            cp.R_County       = DistrictEntity.AreaName.Trim();
            cp.Type           = "4";
            cp.ParcelNo       = ParcelNo;
            cp.GoodsName      = GoodsName;
            cp.Mark           = "300-012-005";
            cp.Batch          = "114批";
            cp.DeliveryType   = -1;
            cp.PrintSenderMsg = warehouseMod.WarehouseName.Trim();
            cp.PayType        = -1;
            cp.Company        = kuaidi.Company;
            cp.Date           = kuaidi.Date;
            cp.TrackingNo     = kuaidi.TrackingNo;


            using (ChannelFactory <IExpress> channelFactory = new ChannelFactory <IExpress>("WSHttpBinding_IExpress"))
            {
                UserNamePasswordClientCredential credential = channelFactory.Credentials.UserName;
                credential.UserName = UserName;
                credential.Password = Password;
                IExpress calculator = channelFactory.CreateChannel();

                #region 参数
                T_Express express = new T_Express
                {
                    PicLocalNo        = cp.PicLocalNo,
                    Batch             = cp.Batch,
                    Type              = cp.Type,
                    S_Name            = cp.S_Name,
                    S_Phone           = cp.S_Phone,
                    S_Province        = cp.S_Province,
                    S_City            = cp.S_City,
                    S_County          = cp.S_County,
                    S_Address         = cp.S_Address,
                    R_Name            = cp.R_Name,
                    R_Phone           = cp.R_Phone,
                    R_Province        = cp.R_Province,
                    R_City            = cp.R_City,
                    R_County          = cp.R_County,
                    R_Address         = cp.R_Address,
                    R_IDNo            = cp.R_IDNo,
                    OrderNo           = cp.OrderNo,
                    GoodsName         = cp.GoodsName,
                    CollectionPayment = cp.CollectionPayment,

                    Cost           = cp.Cost,
                    OrderDateTime  = cp.OrderDateTime,
                    Account        = cp.Account,
                    BankAccount    = cp.BankAccount,
                    PayType        = cp.PayType,
                    DeliveryType   = cp.DeliveryType,
                    Mark           = cp.Mark,
                    PrintSenderMsg = cp.PrintSenderMsg,
                    ParcelNo       = cp.ParcelNo.ToString(),
                    Date           = DateTime.Parse(cp.Date),
                    Company        = cp.Company,
                    TrackingNo     = cp.TrackingNo,
                    CustomerID     = cp.CustomerID

                                     #region 测试数据
                                     // //预留溯源码
                                     //Batch = "114批",
                                     ////已下订单,未受理
                                     //Type = "4",
                                     //S_Name = "货之家",
                                     //S_Phone = "15802026993",
                                     //S_Province = "广东省",
                                     //S_City = "广州市",
                                     //S_County = "南沙区",
                                     //S_Address = "货之家保税仓",
                                     //R_Name = "周恒",
                                     //R_Phone = "13662656512",
                                     //R_Province = "四川省",
                                     //R_City = "达州市",
                                     //R_County = "开江县",
                                     //R_Address = "新宁镇接龙桥惠民社区5号楼三楼八号",
                                     //R_IDNo = "440103698954523618",
                                     //OrderNo = "Test_70151538959",
                                     ////快递面单,底部信息
                                     //GoodsName = "日用品",
                                     //Company = "圆通",
                                     //TrackingNo = "81257111826892",
                                     //Cost = 0,
                                     ////订单日期
                                     //OrderDateTime = DateTime.Parse("2018-01-08 09:48:23"),
                                     //PayType = -1,
                                     //DeliveryType = -1,
                                     ////三段码、大头笔
                                     //Mark = "300-012-005",
                                     ////覆盖详细的发件信息
                                     //PrintSenderMsg = "货之家南沙保税仓",
                                     //ParcelNo = "1",
                                     ////快递单日期
                                     //Date = DateTime.Parse("2018-01-08 09:48:23"),
                                     ////新绕城,固定为689
                                     //CustomerID = 689,

                                     //PicLocalNo = null,
                                     //CollectionPayment = null,
                                     //可空 = null,
                                     //BankAccount = null,
                                     #endregion
                };
                #endregion

                result.Status = calculator.ExpressSaveOrUpdate(express);
            }
            return(result);
        }