/// <summary> /// /// </summary> /// <param name="SysNo"></param> /// <returns></returns> /// <remarkss>2016-04-05 王耀发 创建</remarks> public override int InsertLgGaoJiePushInfoEntity(LgGaoJiePushInfo entity) { entity.SysNo = Context.Insert("LgGaoJiePushInfo", entity) .AutoMap(o => o.SysNo) .ExecuteReturnLastId <int>("SysNo"); return(entity.SysNo); }
/// <summary> /// 保存高捷商品推送信息 /// </summary> /// <param name="model"></param> /// <returns></returns> /// <remarks>2016-04-05 王耀发 创建</remarks> public Result InsertLgGaoJiePushInfoEntity(LgGaoJiePushInfo model, SyUser user) { Result r = new Result() { Status = false }; model.CreatedDate = DateTime.Now; model.CreatedBy = user.SysNo; model.LastUpdateBy = user.SysNo; model.LastUpdateDate = DateTime.Now; ILogisticsDao.Instance.InsertLgGaoJiePushInfoEntity(model); r.Status = true; return(r); }
public override Result AddOrderTrade(int orderSysno) { //throw new NotImplementedException(); List <SoOrderSyncLogisticsLog> logList = SoOrderSyncLogisticsLogBo.Instance.GetModelList(orderSysno); List <SoOrderSyncLogisticsLog> haveLogisticsList = logList.Where(p => p.Code == (int)this.Code && p.StatusCode == "OK" && !string.IsNullOrEmpty(p.LogisticsOrderId)).ToList(); SoOrderSyncLogisticsLog nowLogistics = null; if (haveLogisticsList.Count == 0) { Result expressResult = GetExpressno(orderSysno.ToString()); nowLogistics = (expressResult as Result <SoOrderSyncLogisticsLog>).Data; if (!expressResult.Status) { return(expressResult); } } else { nowLogistics = haveLogisticsList[0]; } var order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysno); var config = Hyt.BLL.Config.Config.Instance.GetGaoJieConfig(); var result = new Result <string>(); WhWarehouse warehouseMod = Hyt.BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo); BsArea wareDistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(warehouseMod.AreaSysNo); BsArea wareCityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(wareDistrictEntity.ParentSysNo); SoReceiveAddress srenity = Hyt.BLL.Order.OutboundReturnBo.Instance.GetSoReceiveAddressBysoOrderSysNo(order.SysNo); string buyer_idcard = ""; if (!string.IsNullOrEmpty(srenity.IDCardNo)) { buyer_idcard = srenity.IDCardNo.Trim(); } BsArea DistrictEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(srenity.AreaSysNo); string District = DistrictEntity.AreaName.Trim(); BsArea CityEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(DistrictEntity.ParentSysNo); string City = CityEntity.AreaName.Trim(); BsArea ProvinceEntity = Hyt.BLL.Basic.BasicAreaBo.Instance.GetArea(CityEntity.ParentSysNo); string Province = ProvinceEntity.AreaName.Trim(); CBFnOnlinePayment payment = FinanceBo.Instance.GetOnPaymentBySourceSysNo(order.SysNo); IList <CBSoOrderItem> datao = SoOrderBo.Instance.GetCBOrderItemsByOrderId(order.SysNo); List <int> ProSysNo = new List <int>(); foreach (CBSoOrderItem item in datao) { ProSysNo.Add(item.ProductSysNo); } IList <CBPdProduct> productList = Hyt.BLL.Product.PdProductBo.Instance.GetProductInfoList(ProSysNo); decimal goodsGweight = 0; foreach (var mod in productList) { goodsGweight += mod.GrosWeight; } LgGaoJiePushInfo model = new LgGaoJiePushInfo(); string strorder = ""; strorder += "{\"order_sn\":\"" + order.OrderNo + "\",\"pfreight_no\":\"\",\"express_num\":\"" + nowLogistics.LogisticsOrderId + "\","; strorder += "\"sender_name\":\"" + warehouseMod.Contact + "\",\"sender_city\":\"" + wareCityEntity.AreaName + "\",\"sender_address\":\"" + warehouseMod.StreetAddress + "\","; strorder += "\"sender_phone\":\"" + warehouseMod.Phone + "\",\"sender_country_code\":\"" + wareCityEntity.AreaCode + "\","; strorder += "\"buyer_name\":\"" + srenity.Name + "\",\"buyer_idcard\":\"" + buyer_idcard + "\",\"buyer_phone\":\"" + srenity.MobilePhoneNumber + "\","; strorder += "\"province_code\":\"" + ProvinceEntity.AreaCode + "" + "\",\"buyer_address\":\"" + Province + "^^^" + City + "^^^" + District + "^^^" + srenity.StreetAddress + "\","; strorder += "\"curr\":\"502" + "\",\"pkg_gweight\":" + goodsGweight + ",\"p_name\":\"" + (payment == null ? "" : payment.PaymentName) + "\",\"p_no\":\"" + (payment == null ? "" : payment.VoucherNo) + "\","; strorder += "\"p_time\":\"" + (payment == null ? DateTime.Now.ToString("yyyy-mm-dd hh :MM") : payment.CreatedDate.ToString("yyyy-mm-dd hh :MM")) + "\",\"sh_fee\":\"" + order.FreightAmount.ToString() + "\","; strorder += "\"cus_tax\":\"" + order.TaxFee.ToString() + "\",\"pweb\":\"" + config.pweb + "\",\"web_name\":\"" + config.web_name + "\",\"re_no\":\"" + config.re_no + "\",\"re_name\":\"" + config.re_name + "\","; strorder += "\"order_goods\":"; strorder += "["; string str = ""; int i = 0; foreach (CBSoOrderItem item in datao) { //LgGaoJieGoodsInfo goodsInfo = LogisticsBo.Instance.GetLgGaoJieGoodsInfoEntityByPid(item.ProductSysNo); List <CBPdProduct> tempProductList = productList.Where(p => p.SysNo == item.ProductSysNo).ToList(); var originInfo = BLL.Basic.OriginBo.Instance.GetEntity(tempProductList[0].OriginSysNo); var brandInfo = BLL.Product.PdBrandBo.Instance.GetEntity(tempProductList[0].BrandSysNo); string ycg_code = originInfo != null ? originInfo.CusOriginNO : ""; if (i > 0) { str += ",{"; } else { str += "{"; } str += "\"goods_ptcode\":\"" + tempProductList[0].ProductDeclare; str += "\",\"goods_name\":\"" + tempProductList[0].ProductName; str += "\",\"brand\":\"" + brandInfo.Name; str += "\",\"goods_spec\":\"" + tempProductList[0].GrosWeight + "kg"; str += "\",\"goods_num\":\"" + item.Quantity.ToString(); str += "\",\"goods_price\":\"" + item.SalesUnitPrice.ToString(); str += "\",\"ycg_code\":\"" + originInfo.CusOriginNO; str += "\",\"goods_barcode\":\"" + tempProductList[0].Barcode.Trim() + "\""; str += "}"; i++; } strorder += str; strorder += "]}"; string orders = strorder; strorder = EncodeBase64(EncodeBase64(strorder)); var strPost = "&seller=" + EncodeBase64(config.seller) + "&api_key=" + EncodeBase64(config.api_key) + "&mark=" + EncodeBase64("order") + "&confirm=" + EncodeBase64("2") + "&order=" + strorder; var strResult = GetResponse(url, strPost); var json = JObject.Parse(strResult); string jsons = json.ToString(); result.Status = true; result.Data = json.ToString(); var soOrderSyncLogisticsLog = new SoOrderSyncLogisticsLog(); soOrderSyncLogisticsLog.OrderSysNo = orderSysno; soOrderSyncLogisticsLog.Code = (int)this.Code; soOrderSyncLogisticsLog.CreateDate = DateTime.Now; soOrderSyncLogisticsLog.CreatedBy = BLL.Authentication.AdminAuthenticationBo.Instance.Current.Base.SysNo; soOrderSyncLogisticsLog.LastUpdateBy = 0; soOrderSyncLogisticsLog.LastUpdateDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue; soOrderSyncLogisticsLog.Packets = orders.ToString(); soOrderSyncLogisticsLog.ReceiptContent = json.ToString(); soOrderSyncLogisticsLog.LogisticsOrderId = ""; //var model = new LgGaoJiePushInfo(); //model.OrderSysNo = orderSysno; //model.OrderInfo = orders.ToString(); ////保存订单回执信息 //model.ReturnInfo = json.ToString(); ////保存推送回执信息 //LogisticsBo.Instance.InsertLgGaoJiePushInfoEntity(model, BLL.Authentication.AdminAuthenticationBo.Instance.Current.Base); string state = json["flag"].ToString().ToLower(); //推送成功 if (state == "ok" || json["info"].ToString() == "重复下单") { result.Status = true; result.Message = json["info"].ToString(); soOrderSyncLogisticsLog.StatusCode = ""; soOrderSyncLogisticsLog.StatusMsg = result.Message; //更新物流状态CBLogisticsSendStatus BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus((int)Hyt.Model.WorkflowStatus.OrderStatus.跨境物流推送状态.已推送, 3, orderSysno); } else { result.Status = false; result.Message = json["info"].ToString(); soOrderSyncLogisticsLog.StatusCode = ""; soOrderSyncLogisticsLog.StatusMsg = result.Message; BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus((int)Hyt.Model.WorkflowStatus.OrderStatus.跨境物流推送状态.失败, 3, orderSysno); } SoOrderSyncLogisticsLogBo.Instance.Insert(soOrderSyncLogisticsLog); return(result); }
/// <summary> /// 插入数据 /// </summary> /// <param name="entity">数据实体</param> /// <returns>新增记录编号</returns> /// <remarkss>2016-04-05 王耀发 创建</remarks> public abstract int InsertLgGaoJiePushInfoEntity(LgGaoJiePushInfo entity);