예제 #1
0
        private void BaseButton_AddCostume_Click(object sender, EventArgs e)
        {
            try
            {
                int buyCount = int.Parse(this.skinTextBox_bugCount.SkinTxt.Text);
                PfCustomerRetailDetail detail = new PfCustomerRetailDetail()
                {
                    PfCustomerID   = pfCustomer.ID,
                    PfCustomerName = PfCustomerCache.GetPfCustomerName(pfCustomer.ID),
                    CostumeID      = this.currentSelectedItem.Costume.ID,
                    CostumeName    = this.currentSelectedItem.Costume.Name,
                    ColorName      = this.skinComboBox_Color.Text,
                    SizeName       = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue),
                    // 显示自己设置的尺码组和对应的尺码列表
                    SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)),
                    BuyCount        = buyCount,
                };

                if (!this.AddSelectedCostumeToList(detail))
                {
                    return;
                }
                dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.PfCustomerRetailDetailList));
                lastAddCustomer = pfCustomer;
                this.skinTextBox_bugCount.SkinTxt.Text = "1";
            }
            catch (Exception ee)
            {
                CommonGlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("添加失败!");
            }
        }
예제 #2
0
        private void LoadOrder(PfOrder order)
        {
            if (order != null)
            { //冲单重做
                skinComboBox_PfCustomer.SelectedValue = order.PfCustomerID;
                dateTimePicker_Start.Value            = order.CreateTime;
                numericTextBoxMoney.Value             = order.PayMoney;
                SetPayType(order.PayType);
                skinComboBoxShopID.SelectedValue = order.ShopID;
                curInboundDetailList             = GlobalCache.ServerProxy.GetPfOrderDetails(order.ID);
                if (curInboundDetailList != null)
                {
                    foreach (var item in curInboundDetailList)
                    {
                        Costume costume = CommonGlobalCache.GetCostume(item.CostumeID);
                        item.CostumeName  = costume.Name;
                        item.CustomerID   = order.PfCustomerID;
                        item.BrandName    = CommonGlobalCache.GetBrandName(costume.BrandID);
                        item.CustomerName = PfCustomerCache.GetPfCustomerName(item.CustomerID);
                    }
                }
                skinTextBox_Remarks.Text = order.Remarks;
            }

            this.BindingInboundDetailSource();
        }
예제 #3
0
        private void UpdatePayType(int selectType, PfInfo item)
        {
            switch (selectType)
            {
            case 0:
                //记录一条欠条
                GlobalCache.ServerProxy.PfDelivery(item);
                break;

            case 1:
                //减去余额
                pfCustomer.Balance -= item.PfOrder.TotalPfPrice;
                InteractResult interactResult = PfCustomerCache.PfCustomer_OnUpdate(pfCustomer);
                switch (interactResult.ExeResult)
                {
                case ExeResult.Success:
                    break;

                case ExeResult.Error:
                    GlobalMessageBox.Show(interactResult.Msg);
                    break;

                default:
                    break;
                }
                break;

            case 2:
                break;

            default:
                break;
            }
        }
        private void Remove(List <PfCustomer> list, PfCustomer item)
        {
            InteractResult result = PfCustomerCache.PfCustomer_OnRemove(item.ID);

            switch (result.ExeResult)
            {
            case ExeResult.Success:
                TreeModel treeM = new TreeModel();
                treeM.ID   = item.ID;
                treeM.Name = item.Name;
                CommonGlobalCache.DeletePFDistributor(treeM);
                GlobalMessageBox.Show("删除成功!");
                this.dataGridView1.DataSource = null;
                list.Remove(item);
                this.dataGridView1.DataSource = list;
                break;

            case ExeResult.Error:
                GlobalMessageBox.Show(result.Msg);
                break;

            default:
                break;
            }
        }
예제 #5
0
        /// <summary>
        /// 绑定CostumeStore数据源
        /// </summary>
        /// <param name="listPage"></param>
        private void BindingCostumeStoreDataSource(PfCustomerStorePage listPage)
        {
            this.dataGridView1.DataSource = null;
            this.costumeStoreList.Clear();
            if (listPage != null && listPage.PfCustomerStores != null)
            {
                foreach (PfCustomerStore store in listPage.PfCustomerStores)
                {
                    Costume costume = CommonGlobalCache.GetCostume(store.CostumeID);
                    if (costume != null)

                    {
                        store.PfCustomerName = PfCustomerCache.GetPfCustomerName(store.PfCustomerID);
                        store.CostumeName    = costume.Name;
                        store.Remarks        = costume.Remarks;
                    }
                    this.costumeStoreList.Add(store);
                }
                if (this.costumeStoreList != null && this.costumeStoreList.Count > 0)
                {
                    this.dataGridViewPagingSumCtrl.BindingDataSource <PfCustomerStore>(DataGridViewUtil.ToDataTable <PfCustomerStore>(costumeStoreList));
                }
            }
            this.dataGridView1.Refresh();
        }
예제 #6
0
        public WholesaleDeliveryPickForm(bool isPurchase)
        {
            InitializeComponent();
            MenuPermission            = RolePermissionMenuEnum.批发发货;
            dataGridViewPagingSumCtrl = new DataGridViewPagingSumCtrl(this.dataGridView1);
            dataGridViewPagingSumCtrl.Initialize();
            dataGridViewPagingSumCtrl.ShowRowCounts = false;
            dataGridViewPagingSumCtrl1 = new DataGridViewPagingSumCtrl(this.dataGridView2);
            dataGridViewPagingSumCtrl1.Initialize();
            dataGridViewPagingSumCtrl1.ShowRowCounts = false;

            if (isPurchase)
            {
                this.Text = "批发发货单提单";
            }
            else
            {
                this.Text = "批发退货单提单";
            }
            GetHangUpPfsPara para = new GetHangUpPfsPara()
            {
                IsDelivery = isPurchase
            };

            orders = GlobalCache.ServerProxy.GetHangUpPfs(para);
            if (orders != null)
            {
                foreach (var item in orders)
                {
                    item.PfCustomerName = PfCustomerCache.GetPfCustomerName(item.PfCustomerID);
                    item.AdminUserName  = CommonGlobalCache.GetUserName(item.AdminUserID);
                }
            }
            dataGridViewPagingSumCtrl.BindingDataSource(orders);
        }
예제 #7
0
        private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode   node              = skinTreeViewClass.SelectedNode;
            TreeModel  CurClass          = node.Tag as TreeModel;
            PfCustomer pfCustomer        = PfCustomerCache.GetPfCustomer(CurClass.ID);
            SaveOffLineCustomerForm form = new SaveOffLineCustomerForm(CurClass.ID, pfCustomer, node);

            form.ShowDialog();
        }
예제 #8
0
 private void BindingDataSource(CustomerRetailPage listPage)
 {
     if (listPage?.PfCustomerRetailOrders != null)
     {
         foreach (var item in listPage?.PfCustomerRetailOrders)
         {
             item.PfCustomerName = PfCustomerCache.GetPfCustomerName(item.PfCustomerID);
         }
     }
     dataGridViewPagingSumCtrl.BindingDataSource(listPage?.PfCustomerRetailOrders, null, listPage?.TotalEntityCount);
 }
예제 #9
0
        private void skinLabelAddSupplier_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                List <PfCustomer> list = (List <PfCustomer>) this.skinComboBox_PfCustomer.DataSource;
                NewWholesaleCustomerSimpleForm addForm = new NewWholesaleCustomerSimpleForm();
                if (addForm.ShowDialog(this) == DialogResult.OK)
                {
                    if (list == null)
                    {
                        list = new List <PfCustomer>();
                    }
                    PfCustomer item     = addForm.Result;
                    PfCustomer listItem = list.Find(t => t.Name == item.Name || t.ID == item.ID);
                    if (listItem == null)
                    {
                        item.Enabled    = true;
                        item.CreateTime = DateTime.Now;
                        InteractResult result = PfCustomerCache.PfCustomer_OnInsert(item);
                        switch (result.ExeResult)
                        {
                        case ExeResult.Success:
                            this.skinComboBox_PfCustomer.DataSource = null;
                            list.Add(item);
                            this.skinComboBox_PfCustomer.DisplayMember = "Name";
                            this.skinComboBox_PfCustomer.ValueMember   = "ID";
                            this.skinComboBox_PfCustomer.DataSource    = list;
                            // this.skinComboBox_SupplierID.SelectedIndex = list.IndexOf(item);
                            break;

                        case ExeResult.Error:
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        // this.skinComboBox_SupplierID.SelectedItem = listItem;
                    }
                }
            }
            catch (Exception ex) { GlobalUtil.ShowError(ex); }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
