示例#1
0
        private void PrintRetail(RetailOrder retailOrder)
        {
            OrderPrintUtil      printHelper      = new OrderPrintUtil();
            List <RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID);

            foreach (var item in retailDetailList)
            {
                Costume costume = CommonGlobalCache.GetCostume(item.CostumeID);
                // 显示自己设置的尺码组和对应的尺码列表
                item.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(item.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName));
            }

            RetailCostume retailCostume = new RetailCostume()
            {
                RetailDetailList = retailDetailList,
                RetailOrder      = retailOrder
            };
            int          times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
            DataGridView dgv   = deepCopyDataGridView();

            printHelper.Print(retailCostume, times, dgv);
        }
示例#2
0
        private void DoImport()
        {
            try
            {
                List <CostumeClass2> emptyStore  = new List <CostumeClass2>();
                List <CostumeClass2> stores      = new List <CostumeClass2>();
                List <CostumeClass2> repeatItems = new List <CostumeClass2>();
                DataTable            dt          = NPOIHelper.FormatToDatatable(path, 0);
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow       row   = dt.Rows[i];
                    int           index = 0;
                    CostumeClass2 store = new CostumeClass2();
                    try
                    {
                        if (!CommonGlobalUtil.ImportValidate(row, 5))
                        {
                            store.Index        = (i + 2);
                            store.AutoID       = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.ClassName    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.ParentAutoID = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.OrderNo      = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.ClassCode    = CommonGlobalUtil.ConvertToString(row[index++]);
                            //  store.FirstCharSpell = DisplayUtil.GetPYString(store.Name);
                            if (store.AutoID == 0 || String.IsNullOrEmpty(store.ClassName))
                            {
                                //必填项为空
                                emptyStore.Add(store);
                                continue;
                            }
                            else
                            {
                                //判断是否重复款号/颜色
                                if (stores.Find(t => t.AutoID == store.AutoID) != null)
                                {
                                    repeatItems.Add(store);
                                    continue;
                                }

                                stores.Add(store);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (emptyStore.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in emptyStore)
                    {
                        str += "第" + item.Index + "行\r\n";
                    }
                    ShowError("必填项没有填写,请补充完整!\r\n" + str);
                    return;
                }
                if (repeatItems.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in repeatItems)
                    {
                        str += "第" + item.Index + "行" + "\r\n";
                    }
                    ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str);
                    //  return;
                }
                if (stores != null && stores.Count > 0)
                {
                }
                else
                {
                    ShowMessage("没有数据可以导入,请检查列表信息!");
                    return;
                }
                path = null;
                //檢查結果
                InteractResult result = GlobalCache.ServerProxy.ImportCostumeClass(stores);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    ShowMessage(result.Msg);
                    break;

                case ExeResult.Success:
                    RefreshPage();
                    ShowMessage("导入成功!");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
示例#3
0
        private void BaseButton_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                BaseButton_Submit.Enabled = false;
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.member != null && this.m_MoneyStoredCard > this.member.Balance)
                {
                    GlobalMessageBox.Show("卡余额不足!");
                    return;
                }
                decimal moneyIntegration = string.IsNullOrEmpty(this.skinLabel_JFToMoeny.Text) ? 0 : decimal.Parse(this.skinLabel_JFToMoeny.Text);

                if (m_MoneyIntegration != 0)
                {
                    if (moneyIntegration < this.m_MoneyIntegration)
                    {
                        GlobalMessageBox.Show("积分不足!");
                        return;
                    }
                }

                if (this.m_MoneyStoredCard + this.m_MoneyIntegration > this.totalMoneyReceived)
                {
                    GlobalMessageBox.Show("输入的积分返现金额与卡余额之和不能大于应收金额!");
                    return;
                }
                decimal refundAmount = decimal.Parse(this.skinLabel_MoneyChange.Text);
                if (!skinCheckBoxNew.Checked)
                {
                    if (refundAmount < 0)
                    {
                        GlobalMessageBox.Show("付款金额不足!");
                        return;
                    }
                }
                string  id = GlobalCache.ServerProxy.GetRetailOrderID(); //IDHelper.GetID(OrderPrefix.RetailOrder, GlobalCache.GetShop(GlobalCache.CurrentShopID).AutoCode);
                decimal moneyVipCardMain   = this.member == null ? this.m_MoneyStoredCard : this.m_MoneyStoredCard * (1 - (decimal)this.member.DonateCoef);
                decimal moneyVipCardDonate = this.member == null ? 0 : this.m_MoneyStoredCard * (decimal)this.member.DonateCoef;
                this.totalMoneyReceivedActual = this.totalMoneyReceived - this.m_MoneyIntegration - moneyVipCardDonate - this.discountMoney;

                CommonGlobalUtil.WriteLog("应收总金额:" + totalMoneyReceived);
                CommonGlobalUtil.WriteLog("积分:" + m_MoneyIntegration);
                CommonGlobalUtil.WriteLog("vip赠送金额:" + moneyVipCardDonate);
                CommonGlobalUtil.WriteLog("优惠券:" + discountMoney);
                CommonGlobalUtil.WriteLog("满减金额:" + this.mjMoney);
                CommonGlobalUtil.WriteLog("实收总金额:" + totalMoneyReceivedActual);
                if (this.skinCheckBoxNew.Checked)
                {
                    if (this.salesPromotion != null)
                    {
                        this.salesPromotion.ID = String.Empty;
                    }
                    this.discountMoney            = 0;
                    this.totalMoneyReceivedActual = 0;
                    this.totalMoneyReceived       = Convert.ToDecimal(this.skinLabel_TotalMoneySupposed.Text);
                    this.promotionText            = "未付款,不参与任何促销优惠";
                }
                //  String orderId =
                //重新获取订单编号
                //  bool isNotPay = this.skinCheckBoxNew.Checked;

                retailOrder = new RetailOrder()
                {
                    ID                       = id,
                    MemeberID                = this.member == null ? string.Empty : this.member.PhoneNumber,
                    MoneyCash                = this.m_MoneyCash,
                    MoneyCash2               = this.m_MoneyCash - this.moneyChange,
                    MoneyVipCard             = this.m_MoneyStoredCard,
                    MoneyVipCardMain         = moneyVipCardMain,
                    MoneyVipCardDonate       = moneyVipCardDonate,
                    MoneyBankCard            = this.m_MoneyBankCard,
                    MoneyWeiXin              = this.m_MoneyWeiXin,
                    MoneyAlipay              = this.m_MoneyAlipay,
                    MoneyOther               = this.m_MoneyElse,
                    MoneyIntegration         = this.m_MoneyIntegration,
                    SmallMoneyRemoved        = this.m_SmallMoneyRemoved,
                    TotalPrice               = this.totalOriginalAmount,
                    MoneyDiscounted          = this.moneyDiscounted,
                    TotalMoneyReceived       = this.totalMoneyReceived,
                    TotalMoneyReceivedActual = this.totalMoneyReceivedActual,
                    ShopID                   = shopID,
                    Remarks                  = this.rtfRichTextBox_Remarks.Text,
                    TotalCount               = this.totalCount,
                    CreateTime               = createTime,

                    EntryTime        = DateTime.Now,
                    EntryUserID      = CommonGlobalCache.CurrentUserID,
                    MoneyChange      = this.moneyChange,
                    SalesPromotionID = this.salesPromotion == null ? String.Empty : this.salesPromotion.ID,
                    GuideID          = this.guideID,
                    TotalCost        = this.totalCost,
                    //已经满减了
                    Benefit               = this.totalMoneyReceivedActual - this.totalCost,
                    PromotionText         = this.promotionText,
                    IsRefundOrder         = false,
                    OperateGuideID        = this.guideID,
                    MoneyDeductedByTicket = this.discountMoney,
                    IsNotPay              = this.skinCheckBoxNew.Checked,
                    GiftTicket            = this.giftTicketList,
                };


                List <RetailDetail> retailDetailListWithoutBuyout = retailDetailList.FindAll(t => !t.IsBuyout);
                List <RetailDetail> retailDetailListBuyout        = retailDetailList.FindAll(t => t.IsBuyout);

                if (skinCheckBoxNew.Checked)

                {
                    foreach (RetailDetail detail in retailDetailListWithoutBuyout)
                    {
                        List <CostumeItem> resultList = CommonGlobalCache.ServerProxy.GetCostumeStoreList(
                            new CostumeStoreListPara()
                        {
                            CostumeID       = detail.CostumeID,
                            ShopID          = shopID,
                            IsOnlyShowValid = true,
                            IsAccurateQuery = true,
                        });
                        decimal      saleprice  = 0;
                        CostumeStore reslutList = new CostumeStore();
                        if (resultList != null && resultList.Count > 0)
                        {
                            List <CostumeStore> lStore = resultList[0].CostumeStoreList;
                            reslutList = lStore.Find(t => t.ColorName == detail.ColorName);
                            if (reslutList.SalePrice < reslutList.Price)
                            {
                                saleprice = reslutList.Price;
                            }
                            else
                            {
                                saleprice = reslutList.SalePrice;
                            }
                            //saleprice = resultList[0].CostumeStoreList[].Price;
                        }
                        detail.Price    = saleprice;
                        detail.Discount = saleprice / reslutList.Price * 100;

                        detail.SumMoney = detail.Price * detail.BuyCount;
                    }
                }
                RetailCostume retailCostume = new RetailCostume()
                {
                    RetailDetailList = this.retailDetailList,
                    RetailOrder      = retailOrder
                };

                foreach (var item in retailDetailList)
                {
                    item.RetailOrderID = id;
                    CostumeSalePriceConfiguration costumeSalePrice = new CostumeSalePriceConfiguration();
                    costumeSalePrice.price = item.SinglePrice;
                    //  item.SalePrice = item.SinglePrice;
                    costumeSalePrice.Save(CommonGlobalUtil.AgileConfiguration("Pos//SalePrice//" + GlobalCache.CurrentShopID + "//" + item.CostumeID));
                }



                InteractResult result = GlobalCache.ServerProxy.RetailCostume(retailCostume);

                switch (result.ExeResult)
                {
                case ExeResult.Success:
                    GlobalMessageBox.Show("结算成功!");
                    this.DialogResult = DialogResult.OK;
                    if (skinCheckBoxPrint.Checked)
                    {
                        OrderPrintUtil printHelper = new OrderPrintUtil();
                        int            times       = CommonGlobalUtil.ConvertToInt32(GlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
                        DataGridView   dgv         = deepCopyDataGridView();
                        printHelper.Print(retailCostume, times, dgv);
                    }

                    break;

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

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                BaseButton_Submit.Enabled = true;
                GlobalUtil.UnLockPage(this);
            }
        }
示例#4
0
        private void DoImport()
        {
            try
            {
                List <PfCustomerStore> unableStore  = new List <PfCustomerStore>();
                List <PfCustomerStore> stores       = new List <PfCustomerStore>();
                List <PfCustomerStore> repeatStores = new List <PfCustomerStore>();
                DataTable dt = NPOIHelper.FormatToDatatable(importPath, 0);
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow         row   = dt.Rows[i];
                    int             index = 0;
                    PfCustomerStore store = new PfCustomerStore();
                    try
                    {
                        if (!ImportValidate(row))
                        {
                            //款号	商品名称	色号	颜色名称	吊牌价	成本价	品牌	供应商名称	年份	季节	大类	小类	款型	风格	XS	S	M	L	XL	2XL	3XL	4XL	5XL	6XL	F
                            store.AutoID         = i + 2;
                            store.CostumeID      = CommonGlobalUtil.ConvertToString(row[index]);
                            store.CostumeID      = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.CostumeName    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.CostumeColorID = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.ColorName      = CommonGlobalUtil.ConvertToString(row[index++]);
                            //store.Price = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Price   = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.PfPrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);

                            //store.SalePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            //store.EmOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            //store.PfOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.BrandName    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SupplierName = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Year         = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.Season       = CommonGlobalUtil.ConvertToString(row[index++]);
                            // store.ClassCode = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.BigClass      = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SmallClass    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SubSmallClass = CommonGlobalUtil.ConvertToString(row[index++]);
                            // store.Style = CommonGlobalUtil.ConvertToString(row[index++]);
                            //  store.Models = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SizeGroupShowName = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.XS  = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.S   = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.M   = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.L   = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL  = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL2 = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL3 = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL4 = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL5 = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.XL6 = CommonGlobalUtil.ConvertToInt16(row[index++]);
                            store.F   = CommonGlobalUtil.ConvertToInt16(row[index++]);

                            store.PfCustomerID = pfCustomeId;
                            if ((String.IsNullOrEmpty(store.CostumeID) || String.IsNullOrEmpty(store.CostumeName) ||
                                 String.IsNullOrEmpty(store.ColorName) ||
                                 String.IsNullOrEmpty(store.SizeGroupShowName)))
                            {
                                unableStore.Add(store);
                            }
                            else
                            {
                                if (stores.Find(t => t.CostumeID == store.CostumeID && t.CostumeName == store.CostumeName &&
                                                t.ColorName == store.ColorName
                                                ) != null)
                                {
                                    repeatStores.Add(store);
                                }
                                else
                                {
                                    //store.CostumeID = CommonGlobalCache.GetCorrectCostumeID(store.CostumeID);

                                    /* if (!String.IsNullOrEmpty(store.ClassCode))
                                     * {
                                     *    store.ClassName = CommonGlobalCache.ServerProxy.GetCostumeClass4Code(store.ClassCode)?.ClassName;
                                     * }*/
                                    stores.Add(store);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (unableStore.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in unableStore)
                    {
                        str += "第" + item.AutoID + "行\r\n";
                    }

                    ShowError("必填项没有填写,请补充完整!\r\n" + str);
                    ImportFormCancel();
                    return;
                }
                if (repeatStores.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in repeatStores)
                    {
                        str += "第" + item.AutoID + "行\r\n";
                    }

                    //这个与已导入的列表数据无关
                    ShowError("重复的款号与颜色,系统已过滤,详见错误报告!\r\n" + str);
                    ImportFormCancel();
                    return;
                }
                if (stores != null && stores.Count > 0)
                {
                }
                else
                {
                    ShowMessage("没有数据可以导入,请检查列表信息!");
                    ImportFormCancel();
                    return;
                }

                importPath = null;
                AddItems4Display(stores);
                //    ShowMessage("导入成功!");
                ImportFormDialogResult(DialogResult.OK);
            }
            catch (Exception ex)
            {
                ImportFormCancel();
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
示例#5
0
        private void DoImport()
        {
            try
            {
                List <Supplier> emptyStore  = new List <Supplier>();
                List <Supplier> stores      = new List <Supplier>();
                List <Supplier> repeatItems = new List <Supplier>();
                DataTable       dt          = NPOIHelper.FormatToDatatable(path, 0);
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow  row   = dt.Rows[i];
                    int      index = 0;
                    Supplier store = new Supplier();
                    try
                    {
                        if (!CommonGlobalUtil.ImportValidate(row, 10))
                        {
                            // 名称 进货折扣    联系人 联系电话    银行账户信息 应付款结余(正数表示欠供应商)	最后一次记账时间 创建时间    序号 备注

                            store.ID              = "" + (i + 2);
                            store.Name            = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SupplyDiscount  = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.Contact         = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.ContactPhone    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.BankInfo        = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.PaymentBalance  = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.LastAccountTime = DateTimeUtil.ConvertToDateTime(CommonGlobalUtil.ConvertToString(row[index++]));
                            store.CreateTime      = DateTimeUtil.ConvertToDateTime(CommonGlobalUtil.ConvertToString(row[index++]));
                            store.OrderNo         = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.Remarks         = CommonGlobalUtil.ConvertToString(row[index++]);
                            if (String.IsNullOrEmpty(store.Name))
                            {
                                //必填项为空
                                emptyStore.Add(store);
                                continue;
                            }
                            else
                            {
                                //判断是否重复款号/颜色
                                if (stores.Find(t => t.Name == store.Name) != null)
                                {
                                    repeatItems.Add(store);
                                    continue;
                                }

                                stores.Add(store);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if (emptyStore.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in emptyStore)
                    {
                        str += "第" + item.ID + "行\r\n";
                    }
                    ShowError("必填项没有填写,请补充完整!\r\n" + str);
                    return;
                }
                if (repeatItems.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in repeatItems)
                    {
                        str += "第" + item.ID + "行" + "\r\n";
                    }
                    ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str);
                    //  return;
                }
                if (stores != null && stores.Count > 0)
                {
                }
                else
                {
                    ShowMessage("没有数据可以导入,请检查列表信息!");
                    return;
                }
                path = null;
                //檢查結果
                InteractResult result = GlobalCache.ServerProxy.ImportSupplier(stores);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                case ExeResult.Success:
                    RefreshPage();
                    ShowMessage("导入成功!");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
示例#6
0
        /// <summary>
        /// 导入数据
        /// </summary>
        private void DoImport()
        {
            try
            {
                List <Costume> emptyStore         = new List <Costume>();
                List <Costume> stores             = new List <Costume>();
                List <Costume> repeatItems        = new List <Costume>();
                DataTable      dt                 = NPOIHelper.FormatToDatatable(path, 0);
                List <int>     NoNullRows         = new List <int>(); //必填项不为空集合
                List <int>     IDRepeatRows       = new List <int>(); //款号重复集合
                List <int>     ErrorSizeRows      = new List <int>(); //尺码格式不正确
                List <int>     ErrorGroupNameRows = new List <int>(); //尺码组名称不存在
                List <int>     ErrorIdOrName      = new List <int>(); //款号或名称长度不正确

                List <EmCostumePhoto> listPhoto = ExcelToImage(path, GlobalUtil.EmallDir);

                #region //数据处理
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    DataRow row   = dt.Rows[i];
                    int     index = 0;
                    Costume store = new Costume();
                    try
                    {
                        if (!ImportValidate(row))
                        {
                            //款号 商品名称    颜色名称(使用逗号分隔)	吊牌价 成本价 售价 品牌  供应商名称 年份  季节 类别编码    尺码组名称 含有的尺码(使用逗号分隔)	备注

                            store.ID            = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Name          = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Colors        = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Price         = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.CostPrice     = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.SalePrice     = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.EmOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.PfOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]);
                            store.BrandName     = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SupplierName  = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Year          = CommonGlobalUtil.ConvertToInt32(row[index++]);
                            store.Season        = CommonGlobalUtil.ConvertToString(row[index++]);
                            // Image image =(Image) row[index++];

                            // store.ClassCode = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.BigClass      = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SmallClass    = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SubSmallClass = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SizeGroupName = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.SizeNames     = CommonGlobalUtil.ConvertToString(row[index++]);
                            store.Remarks       = CommonGlobalUtil.ConvertToString(row[index++]);
                            //图片放最后面
                            index++;
                            int curRow = i + 2;
                            if (String.IsNullOrEmpty(store.ID) || String.IsNullOrEmpty(store.Name) || String.IsNullOrEmpty(store.Colors) || String.IsNullOrEmpty(store.SizeGroupName) || String.IsNullOrEmpty(store.SizeNames))
                            {
                                //必填项为空
                                // emptyStore.Add(store);
                                NoNullRows.Add(curRow);
                                continue;
                            }
                            else
                            {
                                /* if (store.ID.Length > 50 || store.Name.Length > 50)
                                 * {
                                 *   ErrorIdOrName.Add(curRow);
                                 *   continue;
                                 * }*/
                                //判断尺码组以及尺码是否格式正确 CommonGlobalCache.SizeGroupList
                                List <SizeGroup> SizeGroupList = CommonGlobalCache.SizeGroupList;

                                int isNoGName = 0;
                                foreach (var sGroup in SizeGroupList)
                                {
                                    if (sGroup.ShowName == store.SizeGroupName)  //尺码组名称存在
                                    {
                                        //判断尺码格式是否正确  M,S,XL
                                        //sGroup.NameOfF
                                        String[] tempSizeList = store.SizeNames.Split(',');
                                        if (tempSizeList != null)
                                        {
                                            bool isRight = true; //当前尺码是否格式完全正确
                                            for (int t = 0; t < tempSizeList.Length; t++)
                                            {
                                                if (tempSizeList[t] == sGroup.NameOfF || tempSizeList[t] == sGroup.NameOfL ||
                                                    tempSizeList[t] == sGroup.NameOfM || tempSizeList[t] == sGroup.NameOfS ||
                                                    tempSizeList[t] == sGroup.NameOfXL || tempSizeList[t] == sGroup.NameOfXL2 ||
                                                    tempSizeList[t] == sGroup.NameOfXL3 || tempSizeList[t] == sGroup.NameOfXL4 ||
                                                    tempSizeList[t] == sGroup.NameOfXL5 || tempSizeList[t] == sGroup.NameOfXL6 ||
                                                    tempSizeList[t] == sGroup.NameOfXS)
                                                {
                                                    //逗号分隔后当前尺码跟数据库尺码匹配
                                                }
                                                else
                                                {
                                                    isRight = false; //当前含有的尺码有错误的格式
                                                    ErrorSizeRows.Add(curRow);
                                                    continue;
                                                }
                                            }
                                            if (isRight == false)
                                            {
                                                continue; //跳出循环,正确的尺码组没有正确的尺码
                                            }
                                        }
                                        else
                                        {
                                            ErrorSizeRows.Add(curRow);   //格式不正确,没有尺码
                                        }
                                    }
                                    else
                                    {
                                        isNoGName++;
                                        if (isNoGName == SizeGroupList.Count)
                                        {
                                            ErrorGroupNameRows.Add(curRow);   //尺码组不存在,格式不正确
                                        }
                                    }
                                }

                                //判断是否重复款号
                                if (stores.Find(t => t.ID == store.ID) != null)
                                {
                                    IDRepeatRows.Add(curRow);
                                    continue;
                                }

                                stores.Add(store);
                            }
                        }
                    }
                    //catch (IOException ex)
                    //{
                    //    ShowMessage(ex.Message);
                    //}
                    catch (Exception ex)
                    {
                    }
                }
                #endregion


                #region  //数据检验
                if (NoNullRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in NoNullRows)
                    {
                        str += "第" + item + "行\r\n";
                    }
                    ShowError("必填项没有填写,请补充完整!\r\n" + str);
                    return;
                }
                if (ErrorIdOrName.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorGroupNameRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("款号超过50个字符或商品名称超过50个汉字,请检查列表信息!\r\n" + str);
                    return;
                }
                if (IDRepeatRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in IDRepeatRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("重复的款号,系统已过滤,详见错误报告!\r\n" + str);
                    //  return;
                }

                if (ErrorGroupNameRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorGroupNameRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("尺码组不存在,请检查列表信息!\r\n" + str);
                    return;
                }

                if (ErrorSizeRows.Count > 0)
                {
                    String str = string.Empty;
                    foreach (var item in ErrorSizeRows)
                    {
                        str += "第" + item + "行" + "\r\n";
                    }
                    ShowError("尺码不存在或尺码格式错误,请检查列表信息!\r\n" + str);
                    return;
                }

                if (stores != null && stores.Count > 0)
                {
                    if (stores.Count == listPhoto.Count)
                    {
                    }
                    else
                    {
                        if (GlobalMessageBox.Show("导入的数据和图片不对应,如果导入会影响到导入的图片与款号不对应,是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                        {
                            return;
                        }
                    }
                }
                else
                {
                    ShowMessage("没有数据可以导入,请检查列表信息!");
                    return;
                }

                #endregion

                path = null;


                #region  //数据录入
                InteractResult result = GlobalCache.ServerProxy.ImportCostumes(stores);
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                case ExeResult.Success:
                    foreach (var item in stores)
                    {
                        Costume costume = CommonGlobalCache.GetCostume(item.ID);
                        if (costume != null)
                        {
                            //重新给商品名称
                            //ShowMessage(item.ID);
                            item.Name = costume.Name;
                        }
                    }

                    for (int i = 0; i < stores.Count; i++)
                    {
                        if (listPhoto.Count > 0 && listPhoto.Count > i)
                        {
                            listPhoto[i].CostumeID = stores[i].ID;

                            //这里还是要给新图片名称,下面取回来对应过去。才有LINKADDRESS
                            PhotoData para = new PhotoData()
                            {
                                Datas          = listPhoto[i].Bytes,
                                EmCostumePhoto = listPhoto[i],
                                Name           = listPhoto[i].PhotoName,
                            };
                            GlobalCache.ServerProxy.UploadPhotoToCos(para);

                            /* GlobalCache.ServerProxy.UploadCostumePhoto(new UploadCostumePhotoPara()
                             * {
                             *
                             *   ID = stores[i].ID,
                             *   Photo = listPhoto[i].Photo,
                             *
                             * });*/
                        }
                    }
                    // AddItems4Display(stores);

                    ShowMessage("导入成功!");
                    break;

                default:
                    break;
                }

                #endregion
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                UnLockPage();
            }
        }
示例#7
0
        private void BaseButton_OK_Click(object sender, EventArgs e)
        {
            try
            {
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.refundCostume.RefundOrder.TotalCount == 0)
                {
                    GlobalMessageBox.Show("退货数量为0,不能退货");
                    return;
                }

                if (Math.Abs(skinLabel_TotalMoney.Value) != (skinLabel_RefundIntegration.Value + skinLabel_RefundStoredCard.Value + skinLabel_RefundCash.Value +
                                                             this.numericTextBoxBankCard.Value +
                                                             this.numericTextBoxWeixin.Value +
                                                             this.numericTextBoxAlipay.Value +
                                                             this.numericTextBoxElse.Value
                                                             ))
                {
                    GlobalMessageBox.Show("退款总额必须与总计相等!");
                    return;
                }


                this.refundCostume.RefundOrder.MoneyIntegration = skinLabel_RefundIntegration.Value * -1;
                this.refundCostume.RefundOrder.MoneyVipCard     = skinLabel_RefundStoredCard.Value * -1;
                this.refundCostume.RefundOrder.MoneyCash        = skinLabel_RefundCash.Value * -1;
                this.refundCostume.RefundOrder.MoneyAlipay      = numericTextBoxAlipay.Value * -1;
                this.refundCostume.RefundOrder.MoneyOther       = numericTextBoxElse.Value * -1;
                this.refundCostume.RefundOrder.MoneyWeiXin      = numericTextBoxWeixin.Value * -1;
                this.refundCostume.RefundOrder.MoneyBankCard    = numericTextBoxBankCard.Value * -1;
                //  decimal moneyVipCardDonate = this.refundCostume.RefundOrder.MoneyVipCard * (decimal)member.DonateCoef;
                //  decimal moneyVipCardMain = this.refundCostume.RefundOrder.MoneyVipCard * (1 - (decimal)member.DonateCoef);
                if (!String.IsNullOrEmpty(refundCostume.RefundOrder.MemeberID))
                {
                    Member member = CommonGlobalCache.ServerProxy.GetOneMember(refundCostume.RefundOrder.MemeberID);
                    if (member != null)
                    {
                        decimal moneyVipCardMain = refundCostume.RefundOrder.MoneyVipCard * (decimal)(1.0 - member.DonateCoef);
                        refundCostume.RefundOrder.MoneyCash2         = refundCostume.RefundOrder.MoneyCash;
                        refundCostume.RefundOrder.MoneyVipCardMain   = moneyVipCardMain;
                        refundCostume.RefundOrder.MoneyVipCardDonate = refundCostume.RefundOrder.MoneyVipCard * (decimal)(member.DonateCoef);
                    }
                }
                else
                {
                    refundCostume.RefundOrder.MoneyCash2         = refundCostume.RefundOrder.MoneyCash;
                    refundCostume.RefundOrder.MoneyVipCardMain   = 0;
                    refundCostume.RefundOrder.MoneyVipCardDonate = 0;
                }
                if (refundCostume.RefundOrder.IsNotPay)
                {
                    decimal total = 0;
                    foreach (RetailDetail curDetail in this.refundCostume.RefundDetailList)
                    {
                        foreach (RetailDetail keepDetail in keepCostume.RefundDetailList)
                        {
                            if (curDetail.RetailOrderID == keepDetail.RetailOrderID && curDetail.CostumeID == keepDetail.CostumeID && curDetail.ColorName == keepDetail.ColorName && curDetail.SizeName == keepDetail.SizeName)
                            {
                                curDetail.SumMoney = keepDetail.SumMoney;
                                total += keepDetail.SumMoney;
                            }
                        }
                    }

                    refundCostume.RefundOrder.TotalMoneyReceived = total * -1;
                }
                else
                {
                    //总计=现金+积分+VIP卡+优惠券
                    //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券
                    refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard
                                                                   + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther +
                                                                   this.refundCostume.RefundOrder.MoneyWeiXin +
                                                                   this.refundCostume.RefundOrder.MoneyBankCard;
                    refundCostume.RefundOrder.TotalMoneyReceivedActual = refundCostume.RefundOrder.MoneyCash
                                                                         + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther +
                                                                         this.refundCostume.RefundOrder.MoneyWeiXin +
                                                                         this.refundCostume.RefundOrder.MoneyBankCard
                                                                         + refundCostume.RefundOrder.MoneyVipCardMain + (refundCostume.RefundOrder.RetailMoneyDeductedByTicket - refundCostume.RefundOrder.MoneyDeductedByTicket);
                    refundCostume.RefundOrder.Benefit = refundCostume.RefundOrder.TotalMoneyReceivedActual - refundCostume.RefundOrder.TotalCost;



                    //平摊
                    if (refundCostume.RefundDetailList != null)
                    {
                        CalcDirectly();
                    }

                    //总计=现金+积分+VIP卡+优惠券
                    //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券
                    //  refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard;
                }

                refundCostume.RefundOrder.ShopID = this.ShopID;
                InteractResult result = GlobalCache.ServerProxy.RefundCostume(this.refundCostume);

                if (result.ExeResult == ExeResult.Success)
                {
                    GlobalMessageBox.Show("退货成功!");
                    this.DialogResult = DialogResult.OK;
                    if (skinCheckBoxPrint.Checked)
                    {
                        RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil();
                        int          times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
                        DataGridView dgv   = deepCopyDataGridView();
                        printHelper.Print(refundCostume, times, dgv);
                    }
                }
                else if (result.ExeResult == ExeResult.Error)
                {
                    GlobalMessageBox.Show(result.Msg);
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.WriteLog(ee);
                GlobalMessageBox.Show("内部错误,退货失败!");
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }