Commit 1d222ace authored by liudong1993's avatar liudong1993

电商erp订单取消

parent d67443b9
......@@ -573,6 +573,17 @@ namespace Mall.Common
}
}
/// <summary>
/// 电商erp订单 原路退款
/// </summary>
public static string ZYRefundFinanceApi
{
get
{
return ReadConfigKey("ZYRefundFinanceApi");
}
}
/// <summary>
/// 微信支付结算率0.60%
/// </summary>
......
This diff is collapsed.
......@@ -203,5 +203,68 @@ INNER JOIN rb_member_user mu on mu.Id=oas.UserId
string sql = $@"SELECT oas.* FROM rb_goods_orderaftersale oas {where} order by oas.ReOrderId desc";
return Get<RB_Goods_OrderAfterSale_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderAfterSale_Extend> GetList_V2(RB_Goods_OrderAfterSale_Extend dmodel, bool IsNormal = true)
{
string where = $" where 1=1 and oas.{nameof(RB_Goods_OrderAfterSale.Status)}=0 and o.OrderSource<>6";
if (IsNormal)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)} <> {(int)Common.Enum.Goods.OrderAfterSaleStatusEnum.Rejected}";
}
if (dmodel.TenantId > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.UserId)}={dmodel.UserId}";
}
if (dmodel.OrderId > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderDetialId > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.OrderDetialId)}={dmodel.OrderDetialId}";
}
if (dmodel.Type > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.Type)}={dmodel.Type}";
}
if (dmodel.ReOrderStatus > 0)
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.ReOrderStatus)}={(int)dmodel.ReOrderStatus}";
}
if (!string.IsNullOrEmpty(dmodel.ReOrderNo))
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.ReOrderNo)} like '%{dmodel.ReOrderNo}%'";
}
if (!string.IsNullOrEmpty(dmodel.OrderDetailIds))
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.OrderDetialId)} in({dmodel.OrderDetailIds})";
}
if (!string.IsNullOrEmpty(dmodel.FStartTime))
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.FinishTime)}>='{dmodel.FStartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.FEndTime))
{
where += $" and oas.{nameof(RB_Goods_OrderAfterSale.FinishTime)}<='{dmodel.FEndTime} 23:59:59'";
}
string sql = $@"SELECT oas.* FROM rb_goods_orderaftersale oas
INNER JOIN rb_goods_order o on oas.OrderId=o.OrderId
{where} order by oas.ReOrderId desc";
return Get<RB_Goods_OrderAfterSale_Extend>(sql).ToList();
}
}
}
......@@ -733,7 +733,7 @@ GROUP BY oc.OrderId";
public List<RB_Goods_Order_Extend> GetOrderRefunedCreateList(int tenantId, int mallBaseId, string startTime, string endTime)
{
string sql = $@"SELECT * FROM rb_goods_order o
WHERE o.TenantId={tenantId} and o.MallBaseId={mallBaseId} and o.OrderStatus = 7 AND o.PaymentTime IS NOT NULL AND DATE_FORMAT(o.PaymentTime,'%Y-%m-%d') <> DATE_FORMAT(o.CancelTime,'%Y-%m-%d') AND o.CancelTime>='{startTime}' AND o.CancelTime <'{endTime}'";
WHERE o.TenantId={tenantId} and o.MallBaseId={mallBaseId} and o.OrderStatus = 7 and o.OrderSource <> 6 AND o.PaymentTime IS NOT NULL AND DATE_FORMAT(o.PaymentTime,'%Y-%m-%d') <> DATE_FORMAT(o.CancelTime,'%Y-%m-%d') AND o.CancelTime>='{startTime}' AND o.CancelTime <'{endTime}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
......@@ -1493,7 +1493,7 @@ GROUP BY od.GoodsId,o.OrderId
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetCanCancelOrderList(int cancelTime, int t, int m)
{
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and OrderSource <> 6 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
string sql = $@"SELECT OrderId,UserId,OrderNo,OrderSource,CouponsIds FROM rb_goods_order where TenantId ={t} and MallBaseId ={m} and `Status`=0 and OrderStatus =1 and DATE_ADD(CreateDate,INTERVAL {cancelTime} MINUTE) < '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";
return Get<RB_Goods_Order_Extend>(sql).ToList();
}
......
......@@ -881,7 +881,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed("该订单未申请取消该订单");
}
int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
if (Type == 1 && IsNormalServer == 1)
if (Type == 1 && IsNormalServer == 1 && omodel.OrderSource != UserSourceEnum.ERP)
{
//获取小程序信息
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId);
......@@ -2401,6 +2401,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.ReOrderStatus,
ReOrderStatusName = x.ReOrderStatus.GetEnumName(),
x.ReRemark,
x.FinanceId,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
......@@ -2654,7 +2655,7 @@ namespace Mall.WebApi.Controllers.MallBase
var omodel = orderModule.GetOrderInfo(ReModel.OrderId ?? 0);
int IsNormalServer = Convert.ToInt32(new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("IsNormalServer").Value);
if (IsNormalServer == 1)
if (IsNormalServer == 1 && omodel.OrderSource != UserSourceEnum.ERP)
{
//获取小程序信息
var mallModel = orderModule.GetMiniProgramExtend(req.MallBaseId);
......@@ -2698,6 +2699,25 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed();
}
}
else if (IsNormalServer == 1 && omodel.OrderSource == UserSourceEnum.ERP) {
bool refundflag = orderModule.SetMallOrderSalesTheWayRefund(omodel.OrderId, ReModel.FinanceId);
if (refundflag)
{
bool flag = orderModule.SetOrderAfterSaleForRefunds(omodel, ReOrderId, Refund, "", req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, "", "", "", "");
if (flag)
{
return ApiResult.Success("");
}
else
{
return ApiResult.Failed();
}
}
else {
LogHelper.Write("调用erp退款接口失败");
return ApiResult.Failed();
}
}
else
{
bool flag = orderModule.SetOrderAfterSaleForRefunds(omodel, ReOrderId, Refund, "", req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, "", "", "", "");
......
......@@ -45,8 +45,9 @@
"ExpendDepartment": 331,
"RebornDMC": "reborn_dmc",
"PropertyDB": "test_property",
"IncomeFinanceApi": "http://testapi.oytour.com/api/Mall/InsertFinanceBatchForMallIn",
"PaymentFinanceApi": "http://testapi.oytour.com/api/Mall/InsertFinanceBatchForMallOut",
"IncomeFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallIn",
"PaymentFinanceApi": "http://192.168.2.16:8083/api/Mall/InsertFinanceBatchForMallOut",
"ZYRefundFinanceApi": "http://192.168.2.16:8083/api/Mall/SetMallOrderSalesTheWayRefund",
"PropertyApi": "http://192.168.2.16:8087/api/ECWorkFlow/SetECSuppliesStockInFlow",
"FinanceKey": "FinanceMallInsertToERPViitto2020",
"SettlementRate": "0.60",
......@@ -56,7 +57,7 @@
"Port": 5672,
"UserName": "guest",
"Password": "viitto2019"
},
},
"RedisSetting": {
"RedisServer": "47.96.23.199",
"RedisPort": "6379",
......
......@@ -2090,7 +2090,7 @@ and DATE_FORMAT(b.PaymentTime,'%y-%m-%d')<DATE_FORMAT('{endDate}','%y-%m-%d') A
//查询所有的退款
var olist = goods_OrderRepository.GetOrderRefunedCreateList(item.TenantId, item.MallBaseId, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"));
//查询所有的售后退款
var afterlist = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { FStartTime = startDate.ToString("yyyy-MM-dd"), FEndTime = endDate.AddDays(-1).ToString("yyyy-MM-dd"), TenantId = item.TenantId, MallBaseId = item.MallBaseId, Type = 1, ReOrderStatus = OrderAfterSaleStatusEnum.Completed });
var afterlist = goods_OrderAfterSaleRepository.GetList_V2(new RB_Goods_OrderAfterSale_Extend() { FStartTime = startDate.ToString("yyyy-MM-dd"), FEndTime = endDate.AddDays(-1).ToString("yyyy-MM-dd"), TenantId = item.TenantId, MallBaseId = item.MallBaseId, Type = 1, ReOrderStatus = OrderAfterSaleStatusEnum.Completed });
if (olist.Any() || afterlist.Any())
{
OrderRefundFinanceModule(olist, afterlist);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment