shanji 2 years ago
parent
commit
9afa97b184
  1. 25
      BBWYB.Client/APIServices/TestApiService.cs
  2. 10
      BBWYB.Server.API/Controllers/OrderController.cs
  3. 33
      BBWYB.Server.Business/Order/OrderBusiness.cs

25
BBWYB.Client/APIServices/TestApiService.cs

@ -0,0 +1,25 @@
using BBWYB.Common.Http;
using BBWYB.Common.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BBWYB.Client.APIServices
{
public class TestApiService : BaseApiService, IDenpendency
{
public TestApiService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
{
}
public ApiResponse<object> BatchManualSign()
{
return SendRequest<object>(globalContext.BBWYApiHost, "Api/PurchaseOrder/BatchManualSign", new
{
wayBillNoList = new string[] { "ceshi123456" }
}, null, System.Net.Http.HttpMethod.Post);
}
}
}

10
BBWYB.Server.API/Controllers/OrderController.cs

@ -114,6 +114,16 @@ namespace BBWYB.Server.API.Controllers
orderBusiness.CheckSku(request);
}
/// <summary>
/// 核算订单
/// </summary>
/// <param name="orderId"></param>
[HttpPost("{orderId}")]
public void CheckComputationOrder([FromRoute]string orderId)
{
orderBusiness.CheckComputationOrder(orderId);
}
/// <summary>
/// 齐库推送打包费
/// </summary>

33
BBWYB.Server.Business/Order/OrderBusiness.cs

@ -542,5 +542,38 @@ namespace BBWYB.Server.Business
updateOrder?.ExecuteAffrows();
});
}
public void CheckComputationOrder(string orderId)
{
var order = fsql.Select<Order>(orderId).ToOne();
if (order == null)
throw new BusinessException("未查询到订单");
if (order.OrderState != Enums.OrderState.)
throw new BusinessException("订单状态不正确,只有待核算的订单才允许核算");
var orderCost = fsql.Select<OrderCost>(orderId).ToOne();
if (orderCost == null)
throw new BusinessException("未查询到订单成本");
if (Math.Abs(orderCost.Profit ?? 0) > 1M)
throw new BusinessException("订单利润绝对值不能大于1");
fsql.Update<Order>(orderId).Set(o => o.OrderState, Enums.OrderState.).ExecuteAffrows();
SendPurchaseOrderStateToC(orderId, Enums.OrderState.);
}
private void SendPurchaseOrderStateToC(string orderId, Enums.OrderState orderState)
{
try
{
restApiService.SendRequest("https://bbwy.qiyue666.com", "api/BatchPurchase/UpdatePurchaseOrderState", new
{
OrderId = orderId,
PurchaseOrderState = orderState
}, null, HttpMethod.Post);
}
catch
{
}
}
}
}

Loading…
Cancel
Save