Пример #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (!CheckInput())
        {
            return;
        }
        var service = new cPos.Admin.Service.Implements.CustomerService();
        var obj     = new BrandCustomerInfo();

        obj.brand_customer_code      = this.tbCode.Text.Trim();
        obj.brand_customer_name      = this.tbName.Text.Trim();
        obj.brand_customer_eng       = this.tbEng.Text.Trim();
        obj.brand_customer_address   = this.tbAddress.Text.Trim();
        obj.brand_customer_post      = this.tbPost.Text.Trim();
        obj.brand_customer_contacter = this.tbContacter.Text.Trim();
        obj.brand_customer_tel       = this.tbTel.Text.Trim();
        obj.brand_customer_email     = this.tbEmail.Text.Trim();
        obj.status         = this.ddlStatus.SelectedValue;
        obj.create_user_id = loggingSessionInfo.CurrentUser.User_Id;
        obj.create_time    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        if (PageHelper.IsCreateOperate(this))//新建
        {
            obj.brand_customer_id = Guid.NewGuid().ToString().Replace("-", string.Empty);
            Hashtable ht = service.SaveBrandCustomerInfo(obj);
            if (Convert.ToBoolean(ht["status"]))
            {
                this.Redirect("新建成功", InfoType.Info, this.Request.QueryString["from"] ?? "brand_customer_query.aspx");
            }
            else
            {
                this.InfoBox.ShowPopError("新建失败!");
            }
        }
        else
        {
            obj.brand_customer_id = this.Request.QueryString["bc_id"];
            obj.modify_user_id    = loggingSessionInfo.CurrentUser.User_Id;
            obj.modify_time       = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            Hashtable ht = service.SaveBrandCustomerInfo(obj);
            if (Convert.ToBoolean(ht["status"]))
            {
                this.Redirect("修改成功", InfoType.Info, this.Request.QueryString["from"] ?? "brand_customer_query.aspx");
            }
            else
            {
                this.InfoBox.ShowPopError("修改失败!");
            }
        }
    }
Пример #2
0
    private bool CheckInput()
    {
        var service = new cPos.Admin.Service.Implements.CustomerService();

        if (string.IsNullOrEmpty(tbCode.Text))
        {
            this.InfoBox.ShowPopError("编码不能为空");
            tbCode.Focus();
            return(false);
        }
        if (PageHelper.IsModifyOperate(this))
        {
            if (!string.IsNullOrEmpty(tbCode.Text))
            {
                var exists = service.CheckExistBrandCustomer(this.Request.QueryString["bc_id"], this.tbCode.Text);
                if (exists)
                {
                    this.InfoBox.ShowPopError("编码已存在!");
                    this.tbCode.Focus();
                    return(false);
                }
            }
        }
        else
        {
            if (!ViewState["code"].ToString().Equals(this.tbCode.Text))
            {
                if (!string.IsNullOrEmpty(tbCode.Text))
                {
                    var exists = service.CheckExistBrandCustomer(this.Request.QueryString["bc_id"], this.tbCode.Text);
                    if (exists)
                    {
                        this.InfoBox.ShowPopError("编码已存在!");
                        this.tbCode.Focus();
                        return(false);
                    }
                }
            }
        }
        return(true);
    }
Пример #3
0
    private void showBrandCustomer()
    {
        var    service = new cPos.Admin.Service.Implements.CustomerService();
        string id      = PageHelper.GetRequestParam(this, "bc_id", "");

        if (!string.IsNullOrEmpty(id))
        {
            this.displayBrandCustomer(service.GetBrandCustomerById(id));
        }

        if (PageHelper.IsViewOperate(this))
        {
            this.tbCode.ReadOnly      = true;
            this.tbName.ReadOnly      = true;
            this.tbEng.ReadOnly       = true;
            this.tbAddress.ReadOnly   = true;
            this.tbPost.ReadOnly      = true;
            this.tbContacter.ReadOnly = true;
            this.tbTel.ReadOnly       = true;
            this.tbEmail.ReadOnly     = true;
            this.ddlStatus.Enabled    = false;
            this.btnOK.Visible        = false;
        }
    }
Пример #4
0
        public BaseContract Run(PackageGenTypeMethod packageGenType,
                                string batId, string customerId, string unitId, string userId)
        {
            int       pageSize  = 1000; // 每页数量
            AppType   appType   = AppType.AP;
            string    bizId     = Utils.NewGuid();
            string    methodKey = "Task.PackageMobileUnit";
            string    ifCode    = TaskCode.T012.ToString();
            var       data      = new BaseContract();
            Hashtable htLogExt  = new Hashtable();

            htLogExt["customer_code"] = null;
            htLogExt["customer_id"]   = customerId;
            htLogExt["unit_code"]     = null;
            htLogExt["unit_id"]       = unitId;
            htLogExt["user_code"]     = null;
            htLogExt["user_id"]       = userId;
            htLogExt["if_code"]       = ifCode;
            htLogExt["app_code"]      = appType.ToString();
            try
            {
                Hashtable htParams = new Hashtable();
                htParams.Add("package_gen_type", packageGenType);
                htParams.Add("bat_id", batId);
                htParams.Add("customer_id", customerId);
                htParams.Add("unit_id", unitId);
                htParams.Add("user_id", userId);
                LogService.WriteTrace(bizId, methodKey, TraceLogType.Params.ToString(), htParams, userId, htLogExt);

                bool statusFlag = true;

                // 检查参数
                Hashtable htResult       = new Hashtable();
                bool      paramCheckFlag = false;
                #region Check Length
                htResult = ErrorService.CheckLength("用户ID", userId, 1, 50, true, false, ref paramCheckFlag);
                if (!paramCheckFlag)
                {
                    throw new Exception(string.Format("批次{0}:用户ID不能为空", batId));
                }
                #endregion

                htLogExt["customer_id"] = customerId;

                var dataService       = new ExchangeBsService.UnitBsService();
                var apCustomerService = new cPos.Admin.Service.Implements.CustomerService();

                // 获取总数量
                int customersCount = apCustomerService.GetMobileCustomerNotPackagedCount(customerId, userId, unitId);
                int unitsCount     = apCustomerService.GetMobileCustomerShopNotPackagedCount(customerId, userId, unitId);
                if (customersCount <= 0 && unitsCount <= 0)
                {
                    data.status = Utils.GetStatus(true);
                    return(data);
                }

                // 创建数据包
                string         pkgTypeCode    = PackageTypeMethod.MOBILE.ToString();
                string         pkgGenTypeCode = packageGenType.ToString();
                PackageService pkgService     = new PackageService();
                Hashtable      htPkg          = pkgService.CreatePackage(appType, batId, pkgTypeCode,
                                                                         customerId, unitId, userId, pkgGenTypeCode, null, null, AppType.MOBILE.ToString());
                if (!Convert.ToBoolean(htPkg["status"]))
                {
                    data.status          = Utils.GetStatus(false);
                    data.error_code      = htPkg["error_code"].ToString();
                    data.error_full_desc = htPkg["error_desc"].ToString();
                    LogService.WriteError(bizId, methodKey, data.error_code, data.ToString(), userId, htLogExt);
                    Console.WriteLine(data.error_full_desc);
                    return(data);
                }
                string pkgId = htPkg["package_id"].ToString();

                // 循环生成数据包文件
                int num = 0;
                IList <cPos.Admin.Model.Customer.CustomerInfo> customers = apCustomerService.GetMobileCustomerListNotPackaged(
                    customerId, userId, unitId, num, pageSize);
                IList <cPos.Admin.Model.Customer.CustomerShopInfo> units = apCustomerService.GetMobileCustomerShopListNotPackaged(
                    customerId, userId, unitId, num, pageSize);


                Hashtable htPkgf = pkgService.CreateMoblieCustomerAndUnitsPackageFile(
                    appType, batId, pkgId, userId, null, customers, units);
                if (!Convert.ToBoolean(htPkgf["status"]))
                {
                    data.status          = Utils.GetStatus(false);
                    data.error_code      = htPkgf["error_code"].ToString();
                    data.error_full_desc = htPkgf["error_desc"].ToString();
                    LogService.WriteError(bizId, methodKey, data.error_code, data.ToString(), userId, htLogExt);
                    Console.WriteLine(data.error_full_desc);
                    return(data);
                }
                // 记录数据打包批次号
                apCustomerService.SetMobileCustomerBatInfo(customerId, userId, unitId, batId, customers);
                apCustomerService.SetMobileCustomerShopBatInfo(customerId, userId, unitId, batId, units);


                // 发布数据包
                Hashtable htPkgPublish = pkgService.PublishPackage(appType, batId, pkgId, userId);
                if (!Convert.ToBoolean(htPkgPublish["status"]))
                {
                    data.status          = Utils.GetStatus(false);
                    data.error_code      = htPkgPublish["error_code"].ToString();
                    data.error_full_desc = htPkgPublish["error_desc"].ToString();
                    LogService.WriteError(bizId, methodKey, data.error_code, data.ToString(), userId, htLogExt);
                    Console.WriteLine(data.error_full_desc);
                    return(data);
                }

                // 更新数据打包标识
                apCustomerService.UpdateMobileCustomerNotPackagedIfFlag(customerId, userId, unitId, batId);
                apCustomerService.UpdateMobileCustomerShopNotPackagedIfFlag(customerId, userId, unitId, batId);

                data.status = Utils.GetStatus(statusFlag);
                LogService.WriteTrace(bizId, methodKey, TraceLogType.Return.ToString(), data.ToString(), userId, htLogExt);
            }
            catch (Exception ex)
            {
                data.status          = Utils.GetStatus(false);
                data.error_code      = ErrorCode.A000.ToString();
                data.error_full_desc = ex.ToString();
                LogService.WriteError(bizId, methodKey, data.error_code, data.ToString(), userId, htLogExt);
                Console.WriteLine(data.error_full_desc);
            }
            return(data);
        }
Пример #5
0
        static void Main(string[] args)
        {
            string logFolderPath = @"C:\cPos\log\admin_task\";

            try
            {
                int    cycleTime         = Convert.ToInt32(ConfigurationManager.AppSettings["cycleTime"].Trim()) * 1000;
                string batId             = string.Empty;
                var    apCustomerService = new cPos.Admin.Service.Implements.CustomerService();

                while (true)
                {
                    Console.WriteLine(string.Format("[{0}]导入数据任务批次开始...", Utils.GetNow()));

                    // 获取客户列表
                    Hashtable htCustomer = new Hashtable();
                    htCustomer["Status"] = "1";
                    IList <cPos.Admin.Model.Customer.CustomerInfo> customers =
                        apCustomerService.GetAllCustomerList(htCustomer);
                    WorkerType workerType;
                    Hashtable  result          = new Hashtable();
                    string     taskBeginFormat = "[{0}] {2} {1}任务开始...";
                    string     taskEndFormat   = "[{0}] {2} {1}任务结束";
                    foreach (var customer in customers)
                    {
                        if (customer.Connect == null || customer.Connect.WsUrl.Trim().Length == 0)
                        {
                            customer.Connect = apCustomerService.GetCustomerConnectByID(customer.ID);
                        }

                        // MonitorLog
                        if (true)
                        {
                            workerType = WorkerType.MonitorLog;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new MonitorLogTask();
                            result = worker.Run(batId, customer);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // PosOrder
                        if (true)
                        {
                            workerType = WorkerType.PosOrder;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PosOrderTask();
                            result = worker.Run(batId, customer);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // Ad
                        if (true)
                        {
                            workerType = WorkerType.AdOrder;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new AdOrderTask();
                            result = worker.Run(batId, customer);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                    }

                    Console.WriteLine(string.Format("[{0}]导入数据任务批次结束", Utils.GetNow()));
                    Console.WriteLine(string.Format("".PadLeft(50, '=')));
                    Thread.Sleep(cycleTime);
                }
            }
            catch (Exception ex)
            {
                Utils.SaveFile(logFolderPath, Utils.GetNowString() + ".log", ex.ToString());
                Console.Write(ex.ToString());
                Console.Read();
            }
        }
Пример #6
0
        static void Main(string[] args)
        {
            string logFolderPath = @"C:\cpos_log\task\";   //日志文件地址

            try
            {
                int    cycleTime = 60000;
                string userId    = "0ed1a737a178491c86278b001a059a15";
                string unitId    = null; // "1"
                string batId     = string.Empty;
                PackageGenTypeMethod packageGenType = PackageGenTypeMethod.AUTO_TASK;
                var exPackageService  = new cPos.ExchangeService.DexPackageService();
                var apCustomerService = new cPos.Admin.Service.Implements.CustomerService();
                var apUserService     = new cPos.Admin.Service.Implements.UserService();

                while (true)
                {
                    Console.WriteLine(string.Format("[{0}]任务批次开始...", Utils.GetNow()));
                    Common.PackageIds.Clear();

                    // 获取客户列表
                    Hashtable htCustomer = new Hashtable();
                    htCustomer["Status"] = "1";
                    IList <cPos.Admin.Model.Customer.CustomerInfo> customers =
                        apCustomerService.GetAllCustomerList(htCustomer);
                    WorkerType   workerType;
                    BaseContract result          = new BaseContract();
                    string       taskBeginFormat = "[{0}] {2} {1}任务开始...";
                    string       taskEndFormat   = "[{0}] {2} {1}任务结束";
                    foreach (var customer in customers)
                    {
                        if (!customer.IsPad.Equals(1))
                        {
                            Console.WriteLine(string.Format("[{0} {1}]该客户暂未开放同步功能.", Utils.GetNow(), customer.Code));
                            continue;
                        }
                        //if (customer.Code.Equals("nestle"))//测试单个客户
                        //{

                        // Package - ObjectImages  新增图片
                        if (true)
                        {
                            workerType = WorkerType.ObjectImages;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageObjectImages();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        //}

                        // Package - SkuPrices
                        if (true)
                        {
                            unitId     = null;
                            workerType = WorkerType.SkuPrices;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageSkuPrices();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }

                        // Package - ItemProps
                        if (true)
                        {
                            workerType = WorkerType.ItemProps;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageItemProps();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // Package - SkuProps
                        if (true)
                        {
                            workerType = WorkerType.SkuProps;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageSkuProps();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // Package - Items
                        if (true)
                        {
                            workerType = WorkerType.Items;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageItems();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // Package - ItemsCategory
                        if (true)
                        {
                            workerType = WorkerType.ItemCategorys;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageItemCategorys();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }

                        // Package - Skus
                        if (true)
                        {
                            workerType = WorkerType.Skus;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageSkus();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }
                        // Package - Units
                        if (true)
                        {
                            workerType = WorkerType.Units;
                            batId      = Utils.NewGuid();
                            Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                            var worker = new PackageUnits();
                            result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                            Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        }



                        //// Package - Users
                        //if (true)
                        //{
                        //    workerType = WorkerType.Users;
                        //    batId = Utils.NewGuid();
                        //    Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, customer.Code));
                        //    var worker = new PackageUsers();
                        //    result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                        //    Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, customer.Code));
                        //}

                        #region
                        // Package - ItemPrices
                        //if (false)
                        //{
                        //    workerType = WorkerType.SkuProps;
                        //    batId = Utils.NewGuid();
                        //    Console.WriteLine(string.Format("[{0}] {1}任务开始...", Utils.GetNow(), workerType));
                        //    var worker = new PackageItemPrices();
                        //    result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                        //    Console.WriteLine(string.Format("[{0}] {1}任务结束", Utils.GetNow(), workerType));
                        //}
                        //// Package - Users
                        //if (false)
                        //{
                        //    workerType = WorkerType.Users;
                        //    batId = Utils.NewGuid();
                        //    Console.WriteLine(string.Format("[{0}] {1}任务开始...", Utils.GetNow(), workerType));
                        //    var worker = new PackageUsers();
                        //    result = worker.Run(packageGenType, batId, customer.ID, unitId, userId);
                        //    Console.WriteLine(string.Format("[{0}] {1}任务结束", Utils.GetNow(), workerType));
                        //}

                        //// 获取门店列表
                        //Hashtable htUnit = new Hashtable();
                        //htUnit["CustomerID"] = customer.ID;
                        //htUnit["ShopStatus"] = "1";
                        //IList<MVS.cPos.Model.Customer.CustomerShopInfo> units =
                        //    apCustomerService.GetAllShopList(htUnit);
                        //foreach (var unit in units)
                        //{
                        //    if (true)
                        //    {
                        //        workerType = WorkerType.ItemPrices;
                        //        batId = Utils.NewGuid();
                        //        Console.WriteLine(string.Format("[{0}] {1} {2}任务开始...",
                        //            Utils.GetNow(), workerType, unit.Code));
                        //        var worker = new PackageItemPrices();
                        //        result = worker.Run(packageGenType, batId, customer.ID, unit.ID, userId);
                        //        Console.WriteLine(string.Format("[{0}] {1} {2}任务结束:{3}.",
                        //            Utils.GetNow(), workerType, unit.Code, result.status));
                        //    }
                        //}
                        #endregion
                    }

                    // 导出mobile人员(客户、门店)相关数据
                    if (false)
                    {
                        IList <cPos.Admin.Model.User.UserInfo> mobileUserList = null;
                        Hashtable htMoblieUser = new Hashtable();
                        htMoblieUser["RoleCode"] = "MobileSales";
                        mobileUserList           = apUserService.GetUserList(htMoblieUser);
                        if (mobileUserList != null && mobileUserList.Count > 0)
                        {
                            foreach (var mobileUser in mobileUserList)
                            {
                                // Package - Mobile-customers,units
                                if (true)
                                {
                                    unitId     = null;
                                    workerType = WorkerType.Mobile;
                                    batId      = Utils.NewGuid();
                                    Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType,
                                                                    "MOBILE-" + mobileUser.Account));
                                    var worker = new PackageMobileUnit();
                                    result = worker.Run(packageGenType, batId, null, null, mobileUser.ID);
                                    Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType,
                                                                    "MOBILE-" + mobileUser.Account));
                                }
                            }
                        }
                    }

                    // Package - Mobile基础数据
                    if (false)
                    {
                        unitId     = null;
                        workerType = WorkerType.Mobile;
                        batId      = Utils.NewGuid();
                        Console.WriteLine(string.Format(taskBeginFormat, Utils.GetNow(), workerType, "MOBILE"));
                        var worker = new PackageMobile();
                        result = worker.Run(packageGenType, batId, null, unitId, userId);
                        Console.WriteLine(string.Format(taskEndFormat, Utils.GetNow(), workerType, "MOBILE"));
                    }

                    // 发布数据包
                    Console.WriteLine(string.Format("[{0}]数据包发布开始...", Utils.GetNow()));
                    foreach (var packageId in Common.PackageIds)
                    {
                        exPackageService.PublishPackage(batId, packageId, userId);
                    }
                    Console.WriteLine(string.Format("[{0}]数据包发布完成", Utils.GetNow()));

                    Console.WriteLine(string.Format("[{0}]任务批次结束", Utils.GetNow()));
                    Console.WriteLine(string.Format("".PadLeft(50, '=')));
                    Thread.Sleep(cycleTime);
                }
            }
            catch (Exception ex)
            {
                Utils.SaveFile(logFolderPath, Utils.GetNowString() + ".log", ex.ToString());
                Console.Write(ex.ToString());
                Console.Read();
            }
        }
Пример #7
0
        public Hashtable Run(string batId, cPos.Admin.Model.Customer.CustomerInfo customer)
        {
            string bizId = Utils.NewGuid();
            var    data  = new Hashtable();

            try
            {
                string customerId = customer.ID;
                int    count      = 0;  // 总数量
                int    rowsCount  = 10; // 每页数量
                int    startRow   = 0;
                string unitId     = null;

                var apService         = new Service.AdOrderService();
                var bsService         = BsWebService.CreateAdvertiseOrderService(customer);
                var apCustomerService = new cPos.Admin.Service.Implements.CustomerService();

                //// Units
                //Hashtable htUnits = new Hashtable();
                //htUnits["CustomerID"] = customerId;
                //htUnits["ShopStatus"] = "1";
                //IList<cPos.Admin.Model.Customer.CustomerShopInfo> units =
                //    apCustomerService.GetAllShopList(htUnits);

                //unitId = unitObj.ID;
                Hashtable ht = new Hashtable();
                count = apService.GetAdOrderCountPackaged(customerId, unitId, ht);

                IList <AdvertiseOrderInfo> orderList = new List <AdvertiseOrderInfo>();
                string dataBatId = string.Empty;
                while (count > 0 && startRow < count)
                {
                    dataBatId = Utils.NewGuid();
                    orderList.Clear();
                    var tmpOrderList = apService.GetAdOrderListPackaged(customerId, unitId, ht, 0, rowsCount, dataBatId);
                    if (tmpOrderList != null && tmpOrderList.Count > 0)
                    {
                        foreach (var tmpOrderObj in tmpOrderList)
                        {
                            // 获取并保存广告信息
                            var adList = apService.GetAdList(tmpOrderObj.order_id);
                            if (adList != null)
                            {
                                bsService.SetAdvertiseInfoXML(Utils.Serialiaze(adList), customerId);
                            }

                            // 获取并保存与广告关系信息
                            var orderAdList = apService.GetOrderAdList(tmpOrderObj.order_id);
                            if (orderAdList != null)
                            {
                                bsService.SetAdvertiseOrderAdvertiseInfoXML(Utils.Serialiaze(orderAdList), customerId);
                            }

                            // 获取并保存与门店关系信息
                            var orderUnitList = apService.GetOrderUnitList(tmpOrderObj.order_id, customerId);
                            if (orderUnitList != null)
                            {
                                bsService.SetAdvertiseOrderUnitInfoXML(Utils.Serialiaze(orderUnitList), customerId);
                            }
                        }

                        // 保存订单信息
                        string orderXmlStr = Utils.Serialiaze(tmpOrderList);
                        bsService.SetAdvertiseOrderInfos(orderXmlStr, customerId);

                        // 更新标记
                        apService.SetAdOrderListFlagByBatId(customerId, dataBatId);
                    }
                    startRow += tmpOrderList.Count;
                }

                data["status"] = Utils.GetStatus(true);
                return(data);
            }
            catch (Exception ex)
            {
                data["status"] = Utils.GetStatus(false);
                data["error"]  = ex.ToString();
                Console.WriteLine(ex.ToString());
            }
            return(data);
        }