100 lines
3.5 KiB
C#
100 lines
3.5 KiB
C#
|
|
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.Dto;
|
|
using WMS.Web.Core.Internal.Results;
|
|
using WMS.Web.Domain.Entitys;
|
|
using WMS.Web.Domain.Infrastructure;
|
|
using WMS.Web.Domain.IService;
|
|
using WMS.Web.Domain.IService.Public;
|
|
|
|
namespace WMS.Web.Api.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class TestController : ControllerBase
|
|
{
|
|
private readonly IErpService _erpService;
|
|
private IInStockTaskService _inStockTaskService;
|
|
private IBasicsRepositories _transactionRepositories;
|
|
private readonly IOpsService _opsService;
|
|
private readonly IBoxService _boxService;
|
|
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
|
|
public TestController(IErpService erpService, IInStockTaskService inStockTaskService,
|
|
IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService,
|
|
IOutStockTaskRepositories outStockTaskRepositories)
|
|
{
|
|
this._erpService = erpService;
|
|
this._inStockTaskService = inStockTaskService;
|
|
this._transactionRepositories = transactionRepositories;
|
|
_opsService = opsService;
|
|
_boxService = boxService;
|
|
_outStockTaskRepositories = outStockTaskRepositories;
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("hj")]
|
|
public async Task<string> TestHJ()
|
|
{
|
|
//var t=await _outStockTaskRepositories.Get(1);
|
|
// t.Details[0].Remark = "sdf";
|
|
// t.Details[0].ErpDetails[0].SaleBillNo = "sdfsfsbbbb";
|
|
// var s = await _outStockTaskRepositories.Edit(t);
|
|
// await _boxService.Sync();
|
|
//var res = await this._erpService.BillQueryForDeliveryNoticeOutStock(null,DateTime.Now.AddDays(-300));
|
|
//var result= await this._erpService.BillQueryForPurchaseInStock();
|
|
//var result = await this._erpService.BillQueryForOrg();
|
|
var result = await this._erpService.BillQueryForMaterial();
|
|
if (!result.IsSuccess)
|
|
return "";
|
|
return JsonConvert.SerializeObject(result.Data);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("tf")]
|
|
public async Task<string> TestTF()
|
|
{
|
|
//var result = await this._erpService.BillQueryForOrg();
|
|
var result = await this._erpService.BillQueryForBillType();
|
|
if (!result.IsSuccess)
|
|
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.SysnTransferin(null,isTransaction);
|
|
if (!result.IsSuccess) isRollback = true;
|
|
|
|
//4.提交事务
|
|
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
|
if (!isSuccess)
|
|
return Result.ReFailure(result.Message, result.Status);
|
|
return result;
|
|
|
|
}
|
|
}
|
|
}
|