Esempio n. 1
0
        /// <summary>
        /// 编辑备注
        /// </summary>
        /// <param name="rParams"></param>
        /// <returns></returns>
        public string EditOrderRemark(NameValueCollection rParams)
        {
            string       res    = "{success:false,msg:'操作失败'}";
            TInoutEntity entity = new TInoutEntity();

            if (!string.IsNullOrEmpty(rParams["id"]))
            {
                entity = new TInoutBLL(CurrentUserInfo).GetByID(rParams["id"]);
            }
            entity = DataLoader.LoadFrom <TInoutEntity>(rParams, entity);
            new TInoutBLL(CurrentUserInfo).Update(entity);
            res = "{success:true,msg:'保存成功'}";
            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据订单ID获取订单明细
        /// </summary>
        /// <param name="pEntity"></param>
        /// <returns></returns>
        public DataSet HS_GetOrderDetail(TInoutEntity pEntity)
        {
            #region 拼接SQL
            StringBuilder strSql = new StringBuilder();
            strSql.AppendFormat(@"
            select
	            inout.order_id OrdersID
	            ,inout.order_no OrderNo
	            ,inout.order_date OrderDate
	            ,inout.Field1 
	            ,inout.Field2
	            ,inout.Field3
	            ,inout.Field4
	            ,inout.Field5
	            ,inout.Field6
	            ,inout.Field7
	            ,inout.Field8
	            ,inout.Field9
	            ,opt.OptionText Field10
                ,opt1.OptionText Field11
                ,opt2.OptionText Field15
                ,inout.Field12
                ,inout.Field13
                ,inout.Field14
                ,inout.Field16
                ,inout.Field17
                ,inout.Field18
                ,inout.Field19
                ,inout.Field20
	            ,vip.VipName
            from T_Inout inout
            left join vip vip on inout.vip_no=vip.VIPID and vip.ClientID=inout.customer_id and vip.IsDelete=0
            left join Options opt on inout.Field7=opt.OptionValue and opt.OptionName='OrdersStatus' and opt.ClientID=vip.ClientID and opt.IsDelete=0
            left join Options opt1 on inout.Field11=opt1.OptionValue and opt1.OptionName='BuyWay' and opt1.ClientID=vip.ClientID and opt1.IsDelete=0
            left join Options opt2 on inout.Field15=opt2.OptionValue and opt2.OptionName='GetWay' and opt2.ClientID=vip.ClientID and opt2.IsDelete=0
            where customer_id='{0}' and inout.order_id='{1}'", CurrentUserInfo.ClientID, pEntity.OrderID);

            return(this.SQLHelper.ExecuteDataset(strSql.ToString()));

            #endregion
        }
Esempio n. 3
0
        /// <summary>
        /// 订单提交
        /// </summary>
        /// <returns></returns>
        public string AddOrders()
        {
            string content  = string.Empty;
            var    respData = new OrdersInfoRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <OrdersInfoReqData>();
                reqObj = reqObj == null ? new OrdersInfoReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content           = new OrdersInfoRespContentData();
                respData.content.orderList = new List <OrdersInfoRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                TInoutBLL    inoutBLL    = new TInoutBLL(loggingSessionInfo);
                TInoutEntity inoutEntity = new TInoutEntity();



                //添加订单
                inoutEntity.OrderID        = Guid.NewGuid().ToString();
                inoutEntity.OrderTypeID    = "1F0A100C42484454BAEA211D4C14B80F";
                inoutEntity.OrderReasonID  = "2F6891A2194A4BBAB6F17B4C99A6C6F5";
                inoutEntity.OrderNo        = GetOrdersNo();
                inoutEntity.VipNo          = reqObj.common.userId;
                inoutEntity.OrderDate      = DateTime.Now.ToString("yyyy-MM-dd");
                inoutEntity.RedFlag        = "1";
                inoutEntity.Status         = "100";
                inoutEntity.StatusDesc     = "未审核";
                inoutEntity.PurchaseUnitID = ConfigurationManager.AppSettings["HS_PurchaseUnitID"].ToString();
                inoutEntity.CreateTime     = DateTime.Now.ToString();

                if (reqObj.special.photo.Length > 0)
                {
                    var length = reqObj.special.photo.Length;
                    inoutEntity.Field1 = length >= 1 ? reqObj.special.photo[0].ToString() : "";
                    inoutEntity.Field2 = length >= 2 ? reqObj.special.photo[1].ToString() : "";
                    inoutEntity.Field3 = length >= 3 ? reqObj.special.photo[2].ToString() : "";
                    inoutEntity.Field4 = length >= 4 ? reqObj.special.photo[3].ToString() : "";
                    inoutEntity.Field5 = length >= 5 ? reqObj.special.photo[4].ToString() : "";
                    inoutEntity.Field6 = length >= 6 ? reqObj.special.photo[5].ToString() : "";
                }
                inoutEntity.Field7  = "100";                   //后台查询订单用
                inoutEntity.Field10 = "";                      //订单状态

                inoutEntity.Field8 = reqObj.special.model;     //产品型号
                inoutEntity.Field9 = reqObj.special.serial;    //产品序列号

                inoutEntity.Field11 = reqObj.special.buyWay;   //购买方式 关联Option
                inoutEntity.Field12 = reqObj.special.name;     //客户姓名
                inoutEntity.Field13 = reqObj.special.mobile;   //电话
                inoutEntity.Field14 = reqObj.special.email;    //Email
                inoutEntity.Field15 = reqObj.special.getWay;   //客户获取方式 关联Option
                inoutEntity.Field16 = reqObj.special.date;     //订单日期
                inoutEntity.Field17 = reqObj.special.price;    //订单价格

                inoutEntity.Field18 = reqObj.special.school;   //学校
                inoutEntity.Field19 = reqObj.special.specialt; //专业
                inoutEntity.Field20 = reqObj.special.intent;   //购买前意向



                inoutEntity.CustomerID = reqObj.common.customerId;

                inoutBLL.Create(inoutEntity);

                respData.code        = "200";
                respData.description = "操作成功";
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
Esempio n. 4
0
 /// <summary>
 /// 根据订单ID获取订单明细 和 订单流水信息
 /// </summary>
 /// <param name="pEntity"></param>
 /// <returns></returns>
 public DataSet HS_GetOrdersDetail(TInoutEntity pEntity)
 {
     return(this._currentDAO.HS_GetOrderDetail(pEntity));
 }
Esempio n. 5
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();
                }
            }
        }
Esempio n. 6
0
 public void Update(TInoutEntity pEntity, IDbTransaction pTran, bool pIsUpdateNullField)
 {
     _currentDAO.Update(pEntity, pTran, pIsUpdateNullField);
 }
Esempio n. 7
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(TInoutEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
Esempio n. 8
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(TInoutEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Esempio n. 9
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <TInoutEntity> PagedQueryByEntity(TInoutEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Esempio n. 10
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public TInoutEntity[] QueryByEntity(TInoutEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
Esempio n. 11
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Delete(TInoutEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Delete(pEntity, pTran);
 }
Esempio n. 12
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(TInoutEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
Esempio n. 13
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(TInoutEntity pEntity)
 {
     _currentDAO.Update(pEntity);
 }