예제 #10
0
        private void BindingSource(PfAccountRecordPage listPage)
        {
            if (listPage != null && listPage.PfAccountRecords != null && listPage.PfAccountRecords.Count > 0)
            {
                foreach (var item in listPage.PfAccountRecords)
                {
                    item.PfCustomerName  = PfCustomerCache.GetPfCustomerName(item.PfCustomerID);
                    item.AccountTypeName = GlobalUtil.GetPfAccountTypeName(item.AccountType);
                    //item.AdminUserName = PfCustomerCache.GetUserNameWithPf(item.AdminUserID);
                }
            }

            this.dataGridViewPagingSumCtrl.BindingDataSource(listPage?.PfAccountRecords, null, listPage?.TotalEntityCount, listPage?.Sum);
        }
예제 #11
0
        /// <summary>
        /// 绑定plenishOrderSource源到dataGridView中
        /// </summary>
        /// <param name="listPage"></param>
        private void BindingScrapOrderSource(DistributorWithdrawRecordPage listPage)
        {
            if (listPage != null && listPage.DistributorWithdrawRecords != null)
            {
                foreach (var item in listPage.DistributorWithdrawRecords)
                {
                    item.DistributorName = PfCustomerCache.GetUserNameWithPf(item.DistributorID);
                }
            }

            //   this.dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ToDataTable(listPage?.DistributorWithdrawRecords), null, listPage?.TotalEntityCount, listPage?.DistributorWithdrawRecordSum);
            this.dataGridViewPagingSumCtrl.BindingDataSource(listPage?.DistributorWithdrawRecords, null, listPage?.TotalEntityCount, listPage?.DistributorWithdrawRecordSum);
            //dataGridViewPagingSumCtrl.BindingDataSource<DistributorWithdrawRecord>(DataGridViewUtil.ToDataTable(listPage?.DistributorWithdrawRecords));
            this.skinSplitContainer1.Panel2Collapsed = true;
        }
예제 #12
0
        private List <CostumeStoreExcel> GetCostumeStoreExcels()
        {
            PfCustomer pfCustomer           = PfCustomerCache.GetPfCustomer(pfCustomeId);
            List <CostumeStoreExcel> excels = new List <CostumeStoreExcel>();

            foreach (var item in this.curInboundDetailList)
            {
                CostumeStoreExcel curStoreExcel = GetCostumeStoreExcel(item);
                curStoreExcel.CostumeColorName = item.ColorName;
                //   curStoreExcel.PfPrice = item.Price * pfCustomer.PfDiscount/100;
                excels.Add(curStoreExcel);
            }

            return(excels);
        }
예제 #13
0
        /// <summary>
        /// 绑定plenishOrderSource源到dataGridView中
        /// </summary>
        /// <param name="listPage"></param>
        private void BindingReturnOrderSource(PfOrderPage listPage)
        {
            if (listPage != null && listPage.PfOrders != null && listPage.PfOrders.Count > 0)
            {
                List <PfOrder> details = listPage.PfOrders;
                foreach (var item in details)
                {
                    item.PfCustomerName = PfCustomerCache.GetPfCustomerName(item.PfCustomerID);
                    item.AdminUserName  = CommonGlobalCache.GetUserName(item.AdminUserID);
                }
            }

            this.dataGridViewPagingSumCtrl.BindingDataSource(listPage?.PfOrders, null, listPage?.TotalEntityCount, listPage?.PfOrderSum);
            this.skinSplitContainer1.Panel2Collapsed = true;
        }
예제 #14
0
        private void BindingDataSource(PfCustomerOrderPage listPage)
        {
            splitContainer1.Panel2Collapsed = true;
            if (listPage != null && listPage.PfCustomerOrders != null && listPage.PfCustomerOrders.Count > 0)
            {
                foreach (var item in listPage.PfCustomerOrders)
                {
                    item.PfCustomerName = PfCustomerCache.GetPfCustomerName(item.PfCustomerID);
                }

                this.dataGridViewPagingSumCtrl.BindingDataSource <PfCustomerOrder>(listPage?.PfCustomerOrders, null, listPage?.TotalEntityCount);
            }
            else
            {
                this.dataGridViewPagingSumCtrl.BindingDataSource <PfCustomerOrder>(listPage?.PfCustomerOrders, null, 0);
            }
        }
 private void BindingSource(List <PfCustomerStore> listPage)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new  CJBasic.CbGeneric <List <PfCustomerStore> >(this.BindingSource), listPage);
     }
     else
     {
         if (listPage != null)
         {
             for (int i = 0; i < listPage.Count; i++)
             {
                 listPage[i].CostumeName    = CommonGlobalCache.GetCostumeName(listPage[i].CostumeID);
                 listPage[i].PfCustomerName = PfCustomerCache.GetPfCustomerName(listPage[i].PfCustomerID);
                 // Thread.Sleep(2);
                 //UpdateProgress("正在加载中 ");
             }
         }
         dataGridViewPagingSumCtrl.BindingDataSource <PfCustomerStore>(DataGridViewUtil.ListToBindingList(listPage));
         //CompleteProgressForm();
     }
 }
예제 #16
0
        /// <summary>
        /// 初始化缓存列表
        /// </summary>
        private static void InitializeCache()
        {
            try
            {
                int total = 19;
                int sleep = 20;
                CommonGlobalCache.iniProgress(total, "加载中……");
                #region 权限
                CommonGlobalCache.updateProgress("权限");
                if (GlobalCache.currentUser == null)
                {
                    InteractResult <UserInfo> userInfo = GlobalCache.ServerProxy.GetUserInfo(CommonGlobalCache.CurrentUserID);
                    GlobalCache.currentUser = userInfo.Data;
                    GlobalCache.IsPos       = GlobalCache.currentUser.Type == UserInfoType.Guide;
                }

                #endregion
                #region 用户信息

                CommonGlobalCache.updateProgress("用户信息");
                ////season
                if (GlobalCache.adminUserList == null)
                {
                    GlobalCache.adminUserList = GlobalCache.ServerProxy.GetAllAdminUser();
                }
                #endregion
                #region 店铺信息
                CommonGlobalCache.updateProgress("店铺信息");
                if (GlobalCache.ShopList == null)
                {
                    GlobalCache.generalStoreShopID = GlobalCache.ServerProxy.GetGeneralStoreShopID();
                    GlobalCache.currentShopID      = GlobalCache.currentUser.ShopId;
                    GlobalCache.ShopList           = GlobalCache.ServerProxy.GetShopList();
                    //      GlobalCache.eMall = GlobalCache.EMallServerProxy.GetEMall();
                }
                #endregion
                #region 导购
                CommonGlobalCache.updateProgress("导购");
                if (GlobalCache.guideList == null)
                {
                    List <Guide> guideList = GlobalCache.ServerProxy.GetGuideList(string.Empty);
                    GlobalCache.guideList = guideList;
                }
                #endregion

                #region 促销活动
                CommonGlobalCache.updateProgress("促销活动");
                if (salesPromotionList == null)
                {
                    GetSalesPromotionListPara getSalesPromotionListPara = new GetSalesPromotionListPara();
                    getSalesPromotionListPara.PromotionType = (int)PromotionTypeEnum.Null;
                    salesPromotionList = GlobalCache.ServerProxy.GetSalesPromotionList(getSalesPromotionListPara);
                }

                #endregion
                #region 充值规则
                CommonGlobalCache.updateProgress("充值规则");
                if (rechargeDonateRuleList == null)
                {
                    GlobalCache.rechargeDonateRuleList = GlobalCache.ServerProxy.GetRechargeDonateRuleList();
                    RechargeDonateRule rechargeDonateRule = GlobalCache.rechargeDonateRuleList[0];
                    if (rechargeDonateRule != null)
                    {
                        GlobalCache.RechargeDonateRule = rechargeDonateRule;
                    }
                }

                #endregion
                #region  装颜色
                CommonGlobalCache.updateProgress("服装颜色");
                if (GlobalCache.costumeColorList == null)
                {
                    GlobalCache.costumeColorList = GlobalCache.ServerProxy.GetCostumeColor();
                }

                #endregion
                #region 年份
                CommonGlobalCache.updateProgress("年份");
                List <int> list = YearHelper.GetYearList(DateTime.Now);
                foreach (int year in list)
                {
                    GlobalCache.yearList.Add(new ListItem <int>(year.ToString(), year));
                }
                #endregion
                #region 品牌
                CommonGlobalCache.updateProgress("品牌");
                if (GlobalCache.brandList == null)
                {
                    //  List<Brand> bList= GlobalCache.ServerProxy.GetBrand().FindAll(t=>t.IsDisable=false);
                    List <Brand> bList = GlobalCache.ServerProxy.GetEnableBrands().Data;
                    GlobalCache.brandList = bList;
                    GlobalCache.brandList?.Sort();
                }

                #endregion
                #region 菜单
                GlobalCache.Permissons = WinformUIUtil.GetAllTreeNodes(PermissonUtil.GetTreeNodes());
                GlobalCache.Permissons.Add(PermissonUtil.NewTreeNode(RolePermissionMenuEnum.工作台));
                if (CommonGlobalCache.CurrentUserID == SystemDefault.DefaultAdmin)
                {
                    GlobalCache.Permissons.Add(PermissonUtil.NewTreeNode(RolePermissionMenuEnum.管理员));
                }
                GlobalCache.Permissons.Add(PermissonUtil.NewTreeNode(RolePermissionMenuEnum.退出));

                #endregion
                #region 配置
                CommonGlobalCache.updateProgress("配置");
                if (GlobalCache.parameterConfigList == null)
                {
                    GlobalCache.parameterConfigList = GlobalCache.ServerProxy.GetAllParameterConfig();
                    SetParams();
                }
                #endregion
                #region 促销类型
                CommonGlobalCache.updateProgress("促销类型");
                if (GlobalCache.promotionTypeEnumList == null)
                {
                    List <ListItem <PromotionTypeEnum> > promotionTypeList = new List <ListItem <PromotionTypeEnum> >();
                    promotionTypeList.Add(new ListItem <PromotionTypeEnum>(GlobalUtil.COMBOBOX_ALL, PromotionTypeEnum.Null));
                    promotionTypeList.Add(new ListItem <PromotionTypeEnum>(EnumHelper.GetDescription(PromotionTypeEnum.MJ), PromotionTypeEnum.MJ));
                    promotionTypeList.Add(new ListItem <PromotionTypeEnum>(EnumHelper.GetDescription(PromotionTypeEnum.Discount), PromotionTypeEnum.Discount));
                    promotionTypeList.Add(new ListItem <PromotionTypeEnum>(EnumHelper.GetDescription(PromotionTypeEnum.YKJ), PromotionTypeEnum.YKJ));
                    GlobalCache.promotionTypeEnumList = promotionTypeList;
                }

                #endregion
                #region 供应商

                CommonGlobalCache.updateProgress("供应商");
                if (GlobalCache.supplierList == null)
                {
                    GlobalCache.supplierList = GlobalCache.ServerProxy.GetSupplierList();
                    GlobalCache.supplierList?.Sort();
                }
                #endregion


                if (GlobalCache.distributorMemberList == null)
                {
                    GlobalCache.distributorMemberList = (List <TreeModel>)CommonGlobalCache.ServerProxy.GetRetailDistributionTree().Data;
                    // GlobalCache.supplierList = GlobalCache.ServerProxy.GetSupplierList();
                }
                if (GlobalCache.distributorPFMemberList == null)
                {
                    GlobalCache.distributorPFMemberList = (List <TreeModel>)CommonGlobalCache.ServerProxy.GetPfDistributionTree().Data;

                    /*  GetDistributorPagePara para = new GetDistributorPagePara()
                     * {
                     *    IdOrName = null,
                     *    PageIndex = 0,
                     *    PageSize = int.MaxValue
                     * };
                     * DistributorPage page = GlobalCache.ServerProxy.GetDistributorPage(para);
                     * List<TreeModel> listM = new List<TreeModel>();
                     * List<Distributor> Dlist =  page.Distributors as List<Distributor>;
                     * foreach (Distributor item in Dlist)
                     * {
                     *    TreeModel curModel = new TreeModel();
                     *    curModel.ID= item.ID;
                     *    curModel.AccruedCommission = item.AccruedCommission;
                     *    curModel.Name = item.Name;
                     *    listM.Add(curModel);
                     * }
                     * GlobalCache.distributorPFMemberList = listM;*/



                    // GlobalCache.supplierList = GlobalCache.ServerProxy.GetSupplierList();
                }
                #region  装信息
                CommonGlobalCache.updateProgress("服装信息");
                if (costumeList == null)
                {
                    LoadCostumeInfos(total, true);
                }
                //条形码
                #endregion
                #region 尺码组
                CommonGlobalCache.updateProgress("尺码组");
                if (sizeGroupList == null)
                {
                    sizeGroupList = GlobalCache.ServerProxy.GetAllSizeGroup();
                }
                #endregion
                #region COS
                CommonGlobalCache.updateProgress("COS");
                if (cosLoginInfo == null)
                {
                    GlobalCache.cosLoginInfo = GlobalCache.EMallServerProxy.GetCosLoginInfo();
                }
                #endregion

                #region 分销人员
                CommonGlobalCache.updateProgress("分销人员");
                if (GlobalCache.distributorList == null)
                {
                    GetDistributorPagePara para = new GetDistributorPagePara()
                    {
                        IdOrName  = null,
                        PageIndex = 0,
                        PageSize  = int.MaxValue
                    };
                    DistributorPage page = GlobalCache.ServerProxy.GetDistributorPage(para);
                    GlobalCache.distributorList = page.Distributors;
                }
                #endregion
                #region 批发
                CommonGlobalCache.updateProgress("批发");
                PfCustomerCache.Load();
                #endregion

                #region 商城
                CommonGlobalCache.updateProgress("商城");
                if (eMallMiniProgramImg == null)
                {
                    byte[] imageByte = GlobalCache.ServerProxy.GetEMallMiniProgramImg();
                    if (imageByte != null)
                    {
                        eMallMiniProgramImg = CCWin.SkinControl.ImageHelper.Convert(imageByte);
                    }
                }
                #endregion
                GlobalCache.updateProgress("");
                GlobalCache.iniCompleted();
            }
            catch (Exception ex)
            {
                CommonGlobalCache.iniFailed(ex);
            }
        }
예제 #17
0
        private void BaseButton1_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                PfCustomer pfCustomer = Build();
                if (!ValidateItem(pfCustomer))
                {
                    return;
                }
                if (curPfCustomer == null)
                {
                    InteractResult result = PfCustomerCache.PfCustomer_OnInsert(pfCustomer);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("添加成功!");
                        if (node != null)
                        {
                            TreeModel CurChildrenClass = new TreeModel();
                            TreeNode  newNode          = new TreeNode(pfCustomer.Name);
                            CurChildrenClass.Name     = pfCustomer.Name;
                            CurChildrenClass.ID       = pfCustomer.ID;
                            CurChildrenClass.ParentID = curItemID;
                            newNode.Tag  = CurChildrenClass;
                            newNode.Text = pfCustomer.Name + "/" + pfCustomer.ContactPhone + "(0.00)";
                            node.Nodes.Add(newNode);
                            CommonGlobalCache.InsertPFDistributor(CurChildrenClass);
                        }
                        ConfirmClick?.Invoke(curPfCustomer, this);
                        this.Close();
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    pfCustomer.CreateTime = curPfCustomer.CreateTime;
                    InteractResult result = PfCustomerCache.PfCustomer_OnUpdate(pfCustomer);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        GlobalMessageBox.Show("保存成功!");
                        this.DialogResult = DialogResult.OK;
                        if (node != null)
                        {
                            List <TreeModel> treeModelL = CommonGlobalCache.DistributorPFList.FindAll(t => t.ID == pfCustomer.ID);
                            TreeModel        bigClass   = node.Tag as TreeModel;
                            bigClass.ID   = pfCustomer.ID;
                            bigClass.Name = pfCustomer.Name;
                            bigClass.AccruedCommission = curPfCustomer.AccruedCommission;
                            string accruedC = "0.00";
                            if (treeModelL.Count > 0)
                            {
                                accruedC = treeModelL[0].AccruedCommission.ToString();
                            }
                            //JGNet.Common.ServerProxy.GetPfCustomer
                            InteractResult <PfCustomer> selectPfCus = CommonGlobalCache.ServerProxy.GetPfCustomer(pfCustomer.ID);
                            if (selectPfCus != null)
                            {
                                accruedC = Math.Round(selectPfCus.Data.AccruedCommission, 2).ToString();
                            }
                            node.Text = pfCustomer.Name + "/" + pfCustomer.ContactPhone + "(" + accruedC + ")";

                            node.Tag = bigClass;
                            CommonGlobalCache.UpdatePFDistributor(bigClass);
                        }
                        this.curPfCustomer = pfCustomer;
                        ConfirmClick?.Invoke(curPfCustomer, this);
                        this.Close();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
예제 #18
0
        private void BaseButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                item = GetEntity();

                if (!Validate(item))
                {
                    return;
                }
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.CurItem != null)
                {
                    //线上商城原属性不替换
                    item.EmShowOnline  = CurItem.EmShowOnline;
                    item.EmOnlinePrice = CurItem.EmOnlinePrice;
                    item.EmTitle       = CurItem.EmTitle;
                    item.EmThumbnail   = CurItem.EmThumbnail == null ? string.Empty : CurItem.EmThumbnail;
                    item.CreateTime    = CurItem.CreateTime;
                    item.SizeNames     = CurItem.SizeNames;


                    CostumeColor  color     = this.colorComboBox1.SelectedItem;
                    List <string> colorList = CurItem.ColorList;
                    if (colorList != null)
                    {
                        if (curStore.ColorName != color.Name)
                        {
                            colorList.Remove(curStore.ColorName);
                            colorList.Add(color.Name);
                        }
                    }

                    item.Colors = CommonGlobalUtil.GetColorFromGridView(colorList);



                    short F = 0, XS = 0, S = 0, M = 0, L = 0, XL = 0, XL2 = 0, XL3 = 0, XL4 = 0, XL5 = 0, XL6 = 0;

                    if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0)
                    {
                        PfCustomerStore curStoreItem = this.dataGridView2.Rows[0].DataBoundItem as PfCustomerStore;
                        if (curStoreItem != null)
                        {
                            F          = curStoreItem.F;
                            XS         = curStoreItem.XS;
                            S          = curStoreItem.S;
                            M          = curStoreItem.M;
                            L          = curStoreItem.L;
                            XL         = curStoreItem.XL;
                            XL2        = curStoreItem.XL2;
                            XL3        = curStoreItem.XL3;
                            XL4        = curStoreItem.XL4;
                            XL5        = curStoreItem.XL5;
                            XL6        = curStoreItem.XL6;
                            customerID = curStoreItem.PfCustomerID;
                        }
                    }
                    UpdateStartStoreCostumePara updateStorePara = new UpdateStartStoreCostumePara()
                    {
                        BrandID       = item.BrandID,
                        ClassID       = item.ClassID,
                        CostPrice     = item.CostPrice,
                        ID            = item.ID,
                        Name          = item.Name,
                        Price         = item.Price,
                        Remarks       = item.Remarks,
                        SalePrice     = item.SalePrice,
                        Season        = item.Season,
                        SizeGroupName = item.SizeGroupName,
                        SizeNames     = item.SizeNames,
                        SupplierID    = item.SupplierID,
                        Year          = item.Year,
                        OldColorName  = curStore.ColorName,
                        NewColorName  = color.Name,

                        F   = F,
                        XS  = XS,
                        S   = S,
                        L   = L,
                        M   = M,
                        XL  = XL,
                        XL2 = XL2,
                        XL3 = XL3,
                        XL4 = XL4,
                        XL5 = XL5,
                        XL6 = XL6,

                        //ShopID = curStore.PfCustomerID,
                        IsPf         = true,
                        PfCustomerID = this.customerID,
                        // PfCustomerID=
                        Colors = item.Colors,
                    };
                    InteractResult result = GlobalCache.ServerProxy.UpdateStartStoreCostume(updateStorePara);
                    // InteractResult result = GlobalCache.ServerProxy.UpdateCostume(item);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("保存成功!");
                        // GlobalCache.CostumeList_OnChange(item);
                        CurItem = item;
                        this.Hide();
                        this.Close();
                        this.DialogResult = DialogResult.OK;
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    PfCustomerStore costumeStore = dataGridView2.Rows[0].DataBoundItem as PfCustomerStore;
                    PfCustomerStore item         = new PfCustomerStore();
                    ReflectionHelper.CopyProperty(costumeStore, item);
                    item.CostumeID   = skinTextBox_ID.Text;
                    item.CostumeName = skinTextBox_Name.Text;
                    item.Year        = (int)(this.skinComboBox_Year.SelectedValue);
                    item.Price       = numericUpDown_Price.Value;
                    // item.SalePrice =
                    item.CostPrice = numericUpDownCostPrice.Value;
                    item.ClassID   = skinComboBoxBigClass.SelectedValue.ClassID;
                    item.ClassCode = GetClassCode(item.ClassID);

                    //线上商城原属性不替换
                    //  item.BigClass = this.skinComboBoxBigClass.SelectedValue?.BigClass;
                    //  item.SmallClass = this.skinComboBoxBigClass.SelectedValue?.SmallClass;
                    //  item.SubSmallClass = this.skinComboBoxBigClass.SelectedValue?.SubSmallClass;
                    if (this.skinComboBox_Brand.SelectedItem != null)
                    {
                        item.BrandID   = this.skinComboBox_Brand.SelectedItem.AutoID;
                        item.BrandName = this.skinComboBox_Brand.SelectedItem.Name;
                    }
                    item.Season         = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue);
                    item.SupplierID     = skinComboBox_SupplierID.SelectedItem?.ID;
                    item.SupplierName   = skinComboBox_SupplierID.SelectedItem?.Name;
                    item.ColorName      = this.colorComboBox1.SelectedItem?.Name;
                    item.CostumeColorID = this.colorComboBox1.SelectedItem.ID;
                    // item.CostumeColorName = this.colorComboBox1.SelectedItem?.Name;
                    List <CostumeStoreExcel> costumeStoreExcels = new List <CostumeStoreExcel>();
                    //item.SizeGroupName= selectSizeGroup.SelectedSizeNames
                    if (selectSizeGroup != null && selectSizeGroup.SizeGroup != null)
                    {
                        item.SizeGroupName     = selectSizeGroup.SizeGroup.SizeGroupName;
                        item.SizeGroupShowName = selectSizeGroup.SizeGroup.ShowName;

                        //   item.SizeNames = selectSizeGroup.SelectedSizeNames;
                    }
                    PfCustomer pfCustomer = PfCustomerCache.GetPfCustomer(customerID);
                    item.SalePrice = this.numericTextBoxSalePrice.Value;
                    CostumeStoreExcel curCostumeStoreExcel = GetCostumeStoreExcel(item);
                    curCostumeStoreExcel.CostumeColorName = item.ColorName;
                    curCostumeStoreExcel.PfPrice          = pfCustomer.PfDiscount * item.Price / 100;

                    costumeStoreExcels.Add(curCostumeStoreExcel);


                    CreatePfCostumeStore store = new CreatePfCostumeStore()
                    {
                        PfCustomerID = customerID,

                        // Date = new CJBasic.Date(),
                        CostumeStoreExcels = costumeStoreExcels,

                        IsImport = true
                    };

                    InteractResult result = GlobalCache.ServerProxy.InsertPfCostumeStores(store);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        GlobalMessageBox.Show("新增成功!");
                        ResetAll();
                        this.Close();
                        SaveClick?.Invoke(item);
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }
예제 #19
0
 private bool CheckBalance()
 {
     return(PfCustomerCache.GetPfCustomer(customer.ID).Balance >= sumPfMoney);
 }
예제 #20
0
        //简单打印示例
        public static void Print(PfOrder item, DataGridView dataGridView2, int times = 1)
        {
            InteractResult <PrintTemplateInfo> result;

            if (item.IsRefundOrder)
            {
                result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.PfTOrder);
            }
            else
            {
                result = CommonGlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.PfOrder);
            }


            if (result.ExeResult == ExeResult.Success)
            {
                PrintTemplateInfo CurrentPTemplate = result.Data;
                for (int c = 0; c < CurrentPTemplate.PrintCount; c++)
                {
                    GoldPrinter.MisGoldPrinter misGoldPrinter = new GoldPrinter.MisGoldPrinter(false, new PrinterMargins(20, 20, 20, 20, 800, 1129));
                    if (CurrentPTemplate.OrderName != "")
                    {
                        misGoldPrinter.Title = CurrentPTemplate.OrderName; //主标题(C#用\n表示换行)	}

                        misGoldPrinter.Caption = "";

                        double headRow = Math.Round(Convert.ToSingle(CurrentPTemplate.SystemVariables.Count / 2));

                        Header header = new Header(Convert.ToInt32(headRow) + 1, 2);
                        header.IsDrawAllPage = true;

                        CommonGlobalUtil.WriteLog("变量总数=" + CurrentPTemplate.SystemVariables.Count + "\r\n" + "应显示行号=" + headRow + 1);

                        //GoldPrinter.MisGoldPrinter misGoldPrinter = new GoldPrinter.MisGoldPrinter(false, new PrinterMargins(20, 20, 20, 20, 787, 1129));

                        // if (item.IsRefundOrder)
                        // {
                        //     misGoldPrinter.Title = "批发退货单";
                        // }
                        // else
                        // {
                        //     misGoldPrinter.Title = "批发发货单";
                        // }

                        //// misGoldPrinter.Title = "批发单";                           //主标题(C#用\n表示换行)
                        // misGoldPrinter.Caption = "";                                        //副标题
                        //                                                                     //misGoldPrinter.Top = "单号:" + item.AllocateOrder.ID + "|收货方:" + CommonGlobalCache.GetShopName(item.AllocateOrder.DestShopID) + "|开单日期:" + item.AllocateOrder.CreateTime;                                       //抬头,一行三列的文字说明,用|分隔



                        for (int i = 0; i < CurrentPTemplate.SystemVariables.Count; i++)
                        {
                            int curR = 0;
                            if (i < 2)
                            {
                                curR = 0;
                            }
                            else
                            {
                                double resRow = i / 2;
                                curR = Convert.ToInt32(Math.Round(resRow));
                            }
                            string KeyStr = "";
                            if (CurrentPTemplate.SystemVariables[i] == "单号")
                            {
                                KeyStr = "批发单号:";
                                header.SetText(curR, i % 2, CurrentPTemplate.SystemVariables[i] + item.ID);
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "客户")
                            {
                                KeyStr = "客    户:";
                                header.SetText(curR, i % 2, KeyStr + PfCustomerCache.GetUserNameWithPf(item.PfCustomerID));
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "开单时间")
                            {
                                KeyStr = "开单时间:";
                                header.SetText(curR, i % 2, KeyStr + item.CreateTime.GetDateTimeFormats('f')[0].ToString());
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "操作人")
                            {
                                KeyStr = "操 作 人:";
                                header.SetText(curR, i % 2, KeyStr + CommonGlobalCache.GetUserName(item.AdminUserID));
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "付款方式")
                            {
                                KeyStr = "付款方式:";
                                header.SetText(curR, i % 2, KeyStr + item.PayTypeName);
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "总数量")
                            {
                                KeyStr = "总 数 量:";
                                header.SetText(curR, i % 2, KeyStr + item.TotalCount.ToString());
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "上欠金额")
                            {
                                KeyStr = "上欠金额:";
                                header.SetText(curR, i % 2, KeyStr + item.PaymentBalanceOld.ToString());
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "本次应收金额")
                            {
                                KeyStr = "本次应收金额:";
                                header.SetText(curR, i % 2, KeyStr + item.TotalPfPrice.ToString());
                            }
                            else if (CurrentPTemplate.SystemVariables[i] == "应收总额")
                            {
                                KeyStr = "应收总额:";
                                header.SetText(curR, i % 2, KeyStr + item.PaymentBalance.ToString());
                            }



                            else if (CurrentPTemplate.SystemVariables[i] == "单据备注")
                            {
                                KeyStr = "备    注:";
                                header.SetText(curR, i % 2, KeyStr + item.Remarks.ToString());
                            }
                        }

                        // Header header = new Header(4, 3);                   //行列数基本不受限制,但超过一页失去意义,因为以Body为主,以其它为辅
                        // header.IsDrawAllPage = true;                        //可以指定每页是否重复打印
                        //header.SetText(0, 0, "批发单号:" + item.ID);
                        //header.SetText(0, 1, "客    户:" + PfCustomerCache.GetUserNameWithPf(item.PfCustomerID));
                        //header.SetText(0, 2, "开单时间:" + item.CreateTime.GetDateTimeFormats('f')[0].ToString());                        //DataSource可以是字符串、一维数组、二维数组、DataTable、WinDataGrid、WebDataGrid、ListView\ListView、
                        //header.SetText(1, 0, "操 作 人:" + CommonGlobalCache.GetUserName(item.AdminUserID));
                        //header.SetText(1, 1, "付款方式:" + item.PayTypeName);               //同仁们还可以根据实际应用对GridBase的DataSource进行扩展
                        //header.SetText(1, 2, String.Empty);
                        //header.SetText(2, 0, "总 数 量:" + item.TotalCount.ToString());
                        //header.SetText(2, 1, "批发总额:" + item.TotalPfPrice.ToString());                //同仁们还可以根据实际应用对GridBase的DataSource进行扩展
                        //header.SetText(2, 2, String.Empty);
                        //header.SetText(3, 0, "备    注:"  );
                        //header.SetText(3, 1, item.Remarks);                //同仁们还可以根据实际应用对GridBase的DataSource进行扩展
                        //header.SetText(3, 2, String.Empty);
                        misGoldPrinter.Header = header;
                        List <PrintColumnInfo> dataGV = CurrentPTemplate.PrintColumnInfos;
                        string ColumnsList            = string.Empty;
                        foreach (PrintColumnInfo itemC in dataGV)
                        {
                            ColumnsList += itemC.Name + ",";
                        }
                        CommonGlobalUtil.WriteLog("模板设置打印列表头为=" + ColumnsList + "\r\n");
                        bool isflag = false;
                        if (dataGV.Count == 0)
                        {
                            isflag = true;
                        }
                        //   DataTable dt = dataGridView2.DataSource as DataTable;
                        //  DataTable newDt = new DataTable();
                        List <int> columnCount = new List <int>();

                        int    pinrtColNum         = 0;
                        string dataGridColumnsList = string.Empty;
                        for (int i = 0; i < dataGridView2.Columns.Count; i++)
                        {
                            DataGridViewColumn column = dataGridView2.Columns[i];
                            //if (column.HeaderText == "F" || column.HeaderText == "XS" || column.HeaderText == "S" || column.HeaderText == "M" || column.HeaderText == "L"
                            //    || column.HeaderText == "XL" || column.HeaderText == "XL2" || column.HeaderText == "XL3" || column.HeaderText == "XL4" || column.HeaderText == "XL5"
                            //    || column.HeaderText == "XL6")
                            //{
                            //    if (dataGV.FindAll(t => t.Name == "尺码列").Count > 0)
                            //    {
                            //        columnCount.Add(i);
                            //    }
                            //    else
                            //    {
                            //        column.Visible = false;
                            //    }
                            //}
                            //else
                            //{
                            if (dataGV.FindAll(t => t.Name == column.HeaderText).Count > 0)
                            {
                                columnCount.Add(i);
                                dataGridColumnsList += column.HeaderText + ",";
                                pinrtColNum++;
                            }
                            else
                            {
                                if (dataGV.FindAll(t => t.Name == column.DataPropertyName).Count > 0)
                                {
                                    columnCount.Add(i);
                                    column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                    dataGridColumnsList += column.DataPropertyName + ",";
                                    pinrtColNum++;
                                }
                                else
                                {
                                    if (column.DataPropertyName.Contains("XL"))
                                    {
                                        string name = column.DataPropertyName;  //XL3
                                                                                //3XL
                                        string newname  = name.Replace("XL", "");
                                        string checkstr = newname + "XL";
                                        if (dataGV.FindAll(t => t.Name == checkstr).Count > 0)
                                        {
                                            columnCount.Add(i);
                                            column.HeaderText    = column.HeaderText.Replace("\r\n", " ");
                                            dataGridColumnsList += column.DataPropertyName + ",";
                                            pinrtColNum++;
                                        }
                                        else
                                        {
                                            column.Visible = false;
                                        }
                                    }
                                    else
                                    {
                                        column.Visible = false;
                                    }
                                }
                            }
                            //}

                            CommonGlobalUtil.WriteLog("DataGridView能打印的列为=" + dataGridColumnsList);
                            if (isflag)
                            {
                                if (i == 0)
                                {
                                    columnCount.Add(i);
                                    column.Visible    = true;
                                    column.HeaderText = "";

                                    DataTable  dt = new DataTable();
                                    DataColumn c1 = new DataColumn();
                                    c1.ColumnName = "HeaderText";

                                    dt.Columns.Add(c1);
                                    dataGridView2.DataSource = null;
                                    dataGridView2.DataSource = dt;
                                }
                            }
                        }

                        misGoldPrinter.DataSource = DataGridViewUtil.ToStringArray(dataGridView2, true, true);
                        if (!Directory.Exists(CommonGlobalUtil.SystemDir + "EXPORTS\\"))
                        {
                            Directory.CreateDirectory(CommonGlobalUtil.SystemDir + "EXPORTS\\");
                        }
                        misGoldPrinter.FileName = CommonGlobalUtil.SystemDir + "EXPORTS\\" + item.ID + ".jpg";
                        ((GoldPrinter.Body)(misGoldPrinter.Body)).Font = dataGridView2.Font;

                        /*  int[] widths = new int[] {
                         * 80,100,50,40, 50,
                         * 30,30,30,30,30,30,30,30,30,30,30
                         * ,40,50,50
                         * };*/
                        int[] widths = new int[CurrentPTemplate.PrintColumnInfos.Count];
                        CommonGlobalUtil.WriteLog("widths长度" + widths.Length);
                        CommonGlobalUtil.WriteLog("实际打印数量=" + pinrtColNum + "\r\n" + "设置能打印的列数量=" + widths.Length.ToString());

                        for (int j = 0; j < CurrentPTemplate.PrintColumnInfos.Count; j++)
                        {
                            widths[j] = Convert.ToInt32(CurrentPTemplate.PrintColumnInfos[j].Rate);
                        }

                        List <int> widthList = new List <int>();
                        for (int i = 0; i < CurrentPTemplate.PrintColumnInfos.Count; i++)
                        {
                            DataGridViewColumn column = dataGridView2.Columns[columnCount[i]];
                            if (column.Visible && !String.IsNullOrEmpty(column.HeaderText))
                            {
                                widthList.Add(widths[i]);
                            }
                            else
                            {
                                /*  if (column.Visible && !String.IsNullOrEmpty(column.DataPropertyName))
                                 * {
                                 *    widthList.Add(widths[i]);
                                 * }*/
                            }
                        }
                        if (isflag)
                        {
                            widths    = new int[1];
                            widths[0] = 100;
                            widthList.Add(widths[0]);
                        }
                        widths = widthList.ToArray();
                        int newWidth = 800;

                        /*  int totalWidth = 0;
                         * for (int i = 0; i < widths.Length; i++)
                         * {
                         *    totalWidth += widths[i];
                         * }*/
                        for (int i = 0; i < widths.Length; i++)
                        {
                            widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)0.1), 0, MidpointRounding.AwayFromZero));
                            // widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)1.0 / totalWidth), 0, MidpointRounding.AwayFromZero));
                        }


                        ((GoldPrinter.Body)(misGoldPrinter.Body)).ColsWidth = widths;
                        //((GoldPrinter.Body)(misGoldPrinter.Body)).RowHeight = 100;
                        misGoldPrinter.Preview();
                        misGoldPrinter.Dispose();
                        misGoldPrinter = null;
                    }
                }
            }
        }
