Пример #1
0
 /// <summary>
 /// 测试OrderAttribute
 /// </summary>
 /// <returns>新建的OrderAttribute对象</returns>
 public OrderAttribute OrderAttributeTest()
 {
     MemberOrganization oOrg = new MemberOrganization
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberOrganizations.Add(oOrg);
     MemberChannel oChannel = new MemberChannel
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberChannels.Add(oChannel);
     GeneralResource oGeneralResource = new GeneralResource { };
     MemberRole oRole = new MemberRole
     {
         Organization = oOrg,
         Code = GetRandCode(),
         Name = oGeneralResource
     };
     oLiveEntities.MemberRoles.Add(oRole);
     MemberUser oUser = new MemberUser
     {
         Organization = oOrg,
         Role = oRole,
         Channel = oChannel,
         LoginName = GetRandCode(),
         Passcode = GetRandCode(),
         SaltKey = "88888888"
     };
     oLiveEntities.MemberUsers.Add(oUser);
     OrderInformation oOrderInformation = new OrderInformation
     {
         Organization = oOrg,
         Channel = oChannel,
         User = oUser,
         Code = GetRandCode()
     };
     oLiveEntities.OrderInformations.Add(oOrderInformation);
     GeneralOptional oOptional = new GeneralOptional
     {
         Organization = oOrg,
         Code = GetRandCode()
     };
     oLiveEntities.GeneralOptionals.Add(oOptional);
     OrderAttribute oAttribute = new OrderAttribute
     {
         Order = oOrderInformation,
         Optional = oOptional
     };
     oLiveEntities.OrderAttributes.Add(oAttribute);
     oLiveEntities.SaveChanges();
     return oAttribute;
 }
Пример #2
0
 /// <summary>
 /// 根据订单更新库存总帐
 /// </summary>
 /// <param name="order"></param>
 public void InventoryByOrder(OrderInformation order)
 {
     List<OrderItem> oGoods = dbEntity.OrderItems.Where(p => p.Deleted == false&&p.OrderID==order.Gid).ToList();
     foreach (OrderItem item in oGoods)
     {
         warehouseBll.InventoryByWarehouseSku((Guid)order.WhID, item.SkuID);
     }
 }
Пример #3
0
 public StockInBill(WarehouseStockIn oStockIn, OrderInformation oOrder, List<StockInSku> oStockInSkus,PurchaseInformation oPurchase, List<StockInSkuAndPurchase> oInSkuAndPurchase)
 {
     this.oStockIn = oStockIn;
     this.oOrder = oOrder;
     this.oStockInSkus = oStockInSkus;
     this.oPurchase = oPurchase;
     this.oInSkuAndPurchase = oInSkuAndPurchase;
 }
Пример #4
0
        /// <summary>
        /// 从淘宝中间表生成系统订单
        /// </summary>
        /// <param name="organ"></param>
        /// <param name="channel"></param>
        /// <see cref=""/>
        /// <returns>0转换成功,数值表示失败计数</returns>
        public int GenerateOrderFromTaobao(MemberOrganization organ, MemberChannel channel)
        {
            string strUserPrefix = Utility.ConfigHelper.GlobalConst.GetSetting("TaobaoUserPrefix");
            int nFailCount = 0;       // 转换失败计数器
            string strFailTids = "";
            var oTbOrders = (from o in dbEntity.ExTaobaoOrders.Include("TaobaoOrderItems")
                             where o.Transfered == false && o.status == "WAIT_SELLER_SEND_GOODS"
                                   && o.OrgID == organ.Gid && o.ChlID == channel.Gid
                             select o).ToList();
            foreach (var oTrade in oTbOrders)
            {
                try
                {
                    // 创建数据库事务
                    using (var scope = new TransactionScope())
                    {
                        string strTid = oTrade.tid.ToString();
                        var oOrder = (from o in dbEntity.OrderInformations
                                      where o.OrgID == organ.Gid && o.ChlID == channel.Gid
                                            && o.LinkCode == strTid
                                      select o).FirstOrDefault();
                        bool bSuccess = false;
                        if (oOrder == null)
                        {
                            // 查询和新建用户
                            string strLoginName = strUserPrefix + oTrade.buyer_nick;
                            var oUser = (from u in dbEntity.MemberUsers
                                         where u.LoginName == strLoginName
                                         select u).FirstOrDefault();
                            if (oUser == null)
                            {
                                oUser = new MemberUser
                                {
                                    Organization = organ,
                                    Role = dbEntity.MemberRoles.Where(r => r.OrgID == organ.Gid && r.Code == "Public").FirstOrDefault(),
                                    Channel = channel,
                                    LoginName = strLoginName,
                                    Ustatus = (byte)ModelEnum.UserStatus.VALID,
                                    NickName = oTrade.buyer_nick,
                                    DisplayName = oTrade.buyer_nick,
                                    Passcode = String.IsNullOrEmpty(oTrade.receiver_mobile) ? oTrade.receiver_phone : oTrade.receiver_mobile,
                                    Culture = dbEntity.GeneralCultureUnits.Where(c => c.Culture == 2052).FirstOrDefault(),
                                    Email = oTrade.buyer_email
                                };
                            }

                            // 匹配地区
                            var oLocation = (from r in dbEntity.GeneralRegions
                                             where r.Code == "CHN"       // 中国
                                             select r).FirstOrDefault();
                            var oProvince = (from r in dbEntity.GeneralRegions
                                             where r.Parent.Code == "CHN"
                                                   && (r.ShortName == oTrade.receiver_state || r.Map01 == oTrade.receiver_state)
                                             select r).FirstOrDefault();
                            if (oProvince != null)
                            {
                                oLocation = oProvince;                   // 匹配到省
                                var oCity = (from r in dbEntity.GeneralRegions
                                             where r.aParent == oProvince.Gid
                                                   && (r.ShortName == oTrade.receiver_city || r.Map01 == oTrade.receiver_city)
                                             select r).FirstOrDefault();
                                if (oCity != null)
                                {
                                    oLocation = oCity;                   // 匹配到市
                                    var oDistrict = (from r in dbEntity.GeneralRegions
                                                     where r.aParent == oCity.Gid
                                                           && (r.ShortName == oTrade.receiver_district || r.Map01 == oTrade.receiver_district)
                                                     select r).FirstOrDefault();
                                    if (oDistrict != null)
                                        oLocation = oDistrict;           // 匹配到区
                                }
                            }

                            // 支付方式 -- 支付宝
                            var oPayType = (from p in dbEntity.FinancePayTypes
                                            where p.Deleted == false && p.OrgID == organ.Gid && p.Code == "alipay"
                                            select p).FirstOrDefault();
                            // 货币 -- 人民币
                            var oCurrency = (from u in dbEntity.GeneralMeasureUnits
                                             where u.Deleted == false && u.Code == "¥"
                                                   && u.Utype == (byte)ModelEnum.MeasureUnit.CURRENCY
                                             select u).FirstOrDefault();

                            // 创建订单主表
                            oOrder = new OrderInformation
                            {
                                Organization = organ,
                                Channel = channel,
                                User = oUser,
                                LinkCode = strTid,
                                Ostatus = (byte)ModelEnum.OrderStatus.NONE,
                                TransType = (oTrade.type == "cod") ? (byte)ModelEnum.TransType.COD : (byte)ModelEnum.TransType.SECURED,
                                PayType = oPayType,
                                PayNote = oTrade.alipay_no,
                                // Pieces = oTrade.num,

                                Currency = oCurrency,
                                SaleAmount = Decimal.Parse(oTrade.total_fee),
                                // ExecuteAmount = Decimal.Parse(oTrade.payment) - Decimal.Parse(oTrade.post_fee),
                                ShippingFee = Decimal.Parse(oTrade.post_fee),
                                MoneyPaid = Decimal.Parse(oTrade.payment),
                                // Differ = 0,

                                PaidTime = new DateTimeOffset(oTrade.pay_time.Value, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)),
                                Consignee = oTrade.receiver_name,
                                Location = oLocation,
                                FullAddress = oTrade.receiver_state + oTrade.receiver_city + oTrade.receiver_district + oTrade.receiver_address,
                                PostCode = oTrade.receiver_zip,
                                Telephone = oTrade.receiver_phone,
                                Mobile = oTrade.receiver_mobile,
                                Email = oTrade.buyer_email,
                                PostComment = oTrade.buyer_memo,
                                LeaveWord = oTrade.seller_memo
                            };

                            // 子订单实付金额。精确到2位小数,单位:元。如:200.07,表示:200元7分。计算公式如下:payment = price * num + adjust_fee - discount_fee + post_fee
                            // (邮费,单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费);
                            // 对于退款成功的子订单,由于主订单的优惠分摊金额,会造成该字段可能不为0.00元。建议使用退款前的实付金额减去退款单中的实际退款金额计算。
                            bool bSingleProduct = (oTrade.TaobaoOrderItems.Count() == 1);
                            decimal nTotalQty = 0m;      // 商品总数量,标准计量单位
                            decimal nItemAmount = 0m;    // 商品总金额

                            // 创建订单从表
                            foreach (var item in oTrade.TaobaoOrderItems)
                            {
                                // 先找OnSale.Code确定是否为pu-parts模式,SKU号对应不上时,必须判断转换失败
                                var oParts = (from s in dbEntity.ProductOnSales.Include("Product")
                                              where s.Deleted == false
                                                    && s.OrgID == organ.Gid && s.ChlID == channel.Gid
                                                    && s.Code == item.outer_sku_id
                                                    && s.Mode == (byte)ModelEnum.ProductMode.PU_PARTS
                                              orderby s.Ostatus descending
                                              select s).FirstOrDefault();
                                if (oParts == null)
                                {
                                    // PU-SKU 模式,只导入一个OnItem加入订单
                                    var oOnSku = (from s in dbEntity.ProductOnItems.Include("SkuItem").Include("OnSale")
                                                  where s.OnSale.Deleted == false && s.Deleted == false
                                                        && s.OnSale.Mode == (byte)ModelEnum.ProductMode.PU_SKU
                                                        && s.OnSale.OrgID == organ.Gid
                                                        && s.OnSale.ChlID == channel.Gid
                                                        && s.SkuItem.Code == item.outer_sku_id
                                                  orderby s.OnSale.Ostatus descending, s.OnSale.CreateTime descending
                                                  select s).FirstOrDefault();
                                    var oOnPrice = (from p in dbEntity.ProductOnUnitPrices.Include("MarketPrice").Include("SalePrice")
                                                    where p.Deleted == false
                                                          && p.OnSkuID == oOnSku.Gid       // oOnSku空,则直接到catch记录错误
                                                    orderby p.IsDefault descending, p.CreateTime descending
                                                    select p).FirstOrDefault();
                                    // 计量单位转换,进位法
                                    decimal nQuantity = Decimal.Parse(item.num.ToString());
                                    decimal nPercent = Decimal.Parse("1" + new string('0', oOnPrice.Percision));
                                    nQuantity = Math.Ceiling(nQuantity * oOnPrice.UnitRatio * nPercent) / nPercent;
                                    decimal nPayment = Decimal.Parse(item.payment);
                                    // 单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费
                                    if (bSingleProduct) nPayment -= oOrder.ShippingFee;
                                    OrderItem oOrderItem = new OrderItem
                                    {
                                        OnSkuItem = oOnSku,
                                        SkuItem = oOnSku.SkuItem,
                                        Name = item.title,
                                        Quantity = nQuantity,
                                        MarketPrice = oOnPrice.MarketPrice.GetResource(oOrder.Currency.Gid),
                                        SalePrice = oOnPrice.SalePrice.GetResource(oOrder.Currency.Gid),
                                        ExecutePrice = Math.Round(nPayment / nQuantity, 2),
                                        Remark = String.Format("淘宝:{0} | {1} | {2} | {3}", item.num, item.payment, item.discount_fee, item.adjust_fee)
                                    };
                                    // 统计与误差计算
                                    nTotalQty += nQuantity;
                                    nItemAmount += oOrderItem.ExecutePrice * nQuantity;
                                    oOrder.OrderItems.Add(oOrderItem);
                                }
                                else
                                {
                                    // PU-Parts模式,需要将所有OnItem加入订单,只第一个商品有价格,其他商品价格为零
                                    var oPartItems = (from i in dbEntity.ProductOnItems.Include("SkuItem").Include("OnSale")
                                                      where i.Deleted == false
                                                            && i.OnSaleID == oParts.Gid
                                                      select i).ToList();
                                    bool bIsFirst = true;
                                    decimal nQuantity = Decimal.Parse(item.num.ToString());
                                    decimal nPayment = Decimal.Parse(item.payment);
                                    // 单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费
                                    if (bSingleProduct) nPayment -= oOrder.ShippingFee;
                                    foreach (var oOnSku in oPartItems)
                                    {
                                        var oOnPrice = (from p in dbEntity.ProductOnUnitPrices.Include("MarketPrice").Include("SalePrice")
                                                        where p.Deleted == false && p.OnSkuID == oOnSku.Gid  // oOnSku空,则直接到catch记录错误
                                                        orderby p.IsDefault descending
                                                        select p).FirstOrDefault();
                                        // decimal nItemQty = oOnSku.SetQuantity * nQuantity;          // 不使用套装数量,使用转换算法
                                        // 计量单位转换,进位法
                                        decimal nPercent = Decimal.Parse("1" + new string('0', oOnPrice.Percision));
                                        decimal nItemQty = Math.Ceiling(nQuantity * oOnPrice.UnitRatio * nPercent) / nPercent;
                                        OrderItem oOrderItem = new OrderItem
                                        {
                                            OnSkuItem = oOnSku,
                                            SkuItem = oOnSku.SkuItem,
                                            Name = oOnSku.FullName.GetResource(2052),
                                            Quantity = nItemQty,
                                            MarketPrice = oOnPrice.MarketPrice.GetResource(oOrder.Currency.Gid),
                                            SalePrice = oOnPrice.SalePrice.GetResource(oOrder.Currency.Gid),
                                            ExecutePrice = (bIsFirst) ? Math.Round(nPayment / nItemQty, 2) : 0m,  // 第一个商品有价格,其他商品没有价格
                                            Remark = String.Format("淘宝:{0} | {1} | {2} | {3} | {4}", item.title, item.num, item.payment, item.discount_fee, item.adjust_fee)
                                        };
                                        // 统计与误差计算
                                        nTotalQty += nItemQty;
                                        nItemAmount += oOrderItem.ExecutePrice * nItemQty;
                                        oOrder.OrderItems.Add(oOrderItem);
                                        bIsFirst = false;
                                    }
                                }
                            }
                            oOrder.Pieces = nTotalQty;
                            oOrder.ExecuteAmount = nItemAmount;
                            oOrder.Differ = oOrder.MoneyPaid - oOrder.ShippingFee - nItemAmount;  // 误差
                            dbEntity.OrderInformations.Add(oOrder);
                            dbEntity.SaveChanges();

                            // 更新淘宝订单转换成功状态
                            oTrade.OrderID = oOrder.Gid;
                            oTrade.Transfered = true;
                            dbEntity.SaveChanges();

                            // 创建已收款记录
                            FinancePayment oFinance = new FinancePayment
                            {
                                Organization = organ,
                                PayTo = (byte)ModelEnum.PayDirection.TO_CORPBANK,
                                Pstatus = (byte)ModelEnum.PayStatus.PAID,
                                RefType = (byte)ModelEnum.NoteType.ORDER,
                                RefID = oOrder.Gid,
                                Reason = String.Format("支付宝:{0}", oTrade.alipay_no),
                                PayDate = new DateTimeOffset(oTrade.pay_time.Value, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)),
                                Currency = oOrder.Currency,
                                Amount = oOrder.MoneyPaid,
                                Remark = String.Format("淘宝订单:{0}", oTrade.tid)
                            };
                            dbEntity.FinancePayments.Add(oFinance);

                            // 索取发票
                            if (!String.IsNullOrEmpty(oTrade.invoice_name))
                            {
                                FinanceInvoice oInvoice = new FinanceInvoice
                                {
                                    OrderInfo = oOrder,
                                    Code = oOrder.Gid.ToString("N"),
                                    Title = oTrade.invoice_name,
                                    Amount = oOrder.MoneyPaid
                                };
                                dbEntity.FinanceInvoices.Add(oInvoice);
                            }
                            dbEntity.SaveChanges();
                            bSuccess = true;
                        }
                        else
                        {
                            // TODO Warning

                            nFailCount++;
                            strFailTids += String.Format("{0},", oTrade.tid);
                        }
                        scope.Complete();
                        if (bSuccess)
                        {
                            oEventBLL.WriteEvent(String.Format("淘宝订单转换成功: {0}, {1}", oOrder.Code, oTrade.tid),
                                ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.ORDER, this.ToString());
                        }
                    }
                }
                catch
                {
                    nFailCount++;
                    strFailTids += String.Format("{0},", oTrade.tid);
                }
            }
            if (nFailCount > 0)
            {
                oEventBLL.WriteEvent(String.Format("淘宝订单转换失败: {0}", strFailTids),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.ORDER, this.ToString());
            }
            return nFailCount;
        }
Пример #5
0
 /// <summary>
 /// 复制采购单成老版本
 /// </summary>
 public OrderHistory(OrderInformation oOrder)
 {
     // TODO
 }
Пример #6
0
        public void OrderItemTest()
        {
            ProductOnItem oSku = ProductOnItemTest();
            GeneralResource res = new GeneralResource
            {
            };
            oLiveEntities.GeneralResources.Add(res);

            MemberOrganization org = new MemberOrganization
            {
                Code = GetRandCode()
            };
            oLiveEntities.MemberOrganizations.Add(org);

            MemberRole role = new MemberRole
            {
                Name = res,
                Code = GetRandCode(),
                Organization = org
            };
            oLiveEntities.MemberRoles.Add(role);

            MemberChannel mChl = new MemberChannel
            {
                Code = GetRandCode()
            };
            oLiveEntities.MemberChannels.Add(mChl);

            MemberUser user = new MemberUser
            {
                Organization = org,
                Channel = mChl,
                Role = role,
                LoginName = "*****@*****.**",
                Passcode = "5425425425",
                SaltKey = "343134"
            };
            oLiveEntities.MemberUsers.Add(user);

            OrderInformation oInfo = new OrderInformation
            {
                Organization = org,
                Channel = mChl,
                Code = GetRandCode(),
                User = user
            };
            oLiveEntities.OrderInformations.Add(oInfo);
            oLiveEntities.SaveChanges();

            OrderItem oItem = new OrderItem
            {
                OnSkuID = oSku.Gid,
                Order = oInfo
            };
            oLiveEntities.OrderItems.Add(oItem);

            oLiveEntities.SaveChanges();
        }
Пример #7
0
        /// <summary>
        /// 修改订单状态
        /// </summary>
        /// <param name="nStatus">订单状态</param>
        /// <returns></returns>
        public string UpdateOrderStatus(int nStatus)
        {
            //根据传入的订单状态信息修改状态
            //订单状态包括 0待确认 1已确认 2已排单 3已发货 4已结算 5已取消
            //从已确认状态到已排单状态,需要自动生成未确认的出库单;从已排单到未排单的状态,则需要删除相应的出库单。
            //取消状态对应页面订单作废按钮
            string content;
            Guid stockOut;
            OrderInformation oNew = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
            //根据传入的订单确定值修改订单的状态
            switch (nStatus)
            {
                case 0:
                    oNew.Ostatus = (byte)ModelEnum.OrderStatus.NONE;
                    content = @LiveAzure.Resource.Common.OrderStatus.Split(',')[0];
                    break;
                case 1:
                    if (oNew.Ostatus == (byte)ModelEnum.OrderStatus.DELIVERIED)
                    {
                        content = "订单已发货,不能返回未排单";
                    }
                    else
                    {
                        if (oNew.Ostatus == (byte)ModelEnum.OrderStatus.ARRANGED)//判断是否从排单状态而来
                        {
                            oNew.Ostatus = (byte)ModelEnum.OrderStatus.CONFIRMED;
                            content = "订单未排单";
                            InventoryByOrder(oNew);
                            //做废出库单
                            DisableWarehouseStockOut(oNew);
                        }
                        else//订单从未确定状态而来
                        {
                            oNew.Ostatus = (byte)ModelEnum.OrderStatus.CONFIRMED;
                            oNew.ConfirmTime = DateTimeOffset.Now;
                            content = @LiveAzure.Resource.Common.OrderStatus.Split(',')[1];
                        }
                    }
                    break;
                case 2:
                    if (oNew.TransType == (byte)ModelEnum.TransType.CASH || oNew.TransType == (byte)ModelEnum.TransType.SECURED)//判断订单是否款到发货
                    {
                        if (!oNew.OrderAmount.Equals(0))
                        {
                            content = "订单未付款";
                            break;
                        }
                    }
                    //货到付款情况
                    int result = warehouseBll.GenerateStockOutFromOrder(oNew.Gid, oNew.UserID, out stockOut);
                    //int result = 0;
                    if (result.Equals(0))
                    {
                        oNew.Ostatus = (byte)ModelEnum.OrderStatus.ARRANGED;
                        oNew.ArrangeTime = DateTimeOffset.Now;
                        content = @LiveAzure.Resource.Common.OrderStatus.Split(',')[2];
                    }
                    else
                    {
                        content = "订单生成出库单失败:"+result.ToString();
                    }
                    break;
                case 4:
                    if (oNew.Ostatus == (byte)ModelEnum.OrderStatus.DELIVERIED && oNew.OrderAmount.Equals(0))
                    {
                        oNew.Ostatus = (byte)ModelEnum.OrderStatus.CLOSED;
                        oNew.ClosedTime = DateTimeOffset.Now;
                        content = @LiveAzure.Resource.Common.OrderStatus.Split(',')[4];
                    }
                    else
                    {
                        content = "未付款|未发货*订单结算失败";
                    }
                    break;
                case 5:
                    oNew.Ostatus = (byte)ModelEnum.OrderStatus.CANCELLED;

                    UpdateOrderHistory(oNew);
                    oNew.Deleted = true;
                    if (oNew.TotalPaid > 0)
                    {
                        RefundFromOrder(oNew);//生成退款单
                    }
                    if (oNew.Ostatus.Equals(3))
                    {
                        content = "退货";
                        ReturnedPurchase(oNew);//生成退货单
                    }
                    else
                    {
                        content = "订单取消";
                    }
                    break;
                default:
                    oNew.Ostatus = 6;
                    content = "操作错误-error";
                    break;
            }
            dbEntity.SaveChanges();
            oNewOrder = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
            string sStatus = oNewOrder.Locking.ToString() + oNewOrder.Hanged.ToString() + oNewOrder.Ostatus.ToString() + oNewOrder.PayStatus.ToString();
            string Status = OrderStatusSelect(sStatus, oNewOrder.TransType.ToString());
            //写操作日志
            oEventBLL.WriteOrderEvent(content, "", this.ToString(), false, oNewOrder.Gid, CurrentSession.UserID);
            //判断 取消-退货 状态转换
            CancelOrReturn();
            InventoryByOrder(oNew);//按SKU核算
            return Status;
        }
Пример #8
0
 /// <summary>
 /// 修改订单锁定状态
 /// </summary>
 /// <param name="bLocking">锁定状态</param>
 /// <returns></returns>
 public string UpdateOrderLocking(bool bLocking)
 {
     string content;
     string Status;
     //判断订单是否已被他人锁定
     OrderInformation oNewOther = dbEntity.OrderInformations.Where(p=>p.Gid==oNewOrder.Gid && p.LastModifiedBy!=oNewOrder.LastModifiedBy).FirstOrDefault();
     OrderInformation oNew = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     if (oNewOther != null)//订单被他人锁定
     {
         Status="2000";//返回初始状态
     }
     else  //订单未被他人锁定
     {
         //根据传入的订单锁定值修改订单的状态
         if (bLocking == true)
         {
             oNew.Locking = (byte)ModelEnum.LockStatus.LOCKED;
             content = @LiveAzure.Resource.Common.LockStatus.Split(',')[1];
         }
         else
         {
             oNew.Locking = (byte)ModelEnum.LockStatus.UNLOCK;
             content = @LiveAzure.Resource.Common.LockStatus.Split(',')[0];
         }
         dbEntity.SaveChanges();
         oNewOrder = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
         string sStatus = oNewOrder.Locking.ToString() + oNewOrder.Hanged.ToString() + oNewOrder.Ostatus.ToString() + oNewOrder.PayStatus.ToString();
         Status = OrderStatusSelect(sStatus, oNewOrder.TransType.ToString());
         //写操作日志
         oEventBLL.WriteOrderEvent(content, "", this.ToString(), false, oNewOrder.Gid,CurrentSession.UserID);
     }
     //判断 取消-退货 状态转换
     CancelOrReturn();
     return Status;
 }
Пример #9
0
 /// <summary>
 /// 生成退款
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public bool RefundFromOrder(OrderInformation order)
 {
     if (order.TotalPaid-order.MoneyPaid>0)
     {
         orderBll.ReturnMoney(order);
     }
     if (order.MoneyPaid > 0)
     {
         FinancePayment oFinancePayment = new FinancePayment
         {
             OrgID=order.OrgID,
             Ptype=(from gpc in dbEntity.GeneralPrivateCategorys
                   where gpc.Deleted.Equals(false) && gpc.Ctype==(byte)ModelEnum.PrivateCategoryType.PAY_TYPE
                   select gpc.Gid).FirstOrDefault(),
             PayTo=1,
             Pstatus=0,
             RefType=(byte)ModelEnum.NoteType.ORDER,
             RefID=order.Gid,
             Reason="退",
             Currency=order.Currency,
             Amount=order.MoneyPaid,
             Remark=order.Remark
         };
         dbEntity.FinancePayments.Add(oFinancePayment);
         dbEntity.SaveChanges();
     }
     return true;
 }
Пример #10
0
        /// <summary>
        /// 添加新订单
        /// </summary>
        /// <returns></returns>
        public ActionResult OrderWithoutUser()
        {
            oNewOrder = new OrderInformation();
            oNewOrder.OrgID = OrganizationGuidGeneralOrder;
            oNewOrder.ChlID = ChannelGuidGeneralOrder;
            oNewOrder.WhID = WarehouseGuidSelected;
            oNewOrder.DocVersion = 0;
            oNewOrder.LinkCode = "";
            oNewOrder.UserID = Guid.Empty;
            listNewOrderItem = new List<OrderItem>();//情况之前变量
            listNewOrderShipping = new List<OrderShipping>();//清空之前变量
            IsEditing = false;//添加状态

            return RedirectToAction("OrderAdd");
        }
Пример #11
0
        /// <summary>
        /// 做费出库单
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public bool DisableWarehouseStockOut(OrderInformation order)
        {
            WarehouseStockOut oWarehouseStockOut = dbEntity.WarehouseStockOuts.Where(p => p.Deleted.Equals(false) && p.RefID == oNewOrder.Gid).FirstOrDefault();
            dbEntity.SaveChanges();
            int result = warehouseBll.StockInDiscard(oWarehouseStockOut.Gid, CurrentSession.UserID);

            return true;
        }
Пример #12
0
        public ActionResult OrderConsignee(bool bSelectAddress, Guid? memberAddressGid)
        {
            OrderInformation oNewOrderInfo = new OrderInformation();

            if (bSelectAddress == true)
            {
                Guid addressGid = (Guid)memberAddressGid;
                MemberAddress oMemberAddress = dbEntity.MemberAddresses.Include("User").Include("Location").Where(p => p.Deleted == false && p.Gid == memberAddressGid).FirstOrDefault();

                if (oMemberAddress != null)
                {
                    oNewOrderInfo.Consignee = oMemberAddress.User.LastName + " " + oMemberAddress.User.FirstName;
                    oNewOrderInfo.Location = oMemberAddress.Location;
                    oNewOrderInfo.aLocation = oMemberAddress.aLocation;
                    oNewOrderInfo.FullAddress = oMemberAddress.FullAddress;
                    oNewOrderInfo.PostCode = oMemberAddress.PostCode;
                    oNewOrderInfo.Telephone = oMemberAddress.CellPhone;
                    oNewOrderInfo.Email = oMemberAddress.Email;
                }
            }

            return View(oNewOrderInfo);
        }
Пример #13
0
        /// <summary>
        /// 进入购物车结算界面,区分不同的组织
        /// </summary>
        /// <returns></returns>
        public ActionResult Cart(Guid? memberAddGid)
        {
            //清空相关的全局变量
            globalCouponList = new Dictionary<Guid, decimal>();
            //清空全局商品的总执行价格
            globalProductExacuteAmount = 0m;
            //清空全局订单商品的列表
            globalOrderItemList = new Dictionary<Guid, OrderItem>();
            //清空全局订单商品的数量
            globalOrderItemPieces = 0m;
            //需要判断是否需要新建订单
            oNewOrder = new OrderInformation();
            //承运商信息清空
            globalShipperGid = Guid.Empty;
            //将发票信息回复为默认
            bInvoiceOrNot = false;
            //默认不使用承运商(快递或物流)
            bUseShipper = false;

            List<MallCart> listMallCart = dbEntity.MallCarts.Include("Organization").Include("Channel").Include("OnSale").Include("OnSkuItem").Include("CartType").Where(p => p.OrgID == globalOrgGid && p.ChlID == LiveSession.channelID && p.UserID == LiveSession.userID && p.Deleted == false).ToList();
            if (listMallCart.Count > 0)
            {
                //收货人信息
                List<MemberAddress> oUserAddressList = dbEntity.MemberAddresses.Where(p => p.UserID == LiveSession.userID && p.Deleted == false).ToList();
                ViewBag.oAddressList = oUserAddressList;

                //交易类型信息
                List<SelectListItem> oTransList = new List<SelectListItem>();
                oTransList = GetSelectList(oNewOrder.TransTypeList);
                ViewBag.oTransList = oTransList;

                //支付信息
                List<FinancePayType> listPayment = new List<FinancePayType>();
                //取支付方式的交集
                for (int i = 0; i < listMallCart.Count; i++)
                {
                    for (int j = 0; j < listMallCart.ElementAt(i).OnSale.OnPayments.Count; j++)
                    {
                        if (!listPayment.Contains(listMallCart.ElementAt(i).OnSale.OnPayments.ElementAt(j).PayType))
                        {
                            listPayment.Add(listMallCart.ElementAt(i).OnSale.OnPayments.ElementAt(j).PayType);
                        }
                    }
                }
                ViewBag.oPaymentList = listPayment;
                //券和积分的信息
                List<MemberPoint> listMemberCoupon = dbEntity.MemberPoints.Include("Promotion").Include("Coupon").Include("Currency").Where(p => p.Ptype == (byte)ModelEnum.PointType.COUPON && p.aCurrency == globalCurrencyGid && p.UserID == LiveSession.userID && p.OrgID == globalOrgGid && p.Deleted == false && p.Pstatus != (byte)ModelEnum.PointStatus.NONE && p.StartTime <= DateTimeOffset.Now && p.EndTime >= DateTimeOffset.Now && p.Balance > 0 || p.Remain > 0).ToList();
                List<MemberPoint> listArriveCoupon = new List<MemberPoint>();
                foreach (var couponItem in listMemberCoupon)
                {
                    listArriveCoupon.Add(couponItem);
                }
                List<MemberPoint> listMemberPoint = dbEntity.MemberPoints.Include("Promotion").Include("Coupon").Include("Currency").Where(p => p.Ptype == (byte)ModelEnum.PointType.POINT && p.Deleted == false && p.Pstatus != (byte)ModelEnum.PointStatus.NONE).ToList();
                if (listMemberPoint != null)
                {
                    ViewBag.pointList = listMemberPoint;
                }
                if (listArriveCoupon != null)
                {
                    ViewBag.arriveCouponList = listArriveCoupon;
                }

                //物流信息
                //独立页面

                //发票信息
                //从GeneralOptional表中取得,下拉框
                GeneralOptional invoiceOption = dbEntity.GeneralOptionals.Include("OptionalItems").Where(p => p.Deleted == false && p.Otype == (byte)ModelEnum.OptionalType.ORDER && p.Code == "Invoice").FirstOrDefault();
                List<SelectListItem> listInvoiceItem = new List<SelectListItem>();
                if (invoiceOption != null)
                {
                    for (int i = 0; i < invoiceOption.OptionalItems.Count; i++)
                    {
                        listInvoiceItem.Add(new SelectListItem { Text = invoiceOption.OptionalItems.ElementAt(i).Name.GetResource(LiveSession.Culture), Value = invoiceOption.OptionalItems.ElementAt(i).Gid.ToString() });
                    }
                }
                ViewBag.invoiceList = listInvoiceItem;

                //订单备注

                //商品清单
                List<MallCartProduct> listMallProduct = new List<MallCartProduct>();
                for (int j = 0; j < listMallCart.Count; j++)
                {
                    Guid onSkuGid = listMallCart.ElementAt(j).OnSkuID;
                    ProductOnUnitPrice oUnitPrice = dbEntity.ProductOnUnitPrices.Include("OnSkuItem.OnSale").Include("ShowUnit").Include("MarketPrice").Include("SalePrice").Where(p => p.OnSkuID == onSkuGid && p.Deleted == false).OrderByDescending(p => p.IsDefault).OrderByDescending(p => p.CreateTime).FirstOrDefault();
                    MallCartProduct oMallCartProduct = new MallCartProduct();
                    oMallCartProduct.mallCartGid = listMallCart.ElementAt(j).Gid;
                    //转换前的数量
                    oMallCartProduct.productCount = listMallCart.ElementAt(j).SetQty;
                    //折扣,现在默认为1,不打折
                    oMallCartProduct.productDiscount = 1;
                    //套装模式
                    oMallCartProduct.productMode = (byte)listMallCart.ElementAt(j).OnSale.Mode;
                    //套装数量,默认计量单位的数量
                    oMallCartProduct.productSetCount = listMallCart.ElementAt(j).SetQty;
                    //标准计量单位下的数量
                    oMallCartProduct.productQuantity = listMallCart.ElementAt(j).Quantity;
                    //转换后的实际默认计量单位的数量
                    if (oUnitPrice.Percision == 0)
                    {
                        oUnitPrice.Percision = 1;
                    }
                    decimal nPercent = Decimal.Parse("1" + new string('0', oUnitPrice.Percision));
                    oMallCartProduct.productFactCount = Math.Ceiling(listMallCart.ElementAt(j).Quantity / oUnitPrice.UnitRatio * nPercent) / nPercent;
                    //商品信息
                    oMallCartProduct.productName = listMallCart.ElementAt(j).OnSkuItem.FullName.GetResource(LiveSession.Culture);
                    oMallCartProduct.productPicture = listMallCart.ElementAt(j).OnSkuItem.OnSale.Picture;
                    //价格以及价格总计,总计按照实际从标准单位转换回来的数量计算
                    oMallCartProduct.productPriceSum = oUnitPrice.SalePrice.GetResource(globalCurrencyGid) * oMallCartProduct.productFactCount;
                    oMallCartProduct.productSalePrice = oUnitPrice.SalePrice.GetResource(globalCurrencyGid);
                    //对应商品的计量单位
                    oMallCartProduct.defaultUnit = oUnitPrice.ShowUnit.Name.GetResource(LiveSession.Culture);
                    oMallCartProduct.standardUnit = oUnitPrice.OnSkuItem.SkuItem.StandardUnit.Name.GetResource(LiveSession.Culture);
                    listMallProduct.Add(oMallCartProduct);
                    globalProductExacuteAmount = globalProductExacuteAmount + oMallCartProduct.productPriceSum;
                    //生成订单商品列表
                    OrderItem oNewOrderItem = new OrderItem();
                    oNewOrderItem.OnSkuID = onSkuGid;
                    oNewOrderItem.SkuID = listMallCart.ElementAt(j).OnSkuItem.SkuItem.Gid;
                    oNewOrderItem.Name = listMallCart.ElementAt(j).OnSkuItem.FullName.GetResource(LiveSession.Culture);
                    //标准计量单位的数量
                    oNewOrderItem.Quantity = listMallCart.ElementAt(j).Quantity;
                    oNewOrderItem.MarketPrice = oUnitPrice.MarketPrice.GetResource(globalCurrencyGid);
                    oNewOrderItem.SalePrice = oUnitPrice.SalePrice.GetResource(globalCurrencyGid);
                    oNewOrderItem.ExecutePrice = oMallCartProduct.productPriceSum / listMallCart.ElementAt(j).Quantity;
                    globalOrderItemList.Add(listMallCart.ElementAt(j).Gid, oNewOrderItem);
                    globalOrderItemPieces = globalOrderItemPieces + listMallCart.ElementAt(j).Quantity;
                }

                ViewBag.oProductItemList = listMallProduct;

            }
            oNewOrder.OrgID = globalOrgGid;
            oNewOrder.ChlID = LiveSession.channelID;
            oNewOrder.UserID = (Guid)LiveSession.userID;

            ViewBag.nCulture = LiveSession.Culture;
            return View();
        }
Пример #14
0
        /// <summary>
        /// 用户确认订单
        /// </summary>
        /// <param name="formCollection"></param>
        /// <returns></returns>
        public string SaveNewOrder(FormCollection formCollection)
        {
            string strReturnInfo = "success";

            //检查收货人信息是否存在
            if (oNewOrder.aLocation == null || oNewOrder.aLocation.Equals(Guid.Empty))
            {
                strReturnInfo = "请选择收货人信息!";
                return strReturnInfo;
            }

            //检查承运商信息是否存在
            if (globalShipperGid == null || globalShipperGid.Equals(Guid.Empty))
            {
                strReturnInfo = "请选择承运商!";
                return strReturnInfo;
            }

            #region 提交订单的信息

            OrderInformation oConfirmOrder = new OrderInformation();
            //订单基本信息
            oConfirmOrder.OrgID = oNewOrder.OrgID;
            oConfirmOrder.ChlID = oNewOrder.ChlID;
            //计算出最佳仓库
            var bestWhID = dbEntity.Database.SqlQuery<Guid>("SELECT dbo.fn_FindBestWarehouse({0}, {1}, {2})", oNewOrder.OrgID, oNewOrder.ChlID, oNewOrder.aLocation).FirstOrDefault();
            oConfirmOrder.WhID = bestWhID;
            oConfirmOrder.UserID = oNewOrder.UserID;
            oConfirmOrder.DocVersion = 0;
            oConfirmOrder.aCurrency = globalCurrencyGid;
            //交易类型
            oConfirmOrder.TransType = byte.Parse(formCollection["TransType"]);
            //当前订单是货到付款,则不需要检查支付方式;否则检查用户是否选择支付方式
            if (oConfirmOrder.TransType != (byte)ModelEnum.TransType.COD)
            {
                if (oNewOrder.PayID == null)
                {
                    strReturnInfo = "请选择支付方式!";
                    return strReturnInfo;
                }
                else
                {
                    oConfirmOrder.PayID = oNewOrder.PayID;
                }
            }
            oConfirmOrder.Pieces = globalOrderItemPieces;
            //计算商品销售总价
            decimal salePriceSum = 0m;
            for (int i = 0; i < globalOrderItemList.Count; i++)
            {
                salePriceSum = salePriceSum + globalOrderItemList.ElementAt(i).Value.SalePrice * globalOrderItemList.ElementAt(i).Value.Quantity;
            }

            #region 订单价格信息

            oConfirmOrder.SaleAmount = salePriceSum;
            //设定订单执行价的总和
            oConfirmOrder.ExecuteAmount = globalProductExacuteAmount;
            oConfirmOrder.ShippingFee = oNewOrder.ShippingFee;
            oConfirmOrder.TaxFee = oNewOrder.TaxFee;
            oConfirmOrder.Insurance = oNewOrder.Insurance;
            oConfirmOrder.PaymentFee = oNewOrder.PaymentFee;
            oConfirmOrder.PackingFee = oNewOrder.PackingFee;
            oConfirmOrder.ResidenceFee = oNewOrder.ResidenceFee;
            oConfirmOrder.LiftGateFee = oNewOrder.LiftGateFee;
            oConfirmOrder.InstallFee = oNewOrder.InstallFee;
            oConfirmOrder.OtherFee = oNewOrder.OtherFee;
            oConfirmOrder.TotalFee = oNewOrder.TotalFee;
            oConfirmOrder.UsePoint = oNewOrder.UsePoint;
            oConfirmOrder.PointPay = oNewOrder.PointPay;
            oConfirmOrder.CouponPay = oNewOrder.CouponPay;
            oConfirmOrder.BounsPay = oNewOrder.BounsPay;
            oConfirmOrder.MoneyPaid = oNewOrder.MoneyPaid;
            oConfirmOrder.Discount = oNewOrder.Discount;
            oConfirmOrder.TotalPaid = oNewOrder.TotalPaid;
            oConfirmOrder.OrderAmount = oNewOrder.OrderAmount;
            oConfirmOrder.Differ = oNewOrder.Differ;

            #endregion

            #region 收货人基本信息

            oConfirmOrder.Consignee = oNewOrder.Consignee;
            oConfirmOrder.aLocation = oNewOrder.aLocation;
            oConfirmOrder.FullAddress = oNewOrder.FullAddress;
            oConfirmOrder.PostCode = oNewOrder.PostCode;
            oConfirmOrder.Telephone = oNewOrder.Telephone;
            oConfirmOrder.Mobile = oNewOrder.Mobile;
            oConfirmOrder.Email = oNewOrder.Email;
            oConfirmOrder.BestDelivery = formCollection["OrderBestDelivery"];
            oConfirmOrder.PostComment = formCollection["OrderPosComment"];

            dbEntity.OrderInformations.Add(oConfirmOrder);
            dbEntity.SaveChanges();

            #endregion

            #endregion

            #region 保存订单商品信息
            //将全局订单商品的列表保存入数据库
            for (int i = 0; i < globalOrderItemList.Count; i++)
            {
                OrderItem oNewOrderItem = new OrderItem();
                oNewOrderItem.OrderID = oConfirmOrder.Gid;
                oNewOrderItem.OnSkuID = globalOrderItemList.ElementAt(i).Value.OnSkuID;
                oNewOrderItem.SkuID = globalOrderItemList.ElementAt(i).Value.SkuID;
                oNewOrderItem.Name = globalOrderItemList.ElementAt(i).Value.Name;
                oNewOrderItem.Quantity = globalOrderItemList.ElementAt(i).Value.Quantity;
                oNewOrderItem.MarketPrice = globalOrderItemList.ElementAt(i).Value.MarketPrice;
                oNewOrderItem.SalePrice = globalOrderItemList.ElementAt(i).Value.SalePrice;
                oNewOrderItem.ExecutePrice = globalOrderItemList.ElementAt(i).Value.ExecutePrice;
                dbEntity.OrderItems.Add(oNewOrderItem);
                //删除购物车
                Guid mallCartGid = globalOrderItemList.ElementAt(i).Key;
                MallCart oCurrrentMallCart = dbEntity.MallCarts.Where(p => p.Gid == mallCartGid && p.Deleted == false).FirstOrDefault();
                if (oCurrrentMallCart != null)
                {
                    oCurrrentMallCart.Deleted = true;
                }
                dbEntity.SaveChanges();
            }

            #endregion

            #region 保存订单承运商信息
            //如果使用承运商,则保存最佳承运商信息
            if (bUseShipper == true)
            {
                OrderShipping oNewOrderShipping = new OrderShipping();
                oNewOrderShipping.OrderID = oConfirmOrder.Gid;
                oNewOrderShipping.ShipID = globalShipperGid;
                dbEntity.OrderShippings.Add(oNewOrderShipping);
                dbEntity.SaveChanges();
            }

            #endregion

            #region 订单的属性

            #endregion

            #region 发票信息
            //有订单发票信息
            if (bInvoiceOrNot == true)
            {
                FinanceInvoice oNewFinanceInvoice = new FinanceInvoice();
                Guid optionItemGid = Guid.Parse(formCollection["InvoiceItem"]);
                GeneralOptItem oInvoiceItem = dbEntity.GeneralOptItems.Include("Name").Where(p => p.Gid == optionItemGid && p.Deleted == false).FirstOrDefault();
                if (oInvoiceItem != null)
                {
                    oNewFinanceInvoice.Matter = oInvoiceItem.Name.GetResource(LiveSession.Culture);
                }
                oNewFinanceInvoice.Title = formCollection["orderInvoice"];
                oNewFinanceInvoice.Amount = oConfirmOrder.OrderAmount;
                dbEntity.FinanceInvoices.Add(oNewFinanceInvoice);
                dbEntity.SaveChanges();
            }

            #endregion

            #region 将使用的券信息写入用户记录

            for (int i = 0; i < globalCouponList.Count; i++)
            {
                Guid pointGid = globalCouponList.ElementAt(i).Key;
                MemberPoint oMemberPoint = dbEntity.MemberPoints.Include("User").Include("Promotion").Include("Coupon").Where(p=>p.Gid == pointGid && p.Deleted==false).FirstOrDefault();
                if (oMemberPoint != null)
                {
                    decimal couponBalance = globalCouponList.ElementAt(i).Value;
                    MemberUsePoint oNewMemberUsePoint = new MemberUsePoint();
                    oNewMemberUsePoint.PointID = pointGid;
                    oNewMemberUsePoint.Pstatus = (byte)ModelEnum.PointUsed.USED;
                    oNewMemberUsePoint.RefType = (byte)ModelEnum.NoteType.ORDER;
                    oNewMemberUsePoint.RefID = oConfirmOrder.Gid;
                    //将原有的金额减去余额即为消费金额
                    oNewMemberUsePoint.Amount = oMemberPoint.Balance - couponBalance;
                    dbEntity.MemberUsePoints.Add(oNewMemberUsePoint);
                    //将积分表的余额变为当前余额
                    oMemberPoint.Balance = couponBalance;
                    //将状态变为已使用
                    oMemberPoint.Pstatus = (byte)ModelEnum.PointStatus.USED;
                    //当余额为0时,是否改变状态
                    //To do 不改变券的状态
                    dbEntity.SaveChanges();
                }
            }

            #endregion

            return strReturnInfo;
        }
Пример #15
0
 public StockInBill(WarehouseStockIn oStockIn, OrderInformation oOrder, List<StockInSku> oStockInSkus)
 {
     this.oStockIn = oStockIn;
     this.oOrder = oOrder;
     this.oStockInSkus = oStockInSkus;
 }
Пример #16
0
 /// <summary>
 /// 修改订单挂起状态
 /// </summary>
 /// <param name="bHanged">挂起状态</param>
 /// <returns></returns>
 public string UpdateOrderHanged(bool bHanged)
 {
     string content;
     OrderInformation oNew = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     //根据传入的订单挂起状态修改状态
     if (bHanged == true)
     {
         oNew.Hanged = (byte)ModelEnum.HangStatus.HANGED;
         content = @LiveAzure.Resource.Common.HangStatus.Split(',')[1];
     }
     else
     {
         oNew.Hanged = (byte)ModelEnum.HangStatus.NONE;
         content = @LiveAzure.Resource.Common.HangStatus.Split(',')[0];
     }
     dbEntity.SaveChanges();
     oNewOrder = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     string sStatus = oNewOrder.Locking.ToString() + oNewOrder.Hanged.ToString() + oNewOrder.Ostatus.ToString() + oNewOrder.PayStatus.ToString();
     string Status = OrderStatusSelect(sStatus, oNewOrder.TransType.ToString());
     //写操作日志
     oEventBLL.WriteOrderEvent(content, "", this.ToString(), false, oNewOrder.Gid, CurrentSession.UserID);
     //判断 取消-退货 状态转换
     CancelOrReturn();
     return Status;
 }
Пример #17
0
 /// <summary>
 /// 取消订单加入历史订单
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public bool UpdateOrderHistory(OrderInformation order)
 {
     OrderHistory oNewOrderHistory = new OrderHistory
     {
         OrderID = order.Gid,
         DocVersion = order.DocVersion,
         Htype = 0,//?
         Reason = "退货",
         RefRefund = null,//?
         RefStockIn = null,//?
         WhID = order.WhID,
         LinkCode = order.LinkCode,
         Ostatus = order.Ostatus,
         Locking = order.Locking,
         PayStatus = order.PayStatus,
         Hanged = order.Hanged,
         HangReason = order.HangReason,
         ReleaseTime = order.ReleaseTime,
         TransType = order.TransType,
         PayID = order.PayID,
         PayNote = order.PayNote,
         Pieces = order.Pieces,
         Currency = order.aCurrency,
         SaleAmount = order.SaleAmount,
         ExecuteAmount = order.ExecuteAmount,
         ShippingFee = order.ShippingFee,
         TaxFee = order.TaxFee,
         Insurance = order.Insurance,
         PaymentFee = order.PaymentFee,
         PackingFee = order.PackingFee,
         ResidenceFee = order.ResidenceFee,
         LiftGateFee = order.LiftGateFee,
         InstallFee = order.InstallFee,
         OtherFee = order.OtherFee,
         TotalFee = order.TotalFee,
         UsePoint = order.UsePoint,
         PointPay = order.PointPay,
         CouponPay = order.CouponPay,
         BounsPay = order.BounsPay,
         MoneyPaid = order.MoneyPaid,
         TotalPaid = order.TotalPaid,
         OrderAmount = order.OrderAmount,
         Differ = order.Differ,
         MergeFrom = order.MergeFrom,
         SplitFrom = order.SplitFrom,
         GetPoint = order.GetPoint,
         ConfirmTime = order.ConfirmTime,
         PaidTime = order.PaidTime,
         ArrangeTime = order.ArrangeTime,
         NoticeTime = order.NoticeTime,
         ClosedTime = order.ClosedTime,
         Consignee = order.Consignee,
         Location = order.aLocation,
         FullAddress = order.FullAddress,
         PostCode = order.PostCode,
         Telephone = order.Telephone,
         Mobile = order.Mobile,
         Email = order.Email,
         ErrorAddress = order.ErrorAddress,
         BestDelivery = order.BestDelivery,
         BuildingSign = order.BuildingSign,
         PostComment = order.PostComment,
         LeaveWord = order.LeaveWord,
         IpAddress = order.IpAddress,
         AdvID = order.AdvID,
         Remark = order.Remark
     };
     dbEntity.OrderHistories.Add(oNewOrderHistory);
     dbEntity.SaveChanges();
     List<OrderItem> OrderItemList = dbEntity.OrderItems.Where(p => p.OrderID == oNewOrder.Gid && p.Deleted == false).ToList();
     foreach(OrderItem item in OrderItemList){
         item.Deleted = true;
         OrderHisItem oNewOrderHisItem = new OrderHisItem
         {
             OrderHisID = oNewOrderHistory.Gid,
             OnSkuID = item.OnSkuID,
             SkuID = item.SkuID,
             Name = item.Name,
             Quantity = item.Quantity,
             MarketPrice = item.MarketPrice,
             SalePrice = item.SalePrice,
             ExecutePrice = item.ExecutePrice,
             SkuPoint = item.SkuPoint,
             Remark = item.Remark
         };
         dbEntity.OrderHisItems.Add(oNewOrderHisItem);
         dbEntity.SaveChanges();
     }
     return true;
 }
Пример #18
0
 /// <summary>
 /// 生成退货单**等待完美
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public bool ReturnedPurchase(OrderInformation order)
 {
     ////生成入库单
     //WarehouseStockIn oStockIn = new WarehouseStockIn
     //{
     //    WhID = (Guid)order.WhID,
     //    Istatus = 0,
     //    InType = dbEntity.GeneralStandardCategorys.Include("Name").Where(p => p.Deleted == false && p.Ctype == 4 && p.Code == "ReturnIn").Select(p => p.Gid).FirstOrDefault(),
     //    RefID = order.Gid,
     //    PrintInSheet = 0,
     //    Prepared = CurrentSession.UserID
     //};
     //dbEntity.WarehouseStockIns.Add(oStockIn);
     //dbEntity.SaveChanges();
     Guid InType = dbEntity.GeneralStandardCategorys.Include("Name").Where(p => p.Deleted == false && p.Ctype == 4 && p.Code == "ReturnIn").Select(p => p.Gid).FirstOrDefault();
     byte RefType = (byte)0;//0:订单号;1:采购单号;
     //跳转到入库单详情页面  StockInAdd(Guid? whID = null,Guid? inType = null ,byte? refType = null, Guid? refID = null)
     RedirectToAction("StockInAdd", "Warehouse",new {order.WhID,InType,RefType,order.Gid});
     return true;
 }
Пример #19
0
 /// <summary>
 /// 修改订单付款状态
 /// </summary>
 /// <param name="bPayStatus">支付状态</param>
 /// <returns></returns>
 public string UpdateOrderPayStatus(int nPayStatus)
 {
     string content;
     OrderInformation oNew = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     //根据传入的付款状态修改订单的付款状态
     switch (nPayStatus)
     {
         case 0:
             oNew.PayStatus = (byte)ModelEnum.PayStatus.NONE;
             content = @LiveAzure.Resource.Common.PayStatus.Split(',')[0];
             break;
         case 1:
             oNew.PayStatus = (byte)ModelEnum.PayStatus.ONPAYMENT;
             content = @LiveAzure.Resource.Common.PayStatus.Split(',')[1];
             break;
         case 2:
             oNew.PayStatus = (byte)ModelEnum.PayStatus.NOTICE;
             oNew.NoticeTime = DateTimeOffset.Now;
             content = @LiveAzure.Resource.Common.PayStatus.Split(',')[2];
             break;
         case 3:
             oNew.PayStatus = (byte)ModelEnum.PayStatus.PAID;
             oNew.PaidTime = DateTimeOffset.Now;
             content = @LiveAzure.Resource.Common.PayStatus.Split(',')[3];
             break;
         default:
             oNew.PayStatus = 6;
             content = "状态错误-error";
             break;
     }
     dbEntity.SaveChanges();
     oNewOrder = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     string sStatus = oNewOrder.Locking.ToString() + oNewOrder.Hanged.ToString() + oNewOrder.Ostatus.ToString() + oNewOrder.PayStatus.ToString();
     string Status = OrderStatusSelect(sStatus, oNewOrder.TransType.ToString());
     //写操作日志
     oEventBLL.WriteOrderEvent(content, "", this.ToString(), false, oNewOrder.Gid, CurrentSession.UserID);
     //判断 取消-退货 状态转换
     CancelOrReturn();
     return Status;
 }
Пример #20
0
        /// <summary>
        /// 保存页面修改信息,通过编辑的标志位来判断保存不同的信息
        /// </summary>
        /// <param name="oBackOrder"></param>
        /// <returns></returns>
        public ActionResult SaveEditOrderInfo(OrderInformation oBackOrder)
        {
            if (bChangeOrder == true)
            {
                if (bOrderBaseInfoEdit == true && bOrderItemInfoEdit == false && bOrderFeeInfoEdit == false)
                {
                    oNewOrder.LinkCode = oBackOrder.LinkCode;
                    oNewOrder.PayID = oBackOrder.PayID;
                    oNewOrder.aCurrency = oBackOrder.aCurrency;
                    oNewOrder.TransType = oBackOrder.TransType;
                    oNewOrder.LeaveWord = oBackOrder.LeaveWord;
                    oNewOrder.PostComment = oBackOrder.PostComment;
                    oNewOrder.PayNote = oBackOrder.PayNote;

                    oNewOrder.Consignee = oBackOrder.Consignee;
                    oNewOrder.aLocation = oBackOrder.aLocation;
                    var bestWhID = dbEntity.Database.SqlQuery<Guid>("SELECT dbo.fn_FindBestWarehouse({0}, {1}, {2})", oNewOrder.OrgID, oNewOrder.ChlID, oNewOrder.aLocation).FirstOrDefault();
                    if (bestWhID != null)
                    {
                        oNewOrder.WhID = (Guid)bestWhID;
                    }
                    oNewOrder.FullAddress = oBackOrder.FullAddress;
                    oNewOrder.PostCode = oBackOrder.PostCode;
                    oNewOrder.Telephone = oBackOrder.Telephone;
                    oNewOrder.Mobile = oBackOrder.Mobile;
                    oNewOrder.Email = oBackOrder.Email;
                    oNewOrder.BestDelivery = oBackOrder.BestDelivery;
                    oNewOrder.BuildingSign = oBackOrder.BuildingSign;
                    EditShippingListShow();//更新承运商列表信息
                    bOrderBaseInfoEdit = false;
                }
                else if (bOrderBaseInfoEdit == false && bOrderItemInfoEdit == true && bOrderFeeInfoEdit == false)
                {
                    //保存商品信息进入全局变量
                    //oNewOrder.OrderItems.Clear();
                    List<OrderItem> newList = new List<OrderItem>();
                    foreach (OrderItem item in listNewOrderItem)
                    {
                        OrderItem newObj = new OrderItem();
                        newObj.OrderID = item.OrderID;
                        newObj.OnSkuID = item.OnSkuID;
                        newObj.SkuID = item.SkuID;
                        newObj.Name = item.Name;
                        newObj.Quantity = item.Quantity;
                        newObj.TobeShip = item.TobeShip;
                        newObj.Shipped = item.Shipped;
                        newObj.BeReturn = item.BeReturn;
                        newObj.Returned = item.Returned;
                        newObj.MarketPrice = item.MarketPrice;
                        newObj.SalePrice = item.SalePrice;
                        newObj.ExecutePrice = item.ExecutePrice;
                        newObj.SkuPoint = item.SkuPoint;
                        newObj.Remark = item.Remark;
                        //oNewOrder.OrderItems.Add(item);
                        newList.Add(newObj);
                    }
                    oNewOrder.OrderItems = newList;
                    setAmount();
                    EditShippingListShow();//更新承运商列表信息
                    bOrderItemInfoEdit = false;
                }
                else if (bOrderBaseInfoEdit == false && bOrderItemInfoEdit == false && bOrderFeeInfoEdit == true)
                {
                    //保存费用信息进入全局变量
                    oNewOrder.ShippingFee = oBackOrder.ShippingFee;
                    oNewOrder.TaxFee = oBackOrder.TaxFee;
                    oNewOrder.Insurance = oBackOrder.Insurance;
                    oNewOrder.PaymentFee = oBackOrder.PaymentFee;
                    oNewOrder.PackingFee = oBackOrder.PackingFee;
                    oNewOrder.ResidenceFee = oBackOrder.ResidenceFee;
                    oNewOrder.LiftGateFee = oBackOrder.LiftGateFee;
                    oNewOrder.InstallFee = oBackOrder.InstallFee;
                    oNewOrder.OtherFee = oBackOrder.OtherFee;
                    bOrderFeeInfoEdit = false;
                }

                if(bSaveEditOrderInfo == true)
                {
                    Guid currentEditOrderGid = oNewOrder.Gid;
                    OrderInformation oCurrentEditOrder = dbEntity.OrderInformations.Where(p => p.Gid == currentEditOrderGid && p.Deleted == false).FirstOrDefault();
                    //订单基本信息保存
                    oCurrentEditOrder.DocVersion = oCurrentEditOrder.DocVersion + 1;
                    oCurrentEditOrder.LinkCode = oNewOrder.LinkCode;
                    oCurrentEditOrder.PayID = oNewOrder.PayID;
                    oCurrentEditOrder.WhID = oNewOrder.WhID;
                    oCurrentEditOrder.aCurrency = oNewOrder.aCurrency;
                    oCurrentEditOrder.TransType = oNewOrder.TransType;
                    oCurrentEditOrder.LeaveWord = oNewOrder.LeaveWord;
                    oCurrentEditOrder.PostComment = oNewOrder.PostComment;
                    oCurrentEditOrder.PayNote = oNewOrder.PayNote;

                    oCurrentEditOrder.Consignee = oNewOrder.Consignee;
                    oCurrentEditOrder.aLocation = oNewOrder.aLocation;
                    oCurrentEditOrder.FullAddress = oNewOrder.FullAddress;
                    oCurrentEditOrder.PostCode = oNewOrder.PostCode;
                    oCurrentEditOrder.Telephone = oNewOrder.Telephone;
                    oCurrentEditOrder.Mobile = oNewOrder.Mobile;
                    oCurrentEditOrder.Email = oNewOrder.Email;
                    oCurrentEditOrder.BestDelivery = oNewOrder.BestDelivery;
                    oCurrentEditOrder.BuildingSign = oNewOrder.BuildingSign;

                    //保存商品信息
                    //保存订单的产品
                    decimal Pieces = 0;//商品件数
                    List<OrderItem> hasBeforeOrderItems = dbEntity.OrderInformations.Find(oNewOrder.Gid).OrderItems.ToList();
                    foreach (OrderItem oldOrderItem in hasBeforeOrderItems)
                    {
                        oldOrderItem.Deleted = true;
                    }
                    foreach (OrderItem newOrderItem in listNewOrderItem)
                    {
                        Pieces += Math.Round(newOrderItem.Quantity,newOrderItem.SkuItem.Percision);//简单相加商品件数
                        newOrderItem.OrderID = oNewOrder.Gid;
                        OrderItem obj = hasBeforeOrderItems.Where(o => o.OrderID == newOrderItem.OrderID && o.OnSkuID == newOrderItem.OnSkuID).FirstOrDefault();
                        if (obj != null)//本身有该索引对应的记录
                        {
                            obj.Quantity = newOrderItem.Quantity;
                            obj.ExecutePrice = newOrderItem.ExecutePrice;
                            obj.TobeShip = newOrderItem.TobeShip;
                            obj.Deleted = false;
                        }
                        else
                        {
                            OrderItem newObj = new OrderItem();
                            newObj.OrderID = newOrderItem.OrderID;
                            newObj.OnSkuID = newOrderItem.OnSkuID;
                            newObj.SkuID = newOrderItem.SkuID;
                            newObj.Name = newOrderItem.Name;
                            newObj.Quantity = newOrderItem.Quantity;
                            newObj.TobeShip = newOrderItem.TobeShip;
                            newObj.Shipped = newOrderItem.Shipped;
                            newObj.BeReturn = newOrderItem.BeReturn;
                            newObj.Returned = newOrderItem.Returned;
                            newObj.MarketPrice = newOrderItem.MarketPrice;
                            newObj.SalePrice = newOrderItem.SalePrice;
                            newObj.ExecutePrice = newOrderItem.ExecutePrice;
                            newObj.SkuPoint = newOrderItem.SkuPoint;
                            newObj.Remark = newOrderItem.Remark;
                            dbEntity.OrderItems.Add(newObj);
                        }
                        oCurrentEditOrder.Pieces = Pieces;//商品件数赋值
                    }
                    //dbEntity.SaveChanges();
                    //保存承运商信息
                    List<OrderShipping> hasBeforeOrderShippings = dbEntity.OrderShippings.Where(o => o.OrderID == oNewOrder.Gid).ToList();//获取原数据库的所有该订单下对应的OrderShipping
                    foreach (OrderShipping oldOrderShip in hasBeforeOrderShippings)
                    {
                        oldOrderShip.Deleted = true;//全部变成删除
                        oldOrderShip.Candidate = false;
                    }
                    foreach (OrderShipping newOrderShip in listNewOrderShipping)
                    {
                        newOrderShip.OrderID = oNewOrder.Gid;
                        OrderShipping obj = hasBeforeOrderShippings.Where(o => o.OrderID == newOrderShip.OrderID && o.ShipID == newOrderShip.ShipID).FirstOrDefault();
                        if (obj==null)
                        {
                            if (newOrderShip.ShipID == oNewShipper.Gid)
                                newOrderShip.Candidate = true;
                            OrderShipping newObj = new OrderShipping();
                            newObj.OrderID = newOrderShip.OrderID;
                            newObj.ShipID = newOrderShip.ShipID;
                            newObj.Ostatus = newOrderShip.Ostatus;
                            newObj.ShipWeight = newOrderShip.ShipWeight;
                            newObj.Candidate = newOrderShip.Candidate;
                            newObj.Remark = newOrderShip.Remark;
                            dbEntity.OrderShippings.Add(newObj);
                        }
                        else
                        {//若OrderShipping已经有该索引的记录
                            if (obj.ShipID == oNewShipper.Gid)
                                obj.Candidate = true;
                            obj.Deleted = false;//变成可用状态
                        }
                    }
                    //dbEntity.SaveChanges();

                    //保存价格信息
                    oCurrentEditOrder.SaleAmount = oNewOrder.SaleAmount;
                    oCurrentEditOrder.ExecuteAmount = oNewOrder.ExecuteAmount;
                    oCurrentEditOrder.ShippingFee = oNewOrder.ShippingFee;
                    oCurrentEditOrder.TaxFee = oNewOrder.TaxFee;
                    oCurrentEditOrder.Insurance = oNewOrder.Insurance;
                    oCurrentEditOrder.PaymentFee = oNewOrder.PaymentFee;
                    oCurrentEditOrder.PackingFee = oNewOrder.PackingFee;
                    oCurrentEditOrder.ResidenceFee = oNewOrder.ResidenceFee;
                    oCurrentEditOrder.LiftGateFee = oNewOrder.LiftGateFee;
                    oCurrentEditOrder.InstallFee = oNewOrder.InstallFee;
                    oCurrentEditOrder.OtherFee = oNewOrder.OtherFee;

                    //保存全局的信息
                    dbEntity.SaveChanges();

                    bOrderBaseInfoEdit = false;
                    bOrderItemInfoEdit = false;
                    bOrderFeeInfoEdit = false;
                    bChangeOrder = false;
                    bSaveEditOrderInfo = false;
                }

            }

            return null;
        }
Пример #21
0
 /// <summary>
 /// 更新沟通
 /// </summary>
 /// <returns></returns>
 public string UpdateOrderTalk(string content)
 {
     content = content + @LiveAzure.Resource.Stage.OrderController.TalkWithSelf;
     oNewOrder = dbEntity.OrderInformations.Where(p => p.Deleted.Equals(false) && p.Gid == oNewOrder.Gid).Single();
     string sStatus = oNewOrder.Locking.ToString() + oNewOrder.Hanged.ToString() + oNewOrder.Ostatus.ToString() + oNewOrder.PayStatus.ToString();
     string Status = OrderStatusSelect(sStatus, oNewOrder.TransType.ToString());
     oEventBLL.WriteOrderEvent(content, "", this.ToString(), false, oNewOrder.Gid, CurrentSession.UserID);
     //判断 取消-退货 状态转换
     CancelOrReturn();
     return Status;
 }
Пример #22
0
        /// <summary>
        /// 保存新建的订单
        /// </summary>
        /// <returns></returns>
        public string SaveNewOrder(OrderInformation oBackOrder,FormCollection formCollection)
        {
            //oOrderBLL.TestRegion();
            //需要根据组织Gid,渠道Gid以及地区Gid找出最佳的仓库
            if (oNewOrder.OrgID.Equals(null))
            {
                return "error";
            }
            if (oNewOrder.ChlID.Equals(null))
            {
                return "error";
            }
            if (oBackOrder.aLocation.Equals(null))
            {
                return "error";
            }
            //计算出最佳仓库
            var bestWhID = dbEntity.Database.SqlQuery<Guid>("SELECT dbo.fn_FindBestWarehouse({0}, {1}, {2})", oNewOrder.OrgID, oNewOrder.ChlID, oNewOrder.aLocation).FirstOrDefault();
            if (bestWhID != null)
            {
                oNewOrder.WhID = (Guid)bestWhID;
            }
            else
            {
                return "error";
            }
            //如果订单没有商品,返回
            if (listNewOrderItem.Count <= 0)
            {
                return "error";
            }
            //如果没有最佳承运商,返回
            if (formCollection["shippingListSelect"] == "" || formCollection["shippingListSelect"] ==string.Empty)
            {
                return "error";
            }

            //保存订单的基本信息
            oNewOrder.User = null;
            oNewOrder.aLocation = oBackOrder.aLocation;
            oNewOrder.LinkCode = oBackOrder.LinkCode;
            oNewOrder.aCurrency = oBackOrder.aCurrency;
            oNewOrder.PayID = oBackOrder.PayID;
            oNewOrder.TransType = oBackOrder.TransType;
            oNewOrder.PayNote = oBackOrder.PayNote;
            oNewOrder.LeaveWord = oBackOrder.LeaveWord;
            oNewOrder.PostComment = oBackOrder.PostComment;
            oNewOrder.Consignee = oBackOrder.Consignee;
            oNewOrder.FullAddress = oBackOrder.FullAddress;
            oNewOrder.PostCode = oBackOrder.PostCode;
            oNewOrder.Telephone = oBackOrder.Telephone;
            oNewOrder.Mobile = oBackOrder.Mobile;
            oNewOrder.Email = oBackOrder.Email;
            oNewOrder.BuildingSign = oBackOrder.BuildingSign;
            oNewOrder.BestDelivery = oBackOrder.BestDelivery;
            //先保存订单信息
            dbEntity.OrderInformations.Add(oNewOrder);
            dbEntity.SaveChanges();

            //保存订单的产品
            decimal Pieces = 0;//定义商品件数
            foreach (OrderItem o in listNewOrderItem)
            {
                Pieces += Math.Round(o.Quantity, o.SkuItem.Percision);//订单商品件数简单相加
                o.SkuItem = null;
                o.OrderID = oNewOrder.Gid;
                dbEntity.OrderItems.Add(o);
            }
            oNewOrder.Pieces = Pieces;//订单商品件数赋值
            dbEntity.SaveChanges();
            //保存订单的承运商
            if (formCollection["shippingListSelect"] != null)//如果有承运商
            {
                Guid shipperID = Guid.Parse(formCollection["shippingListSelect"]);
                foreach (OrderShipping ship in listNewOrderShipping)
                {
                    if (ship.ShipID == shipperID)
                    {
                        ship.Ostatus = (byte)ModelEnum.ShippingCheck.PASSED;//设置选中的承运商
                        ship.Candidate = true;
                    }
                    dbEntity.OrderShippings.Add(ship);
                }
            }
            else
            {
                //没有承运商
            }
            dbEntity.SaveChanges();
            return "success";
        }
Пример #23
0
        public void MakeTestOrder(LiveEntities dbEntity)
        {
            // 建一个测试订单(真实订单,运单号)
            OrderInformation oNewOrder = new OrderInformation
            {
                Organization = (from o in dbEntity.MemberOrganizations
                                where o.Code == "Zhuchao" && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                select o).FirstOrDefault(),
                Channel = (from c in dbEntity.MemberChannels
                           where c.Code == "Taobao01" && c.Otype == (byte)ModelEnum.OrganizationType.CHANNEL
                           select c).FirstOrDefault(),
                Warehouse = (from w in dbEntity.WarehouseInformations
                             where w.Code == "ZCWH01" && w.Otype == (byte)ModelEnum.OrganizationType.WAREHOUSE
                             select w).FirstOrDefault(),
                User = (from u in dbEntity.MemberUsers
                        where u.LoginName == "test"
                        select u).FirstOrDefault(),
                LinkCode = "92781947684462",
                Ostatus = (byte)ModelEnum.OrderStatus.DELIVERIED,
                PayStatus = (byte)ModelEnum.PayStatus.PAID,
                TransType = (byte)ModelEnum.TransType.SECURED,
                Currency = (from u in dbEntity.GeneralMeasureUnits
                            where u.Code == "¥" && u.Utype == (byte)ModelEnum.MeasureUnit.CURRENCY
                            select u).FirstOrDefault(),
                Location = (from r in dbEntity.GeneralRegions
                            where r.Code == "110105"
                            select r).FirstOrDefault(),
            };
            OrderShipping oShipping = new OrderShipping
            {
                Order = oNewOrder,
                Shipper = (from s in dbEntity.ShippingInformations
                           where s.Code == "EMS" && s.Otype == (byte)ModelEnum.OrganizationType.SHIPPER
                           select s).FirstOrDefault(),
                Ostatus = (byte)ModelEnum.ShippingCheck.PASSED,
                Candidate = true
            };
            dbEntity.OrderShippings.Add(oShipping);
            dbEntity.SaveChanges();

            ExTaobaoDeliveryPending oPending = new ExTaobaoDeliveryPending
            {
                Order = oNewOrder,
                Dstatus = (byte)ModelEnum.TaobaoDeliveryStatus.WAIT_FOR_SEND,
                ShipID = oShipping.Gid,
                tid = oNewOrder.LinkCode,
                logistics = oShipping.Shipper.Code,
                out_sid = "EM812010333CS"
            };
            dbEntity.ExTaobaoDeliveryPendings.Add(oPending);
            dbEntity.SaveChanges();
        }
Пример #24
0
 public ActionResult setPriceInformation(OrderInformation viewmodel)
 {
     oNewOrder.ShippingFee = viewmodel.ShippingFee;
     oNewOrder.TaxFee = viewmodel.TaxFee;
     oNewOrder.Insurance = viewmodel.Insurance;
     oNewOrder.PaymentFee = viewmodel.PaymentFee;
     oNewOrder.PackingFee = viewmodel.PackingFee;
     oNewOrder.ResidenceFee = viewmodel.ResidenceFee;
     oNewOrder.LiftGateFee = viewmodel.LiftGateFee;
     oNewOrder.InstallFee = viewmodel.InstallFee;
     oNewOrder.OtherFee = viewmodel.OtherFee;
     return RedirectToAction("PriceMessageDisplayPage", "Order");
 }
Пример #25
0
 /// <summary>
 /// 订单首页
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     // 权限验证
     if (!base.CheckPrivilege())
         RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
     oNewOrder = new OrderInformation();
     return View();
 }
Пример #26
0
 /// <summary>
 /// 查看选择的订单信息
 /// </summary>
 /// <param name="orderGid"></param>
 /// <returns></returns>
 public string SetViewOrderInfo(Guid orderGid)
 {
     //查询出查看的订单信息
     OrderInformation oViewOrder = dbEntity.OrderInformations.Include("Organization").Include("Channel").Include("User").Include("Warehouse").Include("PayType").Include("Currency").Include("Location").Include("OrderItems").Include("OrderProcesses").Include("OrderAttributes").Include("OrderHistories").Where(p => p.Gid == orderGid && p.Deleted == false).FirstOrDefault();
     //设置订单页面编辑状态
     if (oViewOrder.Hanged == (byte)ModelEnum.HangStatus.HANGED)
         bChangeOrder = true;
     else
         bChangeOrder = false;
     if (oViewOrder.Equals(null))
     {
         return "failure";
     }
     oNewOrder = oViewOrder;
     listNewOrderItem.Clear();//清空缓存区商品列表
     foreach (OrderItem item in oNewOrder.OrderItems)
     {
         OrderItem obj = dbEntity.OrderItems.Include("OnSkuItem").Include("SkuItem").Where(o => o.Gid == item.Gid && o.Deleted==false).FirstOrDefault();
         if (obj != null)
             listNewOrderItem.Add(obj);
     }
     listNewOrderShipping.Clear();//清空缓存区承运商列表
     oNewShipper = new ShippingInformation();
     //-----------------------------------------------------------------edit by 2011/10/24 手工订单编辑可以选择该组织所有支持的承运商
     //foreach (OrderShipping ship in oNewOrder.OrderShippings)
     //{
     //    OrderShipping obj = dbEntity.OrderShippings.Include("Shipper").Where(o => o.Gid == ship.Gid && o.Deleted == false).FirstOrDefault();
     //    if (obj != null)
     //    {
     //        if (obj.Candidate)//将原MODEL中选中的承运商赋给oNewShipper
     //            oNewShipper = obj.Shipper;
     //        listNewOrderShipping.Add(obj);
     //    }
     //}
     List<ShippingInformation> listOrgShippers = dbEntity.ShippingInformations.Where(s => s.Deleted == false && s.aParent == oNewOrder.OrgID).ToList();//组织支持的承运商
     foreach (ShippingInformation ship in listOrgShippers)
     {
         OrderShipping oShip = new OrderShipping {  OrderID = oNewOrder.Gid,ShipID = ship.Gid};
         listNewOrderShipping.Add(oShip);
     }
     foreach (OrderShipping ship in oNewOrder.OrderShippings)
     {
         OrderShipping obj = dbEntity.OrderShippings.Include("Shipper").Where(o => o.Gid == ship.Gid && o.Deleted == false).FirstOrDefault();
         if (obj != null)
         {
             if (obj.Candidate)//将原MODEL中选中的承运商赋给oNewShipper
                 oNewShipper = obj.Shipper;
         }
     }
     //---------------------------------------------------------------------------------------------------------------------------------
     return "success";
 }
Пример #27
0
 /// <summary>
 /// 退款
 /// </summary>
 /// <param name="oEdit"></param>
 public void ReturnMoney(OrderInformation oEdit)
 {
     Guid OrderId = oEdit.Gid;
     dbEntity.Database.SqlQuery<string>("EXECUTE sp_UpdatePointByOrder {0}", OrderId);
     List<MemberUsePoint> PointList = dbEntity.MemberUsePoints.Where(p => p.Deleted == false && p.RefType == (byte)ModelEnum.NoteType.ORDER && p.RefID == OrderId).ToList();
     foreach (MemberUsePoint item in PointList)
     {
         item.Deleted = true;
     }
 }
Пример #28
0
 public StockOutBill( WarehouseStockOut oStockOut, OrderInformation oOrder, List<StockOutSku> oOutSkus)
 {
     this.oStockOut = oStockOut;
     this.oOrder = oOrder;
     this.oOutSkus = oOutSkus;
 }