/// <summary> /// crm退货确认 /// </summary> /// <param name="jlbh"></param> /// <returns></returns> public static bool CrmReturn(CustomerScoreEntity request, out string message) { message = string.Empty; CrmProj.Model.CrmAppResp_0104 crm0104 = new CrmProj.Model.CrmAppResp_0104(); if (CrmOpClaUtilInStance != null && CrmOpClaUtilInStance.qzjConfig != null && request != null) { if (request == null || string.IsNullOrEmpty(request.MembershipCard) || string.IsNullOrEmpty(request.OrderSysNo)) { return(false); } CustomerScoreLogDA da = new CustomerScoreLogDA(); //根据订单编号获取SOItemList int soSysNo = 0; if (int.TryParse(request.OrderSysNo, out soSysNo)) { } List <ReturnSoItemInfo> itemList = da.GetReturnSoItemInfoListBySOID(soSysNo); if (itemList == null || itemList.Count <= 0) { message = "noneed"; return(false); } CrmProj.Model.article[] productAryy = new CrmProj.Model.article[itemList.Count]; decimal totalAmount = 0;//= orderDetail.SOMaster.Amount.CashPay + orderDetail.SOMaster.Amount.PayPrice + orderDetail.Shipping.Price + orderDetail.SOMaster.Amount.PremiumAmount + orderDetail.SOMaster.Amount.DiscountAmount - orderDetail.SOMaster.Amount.GiftCardPay - orderDetail.SOMaster.Amount.PrepayAmount; for (int i = 0; i < itemList.Count; i++) { CrmProj.Model.article product = new CrmProj.Model.article(); product.inx = i; product.dept_sale = "980101";// "980101";//部门代码 product.code = itemList[i].MerchantProductID; product.contract_code = itemList[i].ContractCode; product.quantity = itemList[i].Quantity; product.bj_bcjhd = "N"; product.amount = itemList[i].CurrentPrice * itemList[i].Quantity; productAryy[i] = product; totalAmount += product.amount; } bool success = crmOpClaUtilInStance.CrmReturn(request.OrderSysNo, request.CrmMemberID, productAryy, totalAmount, out message, out crm0104); if (success) { //更新奖票信息为不可用: da.SetLuckTicketVoid(soSysNo); return(true); } return(false); } message = "CRM前置机登陆失败"; return(false); }
public void GivePoint() { CustomerScoreLogDA da = new CustomerScoreLogDA(); List <CustomerScoreEntity> list = da.LoadWaitGivePointList(); if (list != null && list.Count > 0) { foreach (CustomerScoreEntity item in list) { if (string.IsNullOrWhiteSpace(item.CrmMemberID)) { string errorMark = "CrmMemberID为空"; da.GivePointFaild(item.SysNo, errorMark); string msg = string.Format("CRM赠送积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo , item.ValidScore, item.CustomerSysNo, errorMark); Writelog(msg); continue; } string message = string.Empty; List <CRMLuckDrawLog> luckList = CRMExternalService.CrmTradeConfirm(item, out message); if (string.IsNullOrEmpty(message)) { da.GivePointSuccess(item.SysNo); string msg = string.Format("CRM赠送积分成功:编号-{0},积分-{1},顾客-{2},CRM顾客编号-{3}", item.SysNo , item.ValidScore, item.CustomerSysNo, item.CrmMemberID); //插入抽奖信息 if (luckList != null && luckList.Count > 0) { foreach (var entity in luckList) { da.InsertCRMLuckDrawLog(entity); } } Writelog(msg); } else { string errorMark = CRMExternalService.CrmOpClaUtilInStance.RMsg; da.GivePointFaild(item.SysNo, errorMark); string msg = string.Format("CRM赠送积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-{3},原因-{4}", item.SysNo , item.ValidScore, item.CustomerSysNo, item.CrmMemberID, errorMark); Writelog(msg); } } } }
public void ReturnPoint() { CustomerScoreLogDA da = new CustomerScoreLogDA(); List <CustomerScoreEntity> list = da.GetWaitReturnSOIDs(); if (list != null && list.Count > 0) { foreach (CustomerScoreEntity item in list) { if (string.IsNullOrWhiteSpace(item.CrmMemberID)) { string errorMark = "CrmMemberID为空"; string msg = string.Format("CRM退还积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo , item.ValidScore, item.CustomerSysNo, errorMark); da.GivePointFaild(item.SysNo, msg); Writelog(msg); continue; } string message = string.Empty; bool success = CRMExternalService.CrmReturn(item, out message); if (success) { string msg = string.Format("CRM退还积分成功:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo , item.ValidScore, item.CustomerSysNo, message); da.ReturnPiontSuccess(item.SysNo); Writelog(msg); } else { if (message == "noneed") { //:该订单没有退款的商品 } else { string msg = string.Format("CRM退还积分失败:编号-{0},积分-{1},顾客-{2},CRM顾客编号-,原因-{3}", item.SysNo , item.ValidScore, item.CustomerSysNo, message); da.GivePointFaild(item.SysNo, msg); Writelog(msg); } } } } }