예제 #21
0
        public void HandleInformation(string sourceUserID, int informationType, byte[] info)
        {
            GlobalUtil.WriteLog("收到通知" + informationType);

            #region 充值规则更改
            if (NoticeInformationTypes.UpdateRechargeDonateRule == informationType)
            {
                RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0);
                GlobalCache.UpdateRechargeDonateRule(rechargeDonateRule);
            }
            else if (NoticeInformationTypes.DeleteRechargeDonateRule == informationType)
            {
                GlobalCache.DeleteRechargeDonateRule();
            }
            else if (NoticeInformationTypes.UpdateShopRechargeRuleID == informationType)
            {
                RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0);
                GlobalCache.UpdateShopRechargeRuleID(rechargeDonateRule);
            }

            #endregion

            #region 系统配置更改

            else if (NoticeInformationTypes.UpdateParameterConfig == informationType)
            {
                ParameterConfig c = CompactPropertySerializer.Default.Deserialize <ParameterConfig>(info, 0);
                GlobalCache.ParameterConfig(c);
            }
            else if (NoticeInformationTypes.UpdateParameterConfigs == informationType)
            {
                List <ParameterConfig> collection = CompactPropertySerializer.Default.Deserialize <List <ParameterConfig> >(info, 0);
                foreach (var item in collection)
                {
                    GlobalCache.ParameterConfig(item);
                }
            }

            #endregion

            #region 导购员信息更改
            else if (NoticeInformationTypes.UpdateGuide == informationType)
            {
                Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0);
                GlobalCache.UpdateGuide(guide);
            }
            else if (NoticeInformationTypes.InsertGuide == informationType)
            {
                Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0);
                GlobalCache.InsertGuide(guide);
            }
            else if (NoticeInformationTypes.DeleteGuide == informationType)
            {
                string guideID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteGuide(guideID);
            }
            else if (NoticeInformationTypes.DeleteGuides == informationType)
            {
                List <String> guideIDs = CompactPropertySerializer.Default.Deserialize <List <String> >(info, 0);
                foreach (var guideID in guideIDs)
                {
                    GlobalCache.DeleteGuide(guideID);
                }
            }
            #endregion

            #region 促销活动更改

            else if (NoticeInformationTypes.InsertSalesPromotion == informationType)
            {
                SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0);
                GlobalCache.InsertSalesPromotion(salesPromotion);
            }
            else if (NoticeInformationTypes.DeleteSalesPromotion == informationType)
            {
                string salesPromotionID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSalesPromotion(salesPromotionID);
            }

            else if (NoticeInformationTypes.UpdateSalesPromotion == informationType)
            {
                SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0);
                GlobalCache.UpdateSalesPromotion(salesPromotion);
            }
            #endregion

            #region 品牌配置更改
            else if (NoticeInformationTypes.InsertBrand == informationType)
            {
                Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0);
                GlobalCache.InsertBrand(brand);
            }
            else if (NoticeInformationTypes.UpdateBrand == informationType)
            {
                Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0);
                GlobalCache.UpdateBrand(brand);
            }
            else if (NoticeInformationTypes.DeleteBrand == informationType)
            {
                int brandID = BitConverter.ToInt32(info, 0);
                GlobalCache.DeleteBrand(brandID);
            }
            #endregion

            #region  装信息更改

            //新增服装
            else if (NoticeInformationTypes.InsertCostume == informationType)
            {
                Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0);
                GlobalCache.InsertCostume(costume);
            }
            //服装信息更改
            else if (NoticeInformationTypes.UpdateCostume == informationType)
            {
                Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0);
                GlobalCache.UpdateCostume(costume);
            }
            else if (NoticeInformationTypes.DeleteCostume == informationType)
            {
                string costumeID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteCostume(costumeID);
            }
            else if (NoticeInformationTypes.InsertCostumes == informationType)
            {
                List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0);
                foreach (var costume in costumes)
                {
                    GlobalCache.InsertCostume(costume);
                }
            }
            else if (NoticeInformationTypes.UpdateCostumes == informationType)
            {
                List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0);
                foreach (var costume in costumes)
                {
                    GlobalCache.UpdateCostume(costume);
                }
            }
            else if (NoticeInformationTypes.UpdateCostumeValid == informationType)
            {
                UpdateCostumeValidPara result = CompactPropertySerializer.Default.Deserialize <UpdateCostumeValidPara>(info, 0);
                GlobalCache.UpdateCostumeValid(result);
            }
            else if (NoticeInformationTypes.InsertCostumeStores == informationType)
            {
                GlobalCache.LoadCostumeInfos();
            }

            #endregion

            #region 管理员信息更改
            //新增管理员
            else if (NoticeInformationTypes.InsertAdminUser == informationType)
            {
                AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0);
                GlobalCache.InsertAdminUser(adminUser);
            }
            //管理员信息更改
            else if (NoticeInformationTypes.UpdateAdminUser == informationType)
            {
                AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0);
                GlobalCache.UpdateAdminUser(adminUser);
            }
            #endregion

            #region 供应商信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertSupplier == informationType)
            {
                Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0);
                GlobalCache.InsertSupplier(supplier);
            }
            else if (NoticeInformationTypes.ImportSupplier == informationType)
            {
                List <Supplier> suppliers = CompactPropertySerializer.Default.Deserialize <List <Supplier> >(info, 0);
                if (suppliers != null)
                {
                    foreach (var supplier in suppliers)
                    {
                        GlobalCache.InsertSupplier(supplier);
                    }
                }
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdateSupplier == informationType)
            {
                Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0);
                GlobalCache.UpdateSupplier(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeleteSupplier == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSupplier(supplierID);
            }
            #endregion

            #region 店铺更改
            //新增店铺
            else if (NoticeInformationTypes.InsertShop == informationType)
            {
                Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0);
                GlobalCache.InsertShop(shop);
            }
            //店铺信息更改
            else if (NoticeInformationTypes.UpdateShop == informationType)
            {
                Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0);
                GlobalCache.UpdateShop(shop);
            }
            else if (NoticeInformationTypes.DisableShop == informationType)
            {
                String shopID = Encoding.UTF8.GetString(info);
                GlobalCache.DisableShop(shopID);
            }
            else if (NoticeInformationTypes.DeleteShop == informationType)
            {
                String shopID = Encoding.UTF8.GetString(info);
                GlobalCache.RemoveShop(shopID);
            }
            //Todo:

            #endregion
            else if (NoticeInformationTypes.InsertDifferenceOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);

                DifferenceOrderPagePara checkOrderPagePara = new DifferenceOrderPagePara()
                {
                    OrderID                  = null,
                    CostumeID                = null,
                    IsOpenDate               = true,
                    IsOnlyGetOut             = true,
                    StartDate                = new CJBasic.Date("1900-01-01"),
                    EndDate                  = new CJBasic.Date(DateTime.Now),
                    PageIndex                = 0,
                    PageSize                 = 1000,
                    ShopID                   = CommonGlobalCache.CurrentShopID,
                    OrderPrefixType          = ValidateUtil.CheckEmptyValue(OrderPrefix.AllocateOrder),
                    DifferenceOrderConfirmed = DifferenceOrderConfirmed.False,
                };

                DifferenceOrderPage checkOrderListPage = CommonGlobalCache.ServerProxy.GetDifferenceOrderPage(checkOrderPagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + checkOrderListPage.DifferenceOrderList.Count + "张差异单待处理,请及时处理!" + "#" + informationType);
            }
            #region 新的补货申请单待处理通知
            else if (NoticeInformationTypes.ReplenishOutbound == informationType)
            {
                ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara()
                {
                    CostumeID           = null,
                    ReplenishOrderID    = null,
                    IsOpenDate          = true,
                    StartDate           = new CJBasic.Date("1900-01-01"),
                    EndDate             = new CJBasic.Date(DateTime.Now),
                    PageIndex           = 0,
                    PageSize            = 10000,
                    ShopID              = CommonGlobalCache.CurrentShopID,
                    ReplenishOrderState = ReplenishOrderState.NotProcessing,
                    BrandID             = -1
                };
                ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPageReplenish.ReplenishOrderList.Count + "张待发货的补货申请单待处理,请及时处理!" + "#" + informationType);
            }
            else if (NoticeInformationTypes.AllocateOutbound == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                if (GlobalCache.GetParameter(ParameterConfigKey.AllocateInDirectly)?.ParaValue == "1")
                {
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有新的调拨单已入库!");
                }
                else
                {
                    GetAllocateOrdersPara pagePara = new GetAllocateOrdersPara()
                    {
                        AllocateOrderID    = null,
                        AllocateOrderState = AllocateOrderState.Normal,
                        CostumeID          = null,
                        EndDate            = new CJBasic.Date(DateTime.Now),
                        StartDate          = new CJBasic.Date("1900-01-01"),
                        ShopID             = "",
                        Type         = AllocateOrderType.All,
                        PageIndex    = 0,
                        PageSize     = 20,
                        ReceiptState = ReceiptState.WaitReceipt,
                        LockShop     = PermissonUtil.HasPermission(RolePermissionMenuEnum.调拨单查询, RolePermissionEnum.查看_只看本店),
                        DestShopID   = CommonGlobalCache.CurrentShopID,
                        SourceShopID = "",
                    };

                    InteractResult <AllocateOrderPage> listPage = CommonGlobalCache.ServerProxy.GetAllocateOrders(pagePara);
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPage.Data.AllocateOrderList.Count + "张调拨单待处理,请及时处理!" + "#" + informationType);
                }
            }
            else if (NoticeInformationTypes.ReplenishCostume == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara()
                {
                    CostumeID           = null,
                    ReplenishOrderID    = null,
                    IsOpenDate          = true,
                    StartDate           = new CJBasic.Date("1900-01-01"),
                    EndDate             = new CJBasic.Date(DateTime.Now),
                    PageIndex           = 0,
                    PageSize            = 10000,
                    ShopID              = CommonGlobalCache.CurrentShopID,
                    ReplenishOrderState = ReplenishOrderState.NotProcessing,
                    BrandID             = -1
                };
                ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有补货申请单待处理,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点已审核通知
            else if (NoticeInformationTypes.CheckStorePass == informationType)
            {
                GlobalUtil.WriteLog("盘点已审核通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单已审核,请及时查收!" + "#" + informationType);
                // GlobalUtil.MainForm.OnStoreStateChanged(false);
            }
            #endregion
            #region 盘点退回通知

            /*  else if (NoticeInformationTypes.CancelCheckStore == informationType)
             * {
             *    GlobalUtil.WriteLog("盘点退回通知");
             *    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时查收!" + "#" + informationType);
             *
             * } */
            #endregion
            #region 补货申请单/调拨单冲单通知
            else if (NoticeInformationTypes.OverrideOrder == informationType)
            {
                string result = String.Empty;
                if (info != null)
                {
                    result = Encoding.UTF8.GetString(info);
                }
                GlobalUtil.WriteLog("补货申请单/或调拨单" + result + "冲单通知");

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被冲单,请及时查收!" + "#" + informationType);
            }
            #endregion
            #region 补货申请单取消
            else if (NoticeInformationTypes.CancelReplenish == informationType)
            {
                string result = String.Empty;
                if (info != null)
                {
                    result = Encoding.UTF8.GetString(info);
                }
                GlobalUtil.WriteLog("补货申请单" + result + "取消通知");

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被取消,请及时查收!" + "#" + informationType);
            }
            #endregion
            else if (NoticeInformationTypes.NewEmRefundOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);

                GetEmOrderPagePara EmReturnpagePara = new GetEmOrderPagePara()
                {
                    OrderID           = null,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    MemberPhoneOrName = null,
                    CostumeIDOrName   = null,
                    OrderState        = EmRetailOrderState.All,

                    RefundStatus = RefundStatus.Refunding,
                };

                EmOrderPage EmReturnlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmReturnpagePara);

                int rows = EmReturnlistPage.ResultList.FindAll(t => t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.RefundApplication) || t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.Refunding)).Count;

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + rows + "张线上退货待处理,请及时处理!" + "#" + informationType);
            }
            else if (NoticeInformationTypes.NewEmRetailOrder == informationType)
            {
                int result = SerializeHelper.ByteArrayToInt(info);
                GetEmOrderPagePara EmpagePara = new GetEmOrderPagePara()
                {
                    OrderID           = null,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    MemberPhoneOrName = null,
                    CostumeIDOrName   = null,
                    OrderState        = EmRetailOrderState.WaitDelivery,
                    RefundStatus      = RefundStatus.NotSelect,
                };

                EmOrderPage EmlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmpagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + EmlistPage.ResultList.Count + "张线上订单待处理,请及时处理!" + "#" + informationType);
            }
            #region 批发客户信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertPfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.InsertPfCustomer(supplier);
            }
            else if (NoticeInformationTypes.ImportPfCustomer == informationType)
            {
                List <PfCustomer> suppliers = CompactPropertySerializer.Default.Deserialize <List <PfCustomer> >(info, 0);
                foreach (var supplier in suppliers)
                {
                    PfCustomerCache.InsertPfCustomer(supplier);
                }
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdatePfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.UpdatePfCustomer(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeletePfCustomer == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                PfCustomerCache.DeletePfCustomer(supplierID);
            }
            #endregion
            #region 盘点待处理通知
            else if (NoticeInformationTypes.InsertCheckStore == informationType)
            {
                GlobalUtil.WriteLog("盘点待处理通知");
                CheckStoreOrderPagePara checkPagePara = new CheckStoreOrderPagePara()
                {
                    CheckStoreOrderID = null,
                    IsOpenDate        = true,
                    StartDate         = new CJBasic.Date("1900-01-01"),
                    EndDate           = new CJBasic.Date(DateTime.Now),
                    PageIndex         = 0,
                    PageSize          = 1000,
                    //ShopID = CommonGlobalCache.CurrentShopID,
                    CostumeID = null,
                    State     = CheckStoreOrderState.PendingReview,
                };

                CheckStoreOrderPage ChecklistPage = CommonGlobalCache.ServerProxy.GetCheckStoreOrderPage(checkPagePara);

                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + ChecklistPage.CheckStoreOrderList.Count + "张盘点单待审核,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点退回通知
            else if (NoticeInformationTypes.CancelCheckStore == informationType)
            {
                GlobalUtil.WriteLog("盘点退回通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时处理!" + "#" + informationType);
            }
            #endregion
            #region 盘点取消通知
            else if (NoticeInformationTypes.CancelCheckStoreTask == informationType)
            {
                GlobalUtil.WriteLog("盘点取消通知");
                ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有盘点已取消!");
            }
            #endregion
            else if (NoticeInformationTypes.EnabledSizeGroup == informationType)
            {
                EnabledSizeGroupPara sizeGroup = CompactPropertySerializer.Default.Deserialize <EnabledSizeGroupPara>(info, 0);
                GlobalCache.EnabledSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.InsertSizeGroup == informationType)
            {
                SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0);
                GlobalCache.InsertSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.UpdateSizeGroup == informationType)
            {
                SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0);
                GlobalCache.UpdateSizeGroup(sizeGroup);
            }
            else if (NoticeInformationTypes.DeleteSizeGroup == informationType)
            {
                String SizeGroupName = Encoding.UTF8.GetString(info);
                GlobalCache.DeleteSizeGroup(SizeGroupName);
            }
            else if (NoticeInformationTypes.UpdateSizeNames == informationType)
            {
                UpdateSizeNamesInfo sizeNameInfo = CompactPropertySerializer.Default.Deserialize <UpdateSizeNamesInfo>(info, 0);
                GlobalCache.UpdateSizeNames(sizeNameInfo);
            }
            else if (NoticeInformationTypes.InsertDistributor == informationType)
            {
                Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0);
                GlobalCache.InsertDistributor(supplier);
            }
            else if (NoticeInformationTypes.UpdateDistributor == informationType)
            {
                Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0);
                GlobalCache.UpdateDistributor(supplier);
            }
            #region 批发客户信息更改
            //新增供应商
            else if (NoticeInformationTypes.InsertPfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.InsertPfCustomer(supplier);
            }
            //供应商信息更改
            else if (NoticeInformationTypes.UpdatePfCustomer == informationType)
            {
                PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0);
                PfCustomerCache.UpdatePfCustomer(supplier);
            }
            //删除供应商
            else if (NoticeInformationTypes.DeletePfCustomer == informationType)
            {
                string supplierID = Encoding.UTF8.GetString(info);
                PfCustomerCache.DeletePfCustomer(supplierID);
            }
            else if (NoticeInformationTypes.SendAnnounce == informationType)
            {
                int      result   = SerializeHelper.ByteArrayToInt(info);
                Announce announce = CompactPropertySerializer.Default.Deserialize <Announce>(info, 0);
                //1:发布中,2:已完成,3:已取消
                AnnounceState state = (AnnounceState)announce.State;

                switch (state)
                {
                case AnnounceState.Finished:
                case AnnounceState.Cancel:
                    ((MainForm)GlobalUtil.MainForm).SendAnnounce(state);
                    break;

                case AnnounceState.Releasing:
                    CommonGlobalCache.SystemUpdateMessage = announce.AnnounceContent;
                    ((MainForm)GlobalUtil.MainForm).OnNewInfomation("系统升级公告\r\n尊敬的客户:\r\n" + announce.AnnounceContent);
                    ((MainForm)GlobalUtil.MainForm).SendAnnounce(state);
                    break;

                default:
                    break;
                }
            }
            else if (NoticeInformationTypes.NoticeClose == informationType)
            {
                ((MainForm)GlobalUtil.MainForm).DoClose();
                //  System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
            }
            #endregion
        }
