Ejemplo n.º 1
0
        public void UpdateSalesUnitId(string unitid, string orderid, string customerid)
        {
            string field = "sales_unit_id";

            var result = _query.UpdateInoutByField(field, orderid, unitid);

            var entity     = GetOrderByOrderId(orderid);
            var unitEntity = _unitQuery.GetUnitById(unitid);

            TInoutStatusEntity info = new TInoutStatusEntity();

            info.InoutStatusID  = Guid.Parse(Guid.NewGuid().ToString());
            info.OrderID        = unitid;
            info.CustomerID     = customerid;
            info.OrderStatus    = Convert.ToInt32(entity.Field7);
            info.StatusRemark   = "订单门店变更[被" + unitEntity.unit_name + "退回]";
            info.CheckResult    = 1;
            info.CreateTime     = DateTime.Now;
            info.CreateBy       = "";
            info.LastUpdateBy   = "";
            info.LastUpdateTime = info.CreateTime;
            info.IsDelete       = 0;

            _tinoutStatusCMD.Create(info);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询订单日志
        /// </summary>
        /// <param name="entity">参数:实体</param>
        /// <param name="pageIndex">参数:当前页</param>
        /// <param name="pageSize">参数:分页个数</param>
        /// <param name="rowCount">参数:数据集的总数</param>
        /// <returns></returns>
        public TInoutStatusEntity[] GetListForChangeUnit(TInoutStatusEntity entity, int pageIndex, int pageSize, out int rowCount)
        {
            List <IWhereCondition> wheres = new List <IWhereCondition>();

            if (entity != null && entity.OrderID != null)
            {
                wheres.Add(new EqualsCondition()
                {
                    FieldName = "T.OrderID", Value = entity.OrderID
                });
            }
            if (entity != null && entity.OrderID != null)
            {
                wheres.Add(new EqualsCondition()
                {
                    FieldName = "T.CheckResult", Value = 1
                });
            }

            List <OrderBy> orderbys = new List <OrderBy>();

            orderbys.Add(new OrderBy()
            {
                FieldName = "[CreateTime]", Direction = OrderByDirections.Desc
            });

            PagedQueryResult <TInoutStatusEntity> pEntity = new TInoutStatusDAO(this.CurrentUserInfo).GetList(wheres.ToArray(), orderbys.ToArray(), pageIndex, pageSize);

            rowCount = pEntity.RowCount;
            return(pEntity.Entities);
        }
Ejemplo n.º 3
0
        public void UpdateStatus(string status, string orderid, string customerid)
        {
            var entity = GetOrderByOrderId(orderid);

            if (entity.Field8 == "1")
            {
                var result = _query.UpdateInoutStauts(orderid, "500", "待发货");
            }
            else if (entity.Field8 == "2")
            {
                var result = _query.UpdateInoutStauts(orderid, "410", "待备货");
            }
            else if (entity.Field8 == "4")
            {
                var result = _query.UpdateInoutStauts(orderid, "520", "待服务");
            }


            TInoutStatusEntity info = new TInoutStatusEntity();

            info.InoutStatusID  = Guid.Parse(Guid.NewGuid().ToString());
            info.OrderID        = orderid;
            info.CustomerID     = customerid;
            info.OrderStatus    = Convert.ToInt32(entity.Field7);
            info.StatusRemark   = "订单状态变更[操作人:]";
            info.CheckResult    = 1;
            info.CreateTime     = DateTime.Now;
            info.CreateBy       = "";
            info.LastUpdateBy   = "";
            info.LastUpdateTime = info.CreateTime;
            info.IsDelete       = 0;

            _tinoutStatusCMD.Create(info);
        }
Ejemplo n.º 4
0
        internal void Create(TInoutStatusEntity dbEntity)
        {
            using (var conn = new SqlConnection(ConnectionString.XgxInsert))
            {
                dbEntity.CreateTime = System.DateTime.Now;
                //dbEntity.CreateBy = "ERP";

                conn.Open();
                conn.Insert(dbEntity);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 批量取消(作废)
        /// </summary>
        /// <param name="OrderID"></param>
        public int BatchInvalidOrder(List <InoutInfo> OrderList, string Remark, LoggingSessionInfo LoggingSessionInfo)
        {
            var UpdateOrderList = new List <InoutInfo>();

            foreach (var item in OrderList)
            {
                var result = this._currentDAO.GetByID(item.order_id);
                if (result != null)
                {
                    var Entity = new InoutInfo()
                    {
                        order_id      = result.order_id,
                        Field2        = result.Field2,
                        carrier_id    = result.carrier_id,
                        status        = "800",
                        status_desc   = "已取消",
                        OldStatusDesc = item.OldStatusDesc
                    };
                    UpdateOrderList.Add(Entity);
                }
            }
            //更新订单状态
            int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList);

            if (Num > 0)
            {//添加状态操作记录
                var inoutStatus = new TInoutStatusBLL(LoggingSessionInfo);
                foreach (var itemes in UpdateOrderList)
                {
                    var info = new TInoutStatusEntity()
                    {
                        InoutStatusID = Guid.Parse(Utils.NewGuid()),
                        OrderID       = itemes.order_id,
                        CustomerID    = LoggingSessionInfo.ClientID,
                        Remark        = Remark,
                        OrderStatus   = 800,
                        StatusRemark  = "订单状态从" + itemes.OldStatusDesc + "变为已取消[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]"
                    };
                    //执行
                    inoutStatus.Create(info);

                    //执行取消订单业务
                    SetCancelOrder(itemes.order_id, 0, LoggingSessionInfo);
                }
                //
                Num = UpdateOrderList.Count();
            }
            return(Num);
        }
Ejemplo n.º 6
0
        public void UpdateNoApprovalStatus(string orderid, string customerid)
        {
            var entity = GetOrderByOrderId(orderid);

            var result = _query.UpdateInoutStauts(orderid, "310", "退款中");

            TInoutStatusEntity info = new TInoutStatusEntity();

            info.InoutStatusID  = Guid.Parse(Guid.NewGuid().ToString());
            info.OrderID        = orderid;
            info.CustomerID     = customerid;
            info.OrderStatus    = Convert.ToInt32(entity.Field7);
            info.StatusRemark   = "订单状态变更[操作人:]";
            info.CheckResult    = 1;
            info.CreateTime     = DateTime.Now;
            info.CreateBy       = "";
            info.LastUpdateBy   = "";
            info.LastUpdateTime = info.CreateTime;
            info.IsDelete       = 0;

            _tinoutStatusCMD.Create(info);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 批量审核
        /// </summary>
        /// <param name="OrderID"></param>
        public int BatchCheckOrder(List <string> OrderIdList, string Remark, LoggingSessionInfo LoggingSessionInfo)
        {
            var UpdateOrderList = new List <InoutInfo>();

            foreach (var item in OrderIdList)
            {
                var result = this._currentDAO.GetByID(item);
                if (result != null)
                {
                    var Entity = new InoutInfo()
                    {
                        order_id    = result.order_id,
                        Field2      = result.Field2,
                        carrier_id  = result.carrier_id,
                        Field1      = result.Field1,
                        status      = "500",
                        status_desc = "未发货"
                    };
                    UpdateOrderList.Add(Entity);
                }
            }
            //更新订单状态
            int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList);

            if (Num > 0)
            {//添加状态操作记录
                var inoutStatus = new TInoutStatusBLL(LoggingSessionInfo);
                foreach (var itemes in UpdateOrderList)
                {
                    var info = new TInoutStatusEntity()
                    {
                        InoutStatusID = Guid.Parse(Utils.NewGuid()),
                        OrderID       = itemes.order_id,
                        CustomerID    = LoggingSessionInfo.ClientID,
                        Remark        = Remark,
                        OrderStatus   = 500,
                        StatusRemark  = "订单状态从未审核变为未发货[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]"
                    };
                    //执行
                    inoutStatus.Create(info);

                    #region 审核成功,并且已支付,调用RabbitMQ发送给ERP

                    if (itemes.Field1 == "0")
                    {
                        continue;
                    }
                    try
                    {
                        var msg = new EventContract
                        {
                            Operation  = OptEnum.Update,
                            EntityType = EntityTypeEnum.Order,
                            Id         = itemes.order_id
                        };
                        var eventService = new EventService();
                        eventService.PublishMsg(msg);
                    }
                    catch (Exception)
                    {
                        throw new Exception("RabbitMQ Error");
                    }

                    #endregion
                }
                //
                Num = UpdateOrderList.Count();
            }
            return(Num);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 批量发货
        /// </summary>
        /// <param name="OrderID"></param>
        public int BatchInvalidShip(List <InoutInfo> OrderList, string Remark, LoggingSessionInfo LoggingSessionInfo)
        {
            var UpdateOrderList = new List <InoutInfo>();

            foreach (var item in OrderList)
            {
                var result = this._currentDAO.GetByID(item.order_id);
                if (result != null)
                {
                    var Entity = new InoutInfo()
                    {
                        order_id    = result.order_id,
                        Field2      = item.Field2,
                        carrier_id  = item.carrier_id,
                        status      = "600",
                        status_desc = "已发货"
                    };
                    UpdateOrderList.Add(Entity);
                }
            }
            //更新订单状态
            int Num = this._currentDAO.BatchChangeOrderStatus(UpdateOrderList);

            if (Num > 0)
            {//添加状态操作记录
                var inoutStatus  = new TInoutStatusBLL(LoggingSessionInfo);
                var vipBll       = new VipBLL(LoggingSessionInfo);
                var inoutService = new Inout3Service(LoggingSessionInfo);
                var CommonBLL    = new CommonBLL();
                foreach (var itemes in UpdateOrderList)
                {
                    var info = new TInoutStatusEntity()
                    {
                        InoutStatusID = Guid.Parse(Utils.NewGuid()),
                        OrderID       = itemes.order_id,
                        CustomerID    = LoggingSessionInfo.ClientID,
                        Remark        = Remark,
                        OrderStatus   = 600,
                        StatusRemark  = "订单状态从未发货变为已发货[操作人:" + LoggingSessionInfo.CurrentUser.User_Name + "]"
                    };
                    //执行
                    inoutStatus.Create(info);

                    #region 发送微信模板消息
                    //获取订单
                    var OerderInfoData = this._currentDAO.GetByID(itemes.order_id);
                    if (OerderInfoData != null)
                    {
                        //获取会员信息
                        var vipInfo = vipBll.GetByID(OerderInfoData.vip_no);
                        if (vipInfo != null)
                        {
                            //物流公司
                            itemes.carrier_name = "";//inoutService.GetCompanyName(itemes.carrier_id);
                            //  CommonBLL.SentShipMessage(itemes, vipInfo.WeiXinUserId, itemes.vip_no, LoggingSessionInfo);
                            new SendOrderSendMsgBLL().SentShipMessage(itemes, vipInfo.WeiXinUserId, itemes.vip_no, LoggingSessionInfo);
                        }
                    }
                    #endregion
                }
                //
                Num = UpdateOrderList.Count();
            }
            return(Num);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(TInoutStatusEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 订单审批
        /// </summary>
        /// <param name="pParams"></param>
        public void OrdersApprove(Dictionary <string, string> pParams)
        {
            TInoutEntity       orderEntity  = new TInoutEntity();
            TInoutStatusEntity statusEntity = new TInoutStatusEntity();

            TInoutDetailEntity[] orderDetailEntity = null;

            #region 拼接查询SQL
            StringBuilder strSearchSql = new StringBuilder();
            strSearchSql.AppendFormat(@"
            select 
	            inout.order_id OrdersID
	            ,inout.order_no OrdersNo
                ,ISNULL(store.UsedAmount,0) UsedAmount
                ,ISNULL(store.StockAmount,0) StockAmount
                ,store.*
            from T_Inout inout
            inner join T_Inout_Detail inout_detail on inout.order_id=inout_detail.order_id
            inner join StoreItemDailyStatus store on inout_detail.sku_id=store.SkuID
            where inout.customer_id='{0}' and inout.order_id='{1}'
            and store.StatusDate between cast(inout_detail.Field1 as datetime) and convert(char(10),dateadd(dd,-1,inout_detail.Field2),120)                   
            order by store.StatusDate", CurrentUserInfo.ClientID, pParams["pOrdersID"]);
            #endregion

            DataSet dsSource = this.SQLHelper.ExecuteDataset(strSearchSql.ToString());
            StoreItemDailyStatusEntity[] storeEntity = ConvertHelper <StoreItemDailyStatusEntity> .ConvertToList(dsSource.Tables[0]).ToArray();

            SqlTransaction tran = this.SQLHelper.CreateTransaction();
            using (tran.Connection)
            {
                try
                {
                    //更新订单主表信息
                    if (pParams.ContainsKey("pOrdersID"))
                    {
                        orderDetailEntity = new TInoutDetailDAO(CurrentUserInfo).QueryByEntity(new TInoutDetailEntity {
                            order_id = pParams["pOrdersID"]
                        }, null);
                        orderEntity            = GetByID(pParams["pOrdersID"]);
                        orderEntity.Status     = pParams["pOrdersStatus"];
                        orderEntity.StatusDesc = pParams["pOrdersDesc"];
                        orderEntity.Field7     = orderEntity.Status;
                        orderEntity.Field10    = orderEntity.StatusDesc;

                        if (pParams["pRemark"] != null && pParams["pRemark"] != "")
                        {
                            orderEntity.Remark = pParams["pRemark"];
                        }
                        orderEntity.ModifyTime   = DateTime.Now.ToString();
                        orderEntity.ModifyUserID = CurrentUserInfo.UserID;
                        if (orderEntity.Status == "500" || orderEntity.Status == "400")
                        {
                            T_InoutEntity[] entity = new T_InoutDAO(CurrentUserInfo).QueryByEntity(new T_InoutEntity {
                                order_id = pParams["pOrdersID"]
                            }, null);
                            new VipDAO(this.CurrentUserInfo).ProcSetCancelOrder(this.CurrentUserInfo.ClientID, pParams["pOrdersID"], entity[0].vip_no);
                        }
                        Update(orderEntity);
                    }

                    //更新房态 库存数量
                    if (storeEntity != null && storeEntity.Length > 0)
                    {
                        for (int i = 0; i < storeEntity.Length; i++)
                        {
                            if (pParams["pOrdersType"].ToString() == "1")
                            {
                                //1.审核通过
                                if (storeEntity[i].StockAmount != 0 && storeEntity[i].StockAmount > 0)
                                {
                                    storeEntity[i].StockAmount = storeEntity[i].StockAmount - (int)Math.Round((decimal)orderDetailEntity[0].OrderQty, 0);
                                }
                                if (storeEntity[i].UsedAmount != 100 && storeEntity[i].UsedAmount < 100)
                                {
                                    storeEntity[i].UsedAmount = storeEntity[i].UsedAmount + (int)Math.Round((decimal)orderDetailEntity[0].OrderQty, 0);
                                }
                                storeEntity[i].LastUpdateBy   = CurrentUserInfo.UserID;
                                storeEntity[i].LastUpdateTime = DateTime.Now;
                            }
                            else
                            {
                                //2.审核不通过
                                if (storeEntity[i].StockAmount != 100 && storeEntity[i].StockAmount < 100)
                                {
                                    storeEntity[i].StockAmount += (int)Math.Round((decimal)orderDetailEntity[0].OrderQty, 0);
                                }
                                if (storeEntity[i].UsedAmount != 0 && storeEntity[i].UsedAmount > 0)
                                {
                                    storeEntity[i].UsedAmount -= (int)Math.Round((decimal)orderDetailEntity[0].OrderQty, 0);
                                }
                                storeEntity[i].LastUpdateBy   = CurrentUserInfo.UserID;
                                storeEntity[i].LastUpdateTime = DateTime.Now;
                            }
                            new StoreItemDailyStatusDAO(CurrentUserInfo).Update(storeEntity[i]);
                        }
                    }

                    //添加订单操作流水
                    statusEntity.OrderID     = pParams["pOrdersID"];
                    statusEntity.OrderStatus = int.Parse(pParams["pOrdersStatus"]);
                    if (pParams["pCheckResult"] != null && pParams["pCheckResult"] != "")
                    {
                        statusEntity.CheckResult = int.Parse(pParams["pCheckResult"]);
                    }
                    statusEntity.CustomerID = CurrentUserInfo.ClientID;
                    statusEntity.CreateBy   = CurrentUserInfo.UserID;
                    new TInoutStatusDAO(CurrentUserInfo).Create(statusEntity);
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    Loggers.Exception(new ExceptionLogInfo()
                    {
                        ClientID = CurrentUserInfo.ClientID, UserID = CurrentUserInfo.UserID, ErrorMessage = ex.Message
                    });
                    tran.Rollback();
                }
            }
        }
Ejemplo n.º 11
0
        protected override ProcessActionRD ProcessRequest(APIRequest <ProcessActionRP> pRequest)
        {
            #region 错误码
            const int ERROR_ORDER_NOTEXISTS = 301;
            const int ERROR_ORDER_PROCESSED = 302;
            #endregion
            ProcessActionRD rd               = new ProcessActionRD();
            T_InoutBLL      _TInoutbll       = new T_InoutBLL(this.CurrentUserInfo);      //订单表
            TInoutStatusBLL _TInoutStatusBLL = new TInoutStatusBLL(this.CurrentUserInfo); //日志表
            VipIntegralBLL  vipIntegralBLL   = new VipIntegralBLL(this.CurrentUserInfo);  //会员业务对象实例化
            var             UserBLL          = new T_UserBLL(this.CurrentUserInfo);       //员工实例

            string OrderID         = pRequest.Parameters.OrderID;                         //订单ID
            string ActionCode      = pRequest.Parameters.ActionCode;                      //订单操作码(当前订单状态码作为操作码)
            string ActionParameter = pRequest.Parameters.ActionParameter;                 //订单操作参数,可为空
            string DeliverCompany  = pRequest.Parameters.DeliverCompany;                  //快递公司
            string DeliverOrder    = pRequest.Parameters.DeliverOrder;                    //快递单号

            string VipID = pRequest.UserID;
            if (pRequest.ChannelId != "2")
            {
                VipID = pRequest.Parameters.VipID;
            }

            var tran = _TInoutbll.GetTran();
            using (tran.Connection)//事物
            {
                try
                {
                    #region 1.根据订单ID,订单操作码更新订单表中订单状态和状态描述

                    var entity = _TInoutbll.GetInoutInfo(OrderID, this.CurrentUserInfo); //根据标识获取新的实例

                    if (entity.status == ActionCode)                                     //判断是否重复操作
                    {
                        throw new APIException("操作已处理")
                              {
                                  ErrorCode = ERROR_ORDER_PROCESSED
                              }
                    }
                    ;

                    #region 当状态为完成时,返现,返积分
                    if (ActionCode == "700" && entity.status != "700")
                    {
                        //确认收货时处理积分、返现、佣金[完成订单]
                        // vipIntegralBLL.OrderReward(entity, tran);
                        new SendOrderRewardMsgBLL().OrderReward(entity, this.CurrentUserInfo, tran);//存入到缓存
                    }

                    #endregion
                    if (entity == null)
                    {
                        throw new APIException(string.Format("未找到OrderID:{0}订单", pRequest.Parameters.OrderID))
                              {
                                  ErrorCode = ERROR_ORDER_NOTEXISTS
                              }
                    }
                    ;

                    if (entity.status == ActionCode) //如果状态以及国内是要提交的状态了,就不要再提交了
                    {
                        return(rd);
                    }

                    string Updatebeforestatus = entity.status_desc;                       //更新之前的订单状态描述
                    entity.status         = ActionCode;                                   //输入的状态码
                    entity.Field7         = ActionCode;
                    entity.status_desc    = GetStatusDesc(ActionCode);                    //输入的状态码对应的状态描述
                    entity.Field10        = GetStatusDesc(ActionCode);                    //Field10=status_desc状态描述
                    entity.modify_time    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //修改时间
                    entity.modify_user_id = pRequest.UserID;                              //修改人

                    if (ActionCode == "600" || !string.IsNullOrEmpty(DeliverOrder) || !string.IsNullOrEmpty(DeliverCompany))
                    {
                        entity.Field9     = DateTime.Now.ToSQLFormatString();
                        entity.Field2     = DeliverOrder;   //快递单号
                        entity.carrier_id = DeliverCompany; //快递单号
                        //更新订单配送商及配送单号
                    }

                    if (ActionCode == "700" && pRequest.ChannelId != "2")
                    {
                        if (string.IsNullOrEmpty(entity.sales_user))
                        {
                            entity.sales_user = pRequest.UserID;//把当前用户作为服务人员。****!!
                        }
                        //更新订单支付状态
                        entity.Field1       = "1";
                        entity.accpect_time = DateTime.Now.ToString();

                        #region 提货,订单明细修改

                        T_Inout_DetailBLL  inoutDetailBll     = new T_Inout_DetailBLL(CurrentUserInfo);
                        VipAmountDetailBLL vipAmountDetailBll = new VipAmountDetailBLL(CurrentUserInfo);
                        if (pRequest.Parameters.OrderItemInfoList != null)
                        {
                            foreach (var item in pRequest.Parameters.OrderItemInfoList)
                            {
                                T_Inout_DetailEntity inoutDetailEntity = inoutDetailBll.QueryByEntity(new T_Inout_DetailEntity()
                                {
                                    order_id = OrderID, sku_id = item.SkuId
                                }, null).FirstOrDefault();
                                var vipAmountDetailEntity = vipAmountDetailBll.QueryByEntity(new VipAmountDetailEntity()
                                {
                                    ObjectId = OrderID, AmountSourceId = "1"
                                }, null).FirstOrDefault();
                                //将提货金额 + 余额 = SumPrice
                                if (vipAmountDetailEntity != null)
                                {
                                    item.SumPrice += Math.Abs(Convert.ToDecimal(vipAmountDetailEntity.Amount));
                                }
                                inoutDetailEntity.enter_qty    = item.EnterQty;
                                inoutDetailEntity.Field9       = "kg";
                                inoutDetailEntity.enter_amount = item.SumPrice;
                                inoutDetailEntity.enter_price  = Convert.ToDecimal(Math.Round(item.SumPrice / item.EnterQty, 2));
                                entity.total_amount            = entity.total_amount + Math.Round(Convert.ToDecimal(item.SumPrice / (entity.discount_rate / 100)), 2) - inoutDetailEntity.retail_amount;
                                entity.total_retail            = entity.total_amount;
                                entity.actual_amount           = entity.actual_amount + Math.Round(Convert.ToDecimal(item.SumPrice / (entity.discount_rate / 100)), 2) - inoutDetailEntity.retail_amount;
                                inoutDetailBll.Update(inoutDetailEntity, tran);
                            }
                        }
                        #endregion
                    }
                    entity.accpect_time = DateTime.Now.ToString();
                    _TInoutbll.Update(entity, tran); //用事物更新订单表(T_Inout)
                    #endregion



                    #region 2.根据订单ID更新订单日志表中数据

                    string CreateName = "";
                    if (pRequest.ChannelId != "2")
                    {
                        var UserData = UserBLL.GetByID(this.CurrentUserInfo.CurrentUser.User_Id);
                        CreateName = string.Format("[操作人:{0}]", (UserData == null ? "" : UserData.user_name));
                    }
                    else
                    {
                        CreateName = "[操作人:客户]";
                    }



                    var _TInoutStatusEntity = new TInoutStatusEntity()
                    {
                        InoutStatusID = Guid.NewGuid(),
                        OrderID       = OrderID,                                                                     //订单ID
                        OrderStatus   = Convert.ToInt32(ActionCode),                                                 //状态码
                        //StatusRemark = "订单状态从" + Updatebeforestatus + "变为" + GetStatusDesc(ActionCode) + "[操作人:" + CurrentUserInfo.CurrentUser.User_Name + "]",               //状态更新描述
                        StatusRemark = "订单状态从" + Updatebeforestatus + "变为" + GetStatusDesc(ActionCode) + CreateName, //状态更新描述
                        CustomerID   = CurrentUserInfo.ClientID                                                      //客户ID
                    };
                    _TInoutStatusBLL.Create(_TInoutStatusEntity, tran);                                              //用事物更新,向日志表(TInoutStatus)中插入一条数据
                    #endregion

                    tran.Commit();

                    if (ActionCode == "600")
                    {
                        #region 处理订单发货发送微信模板消息
                        //获取会员信息
                        var vipBll       = new VipBLL(CurrentUserInfo);
                        var vipInfo      = vipBll.GetByID(entity.vip_no);
                        var inoutService = new Inout3Service(CurrentUserInfo);
                        //物流公司
                        string LogisticsName = inoutService.GetCompanyName(entity.carrier_id);

                        var InoutInfo = new InoutInfo()
                        {
                            order_no     = entity.order_no,
                            carrier_name = LogisticsName,
                            vipId        = entity.vip_no,
                            Field2       = entity.Field2
                        };

                        //  var CommonBLL = new CommonBLL();
                        //   CommonBLL.SentShipMessage(InoutInfo, vipInfo.WeiXinUserId, InoutInfo.vip_no, CurrentUserInfo);
                        new SendOrderSendMsgBLL().SentShipMessage(InoutInfo, vipInfo.WeiXinUserId, InoutInfo.vip_no, CurrentUserInfo);
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw new APIException(ex.Message)
                          {
                              ErrorCode = ERROR_ORDER_NOTEXISTS
                          };
                }
            }
            return(rd);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(TInoutStatusEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(TInoutStatusEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <TInoutStatusEntity> PagedQueryByEntity(TInoutStatusEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public TInoutStatusEntity[] QueryByEntity(TInoutStatusEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
        public void AutoSetOrderNotPayCache()
        {
            foreach (var customer in _CustomerIDList)
            {
                _T_loggingSessionInfo.ClientID = customer.Key;
                _T_loggingSessionInfo.CurrentLoggingManager.Connection_String = customer.Value;

                //
                _T_InoutBLL    = new T_InoutBLL(_T_loggingSessionInfo);
                _Inout3Service = new InoutService(_T_loggingSessionInfo);
                var inoutStatus = new TInoutStatusBLL(_T_loggingSessionInfo);
                _VipBLL = new VipBLL(_T_loggingSessionInfo);

                //
                // var t_InoutList = new List<string>();
                try
                {
                    List <IWhereCondition> complexCondition = new List <IWhereCondition>();
                    string[] statusArr = { "620", "610", "600" };
                    complexCondition.Add(new InCondition <string>()
                    {
                        FieldName = "Field7", Values = statusArr
                    });
                    complexCondition.Add(
                        new DirectCondition(
                            " CONVERT(NVARCHAR(10),complete_date,120) = CONVERT(NVARCHAR(10),DATEADD(day, -1, GETDATE()),120)"));

                    var t_InoutEntitys = _T_InoutBLL.Query(complexCondition.ToArray(), null);
                    if (t_InoutEntitys == null || t_InoutEntitys.Count() <= 0)
                    {
                    }
                    //
                    //   roleList = roleEntities.Select(it => it.role_id).ToList();

                    foreach (var t_InoutInfo in t_InoutEntitys)
                    {
                        TInoutStatusEntity info = new TInoutStatusEntity();
                        info.InoutStatusID = Guid.Parse(Utils.NewGuid());
                        info.OrderID       = t_InoutInfo.order_id;
                        info.CustomerID    = _T_loggingSessionInfo.ClientID;
                        info.Remark        = string.Empty;
                        info.OrderStatus   = 700;

                        string statusDesc = GetStatusDesc("700");//变更后的状态名称

                        try
                        {
                            info.StatusRemark = "订单状态从" + t_InoutInfo.status_desc + "变为" + statusDesc + "[操作人:自动]";
                            _Inout3Service.UpdateOrderDeliveryStatus(t_InoutInfo.order_id, "700", Utils.GetNow());
                        }
                        catch
                        {
                            continue;
                        }

                        inoutStatus.Create(info);

                        #region 支付成功,调用RabbitMQ发送给ERP

                        try
                        {
                            var msg = new EventContract
                            {
                                Operation  = OptEnum.Update,
                                EntityType = EntityTypeEnum.Order,
                                Id         = t_InoutInfo.order_id
                            };
                            var eventService = new EventService();
                            eventService.PublishMsg(msg);
                        }
                        catch (Exception ex)
                        {
                            throw new Exception(ex.Message);
                        }

                        #endregion
                    }
                }
                catch
                {
                    // ignored
                }
            }
        }
Ejemplo n.º 17
0
 public void Create(TInoutStatusEntity dbEntity)
 {
     _cmd.Create(dbEntity);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(TInoutStatusEntity pEntity)
 {
     _currentDAO.Update(pEntity);
 }