金蝶获取采购入库单
This commit is contained in:
@@ -2,12 +2,16 @@
|
||||
using ERP;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ServiceModel;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
|
||||
namespace WMS.Web.Api.Controllers
|
||||
@@ -17,9 +21,13 @@ namespace WMS.Web.Api.Controllers
|
||||
public class TestController : ControllerBase
|
||||
{
|
||||
private readonly IErpService _erpService;
|
||||
public TestController(IErpService erpService)
|
||||
private IInStockTaskService _inStockTaskService;
|
||||
private ITransactionRepositories _transactionRepositories;
|
||||
public TestController(IErpService erpService, IInStockTaskService inStockTaskService, ITransactionRepositories transactionRepositories)
|
||||
{
|
||||
this._erpService = erpService;
|
||||
this._inStockTaskService = inStockTaskService;
|
||||
this._transactionRepositories = transactionRepositories;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -32,5 +40,30 @@ namespace WMS.Web.Api.Controllers
|
||||
return "";
|
||||
return JsonConvert.SerializeObject(result.Data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试:同步采购单的入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("InStock")]
|
||||
public async Task<Result> InStock()
|
||||
{
|
||||
//1.事务
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isTransaction = false;
|
||||
|
||||
//3.同步数据
|
||||
var result = await _inStockTaskService.SsynPurchaseInStock(isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
|
||||
//4.提交事务
|
||||
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(result.Message,result.Status);
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user