예제 #22
0
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                //ShowMessage(Pinyin.GetInitials("埼", Encoding.GetEncoding("GB2312")));

                if (curPfCustomer == null)
                {
                    String     name       = this.skinTextBox_Name.SkinTxt.Text.Trim();
                    PfCustomer pfCustomer = new PfCustomer()
                    {
                        ID                = this.skinTextBox_ID.SkinTxt.Text.Trim(),
                        Name              = name,
                        Contact           = this.skinTextBox_Contact.SkinTxt.Text.Trim(),
                        ContactPhone      = this.skinTextBox_ContactPhone.SkinTxt.Text.Trim(),
                        BankInfo          = this.skinTextBox_BankInfo.SkinTxt.Text.Trim(),
                        Remarks           = this.skinTextBox_Remarks.SkinTxt.Text.Trim(),
                        PfDiscount        = this.textBoxDicount.Value,
                        BusinessAccountID = textBoxBusinessAccount.Text.Trim(),
                        Password          = this.textBoxPwd.Text.Trim(),
                        LastAccountTime   = DateTime.Now,
                        DefaultAddressID  = 0,
                        Balance           = 0,
                        PaymentBalance    = 0,
                        FirstCharSpell    = DisplayUtil.GetPYString(name),
                        //  SupplyDiscount = Decimal.ToByte(this.numericUpDownSupplyDiscount.Value),
                        Enabled      = this.skinCheckBox_Enabled.Checked,
                        CreateTime   = DateTime.Now,
                        CustomerType = (byte)(skinRadioButtonSale.Checked ? 1 : 0)
                    };

                    if (String.IsNullOrEmpty(pfCustomer.ID))
                    {
                        GlobalMessageBox.Show("客户编号不能为空,请输入编号!");
                        this.skinTextBox_ID.Focus();
                        return;
                    }
                    else if (String.IsNullOrEmpty(pfCustomer.Name))
                    {
                        GlobalMessageBox.Show("客户名称不能为空,请输入名称!");
                        this.skinTextBox_Name.Focus();
                        return;
                    }
                    else if (String.IsNullOrEmpty(pfCustomer.Password))
                    {
                        GlobalMessageBox.Show("客户密码不能为空,请输入密码!");
                        this.textBoxPwd.Focus();
                        return;
                    }
                    //BusinessAccountID 账套不能为当前账套
                    string CurrbusinessAccountId = CommonGlobalCache.BusinessAccount.ID.ToUpper();
                    if (pfCustomer.BusinessAccountID.ToUpper() == CurrbusinessAccountId)
                    {
                        GlobalMessageBox.Show("不能绑定当前账套!");
                        this.textBoxBusinessAccount.Focus();
                        return;
                    }
                    InteractResult result = PfCustomerCache.PfCustomer_OnInsert(pfCustomer);

                    switch (result.ExeResult)
                    {
                    case ExeResult.Success:
                        TreeModel treeN = new TreeModel();
                        treeN.ID   = pfCustomer.ID;
                        treeN.Name = pfCustomer.Name;
                        CommonGlobalCache.InsertPFDistributor(treeN);
                        //CommonGlobalCache.DistributorPFList.Clear();

                        GlobalMessageBox.Show("添加成功!");
                        TabPage_Close(this.CurrentTabPage, this.SourceCtrlType);
                        break;

                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    this.curPfCustomer.ID                = this.skinTextBox_ID.SkinTxt.Text.Trim();
                    this.curPfCustomer.Name              = this.skinTextBox_Name.SkinTxt.Text.Trim();
                    this.curPfCustomer.Contact           = this.skinTextBox_Contact.SkinTxt.Text.Trim();
                    this.curPfCustomer.ContactPhone      = this.skinTextBox_ContactPhone.SkinTxt.Text.Trim();
                    this.curPfCustomer.BankInfo          = this.skinTextBox_BankInfo.SkinTxt.Text.Trim();
                    this.curPfCustomer.Remarks           = this.skinTextBox_Remarks.SkinTxt.Text.Trim();
                    this.curPfCustomer.PfDiscount        = this.textBoxDicount.Value;
                    this.curPfCustomer.BusinessAccountID = this.textBoxBusinessAccount.Text.Trim();
                    this.curPfCustomer.Password          = this.textBoxPwd.Text;
                    this.curPfCustomer.Enabled           = this.skinCheckBox_Enabled.Checked;
                    this.curPfCustomer.FirstCharSpell    = DisplayUtil.GetPYString(this.curPfCustomer.Name);
                    this.curPfCustomer.CustomerType      = (byte)(skinRadioButtonSale.Checked ? 1 : 0);
                    if (String.IsNullOrEmpty(curPfCustomer.Password))
                    {
                        this.textBoxPwd.Focus();
                        return;
                    }
                    //BusinessAccountID 账套不能为当前账套
                    string CurrbusinessAccountId = CommonGlobalCache.BusinessAccount.ID.ToUpper();
                    if (curPfCustomer.BusinessAccountID.ToUpper() == CurrbusinessAccountId)
                    {
                        this.textBoxBusinessAccount.Focus();
                        GlobalMessageBox.Show("不能绑定当前账套!");
                        return;
                    }

                    InteractResult result = PfCustomerCache.PfCustomer_OnUpdate(curPfCustomer);
                    switch (result.ExeResult)
                    {
                    case ExeResult.Error:
                        GlobalMessageBox.Show(result.Msg);
                        break;

                    default:
                        TreeModel treeN = new TreeModel();
                        treeN.ID   = curPfCustomer.ID;
                        treeN.Name = curPfCustomer.Name;
                        CommonGlobalCache.UpdatePFDistributor(treeN);
                        GlobalMessageBox.Show("保存成功!");
                        SaveResult?.Invoke(curPfCustomer);
                        TabPage_Close(this.CurrentTabPage, this.SourceCtrlType);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }