/// <summary> /// 创建订单收款单 /// </summary> /// <param name="soOrder">订单</param> /// <returns>FnReceiptVoucher</returns> /// <remarks>2013-07-16 黄伟 创建</remarks> private FnReceiptVoucher CreateReceiptVoucherByOrder(SoOrder soOrder) { var entity = IFnReceiptVoucherDao.Instance.GetEntity((int)FinanceStatus.收款来源类型.销售单, soOrder.SysNo); if (entity != null) { return(null); } var payType = Hyt.BLL.Basic.PaymentTypeBo.Instance.GetEntity(soOrder.PayTypeSysNo); var rv = new FnReceiptVoucher() { TransactionSysNo = soOrder.TransactionSysNo, Status = (int)FinanceStatus.收款单状态.已确认, ConfirmedBy = soOrder.OrderCreatorSysNo, ConfirmedDate = DateTime.Now, Source = (int)FinanceStatus.收款来源类型.销售单, CreatedBy = soOrder.OrderCreatorSysNo, CreatedDate = DateTime.Now, IncomeAmount = soOrder.CashPay, IncomeType = payType.PaymentType, SourceSysNo = soOrder.SysNo }; rv.SysNo = IFnReceiptVoucherDao.Instance.Insert(rv); return(rv); }
/// <summary> /// 获取订单详细信息 /// </summary> /// <param name="orderSysNo">订单编号</param> /// <returns>订单实体信息</returns> /// <remarks>2013-08-16 唐永勤 创建</remarks> /// <remarks>2013-08-29 邵 斌 优化 加入无效订单判断</remarks> public override SoOrder GetEntity(int orderSysNo) { SoOrder entity = new SoOrder(); using (var context = Context.UseSharedConnection(true)) { entity = context.Select <SoOrder>("so.*") .From("SoOrder so") .Where("sysno=@sysno") .Parameter("sysno", orderSysNo) .QuerySingle(); //订单是否有效 if (entity == null) { return(entity); } //获取订单商品详单 entity.OrderItemList = context.Select <SoOrderItem>("*") .From("SoOrderItem") .Where("OrderSysno = @OrderSysno") .Parameter("OrderSysno", entity.SysNo) .OrderBy("sysno desc") .QueryMany(); } return(entity); }
/// <summary> /// 广州电子口岸海关申报 /// </summary> /// <returns></returns> public virtual Result ApplyToCustomsDZ30(SoOrder order) { return(new Result() { Status = false }); }
/// <summary> /// 执行分销商返利 /// </summary> /// <param name="order">订单实体</param> /// <returns></returns> /// <remarks>2015-09-11 杨浩 创建 2015-10-28 王耀发引用</remarks> public void ExecuteSellBusinessRebates(SoOrder order) { CrCustomer customer = GetModel(order.OrderCreatorSysNo); if (customer != null) { int indirect2Id = 0; int indirect1Id = 0; int recommendId = customer.PSysNo; string[] ids = customer.CustomerSysNos.Trim(',').Split(','); int length = ids.Length; if (length >= 3) { indirect1Id = int.Parse(ids[length - 3]); } if (length >= 4) { indirect2Id = int.Parse(ids[length - 4]); } CrSellBusinessRebatesResult sellBusinessRebatesResult = Hyt.DataAccess.CRM.ICrCustomerDao.Instance.ExecuteSellBusinessRebates(customer.PSysNo, order.OrderCreatorSysNo, indirect2Id, indirect1Id, order.SysNo, "2", order.ProductAmount); } }
void BindOrderHeadData(SoOrder order, OrderHead head, CBFnOnlinePayment payment, SoReceiveAddress srenity, string buyer_idcard, string District, string City, string Province, WhWarehouse warehouseMod, BsArea wareDistrictEntity, BsArea wareCityEntity, BsArea wareProvinceEntity) { head.cbeCode = config2.CIECode; head.cbeName = config2.CIEName; head.ecpCode = config2.CIECode; head.ecpName = config2.CIEName; head.orderNo = payment.BusinessOrderSysNo; head.charge = order.OrderAmount; head.goodsValue = order.ProductAmount; head.freight = order.FreightAmount; head.other = 0; head.tax = order.TaxFee; head.currency = "142"; head.customer = srenity.Name; head.shipper = warehouseMod.Contact; head.shipperAddress = wareProvinceEntity.AreaName + " " + wareCityEntity.AreaName + " " + wareDistrictEntity.AreaName + " " + warehouseMod.StreetAddress; head.shipperTelephone = warehouseMod.Phone; head.consignee = srenity.Name; head.consigneeAddress = Province + " " + City + " " + District + " " + srenity.StreetAddress; head.consigneeTelephone = srenity.MobilePhoneNumber; head.idType = "1"; head.customerId = srenity.IDCardNo; head.accessType = "1"; head.ieType = "I"; head.modifyMark = "1"; head.appTime = DateTime.Now.ToString("yyyyMMddHHmmss"); head.appStatus = "2"; }
/// <summary> /// 提交订单到支付方 /// </summary> /// <param name="order">订单实体</param> /// <param name="orderPayLogSysNo">订单支付系统编号</param> /// <returns></returns> /// <remarks>2017-04-02 杨浩 创建</remarks> public virtual Result SubmitOrderToPay(SoOrder order, int orderPayLogSysNo = 0) { return(new Result() { Status = false }); }
/// <summary> /// 作废订单收款单(已付款的生成退款信息) /// </summary> /// <param name="order">订单</param> /// <param name="user">操作用户</param> /// <param name="autoPay">自动付款</param> /// <returns></returns> ///<remarks>2013-07-17 朱成果 创建</remarks> public void CancelOrderReceipt(SoOrder order, SyUser user, bool autoPay = false) { if (order != null) { var entity = Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.GetEntity(sourceFromOrder, order.SysNo); if (entity != null && entity.Status != (int)FinanceStatus.收款单状态.作废) { //已收款,生成新的付款单,否则作废收款单 if (entity.ReceivedAmount > 0) { FnPaymentVoucher pv = new FnPaymentVoucher() { PayableAmount = entity.ReceivedAmount, CreatedBy = user == null ? 0 : user.SysNo, CreatedDate = DateTime.Now, CustomerSysNo = order.CustomerSysNo, Source = (int)FinanceStatus.付款来源类型.销售单, TransactionSysNo = entity.TransactionSysNo, SourceSysNo = order.SysNo, Status = autoPay?(int)FinanceStatus.付款单状态.已付款:(int)FinanceStatus.付款单状态.待付款, Remarks = "订单作废", PayDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue, LastUpdateDate = DateTime.Now }; pv.SysNo = Hyt.DataAccess.Finance.IFnPaymentVoucherDao.Instance.Insert(pv); var list = Hyt.DataAccess.Finance.IFnReceiptVoucherItemDao.Instance.GetListByReceiptNo(entity.SysNo); if (list != null) { foreach (FnReceiptVoucherItem m in list) { FnPaymentVoucherItem p = new FnPaymentVoucherItem() { Amount = m.Amount, CreatedBy = user == null ? 0 : user.SysNo, CreatedDate = DateTime.Now, OriginalVoucherNo = m.VoucherNo, OriginalPaymentTypeSysNo = m.PaymentTypeSysNo, PaymentType = GetPaymentType(m.PaymentTypeSysNo),//支付方式对应付款方式 PaymentVoucherSysNo = pv.SysNo, RefundAccount = m.CreditCardNumber, TransactionSysNo = entity.TransactionSysNo, Status = autoPay? (int)FinanceStatus.付款单明细状态.已付款 : (int)FinanceStatus.付款单明细状态.待付款, PayDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue, LastUpdateDate = DateTime.Now }; Hyt.DataAccess.Finance.IFnPaymentVoucherDao.Instance.InsertItem(p); } } } else { entity.Remark = "订单作废"; entity.Status = (int)FinanceStatus.收款单状态.作废; entity.LastUpdateDate = DateTime.Now; entity.LastUpdateBy = user == null ? 0 : user.SysNo; Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.Update(entity); } } } }
/// <summary> /// 创建订单收款单 /// </summary> /// <param name="soOrder">订单</param> /// <returns>收款单实体</returns> /// <remarks>2013-07-08 朱成果 创建</remarks> public FnReceiptVoucher CreateReceiptVoucherByOrder(SoOrder soOrder) { var entity = Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.GetEntity(sourceFromOrder, soOrder.SysNo); if (entity != null) { return(null); } var payType = Hyt.BLL.Basic.PaymentTypeBo.Instance.GetEntity(soOrder.PayTypeSysNo); FnReceiptVoucher rv = new FnReceiptVoucher() { TransactionSysNo = soOrder.TransactionSysNo, Status = (int)FinanceStatus.收款单状态.待确认, Source = sourceFromOrder, CreatedBy = soOrder.OrderCreatorSysNo, CreatedDate = DateTime.Now, LastUpdateBy = soOrder.OrderCreatorSysNo, LastUpdateDate = DateTime.Now, IncomeAmount = soOrder.CashPay, IncomeType = payType == null?20:payType.PaymentType, SourceSysNo = soOrder.SysNo }; rv.SysNo = Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.Insert(rv); return(rv); }
/// <summary> /// 获取运单号 /// </summary> /// <param name="orderId"></param> /// <returns></returns> /// <remarks>2016-07-19 陈海裕 创建</remarks> public override Result GetOrderExpressno(string orderId) { Result <string> result = new Result <string>(); result.Status = false; result.StatusCode = 0; result.Message = "接口调用失败"; string url = RequestUrl + "express/create"; try { SoOrder order = BLL.Order.SoOrderBo.Instance.GetEntity(TConvert.ToInt32(orderId)); if (order == null) { result.Message = "该订单不存在"; return(result); } LgDeliveryType deliveryType = BLL.Logistics.DeliveryTypeBo.Instance.GetDeliveryType(order.DeliveryTypeSysNo); ParaOnlinePaymentFilter filter = new ParaOnlinePaymentFilter(); filter.OrderSysNo = TConvert.ToInt32(orderId); var onlinePayment = BLL.Finance.FinanceBo.Instance.GetOnlinePayments(filter).Rows.Where(o => o.Status == 1).FirstOrDefault(); CBWhWarehouse warehouse = BLL.Warehouse.WhWarehouseBo.Instance.GetWarehouse(order.DefaultWarehouseSysNo); string _deliveryType = ""; if (deliveryType.DeliveryTypeName.Contains("顺丰")) { _deliveryType = "SF"; //CustomerCode = SFCustomerCode; //Key = SFKey; Token = SFToken; } else if (deliveryType.DeliveryTypeName.Contains("中通")) { _deliveryType = "ZTO"; } if (_deliveryType == "") { result.Message = "友信达物流目前只有支持顺丰和中通两种快递方式"; return(result); } Dictionary <string, string> paramsData = new Dictionary <string, string>(); paramsData.Add("reference_no", onlinePayment.BusinessOrderSysNo); paramsData.Add("warehouse_id", warehouse.LogisWarehouseCode); paramsData.Add("sm_code", _deliveryType); string responseStr = GetResponse(url, InitParams(paramsData)); result = GetResult(JObject.Parse(responseStr), result); if (result.Status == true) { // 生成出库单 } return(result); } catch (Exception ex) { result.Message = "查询订单运单号报错:" + ex.StackTrace; return(result); } }
/// <summary> /// 二期业务数据2段 订单数据 /// </summary> /// <param name="listObject"></param> private void AddBaseTaskObject2ToList3(List <BaseTask> listObject) { BaseTask soOrder = new SoOrder(); BaseTask soOrderItem = new SoOrderItem(); listObject.Add(soOrder); listObject.Add(soOrderItem); }
/// <summary> /// 取消订单 /// </summary> /// <param name="orderSysNo"></param> /// <returns></returns> /// <remarks>2016-07-05 陈海裕 创建</remarks> public override Result CancelOrderTrade(int orderSysNo, string reason = "") { // 订单id,用于日志记录 _orderSysNo = orderSysNo; Result <string> result = new Result <string>(); result.Status = false; result.StatusCode = 0; result.Message = "接口调用失败"; string url = RequestUrl + "order/del"; if (orderSysNo <= 0) { return(result); } try { SoOrder order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysNo); if (order == null) { result.Message = "该订单不存在"; return(result); } ParaOnlinePaymentFilter filter = new ParaOnlinePaymentFilter(); filter.OrderSysNo = orderSysNo; var onlinePayment = BLL.Finance.FinanceBo.Instance.GetOnlinePayments(filter).Rows.Where(o => o.Status == 1).FirstOrDefault(); if (onlinePayment == null) { result.Message = "订单不存在在线支付记录"; return(result); } Dictionary <string, string> paramsData = new Dictionary <string, string>(); paramsData.Add("reference_no", onlinePayment.BusinessOrderSysNo); string postData = InitParams(paramsData); string responseStr = GetResponse(url, postData); result = GetResult(JObject.Parse(responseStr), result); if (result.Status == true) { // 删除物流返回订单记录 //BLL.CrossBorderLogistics.CrossBorderLogisticsOrderBo.Instance.DeleteByOrderSysNo(orderSysNo); BLL.Order.SoOrderSyncLogisticsLogBo.Instance.DeleteByOrderSysNoAndCode(orderSysNo, (int)Code); BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(0, 3, orderSysNo); } } catch (Exception ex) { result.Message = "向" + this.Code + "物流取消订单报错:" + ex.StackTrace; return(result); } return(result); }
/// <summary> /// 提交订单 /// </summary> /// <param name="order">新建订单模型</param> /// <returns>返回新订单信息</returns> /// <remarks>2013-8-15 杨浩 创建</remarks> /// <remarks>2014-0616 陶辉 增加订单来源逻辑</remarks> public Result <OrderResult> CreateOrder(CreateOrder order) { var receiveAddressTemp = Hyt.BLL.CRM.CrReceiveAddressBo.Instance.GetCrReceiveAddress(order.ReceiveAddressSysNo); var receiveAddress = new SoReceiveAddress { SysNo = receiveAddressTemp.SysNo, AreaSysNo = receiveAddressTemp.AreaSysNo, Name = receiveAddressTemp.Name, EmailAddress = receiveAddressTemp.EmailAddress, MobilePhoneNumber = receiveAddressTemp.MobilePhoneNumber, PhoneNumber = receiveAddressTemp.PhoneNumber, StreetAddress = receiveAddressTemp.StreetAddress, ZipCode = receiveAddressTemp.ZipCode, Gender = receiveAddressTemp.Gender, FaxNumber = receiveAddressTemp.FaxNumber }; var contactBeforeDelivery = OrderStatus.配送前是否联系.否; if (order.ContactBeforeDelivery) { contactBeforeDelivery = OrderStatus.配送前是否联系.是; } var shoppingCart = CrShoppingCartBo.Instance.GetShoppingCart(_platformTypes, order.CustomerSysNo, null, null, null, null, order.CouponCode, true); SoOrder newOrder = new SoOrder(); using (var tran = new TransactionScope()) { //newOrder = Hyt.BLL.Order.SoOrderBo.Instance.CreateOrder(User.SystemUser, order.CustomerSysNo, receiveAddress, //order.DefaultWarehouseSysNo, order.DeliveryTypeSysNo, //order.PayTypeSysNo, shoppingCart, 0, null, //order.OrderSource==null? OrderStatus.销售单来源.手机商城:(OrderStatus.销售单来源)order.OrderSource, null, OrderStatus.销售方式.普通订单, null, //OrderStatus.销售单对用户隐藏.否, string.Empty, string.Empty, //string.Empty, order.DeliveryTime, contactBeforeDelivery, //string.Empty,0); tran.Complete(); } //返回新订单信息 var data = new OrderResult { OrderSysNo = newOrder.SysNo.ToString(), Subject = "商城订单号:" + newOrder.SysNo, SettlementAmount = shoppingCart.SettlementAmount, CreateDate = newOrder.CreateDate, PaymentType = GetPaymentType(order.ReceiveAddressSysNo).Data.SingleOrDefault(x => x.SysNo == order.PayTypeSysNo) }; return(new Result <OrderResult> { Data = data, Status = true, StatusCode = 1 }); }
private SoOrder _order; // 当前编辑的订单 /// <summary> /// 订单编辑购物车数据处理 /// </summary> /// <param name="customerSysNo">会员SysNo.</param> /// <param name="jsonCartItemList">购物车明细.</param> /// <param name="areaSysNo">区域SysNo.</param> /// <param name="deliveryTypeSysNo">配送方式SysNo.</param> /// <param name="couponCode">优惠券SysNo.</param> /// <param name="usedPromotionSysNo">订单促销使用的系统编号集合.</param> /// <param name="order">编辑的订单</param> /// <returns></returns> /// <remarks>2013-11-14 杨文兵 创建</remarks> public EditOrderCart(int customerSysNo, IList <JsonCartItem> jsonCartItemList, int areaSysNo, int deliveryTypeSysNo, string couponCode, int[] usedPromotionSysNo, SoOrder order) { _customerSysNo = customerSysNo; foreach (var item in jsonCartItemList) { _jsonCartItemList.Add(item); } _customerSysNo = customerSysNo; _areaSysNo = areaSysNo; _deliveryTypeSysNo = deliveryTypeSysNo; _couponCode = couponCode; _usedPromotionSysNo = usedPromotionSysNo; _order = order; }
/// <summary> /// 根据订单来源获取订单使用的促销平台 /// </summary> /// <param name="order">订单</param> /// <returns></returns> /// <remarks>2014-01-08 吴文强 创建</remarks> public static PromotionStatus.促销使用平台 GetPromotionPlatformType(this SoOrder order) { switch (order.OrderSource) { case (int)OrderStatus.销售单来源.手机商城: return(PromotionStatus.促销使用平台.手机商城); case (int)OrderStatus.销售单来源.门店下单: return(PromotionStatus.促销使用平台.门店); case (int)OrderStatus.销售单来源.业务员下单: return(PromotionStatus.促销使用平台.物流App); case (int)OrderStatus.销售单来源.分销商升舱: return(new PromotionStatus.促销使用平台()); } return(PromotionStatus.促销使用平台.PC商城); }
/// <summary> /// 获取订单运费详情 /// </summary> /// <param name="order">订单</param> /// <returns>运费详情</returns> /// <remarks>2013-11-14 吴文强 创建</remarks> public static SoOrderFreight GetFreight(this SoOrder order) { var orderFreight = new SoOrderFreight(); orderFreight.FreightSysNo = order.DeliveryTypeSysNo; orderFreight.FreightAmount = order.FreightAmount; orderFreight.FreightDiscountAmount = order.FreightDiscountAmount; orderFreight.FreightChangeAmount = order.FreightChangeAmount; //运费 var freightAmount = order.FreightAmount - order.FreightDiscountAmount + order.FreightChangeAmount; //使用会员币时,先抵消运费 orderFreight.CoinDeduction = (order.CoinPay > freightAmount ? freightAmount : order.CoinPay); //实际需要支付的运费 orderFreight.RealFreightAmount = freightAmount - orderFreight.CoinDeduction; return(orderFreight); }
/// <summary> /// 订单编辑购物车数据处理 /// </summary> /// <param name="customerSysNo">会员SysNo.</param> /// <param name="jsonCartItem">Json格式的购物车明细</param> /// <param name="areaSysNo">区域SysNo.</param> /// <param name="deliveryTypeSysNo">配送方式SysNo.</param> /// <param name="couponCode">优惠券SysNo.</param> /// <param name="usedPromotionSysNo">订单促销使用的系统编号集合.</param> /// <param name="order">编辑的订单</param> /// <exception cref="System.ArgumentException">Json格式的购物车明细 数据格式错误</exception> ///<returns></returns> ///<remarks>2013-11-14 杨文兵 创建</remarks> public EditOrderCart(int customerSysNo, string jsonCartItem, int areaSysNo, int deliveryTypeSysNo, string couponCode, int[] usedPromotionSysNo, SoOrder order) { try { foreach (var item in Hyt.Util.Serialization.JsonUtil.ToObject <IList <JsonCartItem> >(jsonCartItem)) { _jsonCartItemList.Add(item); } } catch { throw new ArgumentException("Json格式的购物车明细 数据格式错误"); } _customerSysNo = customerSysNo; _areaSysNo = areaSysNo; _deliveryTypeSysNo = deliveryTypeSysNo; _couponCode = couponCode; _usedPromotionSysNo = usedPromotionSysNo; _order = order; }
/// <summary> /// 获取订单发票状态 /// </summary> /// <param name="order">订单系统编号</param> /// <returns>订单发票状态</returns> /// <remarks>2013-10-29 吴文强 创建</remarks> public static FinanceStatus.订单发票状态 InvoiceStatus(this SoOrder order) { var invoiceStatus = FinanceStatus.订单发票状态.无发票; var invoice = FnInvoiceBo.Instance.GetOrderValidInvoice(order.SysNo); if (invoice != null) { var invoiceType = FnInvoiceBo.Instance.GetFnInvoiceType(invoice.InvoiceTypeSysNo); //最后更新时间为开票时间 if (DateTime.Now > invoice.LastUpdateDate.AddDays(invoiceType.OverTime)) { invoiceStatus = FinanceStatus.订单发票状态.已过期; } else { invoiceStatus = FinanceStatus.订单发票状态.发票; } } return(invoiceStatus); }
public override Result RestartPushCustomsOrder(int orderId) { Result result = new Result(); SoOrder order = SoOrderBo.Instance.GetEntity(orderId); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(order.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } reqHandler.init(); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 reqHandler.setParameter("out_trade_no", payment.BusinessOrderSysNo); //商户号 payBackList[0].OutRequestNo reqHandler.setParameter("action_type", "3"); //商户号 reqHandler.setParameter("customs", customsConfig.customs_place); //商户号 reqHandler.setParameter("mch_customs_no", customsConfig.merchant_customs_code); //商户号 string uriPath = reqHandler.getRequestURL(); string xml = MyHttp.GetResponse(uriPath); return(result); }
/// <summary> /// 绑定订单信息 /// </summary> /// <param name="order"></param> /// <param name="orderMod"></param> void BindCusOrderData(SoOrder order, Model.Icp.GZNanSha.Order.CustomOrderMod orderMod) { CBFnOnlinePayment payment = Hyt.BLL.Finance.FinanceBo.Instance.GetOnPaymentBySourceSysNo(order.SysNo); orderMod.EntInsideNo = payment.BusinessOrderSysNo;//order.SysNo.ToString();//"SO"+order.SysNo.ToString().PadLeft(8,'0'); orderMod.Ciqbcode = SLDW; orderMod.CbeComcode = ERCI; orderMod.CbepComcode = ERCI; orderMod.OrderStatus = "S"; orderMod.ReceiveName = order.ReceiveAddress.Name; orderMod.ReceiveAddr = (order as Hyt.Model.Manual.SoOrderMods).ReceiverProvince + " " + (order as Hyt.Model.Manual.SoOrderMods).ReceiverCity + " " + (order as Hyt.Model.Manual.SoOrderMods).ReceiverArea + " " + order.ReceiveAddress.StreetAddress; orderMod.ReceiveNo = order.ReceiveAddress.IDCardNo; orderMod.ReceivePhone = order.ReceiveAddress.MobilePhoneNumber; orderMod.FCY = order.ProductAmount; orderMod.Fcode = "CNY"; orderMod.Editccode = ERCI; orderMod.DrDate = order.CreateDate.ToString("yyyyMMddHHmmss"); }
/// <summary> /// 根据订单信息取得优先级 /// </summary> /// <param name="order">订单实体</param> /// <returns>优先级</returns> private int GetPriorityByOrder(SoOrder order) { int priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC001.ToString()); if (order.DeliveryTypeSysNo == (int)DeliveryType.门店自提) { priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC050.ToString()); } else if (order.DeliveryTypeSysNo == (int)DeliveryType.第三方快递) { if (order.ImgFlag == MallTypeFlag.天猫商城旗舰店) { priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC025.ToString()); } else { priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC020.ToString()); } } else if (order.DeliveryTypeSysNo == (int)DeliveryType.百城当日达 || order.DeliveryTypeSysNo == (int)DeliveryType.定时百城当日达 || order.DeliveryTypeSysNo == (int)DeliveryType.加急百城当日达 || order.DeliveryTypeSysNo == (int)DeliveryType.普通百城当日达) { if (order.ImgFlag == MallTypeFlag.天猫商城旗舰店) { priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC035.ToString()); } else { priority = SyJobPoolPriorityBo.Instance.GetPriorityByCode(JobPriorityCode.PC030.ToString()); } } return(priority); }
/// <summary> /// 支付报关推送 /// </summary> /// <param name="order">订单实体</param> public override Result ApplyToCustoms(SoOrder order) { Result result = new Result() { Status = false, StatusCode = 0, Message = "未知错误" }; //防止并发操作 lock (lockHelper) { try { if (order != null) { var onlinePaymentFilter = new ParaOnlinePaymentFilter() { OrderSysNo = order.SysNo, Id = 1 }; var onlinePayments = Hyt.BLL.Finance.FinanceBo.Instance.GetOnlinePayments(onlinePaymentFilter).Rows; var receiveAddress = Hyt.BLL.Order.SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo); DateTime dtNow = DateTime.Now; //广州电子口岸 string xmlTemplte = "<VnbMessage>" + "<MessageHead>" + "<MessageCode>VNB3PARTY_GZEPORT</MessageCode>" + "<MessageID>" + dtNow.ToString("yyyyMMddHHmmss") + "0001" + "</MessageID>" + "<SenderID>" + payConfig.TLPaySenderID + "</SenderID>" + "<SendTime>" + dtNow.ToString("yyyy-MM-dd HH:mm:ss") + "</SendTime>" + "<ReceiptUrl>" + payConfig.TLPayReceiptUrl + "</ReceiptUrl>" + "<Sign>{0}</Sign>" + "</MessageHead>" + "<MessageBodyList>" + "<MessageBody>" + "<customICP>" + customsConfig.SenderID + "</customICP>" + "<customName>" + customsConfig.EbcName + "</customName>" + "<ciqType>00</ciqType>" + "<cbepComCode>C000000000001</cbepComCode>" + "<orderNo>" + onlinePayments.First().BusinessOrderSysNo + "</orderNo>" + "<payTransactionNo>" + onlinePayments.First().VoucherNo + "</payTransactionNo>" + "<payChnlID>" + (order.OrderSource == (int)Model.WorkflowStatus.OrderStatus.销售单来源.手机商城 ? "02" : "01") + "</payChnlID>" + "<payTime>" + onlinePayments.First().CreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "</payTime>" + "<payGoodsAmount>" + order.ProductAmount.ToString("F2") + "</payGoodsAmount>" + "<payTaxAmount>" + order.TaxFee.ToString("F2") + "</payTaxAmount>" + "<freight>" + order.FreightAmount.ToString("F2") + "</freight>" + "<payCurrency>142</payCurrency>" + "<payerName>" + receiveAddress.Name + "</payerName>" + "<payerDocumentType>01</payerDocumentType>" + "<payerDocumentNumber>" + receiveAddress.IDCardNo + "</payerDocumentNumber>" + "</MessageBody>" + "</MessageBodyList>" + "</VnbMessage>"; string sign = FormsAuthentication.HashPasswordForStoringInConfigFile(string.Format(xmlTemplte, "") + payConfig.TLPaySignKey, "MD5").ToUpper(); string xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + string.Format(xmlTemplte, sign); BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, "通联支付报关推送报文:" + xmlString, LogStatus.系统日志目标类型.支付方式, order.SysNo, 0); HttpClient client = new HttpClient(payConfig.TLPayCustomsUrl); string back = client.Post(xmlString); BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, "通联支付报关接口响应报文:" + back, LogStatus.系统日志目标类型.支付方式, order.SysNo, 0); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(back); XmlNode xmlNodeHead = xmlDoc.SelectSingleNode("//VnbMessage//MessageHead"); string CommCode = xmlNodeHead.SelectSingleNode("CommCode").InnerText; //通讯状态码(请求方不填, 响应方返回) string BizStatus = xmlNodeHead.SelectSingleNode("BizStatus").InnerText; //业务状态码(请求方不填, 响应方返回) if (CommCode == "000000") { if (BizStatus != "BZ0001") { XmlNode xmlNodeBody = xmlDoc.SelectSingleNode("//VnbMessage//MessageBodyList//MessageBody"); string retInfo = xmlNodeBody.SelectSingleNode("retInfo").InnerText; result.Message = retInfo; } else { result.Message = "请求已受理"; result.Status = true; //更新订单支付报关状态为处理中 Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus((int)OrderStatus.支付报关状态.处理中, 0, order.SysNo); BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, "TLPay推送接口调试成功!", LogStatus.系统日志目标类型.支付方式, order.SysNo, 0); } } else { string retInfo = "通讯失败"; switch (CommCode) { case "HD0001": retInfo = "无效的内容长度"; break; case "HD0002": retInfo = "请求报文为空"; break; case "HD0003": retInfo = "报文头格式错误"; break; case "HD0004": retInfo = "报文头必填字段为空"; break; case "HD0005": retInfo = "无效的报文消息码"; break; case "HD0006": retInfo = "无效的接入系统代码"; break; case "HD0007": retInfo = "无效的接入主机IP"; break; case "HD0008": retInfo = "签名验签错误,报文签名域不正确"; break; default: break; } result.Message = retInfo; } } else { result.Message = "该订单不存在!"; } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; BLL.Log.SysLog.Instance.Error(LogStatus.系统日志来源.后台, "通联支付报关推送异常:" + ex.Message, ex); } } return(result); }
/// <summary> /// 海关报关 /// </summary> /// <returns></returns> /// <remarks>2015-10-12 杨浩 创建</remarks> public abstract Result ApplyToCustoms(SoOrder order);
/// <summary> /// 推送供应链订单 /// </summary> /// <param name="orderSysNo"></param> /// <returns></returns> /// <remarks> /// 2016-4-15 陈海裕 创建 /// 2016-5-20 刘伟豪 修改 /// </remarks> public override Result <string> SendOrder(int orderSysNo) { //防止并发操作 lock (lockHelper) { // type: pushOrderDataInfo var result = new Result <string>() { Status = false, StatusCode = 0, Message = "向" + this.Code + "供应链推送订单失败" }; if (orderSysNo <= 0) { return(result); } // json格式的post数据 string jsonData = ""; try { SoOrder order = BLL.Order.SoOrderBo.Instance.GetEntity(orderSysNo); if (order == null) { result.Message = "该订单不存在"; return(result); } order.ReceiveAddress = BLL.Order.SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo); order.OrderItemList = DataAccess.Order.ISoOrderItemDao.Instance.GetOrderItemsByOrderSysNo(order.SysNo); ParaVoucherFilter voucherFilter = new ParaVoucherFilter(); voucherFilter.SourceSysNo = order.SysNo; CBFnReceiptVoucher recVoucher = BLL.Finance.FinanceBo.Instance.GetReceiptVouchers(voucherFilter).Rows.FirstOrDefault(); recVoucher.VoucherItems = BLL.Finance.FnReceiptVoucherBo.Instance.GetReceiptVoucherItem(recVoucher.SysNo); // 收货人 区 市 省 BsArea receiverDistrict = BLL.Basic.BasicAreaBo.Instance.GetArea(order.ReceiveAddress.AreaSysNo); BsArea receiverCity = BLL.Basic.BasicAreaBo.Instance.GetArea(receiverDistrict.ParentSysNo); BsArea receiverProvince = BLL.Basic.BasicAreaBo.Instance.GetArea(receiverCity.ParentSysNo); DsDealer dealer = BLL.Distribution.DsDealerBo.Instance.GetDsDealer(order.DealerSysNo); HaiTunOrder newOrder = new HaiTunOrder(); newOrder.address = TConvert.ToString(order.ReceiveAddress.StreetAddress); newOrder.city = TConvert.ToString(receiverCity.AreaName.Trim()); newOrder.consignee = TConvert.ToString(order.ReceiveAddress.Name); newOrder.consumerNote = TConvert.ToString(order.Remarks); newOrder.country = "中国"; newOrder.district = TConvert.ToString(receiverDistrict.AreaName.Trim()); newOrder.idCardNumber = TConvert.ToString(order.ReceiveAddress.IDCardNo); newOrder.isCheck = "no"; newOrder.mobile = TConvert.ToString(order.ReceiveAddress.MobilePhoneNumber); newOrder.moneyPaid = TConvert.ToString(order.OrderAmount); newOrder.orderAmount = TConvert.ToString(order.OrderAmount); newOrder.orderSn = TConvert.ToString(order.SysNo); newOrder.paymentAccount = "*****@*****.**"; // 固定值 newOrder.paymentInfoIdCardNumber = TConvert.ToString(order.ReceiveAddress.IDCardNo); newOrder.paymentInfoMethod = "支付宝"; newOrder.paymentInfoName = TConvert.ToString(order.ReceiveAddress.Name); newOrder.paymentInfoNumber = TConvert.ToString(recVoucher.VoucherItems[0].VoucherNo); newOrder.province = TConvert.ToString(receiverProvince.AreaName); newOrder.shippingFee = TConvert.ToString(order.FreightAmount); newOrder.siteName = TConvert.ToString(dealer.ErpName); newOrder.siteType = "商城"; newOrder.tel = TConvert.ToString(order.ReceiveAddress.PhoneNumber); newOrder.zipcode = TConvert.ToString(order.ReceiveAddress.ZipCode); newOrder.items = new List <HaiTunOrderItem>(); HaiTunOrderItem haitunItem = new HaiTunOrderItem(); foreach (var item in order.OrderItemList) { #if DEBUG haitunItem.goodsName = "【广州保税 全国包邮】澳大利亚Swisse 奶蓟草护肝片肝脏排毒120粒 【2件起发】"; haitunItem.goodsPrice = "100"; haitunItem.goodsSn = "AUSW003"; haitunItem.quantity = "1"; newOrder.items.Add(haitunItem); break; #else PdProductStock productStock = BLL.Warehouse.PdProductStockBo.Instance.GetEntityByWP(order.DefaultWarehouseSysNo, item.ProductSysNo); var supplyProduct = BLL.Supply.ScProductBo.Instance.GetScProductInfo(productStock.ProductSku, (int)this.Code); if (supplyProduct != null) { haitunItem.goodsName = TConvert.ToString(supplyProduct.ProductName); haitunItem.goodsPrice = TConvert.ToString(item.SalesUnitPrice); haitunItem.goodsSn = TConvert.ToString(supplyProduct.SKU); haitunItem.quantity = TConvert.ToString(item.Quantity); newOrder.items.Add(haitunItem); } else { result.Message = "商品" + item.ProductSysNo + "对应的供应链商品不存在"; return(result); } #endif } jsonData = Util.Serialization.JsonUtil.ToJson2(new List <HaiTunOrder>() { newOrder }); var back = Post("pushOrderDataInfo", jsonData); result = GetResult(JObject.Parse(back)); if (result.Status) { } } catch (Exception ex) { result.Message = ex.Message; BLL.Log.SysLog.Instance.Error(LogStatus.系统日志来源.后台, this.Code + "供应链订单推送:" + ex.Message, ex); } return(result); } }
private void AddBaseTaskObjectToList(List <BaseTask> listObject) { BaseTask bsAT = new BsArea(); BaseTask bsDP = new BsDeliveryPayment(); BaseTask bsPT = new BsPaymentType(); BaseTask bsCode = new BsCode(); BaseTask bsOrganization = new BsOrganization(); BaseTask bsOrganizationWarehouse = new BsOrganizationWarehouse(); BaseTask crCustomer = new CrCustomer(); BaseTask crCL = new CrCustomerLevel(); BaseTask crCQ = new CrCustomerQuestion(); BaseTask crRA = new CrReceiveAddress(); BaseTask dsMallType = new DsMallType(); BaseTask dsDealerLevel = new DsDealerLevel(); BaseTask feArticle = new FeArticle(); BaseTask feAC = new FeArticleCategory(); BaseTask feCS = new FeCommentSupport(); BaseTask fepc = new FeProductComment(); BaseTask fePCI = new FeProductCommentImage(); BaseTask fePCR = new FeProductCommentReply(); BaseTask feSearchKeyword = new FeSearchKeyword(); BaseTask feadvertgroup = new FeAdvertGroup(); BaseTask feadvertitem = new FeAdvertItem(); BaseTask feproductgroup = new FeProductGroup(); BaseTask feproductitem = new FeProductItem(); BaseTask fnIT = new FnInvoiceType(); BaseTask fninvoice = new FnInvoice(); BaseTask fnpv = new FnReceiptVoucher(); BaseTask fnReceiptVoucherItem = new FnReceiptVoucherItem(); BaseTask fnop = new FnOnlinePayment(); BaseTask fnPaymentVoucher = new FnPaymentVoucher(); BaseTask fnPaymentVoucherItem = new FnPaymentVoucherItem(); BaseTask lgDelivery = new LgDelivery(); BaseTask lgDI = new LgDeliveryItem(); BaseTask lgDS = new LgDeliveryScope(); BaseTask lgDT = new LgDeliveryType(); BaseTask lgDUC = new LgDeliveryUserCredit(); BaseTask lgPT = new LgPickupType(); BaseTask lgsettlement = new LgSettlement(); BaseTask lgSI = new LgSettlementItem(); BaseTask lgDeliveryPrintTemplate = new LgDeliveryPrintTemplate(); BaseTask pdAttribute = new PdAttribute(); BaseTask pdAG = new PdAttributeGroup(); BaseTask pdAGA = new PdAttributeGroupAssociation(); BaseTask pdAO = new PdAttributeOption(); BaseTask pdBrand = new PdBrand(); BaseTask pdCGA = new PdCatAttributeGroupAso(); BaseTask pdCategory = new PdCategory(); BaseTask pdCA = new PdCategoryAssociation(); BaseTask pdPrice = new PdPrice(); BaseTask pdProduct = new PdProduct(); BaseTask pdPA = new PdProductAssociation(); BaseTask pdProductAttribute = new PdProductAttribute(); BaseTask pdPI = new PdProductImage(); BaseTask pdTemplate = new PdTemplate(); BaseTask pdProductStatistics = new PdProductStatistics(); BaseTask soOrder = new SoOrder(); BaseTask soOrderItem = new SoOrderItem(); BaseTask soRA = new SoReceiveAddress(); BaseTask SyUG = new SyUserGroup(); BaseTask syGU = new SyGroupUser(); BaseTask syMenu = new SyMenu(); BaseTask syMenuPrivilege = new SyMenuPrivilege(); BaseTask syPrivilege = new SyPrivilege(); BaseTask syRole = new SyRole(); BaseTask syRoleMenu = new SyRoleMenu(); BaseTask syRolePrivilege = new SyRolePrivilege(); BaseTask syPermission = new SyPermission(); BaseTask syUser = new SyUser(); BaseTask syUW = new SyUserWarehouse(); BaseTask syMyMenu = new SyMyMenu(); BaseTask spcombo = new SpCombo(); BaseTask spComboItem = new SpComboItem(); BaseTask spcopon = new spcoupon(); BaseTask sqpromotion = new SPpromotion(); BaseTask spromotiongift = new SPpromotiongift(); BaseTask sppromotionoverlay = new SPpromotionoverlay(); BaseTask sppromotionrule = new SPpromotionrule(); BaseTask sppromotionrulecondition = new SPpromotionrulecondition(); BaseTask sppromotionrulekeyvalue = new SPpromotionrulekeyvalue(); BaseTask syTaskConfig = new SyTaskConfig(); BaseTask whStockOut = new WhStockOut(); BaseTask whStockOutItem = new WhstockOutItem(); BaseTask whwarehouse = new WhWarehouse(); BaseTask whwa = new WHwarehousearea(); BaseTask whwdy = new WHwarehouseDeliveryType(); BaseTask whWPT = new WhWarehousePickupType(); BaseTask whstockin = new WhStockIn(); BaseTask whstockinItem = new WHStockinItem(); BaseTask rcReturn = new RCReturn(); BaseTask rcReturnItem = new RcReturnItem(); listObject.Add(bsAT); listObject.Add(bsDP); listObject.Add(bsPT); listObject.Add(bsCode); listObject.Add(bsOrganization); listObject.Add(bsOrganizationWarehouse); listObject.Add(crCustomer); listObject.Add(crCL); listObject.Add(crCQ); listObject.Add(crRA); listObject.Add(dsMallType); listObject.Add(dsDealerLevel); listObject.Add(feArticle); listObject.Add(feAC); listObject.Add(feCS); listObject.Add(fePCI); listObject.Add(fePCR); listObject.Add(fepc); listObject.Add(feSearchKeyword); listObject.Add(feadvertgroup); listObject.Add(feadvertitem); listObject.Add(feproductgroup); listObject.Add(feproductitem); listObject.Add(fnIT); listObject.Add(fnpv); listObject.Add(fnReceiptVoucherItem); listObject.Add(fnop); listObject.Add(fninvoice); listObject.Add(fnPaymentVoucher); listObject.Add(fnPaymentVoucherItem); listObject.Add(lgDelivery); listObject.Add(lgDI); listObject.Add(lgDS); listObject.Add(lgDT); listObject.Add(lgPT); listObject.Add(lgsettlement); listObject.Add(lgSI); listObject.Add(lgDeliveryPrintTemplate); listObject.Add(pdAttribute); listObject.Add(pdAG); listObject.Add(pdAGA); listObject.Add(pdAO); listObject.Add(pdBrand); listObject.Add(pdCGA); listObject.Add(pdCategory); listObject.Add(pdCA); listObject.Add(pdPrice); listObject.Add(pdProduct); listObject.Add(pdPA); listObject.Add(pdProductAttribute); listObject.Add(pdTemplate); listObject.Add(pdProductStatistics); listObject.Add(soOrder); listObject.Add(soOrderItem); listObject.Add(spcombo); listObject.Add(spComboItem); listObject.Add(spcopon); listObject.Add(sqpromotion); listObject.Add(spromotiongift); //listObject.Add(sppromotionoverlay); listObject.Add(sppromotionrule); listObject.Add(sppromotionrulecondition); listObject.Add(sppromotionrulekeyvalue); listObject.Add(syGU); listObject.Add(syUW); listObject.Add(SyUG); listObject.Add(syMenu); listObject.Add(syUser); listObject.Add(syPermission); listObject.Add(syMenuPrivilege); listObject.Add(syPrivilege); listObject.Add(syRole); listObject.Add(syRoleMenu); listObject.Add(syRolePrivilege); listObject.Add(syMyMenu); listObject.Add(syTaskConfig); listObject.Add(whStockOut); listObject.Add(whStockOutItem); listObject.Add(whwarehouse); listObject.Add(whwa); listObject.Add(whwdy); listObject.Add(whWPT); listObject.Add(whstockin); listObject.Add(whstockinItem); listObject.Add(rcReturn); listObject.Add(rcReturnItem); listObject.Add(lgDUC); listObject.Add(pdPI); listObject.Add(soRA); }
/// <summary> /// 海关报关 /// </summary> /// <returns></returns> /// <remarks>2015-10-12 杨浩 创建</remarks> public override Result ApplyToCustoms(SoOrder soorder) { Result result = new Result(); try { IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(soorder.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } Hyt.Model.Manual.SoReceiveAddressMod address = SoOrderBo.Instance.GetOrderReceiveAddress2(soorder.ReceiveAddressSysNo); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); reqHandler.init(); //reqHandler.setGateUrl(url); reqHandler.setParameter("order_fee", ((int)(soorder.OrderAmount * 100)).ToString()); //商品总金额,以分为单位 reqHandler.setParameter("product_fee", ((int)((soorder.ProductAmount + (soorder.TaxFee)) * 100)).ToString()); //商品金额,以分为单位 reqHandler.setParameter("transport_fee", ((int)(soorder.FreightAmount * 100)).ToString()); //运费金额,以分为单位 reqHandler.setParameter("duty", ((int)(soorder.TaxFee * 100)).ToString()); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 string out_trade_no = ""; if (string.IsNullOrEmpty(payment.BusinessOrderSysNo)) { out_trade_no = payment.SourceSysNo.ToString(); } else { out_trade_no = payment.BusinessOrderSysNo; } reqHandler.setParameter("out_trade_no", out_trade_no); //商家订单号 reqHandler.setParameter("transaction_id", payment.VoucherNo); //财付通订单号 reqHandler.setParameter("fee_type", "CNY"); //币种,1人民币 reqHandler.setParameter("sub_order_no", out_trade_no); //子订单号 reqHandler.setParameter("customs", customsConfig.customs_place); //海关 0 无需上报海关1广州2杭州3宁波4深圳5郑州保税区(暂停)6重庆7西安8上海9 郑州 reqHandler.setParameter("mch_customs_no", customsConfig.merchant_customs_code); //商户海关备案号IE150723865142 reqHandler.setParameter("cert_type", "1"); //证件类型 reqHandler.setParameter("cert_id", address.IDCardNo); //收货人身份证号 reqHandler.setParameter("name", address.Name); //收货人姓名 reqHandler.setParameter("action_type", "1"); //1新增2修改 string uriPath = reqHandler.getRequestURL(); string xml = MyHttp.GetResponse(uriPath); //Game.Utils.FileManager.WriteFile(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt"), xml); //string xmlTxt = System.IO.File.ReadAllText(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt")); AliAcquireCustomsBack backMod = SaveTenpayAcquireCustomsBackData(xml); // backMod.PushDataInfo = uriPath; backMod.OutReportXML = xml; if (string.IsNullOrEmpty(backMod.Success)) { backMod.Success = "F"; } else { backMod.Success = Enum.GetName(typeof(Hyt.Model.WorkflowStatus.OrderStatus.海关微信申报状态), Convert.ToInt32(backMod.Success)); } //backMod.Type = 1; //AcquireCustomsBo.Instance.InnerAcquireCustoms(backMod); //soorder.CustomsResult = backMod.Success; //SoOrderBo.Instance.UpdateOrder(soorder); //(int)OrderStatus.支付报关状态.处理中 Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(backMod.Success), 0, soorder.SysNo); BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.前台, "订单编号:" + soorder.SysNo + ",支付信息报关提交成功!" + "回执:" + backMod.OutReportXML, LogStatus.系统日志目标类型.订单支付报关, soorder.SysNo, 0); result.Status = true; result.Message = "报关成功"; } catch (Exception e) { result.Status = false; result.Message = "报关失败-" + e.Message; try { BLL.Log.LocalLogBo.Instance.Write(result.Message, "WeiXinCustomsERRORLog"); } catch (Exception ex) { result.Status = false; result.Message = "报关失败-" + ex.Message; BLL.Log.LocalLogBo.Instance.Write(result.Message, "WeiXinCustomsERRORLog"); } } return(result); }
/// <summary> /// 添加订单 /// </summary> /// <param name="stream">订单数据(json格式)</param> /// <returns></returns> /// <remarks>2016-9-7 杨浩 创建</remarks> public Result <string> AddOrder(Stream stream) { int exceptionPoint = 0; string data = ""; int dealerSysNo = 329; var result = new Result <string>() { Status = true, StatusCode = 0 }; try { var reader = new StreamReader(stream); data = reader.ReadToEnd(); exceptionPoint = 1; var orderInfo = Hyt.Util.Serialization.JsonUtil.ToObject <Order>(data); exceptionPoint = 2; var orderAssociationInfo = Hyt.BLL.Stores.DsOrderAssociationBo.Instance.GetOrderAssociationInfo(dealerSysNo, orderInfo.OrderNo); exceptionPoint = 3; if (orderAssociationInfo != null) { result.Status = false; result.Message = "订单已存在"; result.StatusCode = 1; return(result); } if (orderInfo.OnlinePayment == null) { result.Status = false; result.Message = "没有支付记录"; result.StatusCode = 2; return(result); } var onlinePayments = Hyt.BLL.Finance.FinanceBo.Instance.GetOnlinePaymentByVoucherNo(orderInfo.OnlinePayment.PaymentTypeSysNo, orderInfo.OnlinePayment.VoucherNo); if (onlinePayments != null) { result.Status = false; result.Message = "订单中的支付单已存在"; result.StatusCode = 3; return(result); } #region 订单信息 SoOrder so = new SoOrder(); so.OrderNo = BLL.Basic.ReceiptNumberBo.Instance.GetOrderNo(); so.OrderSource = (int)Hyt.Model.WorkflowStatus.OrderStatus.销售单来源.方商城; so.DealerSysNo = dealerSysNo; so.AuditorDate = (DateTime)SqlDateTime.MinValue; so.AuditorSysNo = 0; so.CancelDate = (DateTime)SqlDateTime.MinValue; so.CashPay = orderInfo.CashPay; so.CBLogisticsSendStatus = orderInfo.CBLogisticsSendStatus; so.CoinPay = orderInfo.CoinPay; so.ContactBeforeDelivery = orderInfo.ContactBeforeDelivery; so.CouponAmount = orderInfo.CouponAmount; so.CreateDate = DateTime.Now; so.CustomerMessage = orderInfo.CustomerMessage; so.CustomsPayStatus = orderInfo.CustomsPayStatus; so.CustomsStatus = orderInfo.CustomsStatus; so.DefaultWarehouseSysNo = 0; so.DeliveryRemarks = orderInfo.DeliveryRemarks; so.DeliveryTime = orderInfo.DeliveryTime; so.DeliveryTypeSysNo = orderInfo.DeliveryTypeSysNo; so.FreightAmount = orderInfo.FreightAmount; so.FreightChangeAmount = orderInfo.FreightChangeAmount; so.FreightDiscountAmount = orderInfo.FreightDiscountAmount; so.GZJCStatus = orderInfo.GZJCStatus; so.ImgFlag = orderInfo.ImgFlag; so.InternalRemarks = orderInfo.InternalRemarks; so.InvoiceSysNo = orderInfo.InvoiceSysNo; so.IsHiddenToCustomer = orderInfo.IsHiddenToCustomer; so.LastUpdateDate = (DateTime)SqlDateTime.MinValue; so.NsStatus = 0; so.OperatFee = 0; so.OrderAmount = orderInfo.OrderAmount; so.OrderCreatorSysNo = 0; so.OrderDiscountAmount = orderInfo.OrderDiscountAmount; so.PayStatus = orderInfo.PayStatus; so.PayTypeSysNo = orderInfo.PayTypeSysNo; so.ProductAmount = orderInfo.ProductAmount; so.ProductChangeAmount = orderInfo.ProductChangeAmount; so.ProductDiscountAmount = orderInfo.ProductDiscountAmount; so.RebateRtio = orderInfo.RebateRtio; so.Remarks = orderInfo.Remarks; so.SalesSysNo = orderInfo.SalesSysNo; so.SalesType = orderInfo.SalesType; so.SendStatus = orderInfo.SendStatus; so.Stamp = orderInfo.Stamp; so.Status = 10; so.TaxFee = orderInfo.TaxFee; so.UsedPromotions = ""; #endregion #region 订单明细 var soItems = new List <SoOrderItem>(); var soItem = new SoOrderItem(); var pager = new Pager <PdProduct>() { PageSize = 999999, CurrentPage = 1 }; pager = BLL.Product.PdProductBo.Instance.GetPdProductList(pager); var dealerInfo = BLL.Stores.StoresBo.Instance.GetStoreById(dealerSysNo); var dealerLevelInfo = BLL.Distribution.DsDealerLevelBo.Instance.GetDealerLevelByDealerSysNo(dealerInfo.LevelSysNo); //订单总价 decimal orderTotalPrice = orderInfo.OrderItemList.Sum(x => x.SalesUnitPrice * x.Quantity); if (orderTotalPrice != orderInfo.CashPay) { result.Status = false; result.Message = "订单明细中的商品总价和订单的支付金额不一致"; result.StatusCode = 4; return(result); } foreach (var item in orderInfo.OrderItemList) { var productInfo = pager.Rows.Where(x => x.ErpCode == item.ProductCode).FirstOrDefault(); if (productInfo == null) { result.Status = false; result.Message = "商品编码【" + item.ProductCode + "】在系统中不存在"; result.StatusCode = 5; return(result); } //价格下限 decimal lower = productInfo.TradePrice * (100 - dealerLevelInfo.SalePriceLower) * 0.01m; //价格上限 decimal upper = productInfo.TradePrice * (100 + dealerLevelInfo.SalePriceUpper) * 0.01m; //检查销售价格下限 if (lower > item.SalesUnitPrice) { result.Status = false; result.Message = "商品编码【" + item.ProductCode + "】的销售价不能低于¥" + lower; result.StatusCode = 6; return(result); } //检查销售价格上限 //if (upper<item.SalesUnitPrice) //{ // result.Status = false; // result.Message = "商品编码【" + item.ProductCode + "】的销售价不能高于¥" + upper; // result.StatusCode = 7; // return result; //} //返点=((销售价-批发价)*数量)*操作费 soItem.Catle = ((productInfo.TradePrice - item.SalesUnitPrice) * item.Quantity) * (1 - (dealerLevelInfo.OperatFee * 0.001m)); soItem.Catle = soItem.Catle < 0 ? 0 : soItem.Catle; soItem.ChangeAmount = 0; soItem.DiscountAmount = 0; soItem.GroupCode = ""; soItem.GroupName = ""; soItem.OriginalPrice = item.OriginalPrice; soItem.OriginalSalesUnitPrice = 0; soItem.ProductName = item.ProductName; soItem.ProductSalesType = 10; soItem.ProductSalesTypeSysNo = item.ProductSalesTypeSysNo; soItem.ProductSysNo = productInfo.SysNo; soItem.Quantity = item.Quantity; soItem.RealStockOutQuantity = 0; soItem.RebatesStatus = 0; soItem.SalesAmount = item.SalesAmount; soItem.SalesUnitPrice = item.SalesUnitPrice; soItem.UnitCatle = 0; soItem.UsedPromotions = ""; soItems.Add(soItem); } #endregion Hyt.Model.CrCustomer cr = null; var isNewUser = true; string strPassword = "******";//初始密码 var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = TransactionManager.DefaultTimeout }; #region 会员 using (var trancustomer = new System.Transactions.TransactionScope(TransactionScopeOption.Required, options))//会员创建事物 { cr = Hyt.BLL.CRM.CrCustomerBo.Instance.GetCrCustomer(orderInfo.Customer.Account); exceptionPoint = 4; //var customerlst = Hyt.BLL.Order.SoOrderBo.Instance.SearchCustomer(); if (cr != null) { isNewUser = false; } else //创建会员 { cr = new Model.CrCustomer() { Account = orderInfo.Customer.Account, MobilePhoneNumber = orderInfo.Customer.MobilePhoneNumber, AreaSysNo = orderInfo.Customer.AreaSysNo, Gender = (int)Hyt.Model.WorkflowStatus.CustomerStatus.性别.保密, EmailStatus = (int)Hyt.Model.WorkflowStatus.CustomerStatus.邮箱状态.未验证, LevelSysNo = Hyt.Model.SystemPredefined.CustomerLevel.初级, Name = orderInfo.Customer.Name, NickName = orderInfo.Customer.NickName, RegisterDate = DateTime.Now, Password = strPassword, // Hyt.Util.EncryptionUtil.EncryptWithMd5AndSalt(strPassword), 余勇修改 2014-09-12 Status = (int)Hyt.Model.WorkflowStatus.CustomerStatus.会员状态.效, MobilePhoneStatus = (int)Hyt.Model.WorkflowStatus.CustomerStatus.手机状态.未验证, RegisterSource = (int)Hyt.Model.WorkflowStatus.CustomerStatus.注册来源.方商城, RegisterSourceSysNo = dealerSysNo.ToString(), StreetAddress = orderInfo.ReceiveAddress.StreetAddress, IsReceiveShortMessage = (int)CustomerStatus.是否接收短信.是, IsReceiveEmail = (int)CustomerStatus.是否接收邮件.是, LastLoginDate = DateTime.Now, Birthday = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue, CreatedDate = DateTime.Now, DealerSysNo = dealerSysNo, }; Hyt.Model.CrReceiveAddress crr = new Model.CrReceiveAddress() { AreaSysNo = orderInfo.ReceiveAddress.AreaSysNo, Name = orderInfo.ReceiveAddress.Name, MobilePhoneNumber = orderInfo.ReceiveAddress.MobilePhoneNumber, StreetAddress = orderInfo.ReceiveAddress.StreetAddress, IsDefault = 1 }; Hyt.BLL.Order.SoOrderBo.Instance.CreateCustomer(cr, crr); exceptionPoint = 5; } trancustomer.Complete();//会员创建事物 } if (cr == null || cr.SysNo < 1) { result.Status = false; result.Message = "会员信息读取失败"; return(result); } exceptionPoint = 6; #endregion #region 数据提交 so.CustomerSysNo = cr.SysNo; so.LevelSysNo = cr.LevelSysNo; so.PayTypeSysNo = 12;//易宝支付 using (var tran = new System.Transactions.TransactionScope(TransactionScopeOption.Required, options)) { var r = Hyt.BLL.Order.SoOrderBo.Instance.ImportSoOrder(so, orderInfo.ReceiveAddress, soItems.ToArray(), "系统", orderInfo.OnlinePayment, ref exceptionPoint); exceptionPoint = 7; if (r.StatusCode > 0) { var model = new DsOrderAssociation() { DealerOrderNo = orderInfo.OrderNo, DealerSysNo = dealerSysNo, OrderSysNo = r.StatusCode, }; Hyt.BLL.Stores.DsOrderAssociationBo.Instance.Add(model); exceptionPoint = 8; } exceptionPoint = 9; tran.Complete(); } #endregion } catch (Exception ex) { result.Status = false; result.Message = "接口异常"; result.StatusCode = -1; BLL.Log.LocalLogBo.Instance.Write(ex.Message + "----->exceptionPoint =" + exceptionPoint, "AddOrderExceptionLog"); } return(result); }
/// <summary> /// 海关支付报关查询 /// </summary> /// <param name="orderId">订单编号</param> /// <returns></returns> /// <remarks>2015-12-31 杨浩 创建</remarks public override Result CustomsQuery(int orderId) { Result result = new Result(); //List<SoOrder> orderList = SoOrderBo.Instance.GetOrderByWeiXinCustomsData(); SoOrder order = SoOrderBo.Instance.GetEntity(orderId); result.Status = false; try { IList <FnOnlinePayment> list = FinanceBo.Instance.GetOnlinePaymentList(order.SysNo); FnOnlinePayment payment; if (list.Count > 0) { payment = list[0]; } else { result.Status = false; result.Message = "付款单信息无效,请核实订单是否付款?"; return(result); } SoReceiveAddress address = SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo); //List<AliAcquireCustomsBack> payBackList = AcquireCustomsBo.Instance.GetAllAcquireCustomsBackByOrderSysNos(order.SysNo.ToString()); RequestHandler reqHandler = new RequestHandler(System.Web.HttpContext.Current, customsConfig.key, customsConfig.GATEWAY_NEW); //if (payBackList.Count == 0) //{ // continue; //} reqHandler.init(); //协议参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); // 设置支付参数 //----------------------------- reqHandler.setParameter("partner", customsConfig.partner); //商户号 string out_trade_no = ""; if (string.IsNullOrEmpty(payment.BusinessOrderSysNo)) { out_trade_no = payment.SourceSysNo.ToString(); } else { out_trade_no = payment.BusinessOrderSysNo; } reqHandler.setParameter("out_trade_no", out_trade_no); //商户号 payBackList[0].OutRequestNo //if (list.Count > 0) //{ // reqHandler.setParameter("transaction_id", list[0].VoucherNo); //商户号 //} //reqHandler.setParameter("sub_order_no", payBackList[0].CustomsTradeNo); //商户号 //reqHandler.setParameter("sub_order_id", order.SysNo.ToString()); //商户号 reqHandler.setParameter("customs", customsConfig.customs_place); //商户号 string uriPath = reqHandler.getRequestURL("http://mch.tenpay.com/cgi-bin/mch_custom_query.cgi"); string xml = MyHttp.GetResponse(uriPath); //Game.Utils.FileManager.WriteFile(Hyt.Util.WebUtil.GetMapPath("/TenpayCustomsMdl.txt"), xml); ///插入更新记录 ///Hyt.Model.Customs.AliAcquireCustomsBack backMod = Pay.SaveTenpayAcquireCustomsBackData(xml); /// AliAcquireCustomsBack cusMod = SaveTenpayAcquireCustomsBackData(xml); object obj = GetTenpayReturnCustomsBack(xml); //AliAcquireCustomsBack backMod = payBackList[0]; string status = obj.GetType().GetProperty("state").GetValue(obj, null).ToString(); //backMod.PushDataInfo = uriPath; //backMod.Success = Enum.GetName(typeof(Hyt.Model.WorkflowStatus.OrderStatus.海关微信申报状态), Convert.ToInt32(status)); //backMod.Type = 1; //backMod.OutReportXML = xml; //AcquireCustomsBo.Instance.UpdateAcquireCustoms(backMod); ///更新付款人信息 /// BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.前台, "订单编号:" + order.SysNo + ",支付信息查询!" + "回执:" + xml, LogStatus.系统日志目标类型.订单支付报关, order.SysNo, 0); if (status == "4") { Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(GetTenpayStatus(status)), 0, orderId); /////获取付款人信息名称 //Model.Generated.SoPaymentInfo payInfo = SoPaymentInfoBo.Instance.GetPaymentInfo(order.SysNo); //if (payInfo != null) //{ // payInfo.PaymentName = obj.GetType().GetProperty("name").GetValue(obj, null).ToString(); // payInfo.PaymentIDC = obj.GetType().GetProperty("cert_id").GetValue(obj, null).ToString(); // payInfo.PaymentPhone = address.MobilePhoneNumber; // SoPaymentInfoBo.Instance.UpdatePaymentInfo(payInfo); //} //else //{ // payInfo = new SoPaymentInfo(); // payInfo.SoSysNo = order.SysNo; // payInfo.PaymentName = obj.GetType().GetProperty("name").GetValue(obj, null).ToString(); // payInfo.PaymentIDC = obj.GetType().GetProperty("cert_id").GetValue(obj, null).ToString(); // payInfo.PaymentPhone = address.MobilePhoneNumber; // SoPaymentInfoBo.Instance.InsertPaymentInfo(payInfo); //} } ///更新支付报关情况。 if (status == "5") { Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderApiStatus(GetOrderPayCustomStatus(GetTenpayStatus(status)), 0, orderId); //backMod.Success = ""; //order.AutoPush = 0; } //order.CustomsResult = backMod.Success; //SoOrderBo.Instance.UpdateOrder(order); //content = order.SysNo + " 更新结束。"; result.Message = xml; result.Status = true; } catch (Exception e) { result.Message = e.Message; } //return Json(new { content = content }); return(result); }
/// <summary> /// 添加网上支付(单据来源:订单) /// </summary> /// <param name="onlinePayment">数据实体</param> /// <returns>sysNo</returns> /// <remarks>2013-07-18 朱家宏 创建</remarks> /// <remarks>2013-11-1 黄志勇 修改</remarks> public int CreateOnlinePaymentFromSoOrder(SoOrder soOrder, FnOnlinePayment onlinePayment) { /* * 1.支付方式类型为预付&&未付款的订单 * 2.修改订单相关:支付状态改为已支付 订单状态如果为待支付改为待创建出库单 * 3.根据收款单单据来源和单据来源编号,创建收款单明细 */ if (onlinePayment == null) { throw new ArgumentNullException("onlinePayment"); } onlinePayment.Source = (int)FinanceStatus.网上支付单据来源.销售单; onlinePayment.Status = (int)FinanceStatus.网上支付状态.效; //var soOrder = SoOrderBo.Instance.GetEntity(onlinePayment.SourceSysNo); var payStatus = soOrder.PayStatus; var paymentType = Basic.PaymentTypeBo.Instance.GetEntity(soOrder.PayTypeSysNo).PaymentType; //创建网上支付记录 var r = 0; if (paymentType == (int)BasicStatus.支付方式类型.预付 && payStatus == (int)OrderStatus.销售单支付状态.未支付) { r = IFnOnlinePaymentDao.Instance.Insert(onlinePayment); } if (r == 0) { return(r); } var userName = Sys.SyUserBo.Instance.GetUserName(onlinePayment.CreatedBy); //创建人姓名 SoOrderBo.Instance.WriteSoTransactionLog(soOrder.TransactionSysNo, string.Format(Constant.ORDER_TRANSACTIONLOG_PAY, Util.FormatUtil.FormatCurrency( onlinePayment.Amount, 2)), userName); //创建收款单明细 var receiptVoucherItem = new FnReceiptVoucherItem { Amount = onlinePayment.Amount, CreatedBy = onlinePayment.CreatedBy, LastUpdateBy = onlinePayment.CreatedBy, VoucherNo = onlinePayment.VoucherNo, PaymentTypeSysNo = soOrder.PayTypeSysNo, TransactionSysNo = soOrder.TransactionSysNo, CreatedDate = DateTime.Now, LastUpdateDate = DateTime.Now, Status = (int)FinanceStatus.收款单明细状态.效, ReceivablesSideType = (int)FinanceStatus.收款方类型.财务中心, }; //插入收款单,收款明细, FnReceiptVoucherBo.Instance.InsertOrderReceiptVoucher(soOrder, receiptVoucherItem); //同步支付时间的到订单主表 ISoOrderDao.Instance.UpdateOrderPayDteById(soOrder.SysNo); return(r); }
/// <summary> /// 部分签收退款到EAS /// </summary> /// <param name="pay">付款单及付款单明细</param> /// <param name="operatorSysNo">操作人编号</param> /// <remarks> /// 2014-07-22 余勇 创建 /// </remarks> public void PartialSignWriteEas(CBFnPaymentVoucher pay, int operatorSysNo) { if (pay == null) { return; } if (pay == null || pay.Status != FinanceStatus.付款单状态.已付款.GetHashCode()) { return; } if (pay.VoucherItems != null && pay.VoucherItems.Count > 0) { string orderSysNo = string.Empty; string customer = string.Empty; if (pay.Source == (int)Hyt.Model.WorkflowStatus.FinanceStatus.付款来源类型.销售单) { orderSysNo = pay.SourceSysNo.ToString(); customer = WhWarehouseBo.Instance.GetErpCustomerCode(pay.SourceSysNo); } else if (pay.Source == (int)Hyt.Model.WorkflowStatus.FinanceStatus.付款来源类型.退换货单) { var rma = Hyt.BLL.RMA.RmaBo.Instance.GetRcReturnEntity(pay.SourceSysNo); if (rma != null) { orderSysNo = rma.OrderSysNo.ToString(); customer = WhWarehouseBo.Instance.GetErpCustomerCode(rma.OrderSysNo); } } var lst = new List <Extra.Erp.Model.Receiving.ReceivingInfo>(); string easNum = Extra.Erp.Model.EasConstant.HytWharehouse; //商城仓库 string organizationCode = string.Empty; //组织机构代码 string payeeAccountBank = string.Empty; //收款账户 string settlementType = Extra.Erp.Model.EasConstant.SettlementType_Cash; //仓库只有现金,01:Eas中的现金 foreach (FnPaymentVoucherItem pItem in pay.VoucherItems) { if (pItem.Status == (int)FinanceStatus.付款单明细状态.已付款 && pItem.Amount > 0) { #region 付款明细 if (pItem.PaymentToType == (int)Hyt.Model.WorkflowStatus.FinanceStatus.付款方类型.仓库 && pItem.PaymentType == (int)FinanceStatus.付款单付款方式.现金) { var warehouse = WhWarehouseBo.Instance.GetWarehouse(pItem.PaymentToSysNo);//地区仓库 var oraganization = Hyt.BLL.Basic.OrganizationBo.Instance.GetOrganization(pItem.PaymentToSysNo); if (warehouse != null) { easNum = warehouse.ErpCode; } else { easNum = string.Empty; } if (oraganization != null) { organizationCode = oraganization.Code; } //付款科目 var km = Hyt.BLL.Finance.FnReceiptVoucherBo.Instance.GetFnReceiptTitleAssociation(pItem.PaymentToSysNo, Hyt.Model.SystemPredefined.PaymentType.现金).OrderByDescending(m => m.IsDefault).FirstOrDefault(); lst.Add(new Extra.Erp.Model.Receiving.ReceivingInfo() { Amount = pItem.Amount, OrderSysNo = orderSysNo, WarehouseNumber = easNum, WarehouseSysNo = pItem.PaymentToSysNo, PayeeAccount = km == null ? string.Empty : km.EasReceiptCode, PayeeAccountBank = payeeAccountBank, SettlementType = settlementType, OrganizationCode = organizationCode, }); } #endregion } } if (lst.Count > 0) { try { SoOrder orderinfo = null; if (!string.IsNullOrEmpty(orderSysNo)) { orderinfo = Hyt.BLL.Order.SoOrderBo.Instance.GetEntity(int.Parse(orderSysNo)); } Extra.Erp.EasProviderFactory.CreateProvider().Payment(lst, customer, false, orderSysNo, orderinfo == null ? string.Empty : orderinfo.TransactionSysNo); } catch (Exception ex) { Hyt.BLL.Log.SysLog.Instance.WriteLog(LogStatus.SysLogLevel.Error, LogStatus.系统日志来源.后台, "部分签收写EAS", LogStatus.系统日志目标类型.EAS, pay.SysNo, ex, string.Empty, operatorSysNo); } } } }
/// <summary> /// 获取订单已使用的促销系统编号集合 /// </summary> /// <param name="order">订单</param> /// <returns>订单已使用的促销系统编号集合</returns> /// <remarks>2013-11-14 吴文强 创建</remarks> public static int[] GetUsedPromotionSysNo(this SoOrder order) { return(CrShoppingCartConvertBo.Instance.GetUsedPromotionSysNo(order.SysNo)); }