120 lines
4.6 KiB
C#
120 lines
4.6 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;
|
|
private readonly IOutStockTaskService _outStockTaskService;
|
|
public TestController(IErpService erpService, IInStockTaskService inStockTaskService,
|
|
IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService,
|
|
IOutStockTaskRepositories outStockTaskRepositories, IOutStockTaskService outStockTaskService)
|
|
{
|
|
this._erpService = erpService;
|
|
this._inStockTaskService = inStockTaskService;
|
|
this._transactionRepositories = transactionRepositories;
|
|
_opsService = opsService;
|
|
_boxService = boxService;
|
|
_outStockTaskRepositories = outStockTaskRepositories;
|
|
_outStockTaskService = outStockTaskService;
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("hj")]
|
|
public async Task<string> TestHJ()
|
|
{
|
|
var c = await _erpService.BillQueryForSubStock(null,null);
|
|
//var bc2 = await _erpService.BillQueryForMisDeliveryOutStock(null, DateTime.Now.AddDays(-10));
|
|
//var bc = await _erpService.BillQueryForTransferOutOutStock(null, DateTime.Now.AddDays(-10));
|
|
//var b=await _erpService.BillQueryForAssembledAppOutStock_Assembly(null, DateTime.Now.AddDays(-1));
|
|
//var b2 = await _erpService.BillQueryForAssembledAppOutStock_Dassembly(null, DateTime.Now.AddDays(-10));
|
|
//var result = await this._outStockTaskService.Sync(null);
|
|
//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.BillQueryForAssembledAppOutStock_Dassembly(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);
|
|
return "";
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("Refresh")]
|
|
public async Task<string> Refresh()
|
|
{
|
|
var result = await this._outStockTaskService.Sync(null);
|
|
return "";
|
|
}
|
|
|
|
[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;
|
|
|
|
var billNos = new List<string>();
|
|
billNos.Add("CGDD224207");
|
|
|
|
//3.同步数据
|
|
var result = await _inStockTaskService.SsynPurchaseInStock(billNos, isTransaction);
|
|
if (!result.IsSuccess) isRollback = true;
|
|
|
|
//4.提交事务
|
|
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
|
if (!isSuccess)
|
|
return Result.ReFailure(result.Message, result.Status);
|
|
return result;
|
|
|
|
}
|
|
}
|
|
}
|