Exemple #1
0
        /// <summary>
        /// 生成UU配送订单
        /// </summary>
        /// <returns></returns>
        public string AddUUOrder(DistributionApiModel model)
        {
            string             msg = "";
            UUCustomerRelation customerRelation = UUCustomerRelationBLL.SingleModel.GetModelByAid(model.aid, model.storeid, 0);

            if (customerRelation == null)
            {
                msg = "请先配置UU配送";
                return(msg);
            }
            UUOrderFee feeResult = GetUUFee(model.storeid, model.aid, model.address, ref msg);

            if (msg.Length > 0)
            {
                return(msg);
            }
            string orderNum  = CommonCore.GetOrderNumByUserId(model.userid.ToString());
            string appid     = UUApi._appid;
            string timestamp = UUApi.GetTimestamp();
            //店铺信息
            ShopInfo shopInfo = GetStoreAddressPoint(customerRelation.AId, customerRelation.StoreId, model.temptype);

            //生成订单实体类对象
            UUOrder data = new UUOrder(appid, timestamp, customerRelation.OpenId, feeResult.price_token, feeResult.total_money, feeResult.need_paymoney, model.accepterName, model.accepterTelePhone, model.remark, UUApi._notisUrl, customerRelation.AId, customerRelation.StoreId, model.temptype, model.ordertype, model.orderid, orderNum);

            TransactionModel tran = new TransactionModel();

            tran.Add(base.BuildAddSql(data));

            if (!ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray))
            {
                msg = "添加UU配送订单出错";
            }
            return(msg);
        }
Exemple #2
0
        /// <summary>
        /// 生成快跑者配送订单
        /// </summary>
        /// <param name="rid">权限表ID</param>
        /// <param name="userinfo">用户信息</param>
        /// <param name="orderid">订单ID</param>
        /// <param name="price">订单价格</param>
        /// <param name="receviename">收货人姓名</param>
        /// <param name="receviephone">收货人电话</param>
        /// <param name="address">收货人地址</param>
        /// <param name="lat">纬度</param>
        /// <param name="lnt">经度</param>
        /// <param name="ordertype">看枚举TmpType</param>
        /// <returns></returns>
        public string AddKPZOrder(DistributionApiModel model)
        {
            string           msg           = "";
            KPZStoreRelation storerelation = KPZStoreRelationBLL.SingleModel.GetModelBySidAndAid(model.aid, model.storeid);

            if (storerelation == null)
            {
                msg = "请先配置快跑者配送";
                return(msg);
            }

            //再请求一次腾讯地图,获取准确的坐标
            AddressApi addressModel = AddressHelper.GetLngAndLatByAddress(model.address);

            if (addressModel != null && addressModel.result != null && addressModel.result.location != null)
            {
                model.lnt = addressModel.result.location.lng;
                model.lat = addressModel.result.location.lat;
            }

            TransactionModel tran     = new TransactionModel();
            string           orderno  = CommonCore.GetOrderNumByUserId(model.userid.ToString());
            float            buyprice = model.buyprice / 100.0f;
            float            payfee   = model.fee / 100.0f;
            int paystatus             = 0;
            //店铺信息
            ShopInfo shopinfo = GetStoreAddressPoint(storerelation.AId, storerelation.StoreId, model.temptype);

            //生成订单实体类对象
            KPZOrder data = new KPZOrder(storerelation.Id, shopinfo.ShopName, storerelation.TelePhone, shopinfo.ShopAddress, shopinfo.ShopTag, model.ordercontent, model.remark, orderno, model.accepterName, model.accepterTelePhone, model.address, model.lnt + "," + model.lat, buyprice, buyprice, paystatus, payfee, model.orderid, model.aid, model.temptype, model.storeid);

            tran.Add(base.BuildAddSql(data));

            if (!ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray))
            {
                msg = "添加快跑者配送订单出错";
            }
            return(msg);
        }