Ejemplo n.º 1
0
        /// <summary>
        /// 新增议价单页面
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult BargainAdd(string Id)
        {
            if (!string.IsNullOrEmpty(Id))
            {
                var model = ServiceHelper.Create <IProductService>().GetProduct(long.Parse(Id));
                model.ShopName = ServiceHelper.Create <IShopService>().GetShopName(model.ShopId);
                ViewBag.model  = model;
            }

            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            long orderid = _orderBO.GenerateOrderNumber();

            ViewBag.billno = orderid;

            int CoinType = int.Parse(ConfigurationManager.AppSettings["CoinType"] == null ? "1" : ConfigurationManager.AppSettings["CoinType"]);
            List <ProductSpec> listspec = ServiceHelper.Create <IProductService>().GetProductSpec(long.Parse(Id))._ProductSpec.ToList();

            listspec = listspec.Where(q => q.CoinType == CoinType).ToList();

            ViewBag.ProductSpec = listspec;
            ViewBag.userId      = base.CurrentUser.Id;

            /*当前货币类型*/
            string cointype = "CNY";

            if (System.Configuration.ConfigurationManager.AppSettings["Language"].ToString() == "2")
            {
                cointype = "USD";
            }
            ViewBag.cointype = cointype;

            return(View(ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddressByUserId(base.CurrentUser.Id)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 提交提现操作
        /// </summary>
        /// <param name="amount">提现金额</param>
        /// <param name="pwd">支付密码</param>
        /// <returns></returns>
        public JsonResult ApplyWithDrawSubmit(decimal amount, string pwd)
        {
            Finance_Wallet fwino = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"]));

            if (fwino == null)
            {
                Log.Error("用户" + base.CurrentUser.Id + "在" + DateTime.Now + "时提现 获取提现信息失败.");
                return(Json(""));
            }
            else
            {
                if (!pwd.Equals(fwino.Wallet_PayPassword))
                {
                    throw new HimallException("支付密码不对,请重新输入!");
                }
                else
                {
                    if (amount > fwino.Wallet_UserLeftMoney)
                    {
                        throw new HimallException("提现金额不能超出可用金额!");
                    }
                    else
                    {
                        //创建提现记录 并且更新用户提现后的钱包
                        Finance_WithDraw fwdinfo = new Finance_WithDraw();
                        ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                        fwdinfo.Withdraw_Number       = _orderBO.GenerateOrderNumber();
                        fwdinfo.Withdraw_UserId       = base.CurrentUser.Id;
                        fwdinfo.Withdraw_UserType     = base.CurrentUser.UserType;
                        fwdinfo.Withdraw_Money        = amount;
                        fwdinfo.Withdraw_MoneyType    = int.Parse(ConfigurationManager.AppSettings["CoinType"]);
                        fwdinfo.Withdraw_BankName     = fwino.Wallet_UserBankName;
                        fwdinfo.Withdraw_BankUserName = fwino.Wallet_UserBankUserName;
                        fwdinfo.Withdraw_Account      = fwino.Wallet_UserBankNumber;
                        fwdinfo.Withdraw_Time         = DateTime.Now;
                        fwdinfo.Withdraw_Status       = 0;
                        fwdinfo.Withdraw_shenhe       = 0;
                        fwdinfo.Withdraw_shenheDesc   = "";
                        fwdinfo.Withdraw_shenheTime   = DateTime.Now;
                        fwdinfo.Withdraw_shenheUid    = 0;
                        fwdinfo.Withdraw_shenheUname  = "";
                        fwino.Wallet_UserMoneyLock    = amount;
                        fwino.Wallet_UserLeftMoney    = fwino.Wallet_UserLeftMoney - amount;
                        fwino.Wallet_DoIpAddress      = ChemCloud.Core.Common.GetIpAddress();
                        fwino.Wallet_DoLastTime       = DateTime.Now;
                        fwino.Wallet_DoUserId         = base.CurrentUser.Id;
                        fwino.Wallet_DoUserName       = base.CurrentUser.UserName;
                        if (ServiceHelper.Create <IFinance_WithDrawService>().AddFinance_WithDraw(fwdinfo) && ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwino))
                        {
                            return(Json("ok"));
                        }
                        else
                        {
                            Log.Error("用户" + base.CurrentUser.Id + "在" + DateTime.Now + "时添加提现记录失败.");
                            return(Json(""));
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public ActionResult Management()
        {
            FieldCertification.CertificationStatus fcstatus = FieldCertification.CertificationStatus.Unusable;
            FieldCertification fcf = ServiceHelper.Create <ICertification>().GetCertification(base.CurrentSellerManager.CertificationId);

            if (fcf != null)
            {
                fcstatus = fcf.Status;
            }
            else
            {
                fcf = new FieldCertification();
            }

            ViewBag.Status = fcstatus;

            /*供应商信息*/
            ShopInfo shop = ServiceHelper.Create <IShopService>().GetShop(base.CurrentSellerManager.ShopId, false);

            ViewBag.ShopStatus = shop.ShopStatus;
            ViewBag.ShopId     = shop.Id;

            /*自定义支付单号*/
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            ViewBag.OrderId = _orderBO.GenerateOrderNumber();

            return(View(fcf));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 充值提交
        /// </summary>
        /// <param name="amount"></param>
        /// <returns></returns>
        public JsonResult ChargeSubmit(decimal amount)
        {
            Finance_Wallet Fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));

            if (Fwinfo != null)
            {
            }
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            long             orderid = _orderBO.GenerateOrderNumber();
            Finance_Recharge frinfo  = new Finance_Recharge();

            frinfo.Recharge_Number    = orderid;
            frinfo.Recharge_UserId    = base.CurrentUser.Id;
            frinfo.Recharge_UserType  = base.CurrentUser.UserType;
            frinfo.Recharge_Time      = DateTime.Now;
            frinfo.Recharge_Address   = ChemCloud.Core.Common.GetIpAddress();
            frinfo.Recharge_Money     = amount;
            frinfo.Recharge_MoneyLeft = Fwinfo.Wallet_UserLeftMoney;
            frinfo.Recharge_MoneyType = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
            frinfo.Recharge_Type      = 0;
            frinfo.Recharge_Status    = 1;
            if (ServiceHelper.Create <IFinance_RechargeService>().AddFinance_Recharge(frinfo))
            {
                return(Json(frinfo.Recharge_Number));
            }
            else
            {
                return(Json(""));
            }
        }
Ejemplo n.º 5
0
        //public void AddToCartNew(string skuId, int count, long memberId)
        public void AddToCartNew(long productid, string packingunit, string purity, int productnum, decimal prodcutprice, string cointype, long memberId, long shopid, string speclevel,
                                 string distributiontype, decimal distributioncost, DateTime deliverydate, int regionid, string deliveryaddress, string paymode,
                                 decimal Insurancefee, int InvoiceType = 0, string InvoiceTitle = "", string InvoiceContext = "")
        {
            if (productid != 0)
            {
                ShoppingCartItemInfo shoppingCartItemInfo =
                    context.ShoppingCartItemInfo_.FirstOrDefault(
                        (ShoppingCartItemInfo item) => item.UserId == memberId &&
                        item.ProductId == productid && item.PackingUnit.Equals(packingunit) && item.Purity.Equals(purity) &&
                        item.Quantity.Equals(productnum) && item.ProductTotalAmount == prodcutprice && item.CoinType.Equals(cointype)
                        );

                if (shoppingCartItemInfo != null)
                {
                    ShoppingCartItemInfo quantity = shoppingCartItemInfo;
                    quantity.Quantity           = quantity.Quantity + productnum;
                    quantity.ProductTotalAmount = quantity.ProductTotalAmount + prodcutprice;
                }
                else
                {
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    long orderid = _orderBO.GenerateOrderNumber();

                    DbSet <ShoppingCartItemInfo> shoppingCartItemInfos = context.ShoppingCartItemInfo_;
                    ShoppingCartItemInfo         shoppingCartItemInfo1 = new ShoppingCartItemInfo()
                    {
                        UserId             = memberId,
                        ProductId          = productid,
                        Quantity           = productnum,
                        AddTime            = DateTime.Now,
                        PackingUnit        = packingunit,
                        Purity             = purity,
                        ProductTotalAmount = prodcutprice,
                        CoinType           = cointype,
                        ShopId             = shopid,
                        SpecLevel          = speclevel,
                        ExpressCompanyName = distributiontype,
                        Freight            = distributioncost,
                        ShippingDate       = deliverydate,
                        RegionId           = regionid,
                        ShippingAddress    = deliveryaddress,
                        PaymentTypeName    = paymode,
                        Insurancefee       = Insurancefee,
                        CartNo             = orderid,
                        InvoiceType        = InvoiceType,
                        InvoiceTitle       = InvoiceTitle,
                        InvoiceContext     = InvoiceContext
                    };
                    shoppingCartItemInfos.Add(shoppingCartItemInfo1);
                }
                context.SaveChanges();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 下单页面
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult SubmitOrder(string Id)
        {
            if (!string.IsNullOrEmpty(Id))
            {
                var model = ServiceHelper.Create <IProductService>().GetProduct(long.Parse(Id));
                model.ShopName = ServiceHelper.Create <IShopService>().GetShopName(model.ShopId);
                ViewBag.model  = model;
            }

            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            long orderid = _orderBO.GenerateOrderNumber();

            ViewBag.billno = orderid;

            int CoinType = int.Parse(ConfigurationManager.AppSettings["CoinType"] == null ? "1" : ConfigurationManager.AppSettings["CoinType"]);
            List <ProductSpec> listspec = ServiceHelper.Create <IProductService>().GetProductSpec(long.Parse(Id))._ProductSpec.ToList();

            listspec = listspec.Where(q => q.CoinType == CoinType).ToList();

            ViewBag.ProductSpec = listspec;

            ViewBag.ProConType = ConfigurationManager.AppSettings["CoinType"];

            string           InsurancefeeMaxValue = "1";
            SiteSettingsInfo siteSettings         = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();

            if (siteSettings != null)
            {
                if (!string.IsNullOrWhiteSpace(siteSettings.InsurancefeeMaxValue))
                {
                    InsurancefeeMaxValue = siteSettings.InsurancefeeMaxValue;
                }
            }
            ViewBag.InsurancefeeMaxValue = InsurancefeeMaxValue;

            IOrderService orderService = ServiceHelper.Create <IOrderService>();

            ViewBag.InvoiceTitle     = orderService.GetInvoiceTitles(base.CurrentUser.Id); //发票单位
            ViewBag.InvoiceContext   = orderService.GetInvoiceContexts();                  //发票内容
            ViewBag.orderAddressInfo = ServiceHelper.Create <IorderAddressService>().GetUserorderAddressByUserId(base.CurrentUser.Id);
            /*判断是否已经添加了购物地址*/
            string iseditshippingaddress    = "0";
            List <ShippingAddressInfo> item = ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddressByUserId(base.CurrentUser.Id).ToList();

            if (item.Count > 0)
            {
                iseditshippingaddress = "1";
            }
            ViewBag.iseditshippingaddress = iseditshippingaddress;

            return(View(ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddressByUserId(base.CurrentUser.Id)));
        }
        public JsonResult EditOrderInfo(long id, string productName, string casNo, string chemName, string productCount, string productChundu, string productPrice, string productDesc, string orderDate, string email, string companyName, string conUser, string webSite, string telPhone, string mol)
        {
            OrderPurchasing opinfo = ServiceHelper.Create <IOrderPurchasingService>().GetOrderPurchasing(id);
            int             i;

            if (!int.TryParse(productCount, out i))
            {
                return(Json(new { Successful = "请输入有效的数量" }));
            }
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            DateTime dtlater = DateTime.Parse(DateTime.Now.AddDays(double.Parse(orderDate)).ToString());

            if (id != 0)
            {
                OrderPurchasing op = new OrderPurchasing
                {
                    OrderNum      = opinfo.OrderNum,
                    ProductName   = productName,
                    ProductCount  = int.Parse(productCount),
                    ProductPurity = productChundu,
                    ProductPrice  = productPrice,
                    ProductDesc   = productDesc,
                    BeginTime     = DateTime.Now,
                    EndTime       = dtlater,
                    Email         = email,
                    CompanyName   = companyName,
                    ConUserName   = conUser,
                    ConWebsite    = webSite,
                    ConTelPhone   = telPhone,
                    OrderTime     = opinfo.OrderTime,
                    UserId        = base.CurrentUser.Id,
                    Status        = 0,
                    Mol           = opinfo.Mol,
                    DeliveryDate  = DateTime.Now,
                    CASNo         = casNo,
                    ChemName      = chemName
                };
                ServiceHelper.Create <IOrderPurchasingService>().UpdateOrderPurchasing(op);
                return(Json(new { Successful = true }));
            }
            else
            {
                return(Json(new { Successful = false }));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 添加合成订单
        /// </summary>
        /// <param name="productName"></param>
        /// <param name="productCount"></param>
        /// <param name="productChundu"></param>
        /// <param name="productPrice"></param>
        /// <param name="productDesc"></param>
        /// <param name="orderDate"></param>
        /// <param name="email"></param>
        /// <param name="companyName"></param>
        /// <param name="conUser"></param>
        /// <param name="webSite"></param>
        /// <param name="telPhone"></param>
        /// <returns></returns>
        public JsonResult AddOrderInfo(string productName, string casNo, string chemName, string productCount, string productChundu, string productPrice, string productDesc, string email, string companyName, string conUser, string webSite = "", string telPhone = "", string mol = "", string SynthesisCycle = "")
        {
            IOrderSynthesisService iops = ServiceHelper.Create <IOrderSynthesisService>();
            int i;

            if (!int.TryParse(productCount, out i))
            {
                return(Json(new { Successful = "请输入有效的数量" }));
            }
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            OrderSynthesis op = new OrderSynthesis
            {
                OrderNumber    = _orderBO.GenerateOrderNumber().ToString(),
                ProductName    = productName,
                ProductCount   = productCount,
                ProductPurity  = productChundu,
                Price          = productPrice,
                ProductDesc    = productDesc,
                Email          = email,
                CompanyName    = companyName,
                ConUserName    = conUser,
                ConWebsite     = webSite,
                ConTelPhone    = telPhone,
                OrderTime      = DateTime.Now,
                UserId         = base.CurrentUser.Id,
                Status         = 0,
                Mol            = mol,
                CASNo          = casNo,
                ChemName       = chemName,
                SynthesisCycle = SynthesisCycle
            };
            OrderSynthesis models = iops.AddOrderSynthesis(op);

            if (models != null)
            {
                return(Json(new { Successful = true, parentId = models.Id }));
            }
            else
            {
                return(Json(new { Successful = false }));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 成功添加支付记录后更新供应商的锁定金额和添加供应商的收入记录
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="price">实付金额</param>
        /// <returns></returns>
        public JsonResult AddInComeAndUpdateManagerWallet(string orderId, string price)
        {
            decimal   bxfei = 0;
            OrderInfo oinfo = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(orderId));

            if (oinfo == null)
            {
                Log.Error("获取成功支付的订单信息失败");
                return(Json(""));
            }
            else
            {
                bxfei = oinfo.Insurancefee;
                ManagerInfo minfo = ServiceHelper.Create <IManagerService>().GetManagerInfoByShopId(oinfo.ShopId);
                if (minfo == null)
                {
                    Log.Error("获取成功支付订单的供应商信息失败.");
                    return(Json(""));
                }
                else
                {
                    UserMemberInfo uminfo = ServiceHelper.Create <IMemberService>().GetMemberByName(minfo.UserName);
                    if (uminfo == null)
                    {
                        Log.Error("获取成功支付订单的供应商用户编号、用户类型失败.");
                        return(Json(""));
                    }
                    else
                    {
                        #region 添加供应商的收入记录
                        int montype = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                        ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                        Finance_InCome fi = new Finance_InCome();
                        fi.InCome_Number    = _orderBO.GenerateOrderNumber();
                        fi.InCome_UserId    = uminfo.Id;
                        fi.InCome_UserType  = uminfo.UserType;
                        fi.InCome_StartTime = DateTime.Now;
                        fi.InCome_EndTime   = DateTime.Now.AddDays(int.Parse(ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayoutTime")));
                        fi.InCome_Money     = decimal.Parse(price) - bxfei;
                        fi.InCome_MoneyType = montype;
                        fi.InCome_OrderNum  = long.Parse(orderId);
                        fi.InCome_Address   = ChemCloud.Core.Common.GetIpAddress();
                        fi.InCome_Type      = 1;
                        fi.InCome_Status    = 1;
                        if (ServiceHelper.Create <IFinance_InComeService>().AddFinance_InCome(fi))
                        {
                            Log.Info(DateTime.Now + "时,成功添加供应商编号" + uminfo.Id + "的收入信息,收入金额:" + (fi.InCome_Money) + ",收入币种:" + fi.InCome_MoneyType);
                            //更新供应商锁定金额
                            Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(uminfo.Id, uminfo.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                            if (fwinfo == null)
                            {
                                return(Json(""));
                            }
                            fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock + (fi.InCome_Money);
                            if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                            {
                                #region 保险费付给平台
                                Finance_InCome managerFi = new Finance_InCome()
                                {
                                    InCome_Number    = _orderBO.GenerateOrderNumber(),
                                    InCome_UserId    = -1, //平台
                                    InCome_UserType  = 1,  //平台
                                    InCome_StartTime = DateTime.Now,
                                    InCome_EndTime   = DateTime.Now.AddDays(int.Parse(ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayoutTime"))),
                                    InCome_Money     = bxfei,//保险费付给平台
                                    InCome_MoneyType = montype,
                                    InCome_OrderNum  = long.Parse(orderId),
                                    InCome_Address   = fi.InCome_Address,
                                    InCome_Type      = 1,
                                    InCome_Status    = 1
                                };
                                if (ServiceHelper.Create <IFinance_InComeService>().AddFinance_InCome(managerFi))
                                {
                                    Log.Info(DateTime.Now + "时,成功添加收入信息,收入金额:" + (fi.InCome_Money - bxfei) + ",收入币种:" + fi.InCome_MoneyType);
                                    //更新平台账户金额 如果保险费用大于0
                                    if (bxfei > 0)
                                    {
                                        Finance_Wallet pingtai = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(-1, 1, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                                        if (pingtai == null)
                                        {
                                            Log.Info(DateTime.Now + "时,获取平台账号信息失败.");
                                            return(Json(""));
                                        }
                                        pingtai.Wallet_UserMoneyLock = pingtai.Wallet_UserMoneyLock + bxfei;
                                        if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(pingtai))
                                        {
                                            return(Json("ok"));
                                        }
                                        else
                                        {
                                            Log.Info(DateTime.Now + "时,更新平台账号信息错误.");
                                            return(Json(""));
                                        }
                                    }
                                    else
                                    {
                                        return(Json("ok"));
                                    }
                                }
                                else
                                {
                                    Log.Info(DateTime.Now + "时,平台账户的保险金收入信息失败.");
                                    return(Json(""));
                                }
                                #endregion
                            }
                            else
                            {
                                return(Json(""));
                            }
                        }
                        else
                        {
                            Log.Info(DateTime.Now + "时,添加供应商编号" + uminfo.Id + "的收入信息失败.");
                            return(Json(""));
                        }
                        #endregion
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 成功添加支付记录后更新平台的的 锁定金额和 平台的收入记录
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="price">实付金额</param>
        /// <returns></returns>
        public JsonResult AddInComeAndUpdatePlatformWallet(string orderId, string price, string paytype)
        {
            long userid = 0; int usertype = 1;

            /*4定制合成 5代理采购 (此时支付给供应商)*/
            if (paytype == "4")
            {
                string    strsql = string.Format("SELECT * FROM dbo.ChemCloud_OrderSynthesis where OrderNumber='" + orderId + "';");
                DataTable dt     = DbHelperSQL.QueryDataTable(strsql);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["ZhifuImg"] != null)
                    {
                        userid   = long.Parse(dt.Rows[0]["ZhifuImg"].ToString());
                        usertype = 2;
                    }
                }
            }

            if (paytype == "5")
            {
                string    strsql = string.Format("SELECT * FROM dbo.ChemCloud_OrderPurchasing where OrderNum='" + orderId + "';");
                DataTable dt     = DbHelperSQL.QueryDataTable(strsql);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["ZhifuImg"] != null)
                    {
                        userid   = long.Parse(dt.Rows[0]["ZhifuImg"].ToString());
                        usertype = 2;
                    }
                }
            }

            /*我要采购 支付*/
            if (paytype == "7")
            {
                //orderId

                string    strsql = string.Format("SELECT SupplierID FROM dbo.ChemCloud_IWantToSupply where Id='" + orderId + "';");
                DataTable dt     = DbHelperSQL.QueryDataTable(strsql);
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["SupplierID"] != null)
                    {
                        userid   = long.Parse(dt.Rows[0]["SupplierID"].ToString());
                        usertype = 2;
                    }
                }

                int montype = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                Finance_InCome fi = new Finance_InCome();
                fi.InCome_Number    = _orderBO.GenerateOrderNumber();
                fi.InCome_UserId    = userid;
                fi.InCome_UserType  = usertype;
                fi.InCome_StartTime = DateTime.Now;
                fi.InCome_EndTime   = DateTime.Now.AddDays(int.Parse(ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayoutTime")));
                fi.InCome_Money     = decimal.Parse(price);
                fi.InCome_MoneyType = montype;
                fi.InCome_OrderNum  = long.Parse(orderId);
                fi.InCome_Address   = ChemCloud.Core.Common.GetIpAddress();
                fi.InCome_Type      = 1;
                fi.InCome_Status    = 1;
                if (ServiceHelper.Create <IFinance_InComeService>().AddFinance_InCome(fi))
                {
                    //更新供应商锁定金额
                    Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(-1, 1, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                    if (fwinfo == null)
                    {
                        return(Json(""));
                    }
                    fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock + (decimal.Parse(price));
                    if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                    {
                        return(Json("ok"));
                    }
                    else
                    {
                        return(Json(""));
                    }
                }
                else
                {
                    return(Json(""));
                }
            }
            else
            {
                #region 平台的收入记录
                int montype = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                Finance_InCome fi = new Finance_InCome();
                fi.InCome_Number    = _orderBO.GenerateOrderNumber();
                fi.InCome_UserId    = userid;
                fi.InCome_UserType  = usertype;
                fi.InCome_StartTime = DateTime.Now;
                fi.InCome_EndTime   = DateTime.Now.AddDays(int.Parse(ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayoutTime")));
                fi.InCome_Money     = decimal.Parse(price);
                fi.InCome_MoneyType = montype;
                fi.InCome_OrderNum  = long.Parse(orderId);
                fi.InCome_Address   = ChemCloud.Core.Common.GetIpAddress();
                fi.InCome_Type      = 1;
                fi.InCome_Status    = 1;
                if (ServiceHelper.Create <IFinance_InComeService>().AddFinance_InCome(fi))
                {
                    Log.Info(DateTime.Now + "时,成功添加平台的收入信息,收入金额:" + (fi.InCome_Money) + ",收入币种:" + fi.InCome_MoneyType);
                    //更新供应商锁定金额
                    Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(-1, 1, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                    if (fwinfo == null)
                    {
                        return(Json(""));
                    }
                    fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock + (decimal.Parse(price));
                    if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                    {
                        return(Json("ok"));
                    }
                    else
                    {
                        return(Json(""));
                    }
                }
                else
                {
                    Log.Info(DateTime.Now + "时,添加平台的收入信息失败.");
                    return(Json(""));
                }
                #endregion
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 下单
        /// </summary>
        /// <param name="model"></param>
        public bool CartSubmitOrder(List <MargainBill> listbill)
        {
            bool result = false;

            try
            {
                foreach (MargainBill margainbill in listbill)
                {
                    //订单号
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    long orderid = _orderBO.GenerateOrderNumber();

                    //收货信息
                    ShippingAddressService _ShippingAddressService = new ShippingAddressService();
                    ShippingAddressInfo    addressinfo             = _ShippingAddressService.GetUserShippingAddress(long.Parse(margainbill.RegionId.ToString()));

                    //供应商
                    ShopService _ShopService = new ShopService();
                    string      shopname     = _ShopService.GetShopName(margainbill.ShopId);

                    //会员
                    MemberService _MemberService = new MemberService();
                    string        username       = _MemberService.GetMember(margainbill.MemberId) == null ? "" : (_MemberService.GetMember(margainbill.MemberId).UserName == null ? "" : _MemberService.GetMember(margainbill.MemberId).UserName);

                    using (TransactionScope transactionScope = new TransactionScope())
                    {
                        OrderInfo orderInfo = new OrderInfo();
                        orderInfo.Id        = orderid;                          //订单号
                        orderInfo.ShopId    = margainbill.ShopId;               //供应商编号ChemCloud_Shops
                        orderInfo.ShopName  = shopname;
                        orderInfo.UserId    = margainbill.MemberId;             //采购商ChemCloud_Members
                        orderInfo.UserName  = username;
                        orderInfo.OrderDate = DateTime.Now;                     //订单日期

                        orderInfo.ExpressCompanyName = margainbill.DeliverType; //物流配送方式

                        orderInfo.Freight = margainbill.DeliverCost;            //运费
                        //orderInfo.ShippingDate = margainbill.DeliverDate; //发货日期
                        //orderInfo.ShippingDate = null; //发货日期  尚未支付
                        orderInfo.PaymentTypeName = margainbill.PayMode;           //支付方式

                        orderInfo.ProductTotalAmount = margainbill.TotalAmount;    //产品金额
                        orderInfo.CoinType           = margainbill.CoinType;       //货币种类

                        orderInfo.ShipTo             = addressinfo.ShipTo;         //收货人
                        orderInfo.TopRegionId        = addressinfo.RegionId;       //RegionId
                        orderInfo.RegionId           = addressinfo.RegionId;       //RegionId
                        orderInfo.RegionFullName     = addressinfo.RegionFullName; //省市区街道
                        orderInfo.Address            = addressinfo.Address;
                        orderInfo.CellPhone          = addressinfo.Phone;
                        orderInfo.OrderStatus        = OrderInfo.OrderOperateStatus.WaitPay;//订单
                        orderInfo.IsPrinted          = false;
                        orderInfo.RefundTotalAmount  = new decimal(0);
                        orderInfo.CommisTotalAmount  = new decimal(0);
                        orderInfo.RefundCommisAmount = new decimal(0);
                        orderInfo.Platform           = PlatformType.PC;

                        /*发票信息*/
                        if (margainbill.InvoiceType == 0)
                        {
                            orderInfo.InvoiceType = InvoiceType.None;
                        }
                        else if (margainbill.InvoiceType == 1)
                        {
                            orderInfo.InvoiceType = InvoiceType.VATInvoice;
                        }
                        else if (margainbill.InvoiceType == 2)
                        {
                            orderInfo.InvoiceType = InvoiceType.OrdinaryInvoices;
                        }
                        else if (margainbill.InvoiceType == 3)
                        {
                            orderInfo.InvoiceType = InvoiceType.SpecialTicket;
                        }
                        orderInfo.InvoiceTitle   = margainbill.InvoiceTitle;   //名称
                        orderInfo.InvoiceContext = margainbill.InvoiceContext; //纳税人识别号
                        orderInfo.SellerPhone    = margainbill.SellerPhone;    //电话
                        orderInfo.SellerRemark   = margainbill.SellerRemark;   //开户行及账号
                        orderInfo.SellerAddress  = margainbill.SellerAddress;  //地址
                        /*发票信息*/

                        orderInfo.DiscountAmount   = new decimal(0);
                        orderInfo.ActiveType       = OrderInfo.ActiveTypes.None;
                        orderInfo.IntegralDiscount = new decimal(0);

                        orderInfo.IsInsurance    = margainbill.IsInsurance; //保险费
                        orderInfo.Insurancefee   = margainbill.Insurancefee;
                        orderInfo.Transactionfee = 0;                       //交易费
                        orderInfo.Counterfee     = 0;                       //手续费

                        context.OrderInfo.Add(orderInfo);
                        context.SaveChanges();
                        MargainBillService _MargainBillService = new MargainBillService();
                        OrderItemInfo      orderInfoitem       = new OrderItemInfo();
                        foreach (MargainBillDetail billdetail in margainbill._MargainBillDetail)
                        {
                            orderInfoitem.OrderId        = orderid;
                            orderInfoitem.ShopId         = margainbill.ShopId;
                            orderInfoitem.ProductId      = billdetail.ProductId;
                            orderInfoitem.ProductName    = billdetail.ProductName;
                            orderInfoitem.Quantity       = billdetail.Num;
                            orderInfoitem.SalePrice      = billdetail.PurchasePrice;
                            orderInfoitem.PackingUnit    = billdetail.PackingUnit;
                            orderInfoitem.SpecLevel      = billdetail.SpecLevel;
                            orderInfoitem.Purity         = billdetail.Purity;
                            orderInfoitem.ReturnQuantity = long.Parse("1");
                            orderInfoitem.CostPrice      = 0;
                            orderInfoitem.DiscountAmount = 0;
                            orderInfoitem.RealTotalPrice = 0;
                            orderInfoitem.RefundPrice    = 0;
                            orderInfoitem.CommisRate     = 0;
                            orderInfoitem.IsLimitBuy     = false;
                            context.OrderItemInfo.Add(orderInfoitem);
                            context.SaveChanges();
                            _MargainBillService.RemoveCartAfterOrder(orderInfo.UserId, billdetail.ProductId); //提交成功后,删除购物车内容
                        }
                        transactionScope.Complete();
                    }
                }
                result = true;
            }
            catch (Exception)
            {
                return(false);
            }

            return(result);
        }
Ejemplo n.º 12
0
        public ActionResult Console()
        {
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            ViewBag.sortpayid = _orderBO.GenerateOrderNumber();

            HomeModel homeModel = new HomeModel()
            {
                SellerConsoleModel = ServiceHelper.Create <IShopService>().GetSellerConsoleModel(base.CurrentSellerManager.ShopId, base.CurrentUser.Id),
                Articles           = ServiceHelper.Create <IArticleService>().GetTopNArticle <ArticleInfo>(6, 4, null, false)
            };
            ShopInfo shop = ServiceHelper.Create <IShopService>().GetShop(base.CurrentSellerManager.ShopId, false);

            if (shop != null)
            {
                ViewBag.UserType      = base.CurrentUser.UserType;
                ViewBag.SortType      = shop.SortType;
                ViewBag.Logo          = base.CurrentSiteSetting.MemberLogo;
                homeModel.ShopId      = shop.Id;
                homeModel.ShopLogo    = shop.Logo;
                homeModel.ShopName    = shop.ShopName;
                homeModel.ShopEndDate = (shop.EndDate.HasValue ? shop.EndDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                ShopGradeInfo shopGradeInfo = (
                    from c in ServiceHelper.Create <IShopService>().GetShopGrades()
                    where c.Id == shop.GradeId
                    select c).FirstOrDefault();

                homeModel.ShopGradeName = (shopGradeInfo != null ? shopGradeInfo.Name : string.Empty);


                IQueryable <StatisticOrderCommentsInfo> shopStatisticOrderComments =
                    ServiceHelper.Create <IShopService>().GetShopStatisticOrderComments(base.CurrentSellerManager.ShopId);
                StatisticOrderCommentsInfo statisticOrderCommentsInfo = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 13
                    select c).FirstOrDefault(); //质量与描述满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo1 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 14
                    select c).FirstOrDefault();//发货速度满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo2 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 15
                    select c).FirstOrDefault();//服务态度满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo3 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 16 //包装质量满意度
                    select c).FirstOrDefault();
                string str = "5";                 //如果无评价数据,默认为5分
                homeModel.ProductAndDescription = (statisticOrderCommentsInfo != null ? string.Format("{0:F}", statisticOrderCommentsInfo.CommentValue) : str);
                homeModel.SellerServiceAttitude = (statisticOrderCommentsInfo1 != null ? string.Format("{0:F}", statisticOrderCommentsInfo1.CommentValue) : str);
                homeModel.SellerDeliverySpeed   = (statisticOrderCommentsInfo2 != null ? string.Format("{0:F}", statisticOrderCommentsInfo2.CommentValue) : str);
                homeModel.PackingQuality        = (statisticOrderCommentsInfo3 != null ? string.Format("{0:F}", statisticOrderCommentsInfo3.CommentValue) : str);

                homeModel.ProductsNumberIng        = homeModel.SellerConsoleModel.ProductLimit.ToString();
                homeModel.ProductsNumber           = homeModel.SellerConsoleModel.ProductsCount.ToString();
                homeModel.UseSpace                 = homeModel.SellerConsoleModel.ImageLimit.ToString();
                homeModel.UseSpaceing              = homeModel.SellerConsoleModel.ProductImages.ToString();
                homeModel.OrderProductConsultation = homeModel.SellerConsoleModel.ProductConsultations.ToString();
                homeModel.OrderCounts              = homeModel.SellerConsoleModel.OrderCounts.ToString();
                homeModel.OrderWaitPay             = homeModel.SellerConsoleModel.WaitPayTrades.ToString();
                homeModel.OrderWaitDelivery        = homeModel.SellerConsoleModel.WaitDeliveryTrades.ToString();
                ICommentService commentService = ServiceHelper.Create <ICommentService>();
                CommentQuery    commentQuery   = new CommentQuery()
                {
                    PageNo   = 1,
                    PageSize = 2147483647,
                    IsReply  = new bool?(false),
                    ShopID   = base.CurrentSellerManager.ShopId
                };
                int total = commentService.GetComments(commentQuery).Total;
                homeModel.OrderReplyComments      = total.ToString();
                homeModel.OrderHandlingComplaints = homeModel.SellerConsoleModel.Complaints.ToString();

                homeModel.OrderWithRefund          = homeModel.SellerConsoleModel.RefundTrades.ToString();
                homeModel.OrderWithRefundAndRGoods = homeModel.SellerConsoleModel.RefundAndRGoodsTrades.ToString();

                homeModel.ProductsEvaluation = homeModel.SellerConsoleModel.ProductComments.ToString();
                int num = (
                    from c in ServiceHelper.Create <IBrandService>().GetShopBrandApplys(base.CurrentSellerManager.ShopId)
                    where c.AuditStatus == 1
                    select c).Count();
                homeModel.ProductsBrands = num.ToString();
                homeModel.ProductsOnSale = homeModel.SellerConsoleModel.OnSaleProducts.ToString();
                IProductService productService = ServiceHelper.Create <IProductService>();
                ProductQuery    productQuery   = new ProductQuery()
                {
                    PageNo     = 1,
                    PageSize   = 2147483647,
                    ShopId     = new long?(base.CurrentSellerManager.ShopId),
                    SaleStatus = new ProductInfo.ProductSaleStatus?(ProductInfo.ProductSaleStatus.InDraft)
                };
                int total1 = productService.GetProducts(productQuery).Total;
                homeModel.ProductsInDraft           = total1.ToString();
                homeModel.ProductsWaitForAuditing   = homeModel.SellerConsoleModel.WaitForAuditingProducts.ToString();
                homeModel.ProductsAuditFailed       = homeModel.SellerConsoleModel.AuditFailureProducts.ToString();
                homeModel.ProductsInfractionSaleOff = homeModel.SellerConsoleModel.InfractionSaleOffProducts.ToString();
                homeModel.ProductsInStock           = homeModel.SellerConsoleModel.InStockProducts.ToString();
                DateTime            date          = DateTime.Now.AddDays(-1).Date;
                DateTime            dateTime      = date.AddDays(1).AddMilliseconds(-1);
                ShopInfo.ShopVistis shopVistiInfo = ServiceHelper.Create <IShopService>().GetShopVistiInfo(date, dateTime, base.CurrentSellerManager.ShopId);
                List <EchartsData>  echartsDatas  = new List <EchartsData>();
                if (shopVistiInfo == null)
                {
                    string str1 = (new decimal(0)).ToString();
                    ViewBag.VistiCounts = str1;
                    ViewBag.OrderCounts = str1;
                    ViewBag.SaleAmounts = str1;
                }
                else
                {
                    ViewBag.VistiCounts = shopVistiInfo.VistiCounts;
                    ViewBag.OrderCounts = shopVistiInfo.OrderCounts;
                    ViewBag.SaleAmounts = shopVistiInfo.SaleAmounts;
                }
            }
            return(View(homeModel));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 同意退货
        /// </summary>
        /// <param name="thnum">退货单号</param>
        /// <param name="orderid">订单号</param>
        /// <returns></returns>
        public JsonResult THTY(string thnum, string orderid)
        {
            if (string.IsNullOrWhiteSpace(thnum))
            {
                return(Json("no"));
            }
            TH th = ServiceHelper.Create <ITHService>().GetTHInfo(thnum);

            if (th == null)
            {
                return(Json("no"));
            }
            th.TH_Status = 6;
            if (ServiceHelper.Create <ITHService>().UpdateTH(th))
            {
                Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"]));
                if (fwinfo == null)
                {
                    return(Json("no"));
                }
                //更新供应商的锁定金额 减去退款金额
                fwinfo.Wallet_UserMoneyLock = fwinfo.Wallet_UserMoneyLock - th.TH_ProductMoneyReal;
                if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo))
                {
                    #region 添加退款信息
                    OrderInfo      oinfo  = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(orderid));
                    Finance_Refund frinfo = new Finance_Refund();
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    long frid = _orderBO.GenerateOrderNumber();
                    frinfo.Refund_Number     = frid;
                    frinfo.Refund_OrderNum   = long.Parse(thnum);
                    frinfo.Refund_UserId     = base.CurrentUser.Id;
                    frinfo.Refund_UserType   = base.CurrentUser.UserType;
                    frinfo.Refund_UserName   = base.CurrentUser.UserName;
                    frinfo.Refund_ToUserId   = oinfo.UserId;
                    frinfo.Refund_ToUserType = 3;
                    frinfo.Refund_ToUserName = oinfo.UserName;
                    frinfo.Refund_Money      = th.TH_ProductMoneyReal;
                    frinfo.Refund_MoneyType  = th.TH_ProductMoneyType;
                    frinfo.Refund_SXMoney    = 0;
                    frinfo.Refund_ISChujing  = 0;
                    frinfo.Refund_Address    = ChemCloud.Core.Common.GetIpAddress();
                    frinfo.Refund_Time       = DateTime.Now;
                    frinfo.Refund_Status     = 1;
                    if (ServiceHelper.Create <IFinance_RefundService>().AddFinance_Refund(frinfo))
                    {
                        //更新采购商的可用余额  返还退款金额
                        Finance_Wallet fwuinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(oinfo.UserId, 3, int.Parse(oinfo.CoinType.ToString()));
                        fwuinfo.Wallet_UserLeftMoney = fwuinfo.Wallet_UserLeftMoney + th.TH_ProductMoneyReal;
                        if (ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwuinfo))
                        {
                            //更新订单状态 已退货
                            ServiceHelper.Create <IOrderService>().UpdateOrderStatu(long.Parse(orderid), 9);
                            return(Json("yes"));
                        }
                        else
                        {
                            return(Json("no"));
                        }
                    }
                    else
                    {
                        return(Json("no"));
                    }
                    #endregion
                }
                else
                {
                    return(Json("no"));
                }
            }
            else
            {
                return(Json("no"));
            }
        }
Ejemplo n.º 14
0
        /*审核退货单*/
        public JsonResult CheckTH(long id)
        {
            Result res = new Result();

            try
            {
                /*1、转账*/
                TH tk = ServiceHelper.Create <ITHService>().GetTHByOrderNum(id);

                if (tk != null)
                {
                    long    buyid    = tk.TH_UserId;
                    long    sellid   = tk.TH_ToUserId;
                    decimal tkamount = tk.TH_ProductMoney;

                    /* 获取转账方的用户id和用户类型 供应商2*/
                    Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(sellid, 2, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
                    fwinfo.Wallet_UserLeftMoney = fwinfo.Wallet_UserLeftMoney - tkamount;//获取当前用的可用金额

                    /* 获取转账接受方的用户id和用户类型 采购商3*/
                    Finance_Wallet fwinfoto = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(buyid, 3, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
                    fwinfoto.Wallet_UserLeftMoney = fwinfoto.Wallet_UserLeftMoney + tkamount;//获取当前用的可用金额

                    /*添加财务转账信息*/
                    Finance_Transfer ftinfo = new Finance_Transfer();
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    ftinfo.Trans_Number     = _orderBO.GenerateOrderNumber();/*创建转账单号*/
                    ftinfo.Trans_UserId     = sellid;
                    ftinfo.Trans_UserType   = 2;
                    ftinfo.Trans_Money      = tkamount;
                    ftinfo.Trans_SXMoney    = 0;
                    ftinfo.Trans_MoneyType  = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                    ftinfo.Trans_Time       = DateTime.Now;
                    ftinfo.Trans_Address    = ChemCloud.Core.Common.GetIpAddress();
                    ftinfo.Trans_ToUserId   = buyid;
                    ftinfo.Trans_ToUserType = 3;
                    ftinfo.Trans_Status     = 1;

                    ServiceHelper.Create <IFinance_TransferService>().AddFinance_Transfer(ftinfo);
                    ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo);
                    ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfoto);


                    //添加财务退款信息
                    Finance_Refund frinfo = new Finance_Refund();
                    frinfo.Refund_Number     = _orderBO.GenerateOrderNumber();//创建退款单号
                    frinfo.Refund_OrderNum   = id;
                    frinfo.Refund_UserId     = sellid;
                    frinfo.Refund_UserType   = 2;
                    frinfo.Refund_UserName   = ServiceHelper.Create <IMemberService>().GetMember(sellid).UserName == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(sellid).UserName;
                    frinfo.Refund_Money      = tkamount;
                    frinfo.Refund_MoneyType  = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
                    frinfo.Refund_SXMoney    = 0;
                    frinfo.Refund_ISChujing  = 0;
                    frinfo.Refund_Address    = ChemCloud.Core.Common.GetIpAddress();
                    frinfo.Refund_Time       = tk.TH_Time;
                    frinfo.Refund_Status     = 1;
                    frinfo.Refund_ToUserId   = buyid;
                    frinfo.Refund_ToUserType = 3;
                    frinfo.Refund_ToUserName = ServiceHelper.Create <IMemberService>().GetMember(buyid).UserName == null ? "" : ServiceHelper.Create <IMemberService>().GetMember(buyid).UserName;

                    ServiceHelper.Create <IFinance_RefundService>().AddFinance_Refund(frinfo);



                    /*2、更改退货单的状态 为已完成*/
                    ServiceHelper.Create <ITHService>().UpdateTHStatus(id, 6);

                    /*3更改订单的状态 单状态为已退货*/
                    ServiceHelper.Create <IOrderService>().UpdateOrderStatu(id, 9);

                    res.success = true;
                }
                else
                {
                    res.success = false;
                }
            }
            catch (Exception)
            {
                res.success = false;
            }

            return(Json(res));
        }
Ejemplo n.º 15
0
        /*采购商退货*/
        public JsonResult InsertTH(long OrderNo, string Reson, string Amont, string Introduce, string images, string Attitude)
        {
            Result res = new Result();

            try
            {
                OrderInfo order = ServiceHelper.Create <IOrderService>().GetOrder(Convert.ToInt64(OrderNo));

                TH   thq  = ServiceHelper.Create <ITHService>().GetTHByOrderNum(OrderNo);
                long TKid = 0;
                if (thq == null)
                {
                    OrderInfo     oinfo   = ServiceHelper.Create <IOrderService>().GetOrder(OrderNo);
                    OrderItemInfo oiiinfo = ServiceHelper.Create <IOrderService>().GetOrderItemInfo(OrderNo);
                    if (oiiinfo == null || oinfo == null)
                    {
                        res.success = false;
                    }
                    ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                    TH  th       = new TH();
                    var newmoney = oinfo.OrderTotalAmount - (oinfo.Freight + oinfo.Insurancefee + oinfo.Transactionfee + oinfo.Counterfee);
                    th.TH_Number           = _orderBO.GenerateOrderNumber();
                    th.TH_OrderNum         = OrderNo;
                    th.TH_Time             = DateTime.Now;
                    th.TH_UserId           = base.CurrentUser.Id;
                    th.TH_UserName         = base.CurrentUser.UserName;
                    th.TH_UserType         = base.CurrentUser.UserType;
                    th.TH_ProductName      = oiiinfo.ProductName;
                    th.TH_ProductCount     = int.Parse(oiiinfo.Quantity.ToString());
                    th.TH_ProductMoney     = newmoney;
                    th.TH_ProductMoneyReal = newmoney;
                    th.TH_ProductMoneyType = int.Parse(ConfigurationManager.AppSettings["CoinType"]);
                    ManagerInfo    minfo  = ServiceHelper.Create <IManagerService>().GetManagerInfoByShopId(oinfo.ShopId);
                    UserMemberInfo uminfo = ServiceHelper.Create <IMemberService>().GetMemberByName(minfo.UserName);
                    th.TH_ToUserId   = uminfo.Id;
                    th.TH_ToUserName = oinfo.ShopName;
                    th.TH_ToUserType = uminfo.UserType;
                    th.TH_Status     = 1;
                    th.TH_Reason     = Reson;

                    TKid = ServiceHelper.Create <ITHService>().AddTH(th);
                    if (TKid != 0)
                    {
                        oinfo.OrderStatus = ChemCloud.Model.OrderInfo.OrderOperateStatus.THing;
                        /*订单状态为 退货中*/
                        ServiceHelper.Create <IOrderService>().UpdateOrderStatu(OrderNo, 8);
                        /*2.添加退货日志*/
                        THMessageInfo tkm = new THMessageInfo()
                        {
                            MessageContent  = Introduce,
                            MessageDate     = DateTime.Now,
                            MessageAttitude = Convert.ToInt32(Attitude),
                            ReturnName      = base.CurrentUser.RealName,
                            UserId          = base.CurrentUser.Id,
                            THId            = TKid
                        };
                        long thmid = ServiceHelper.Create <ITHService>().InsertTHMessage(tkm);

                        /*3、退货凭证*/
                        string[]           imgs = images.Split(',');
                        List <THImageInfo> tkis = new List <THImageInfo>();
                        foreach (string item in imgs)
                        {
                            if (string.IsNullOrWhiteSpace(item))
                            {
                                continue;
                            }
                            THImageInfo tki = new THImageInfo()
                            {
                                THImage     = item,
                                THMessageId = thmid
                            };
                            tkis.Add(tki);
                        }
                        ServiceHelper.Create <ITHService>().InsertTHImage(tkis);

                        res.success = true;
                        res.msg     = "操作成功!";
                    }
                    else
                    {
                        res.success = false;
                        res.msg     = "操作失败!";
                    }
                }
                else
                {
                    TKid = thq.Id;

                    if (thq.TH_Status == 3)
                    {
                        /*更改退货订单为 退货申请中1  */
                        ServiceHelper.Create <ITHService>().UpdateTHStatus(thq.TH_OrderNum, 1);
                        /*订单状态为 退货中*/
                        ServiceHelper.Create <IOrderService>().UpdateOrderStatu(OrderNo, 8);
                    }

                    /*2.添加退货日志*/
                    THMessageInfo tkm = new THMessageInfo()
                    {
                        MessageContent  = Introduce,
                        MessageDate     = DateTime.Now,
                        MessageAttitude = Convert.ToInt32(Attitude),
                        ReturnName      = base.CurrentUser.RealName,
                        UserId          = base.CurrentUser.Id,
                        THId            = TKid
                    };
                    long thmid = ServiceHelper.Create <ITHService>().InsertTHMessage(tkm);

                    /*3、退货凭证*/
                    string[]           imgs = images.Split(',');
                    List <THImageInfo> tkis = new List <THImageInfo>();
                    foreach (string item in imgs)
                    {
                        if (string.IsNullOrWhiteSpace(item))
                        {
                            continue;
                        }
                        THImageInfo tki = new THImageInfo()
                        {
                            THImage     = item,
                            THMessageId = thmid
                        };
                        tkis.Add(tki);
                    }
                    ServiceHelper.Create <ITHService>().InsertTHImage(tkis);

                    res.success = true;
                    res.msg     = "操作成功!";
                }
            }
            catch (Exception)
            {
                res.success = false;
                res.msg     = "操作失败!";
            }
            return(Json(res));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 转账
        /// </summary>
        /// <param name="uname">转账接收方</param>
        /// <param name="zmoney">转账金额</param>
        /// <returns></returns>
        public JsonResult AddZZinfo(string uname, string zmoney)
        {
            #region 获取转账对方的用户id和用户类型
            int     touid   = 0;
            int     toutype = 0;
            string  strsql  = string.Format("select * from ChemCloud_Members where username='******'", uname);
            DataSet ds      = DbHelperSQL.Query(strsql.ToString());
            if (ds == null)
            {
                return(Json(""));
            }
            else
            {
                if (ds.Tables[0].Rows.Count == 1)
                {
                    touid   = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                    toutype = int.Parse(ds.Tables[0].Rows[0]["UserType"].ToString());
                }
                else
                {
                    return(Json(""));
                }
            }
            #endregion
            #region 转账方的财务信息
            Finance_Wallet fwinfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
            fwinfo.Wallet_UserLeftMoney = fwinfo.Wallet_UserLeftMoney - decimal.Parse(zmoney);//获取当前用的可用金额
            #endregion
            #region 转账对方的财务信息
            Finance_Wallet fwinfoto = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(touid, toutype, int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString()));
            fwinfoto.Wallet_UserLeftMoney = fwinfoto.Wallet_UserLeftMoney + decimal.Parse(zmoney);//获取当前用的可用金额
            #endregion
            #region 添加财务转账信息
            Finance_Transfer ftinfo = new Finance_Transfer();
            ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
            ftinfo.Trans_Number     = _orderBO.GenerateOrderNumber();//创建转账单号
            ftinfo.Trans_UserId     = base.CurrentUser.Id;
            ftinfo.Trans_UserType   = base.CurrentUser.UserType;
            ftinfo.Trans_Money      = decimal.Parse(zmoney);
            ftinfo.Trans_SXMoney    = 0;
            ftinfo.Trans_MoneyType  = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
            ftinfo.Trans_Time       = DateTime.Now;
            ftinfo.Trans_Address    = ChemCloud.Core.Common.GetIpAddress();
            ftinfo.Trans_ToUserId   = touid;
            ftinfo.Trans_ToUserType = toutype;
            ftinfo.Trans_Status     = 1;

            //对方账户金额转入信息
            Finance_InCome ftcome = new Finance_InCome();
            ftcome.InCome_Number    = _orderBO.GenerateOrderNumber();
            ftcome.InCome_UserId    = touid;
            ftcome.InCome_UserType  = toutype;
            ftcome.InCome_StartTime = DateTime.Now;
            ftcome.InCome_EndTime   = DateTime.Now.AddDays(int.Parse(ChemCloud.Web.Framework.ServiceHelper.Create <ChemCloud.IServices.IChemCloud_DictionariesService>().GetValueBYKey("PayoutTime")));
            ftcome.InCome_Money     = decimal.Parse(zmoney);
            ftcome.InCome_MoneyType = int.Parse(ConfigurationManager.AppSettings["CoinType"].ToString());
            ftcome.InCome_Address   = ChemCloud.Core.Common.GetIpAddress();
            ftcome.InCome_Type      = 2;/// 收入类型(1交易2转账3退款默认1)
            ftcome.InCome_Status    = 1;
            ftcome.InCome_OrderNum  = _orderBO.GenerateOrderNumber();
            #endregion
            if (ServiceHelper.Create <IFinance_InComeService>().AddFinance_InCome(ftcome) && ServiceHelper.Create <IFinance_TransferService>().AddFinance_Transfer(ftinfo) && ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfo) && ServiceHelper.Create <IFinance_WalletService>().UpdateFinance_Wallet(fwinfoto))
            {
                return(Json("ok"));
            }
            else
            {
                Log.Error("用户" + base.CurrentUser.Id + "在" + DateTime.Now + "时转账失败.");
                return(Json(""));
            }
        }
Ejemplo n.º 17
0
        //议价单转订单
        public void TransferOrder(long MargainBillId)
        {
            try
            {
                MargainBill margainbill = GetBillById(MargainBillId, 0);

                ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                long orderid = _orderBO.GenerateOrderNumber();

                ShippingAddressService _ShippingAddressService = new ShippingAddressService();
                ShippingAddressInfo    addressinfo             = _ShippingAddressService.GetUserShippingAddress(long.Parse(margainbill.DeliverAddress));

                ShopService _ShopService = new ShopService();
                string      shopname     = _ShopService.GetShopName(margainbill.ShopId);

                MemberService _MemberService = new MemberService();
                string        username       = _MemberService.GetMember(margainbill.MemberId).UserName;

                using (TransactionScope transactionScope = new TransactionScope())
                {
                    OrderInfo orderInfo = new OrderInfo();
                    orderInfo.Id                 = orderid;                    //订单号
                    orderInfo.ShopId             = margainbill.ShopId;         //供应商编号ChemCloud_Shops
                    orderInfo.ShopName           = shopname;
                    orderInfo.UserId             = margainbill.MemberId;       //采购商ChemCloud_Members
                    orderInfo.UserName           = username;
                    orderInfo.OrderDate          = DateTime.Now;               //订单日期
                    orderInfo.Address            = margainbill.DeliverAddress; //收获地址 shippingaddress 编号
                    orderInfo.ExpressCompanyName = margainbill.DeliverType;
                    orderInfo.Freight            = margainbill.DeliverCost;
                    orderInfo.ShippingDate       = margainbill.DeliverDate;
                    orderInfo.PaymentTypeName    = margainbill.PayMode;
                    orderInfo.ProductTotalAmount = margainbill.TotalAmount;
                    orderInfo.CoinType           = margainbill.CoinType;
                    orderInfo.ShipTo             = addressinfo.ShipTo;//收货人
                    orderInfo.TopRegionId        = int.Parse("1");
                    orderInfo.RegionId           = addressinfo.RegionId;
                    orderInfo.RegionFullName     = addressinfo.RegionFullName;

                    orderInfo.OrderStatus        = OrderInfo.OrderOperateStatus.WaitPay;
                    orderInfo.IsPrinted          = false;
                    orderInfo.RefundTotalAmount  = new decimal(0);
                    orderInfo.CommisTotalAmount  = new decimal(0);
                    orderInfo.RefundCommisAmount = new decimal(0);
                    orderInfo.Platform           = PlatformType.PC;
                    orderInfo.InvoiceType        = InvoiceType.OrdinaryInvoices;
                    orderInfo.InvoiceTitle       = "InvoiceTitle";
                    orderInfo.InvoiceContext     = "InvoiceContext";
                    orderInfo.DiscountAmount     = new decimal(0);
                    orderInfo.ActiveType         = OrderInfo.ActiveTypes.None;
                    orderInfo.IntegralDiscount   = new decimal(0);

                    context.OrderInfo.Add(orderInfo);
                    context.SaveChanges();

                    MargainBillDetail billdetail    = margainbill._MargainBillDetail.LastOrDefault();
                    OrderItemInfo     orderInfoitem = new OrderItemInfo();
                    orderInfoitem.OrderId        = orderid;
                    orderInfoitem.ShopId         = margainbill.ShopId;
                    orderInfoitem.ProductId      = billdetail.ProductId;
                    orderInfoitem.ProductName    = billdetail.ProductName;
                    orderInfoitem.Quantity       = billdetail.Num;
                    orderInfoitem.SalePrice      = billdetail.PurchasePrice;
                    orderInfoitem.ReturnQuantity = long.Parse("1");
                    orderInfoitem.CostPrice      = 0;

                    orderInfoitem.DiscountAmount = 0;
                    orderInfoitem.RealTotalPrice = 0;
                    orderInfoitem.RefundPrice    = 0;
                    orderInfoitem.CommisRate     = 0;
                    orderInfoitem.IsLimitBuy     = false;

                    context.OrderItemInfo.Add(orderInfoitem);
                    context.SaveChanges();

                    //下单成功 更改状态
                    margainbill.BillStatus = EnumBillStatus.BargainSucceed;
                    context.SaveChanges();

                    transactionScope.Complete();
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 加入购物车
        /// </summary>
        /// <param name="jsoncart"></param>
        public bool AddtoCart(string jsoncart, long memberid)
        {
            bool result = false;

            try
            {
                cartlist _catlist  = Newtonsoft.Json.JsonConvert.DeserializeObject <cartlist>(jsoncart);
                long     shopid    = 0;
                long     productid = 0;
                if (_catlist != null)
                {
                    shopid    = _catlist.shopid;
                    productid = _catlist.productid;
                    if (_catlist.cartproductlist.Count > 0)
                    {
                        foreach (cartproductlist _cartproductlist in _catlist.cartproductlist)
                        {
                            ShoppingCartItemInfo shoppingCartItemInfo =
                                context.ShoppingCartItemInfo_.FirstOrDefault(
                                    (ShoppingCartItemInfo item) => item.UserId == memberid &&
                                    item.ProductId == productid && item.PackingUnit.Equals(_cartproductlist.PackingUnit) && item.Purity.Equals(_cartproductlist.Purity) &&
                                    item.Quantity.Equals(_cartproductlist.Num) && item.ProductTotalAmount == _cartproductlist.PurchasePrice && item.CoinType.Equals(_cartproductlist.CoinType)
                                    );
                            if (shoppingCartItemInfo != null)
                            {
                                ShoppingCartItemInfo quantity = shoppingCartItemInfo;
                                quantity.Quantity           = quantity.Quantity + _cartproductlist.Num;
                                quantity.ProductTotalAmount = quantity.ProductTotalAmount + _cartproductlist.PurchasePrice;
                            }
                            else
                            {
                                ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                                long orderid = _orderBO.GenerateOrderNumber();

                                DbSet <ShoppingCartItemInfo> shoppingCartItemInfos = context.ShoppingCartItemInfo_;
                                ShoppingCartItemInfo         shoppingCartItemInfo1 = new ShoppingCartItemInfo()
                                {
                                    UserId             = memberid,
                                    ProductId          = productid,
                                    Quantity           = _cartproductlist.Num,
                                    AddTime            = DateTime.Now,
                                    PackingUnit        = _cartproductlist.PackingUnit,
                                    Purity             = _cartproductlist.Purity,
                                    ProductTotalAmount = _cartproductlist.PurchasePrice,
                                    CoinType           = _cartproductlist.CoinType,
                                    ShopId             = shopid,
                                    SpecLevel          = _cartproductlist.SpecLevel,
                                    ExpressCompanyName = "0",
                                    Freight            = 0,
                                    ShippingDate       = DateTime.Now,
                                    RegionId           = 0,
                                    ShippingAddress    = "",
                                    PaymentTypeName    = "",
                                    Insurancefee       = 0,
                                    CartNo             = orderid,
                                    InvoiceType        = 0,
                                    InvoiceTitle       = "",
                                    InvoiceContext     = ""
                                };
                                shoppingCartItemInfos.Add(shoppingCartItemInfo1);
                            }
                            context.SaveChanges();
                            result = true;
                        }
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 下单
        /// </summary>
        /// <param name="model"></param>
        public void SubmitOrder(MargainBill margainbill)
        {
            try
            {
                //订单号
                ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO();
                long orderid = _orderBO.GenerateOrderNumber();

                //收货信息
                ShippingAddressService _ShippingAddressService = new ShippingAddressService();
                ShippingAddressInfo    addressinfo             = _ShippingAddressService.GetUserShippingAddress(long.Parse(margainbill.RegionId.ToString()));

                //供应商
                ShopService _ShopService = new ShopService();
                string      shopname     = _ShopService.GetShopName(margainbill.ShopId);

                //会员
                MemberService _MemberService = new MemberService();
                string        username       = _MemberService.GetMember(margainbill.MemberId) == null ? "" : (_MemberService.GetMember(margainbill.MemberId).UserName == null ? "" : _MemberService.GetMember(margainbill.MemberId).UserName);

                using (TransactionScope transactionScope = new TransactionScope())
                {
                    OrderInfo orderInfo = new OrderInfo();
                    orderInfo.Id        = orderid;                          //订单号
                    orderInfo.ShopId    = margainbill.ShopId;               //供应商编号ChemCloud_Shops
                    orderInfo.ShopName  = shopname;
                    orderInfo.UserId    = margainbill.MemberId;             //采购商ChemCloud_Members
                    orderInfo.UserName  = username;
                    orderInfo.OrderDate = DateTime.Now;                     //订单日期

                    orderInfo.ExpressCompanyName = margainbill.DeliverType; //物流配送方式
                    orderInfo.Freight            = margainbill.DeliverCost; //运费
                    //orderInfo.ShippingDate = margainbill.DeliverDate; //发货日期

                    orderInfo.PaymentTypeName = margainbill.PayMode;        //支付方式

                    orderInfo.ProductTotalAmount = margainbill.TotalAmount; //产品金额
                    orderInfo.CoinType           = margainbill.CoinType;    //货币种类

                    orderInfo.ShipTo         = addressinfo.ShipTo;          //收货人
                    orderInfo.TopRegionId    = addressinfo.RegionId;        //RegionId
                    orderInfo.RegionId       = addressinfo.RegionId;        //RegionId
                    orderInfo.RegionFullName = addressinfo.RegionFullName;  //省市区街道
                    orderInfo.Address        = addressinfo.Address;
                    orderInfo.CellPhone      = addressinfo.Phone;

                    orderInfo.OrderStatus        = OrderInfo.OrderOperateStatus.WaitPay;//订单
                    orderInfo.IsPrinted          = false;
                    orderInfo.RefundTotalAmount  = new decimal(0);
                    orderInfo.CommisTotalAmount  = new decimal(0);
                    orderInfo.RefundCommisAmount = new decimal(0);
                    orderInfo.Platform           = PlatformType.PC;

                    if (margainbill.InvoiceType == 0)
                    {
                        orderInfo.InvoiceType = InvoiceType.None;
                    }
                    else if (margainbill.InvoiceType == 1)
                    {
                        orderInfo.InvoiceType = InvoiceType.VATInvoice;
                    }
                    else if (margainbill.InvoiceType == 2)
                    {
                        orderInfo.InvoiceType = InvoiceType.OrdinaryInvoices;
                    }
                    orderInfo.InvoiceTitle   = margainbill.InvoiceTitle;
                    orderInfo.InvoiceContext = margainbill.InvoiceContext;

                    orderInfo.DiscountAmount   = new decimal(0);
                    orderInfo.ActiveType       = OrderInfo.ActiveTypes.None;
                    orderInfo.IntegralDiscount = new decimal(0);

                    orderInfo.IsInsurance    = margainbill.IsInsurance; //保险费
                    orderInfo.Insurancefee   = margainbill.Insurancefee;
                    orderInfo.Transactionfee = 0;                       //交易费
                    orderInfo.Counterfee     = 0;                       //手续费

                    context.OrderInfo.Add(orderInfo);
                    context.SaveChanges();

                    MargainBillDetail billdetail    = margainbill._MargainBillDetail.LastOrDefault();
                    OrderItemInfo     orderInfoitem = new OrderItemInfo();
                    orderInfoitem.OrderId        = orderid;
                    orderInfoitem.ShopId         = margainbill.ShopId;
                    orderInfoitem.ProductId      = billdetail.ProductId;
                    orderInfoitem.ProductName    = billdetail.ProductName;
                    orderInfoitem.Quantity       = billdetail.Num;
                    orderInfoitem.SalePrice      = billdetail.PurchasePrice;
                    orderInfoitem.PackingUnit    = billdetail.PackingUnit;
                    orderInfoitem.Purity         = billdetail.Purity;
                    orderInfoitem.SpecLevel      = billdetail.SpecLevel;
                    orderInfoitem.ReturnQuantity = long.Parse("1");
                    orderInfoitem.CostPrice      = 0;

                    orderInfoitem.DiscountAmount = 0;
                    orderInfoitem.RealTotalPrice = 0;
                    orderInfoitem.RefundPrice    = 0;
                    orderInfoitem.CommisRate     = 0;
                    orderInfoitem.IsLimitBuy     = false;

                    context.OrderItemInfo.Add(orderInfoitem);
                    context.SaveChanges();

                    //下单成功 更改状态
                    margainbill.BillStatus = EnumBillStatus.BargainSucceed;
                    context.SaveChanges();

                    transactionScope.Complete();
                }
            }
            catch (Exception)
            {
            }
        }