Esempio n. 1
0
        /// <summary>
        /// 如果是送货到家,根据订单和用户ID来给总金额和实际支付金额加上运费
        /// </summary>
        /// <param name="OrderId"></param>
        /// <returns></returns>

        public void UpdateOrderAddDeliveryAmount(string OrderId, string CustomerId)
        {
            //取订单信息
            OnlineShoppingItemBLL serer = new OnlineShoppingItemBLL(base.loggingSessionInfo);

            JIT.CPOS.BS.Entity.Interface.SetOrderEntity orderInfo = serer.GetOrderOnline(OrderId);
            //如果订单状态不为100,return;
            if (orderInfo.Status != "100")//状态为100时,才是正式的订单,才进行下面的操作
            {
                return;
            }
            OnlineShoppingItemService tInoutDAO = new OnlineShoppingItemService(base.loggingSessionInfo);

            #region 如果订单已产生配送费
            TOrderCustomerDeliveryStrategyMappingEntity[] mappingList = Query(new IWhereCondition[] {
                new EqualsCondition()
                {
                    FieldName = "OrderId", Value = OrderId
                }
            }, null);
            if (mappingList.Count() > 0)
            {
                mappingList[0].IsDelete = 1;
                Delete(mappingList[0]); //逻辑删除订单的配送费
                //修改订单金额
                orderInfo.TotalAmount  = orderInfo.TotalAmount - mappingList[0].DeliveryAmount.Value;
                orderInfo.ActualAmount = orderInfo.ActualAmount - mappingList[0].DeliveryAmount.Value;
                tInoutDAO.UpdateOrderAddDeliveryAmount(orderInfo);
            }
            #endregion

            //根据totalAmount和customerID取对应的运费
            CustomerDeliveryStrategyBLL customerDeliveryStrategyBLL = new CustomerDeliveryStrategyBLL(base.loggingSessionInfo);
            JIT.CPOS.BS.Entity.CustomerDeliveryStrategyEntity customerDeliveryStrategyEntity = customerDeliveryStrategyBLL.GetDeliveryAmount(CustomerId, orderInfo.TotalAmount, orderInfo.DeliveryId);

            if (customerDeliveryStrategyEntity.Id != null)
            {
                //更新订单主表totalAmount和actual_amount
                decimal DeliveryAmount = customerDeliveryStrategyEntity.DeliveryAmount == null ? 0 : Convert.ToDecimal(customerDeliveryStrategyEntity.DeliveryAmount);
                orderInfo.TotalAmount  = orderInfo.TotalAmount + DeliveryAmount;
                orderInfo.ActualAmount = orderInfo.ActualAmount + DeliveryAmount;
                //  serer.UpdateWEventByPhone
                tInoutDAO.UpdateOrderAddDeliveryAmount(orderInfo);


                //插入“订单与配送策略关系表”
                JIT.CPOS.BS.Entity.TOrderCustomerDeliveryStrategyMappingEntity tOrderCustomerDelivery = new TOrderCustomerDeliveryStrategyMappingEntity();
                // tOrderCustomerDelivery.MappingId
                tOrderCustomerDelivery.OrderId        = OrderId;
                tOrderCustomerDelivery.DSId           = customerDeliveryStrategyEntity.Id;
                tOrderCustomerDelivery.DeliveryAmount = customerDeliveryStrategyEntity.DeliveryAmount;
                tOrderCustomerDelivery.CreateBy       = loggingSessionInfo.CurrentUser.User_Name;
                tOrderCustomerDelivery.IsDelete       = 0;
                //TOrderCustomerDeliveryStrategyMappingBLL tOrderCustomerDeliveryBLL = new TOrderCustomerDeliveryStrategyMappingBLL(loggingSessionInfo);
                _currentDAO.Create(tOrderCustomerDelivery);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(TOrderCustomerDeliveryStrategyMappingEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Esempio n. 3
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(TOrderCustomerDeliveryStrategyMappingEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Esempio n. 4
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <TOrderCustomerDeliveryStrategyMappingEntity> PagedQueryByEntity(TOrderCustomerDeliveryStrategyMappingEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Esempio n. 5
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public TOrderCustomerDeliveryStrategyMappingEntity[] QueryByEntity(TOrderCustomerDeliveryStrategyMappingEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }