Browse Source

添加 TS_UNI_API 数据

master
mahao 2 years ago
parent
commit
84e5201d9a
  1. 6
      host/WmsWebApi.HttpApi.Host/appsettings.json
  2. 49
      src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs
  3. 52
      src/WmsWebApi.Application/StockMove/StockMoveService.cs
  4. 12
      src/WmsWebApi.Domain/WMS/IRepository/ITSUNIAPIRepository.cs
  5. 9
      src/WmsWebApi.Domain/WMS/TS_UNI_API.cs
  6. 4
      src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs
  7. 23
      src/WmsWebApi.EntityFrameworkCore/Repositories/TSUNIAPIRepository.cs

6
host/WmsWebApi.HttpApi.Host/appsettings.json

@ -14,8 +14,8 @@
"WmsWebApiJson": "Server=192.168.0.140;Database=CPAT_WMS_Json_TEST;User ID=sa;Password=Microsoft2008",
"AbpBackgroundJobs": "Server=192.168.0.140;Database=CPAT_WMS_Json_TEST;User ID=sa;Password=Microsoft2008",
"AgvInLoc": "CUST",
"AgvOutLoc": "CUST"
"AgvInLoc": "B8L-1",
"AgvOutLoc": "B9ACC"
},
"Redis": {
"Configuration": "127.0.0.1"
@ -28,7 +28,7 @@
},
"CustomConfig": {
"OtherZllConfig": {
"IsEnableErnamFilter": true,
"IsEnableErnamFilter": false,
"ErnamFilters": [ "1023", "1024" ]
}
}

49
src/WmsWebApi.Application/ProductRecieve/ProductRecieveService.cs

@ -15,8 +15,10 @@ using WmsWebApi.BackgroundJobs;
using WmsWebApi.Domain;
using WmsWebApi.EntityFrameworkCore;
using WmsWebApi.Jsons;
using WmsWebApi.Repositories;
using WmsWebApi.Wms;
using WmsWebApi.WMS;
using WmsWebApi.WMS.IRepository;
namespace WmsWebApi.ProductRecieve;
@ -39,6 +41,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry;
private readonly IProductRecieveJsonRepository _productRecieveJsonRepository;
private readonly AsyncRetryPolicy _asyncRetryPolicy;
private readonly ITSUNIAPIRepository _tSUNIAPIRepository;
/// <summary>
/// 是否是请求重试
@ -56,7 +59,8 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
IConfiguration configuration,
IUnitOfWorkManager unitOfWorkManager,
IBackgroundJobRequestRetry backgroundJobRequestRetry,
IProductRecieveJsonRepository productRecieveJsonRepository)
IProductRecieveJsonRepository productRecieveJsonRepository,
ITSUNIAPIRepository tSUNIAPIRepository)
{
_tsStockDetailRepository = tsStockDetailRepository;
_tbProductReceiveRepository = tbProductReceiveRepository;
@ -80,6 +84,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
{
Logger.LogInformation($"执行失败,第 {retryCount} 次重试");
});
_tSUNIAPIRepository = tSUNIAPIRepository;
}
[HttpPost("add/IF01")]
@ -257,6 +262,42 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
TransType = 1
};
_transList.Add(tlTrans);
//插入TS_UNI_API
listTSUNIAPI.Add(new TS_UNI_API()
{
InterfaceType = "BackFlush",
TableName = "xxwms_bk_mstr",
BillType = 201,
SubBillType = tbBill.SubBillType,
BillNum = tbBill.BillNum,
PartCode = item.PartCode,
Batch = item.Batch,
FromLoc = "",
ToLoc = tbRecieve.ToLocCode,
FromErpLoc = "",
ToErpLoc = "",
Qty = item.Qty,
State = 0,
CreateOper = "AGV",
CreateTime = DateTime.Now,
PutTime = DateTime.Now,
CustId = "",
VendId = "",
PoUnit = "",
LocUnit = "",
ValidDate = DateTime.Now,
ErpBillNum = tbBill.BillNum,
ErpLineNum = 0,
EqptCode = "",
EqptType = "B",
VendBatch = item.Batch,
SourceBillNum = tbBill.SourceBillNum,
ProcessId = 0,
GoodQty = item.Qty,
ScrapQty = 0,
InvalidQty = 0
});
}
if (!bErr)
{
@ -269,6 +310,10 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
await _tsStockDetailRepository.AddAsync(_stockList);
if (_stockUpdateList != null && _stockUpdateList.Count() > 0)
await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList);
if (listTSUNIAPI != null && listTSUNIAPI.Count() > 0)
{
await _tSUNIAPIRepository.InsertManyAsync(listTSUNIAPI);
}
await _tlTransactionRepository.AddAsync(_transList);
}
await CurrentUnitOfWork.SaveChangesAsync();
@ -325,7 +370,7 @@ public class ProductRecieveService : ApplicationService, IProductRecieveService
if (bErr == false)
{
result.MESSAGE = "接收成功!";
result.MESSAGE = "成功!";
}
return result;
}

52
src/WmsWebApi.Application/StockMove/StockMoveService.cs

@ -20,6 +20,8 @@ using WmsWebApi.Enums;
using WmsWebApi.Jsons;
using WmsWebApi.StockMove;
using WmsWebApi.Wms;
using WmsWebApi.WMS;
using WmsWebApi.WMS.IRepository;
namespace WmsWebApi.StockMove;
@ -42,6 +44,7 @@ public class StockMoveService : ApplicationService, IStockMoveService
private readonly IBackgroundJobRequestRetry _backgroundJobRequestRetry;
private readonly IStockMoveJsonRepository _stockMoveJsonRepository;
private readonly AsyncRetryPolicy _asyncRetryPolicy;
private readonly ITSUNIAPIRepository _tSUNIAPIRepository;
/// <summary>
/// 是否是请求重试
@ -59,7 +62,8 @@ public class StockMoveService : ApplicationService, IStockMoveService
IConfiguration configuration,
IUnitOfWorkManager unitOfWorkManager,
IBackgroundJobRequestRetry backgroundJobRequestRetry,
IStockMoveJsonRepository stockMoveJsonRepository)
IStockMoveJsonRepository stockMoveJsonRepository,
ITSUNIAPIRepository tSUNIAPIRepository)
{
_tsStockDetailRepository = tsStockDetailRepository;
_tbStockMoveRepository = tbStockMoveRepository;
@ -83,6 +87,7 @@ public class StockMoveService : ApplicationService, IStockMoveService
{
Logger.LogInformation($"执行失败,第 {retryCount} 次重试");
});
_tSUNIAPIRepository = tSUNIAPIRepository;
}
/// <summary>
@ -131,6 +136,7 @@ public class StockMoveService : ApplicationService, IStockMoveService
List<TS_STOCK_DETAIL> _stockUpdateList = new List<TS_STOCK_DETAIL>();
List<TS_STOCK_DETAIL> _stockDelList = new List<TS_STOCK_DETAIL>();
List<TL_TRANSACTION> _transList = new List<TL_TRANSACTION>();
List<TS_UNI_API> listTSUNIAPI = new List<TS_UNI_API>();
#region 添加BILL
var tbBill = new TB_BILL
@ -392,9 +398,43 @@ public class StockMoveService : ApplicationService, IStockMoveService
_transList.Add(tlTrans1);
_transList.Add(tlTrans2);
}
#endregion
//插入TS_UNI_API
listTSUNIAPI.Add(new TS_UNI_API()
{
InterfaceType = "BackFlush",
TableName = "xxwms_bk_mstr",
BillType = 201,
SubBillType = tbBill.SubBillType,
BillNum = tbBill.BillNum,
PartCode = item.PartCode,
Batch = item.Batch,
FromLoc = tbStockMove.FromLocCode,
ToLoc = tbStockMove.ToLocCode,
FromErpLoc = "",
ToErpLoc = "",
Qty = item.Qty,
State = 0,
CreateOper = "AGV",
CreateTime = DateTime.Now,
PutTime = DateTime.Now,
CustId = "",
VendId = "",
PoUnit = "",
LocUnit = "",
ValidDate = DateTime.Now,
ErpBillNum = tbBill.BillNum,
ErpLineNum = 0,
EqptCode = "",
EqptType = "B",
VendBatch = item.Batch,
SourceBillNum = tbBill.SourceBillNum,
ProcessId = 0,
GoodQty = item.Qty,
ScrapQty = 0,
InvalidQty = 0
});
}
if (!bErr)
{
@ -409,6 +449,10 @@ public class StockMoveService : ApplicationService, IStockMoveService
await _tmPgWmsUpdate.UpdateTsStock(_stockUpdateList);
if (_stockDelList != null && _stockDelList.Count() > 0)
await _tmPgWmsUpdate.DeleteTsStock(_stockDelList);
if (listTSUNIAPI != null && listTSUNIAPI.Count() > 0)
{
await _tSUNIAPIRepository.InsertManyAsync(listTSUNIAPI);
}
await _tlTransactionRepository.AddAsync(_transList);
}
await CurrentUnitOfWork.SaveChangesAsync();
@ -436,12 +480,12 @@ public class StockMoveService : ApplicationService, IStockMoveService
if (bErr)
{
result.TYPE = 'E';
apiSSdto.ITYPE = result.MESSAGE;
}
else
{
apiSSdto.ITYPE = "成功";
}
apiSSdto.ITYPE = result.MESSAGE;
try
{
await AddWmsWebApiStockMoveDTONowUnitOfWorkAsync(apiSSdto);

12
src/WmsWebApi.Domain/WMS/IRepository/ITSUNIAPIRepository.cs

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace WmsWebApi.WMS.IRepository
{
public interface ITSUNIAPIRepository : IRepository<TS_UNI_API>, ITransientDependency
{
}
}

9
src/WmsWebApi.Domain/WMS/TS_UNI_API.cs

@ -64,7 +64,7 @@ namespace WmsWebApi.WMS
/// <summary>
/// 数量
/// </summary>
public double? Qty { get; set; }
public decimal? Qty { get; set; }
/// <summary>
/// 状态
@ -154,19 +154,18 @@ namespace WmsWebApi.WMS
/// <summary>
/// GoodQty
/// </summary>
public double? GoodQty { get; set; }
public decimal? GoodQty { get; set; }
/// <summary>
/// ScrapQty
/// </summary>
public double? ScrapQty { get; set; }
public decimal? ScrapQty { get; set; }
/// <summary>
/// InvalidQty
/// </summary>
public double? InvalidQty { get; set; }
public decimal? InvalidQty { get; set; }
#endregion
}
}

4
src/WmsWebApi.EntityFrameworkCore/EntityFrameworkCore/WmsWebApiEntityFrameworkCoreModule.cs

@ -5,7 +5,9 @@ using Volo.Abp;
using Volo.Abp.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
using WmsWebApi.Repositories;
using WmsWebApi.Wms;
using WmsWebApi.WMS.IRepository;
namespace WmsWebApi.EntityFrameworkCore
{
@ -43,7 +45,7 @@ namespace WmsWebApi.EntityFrameworkCore
context.Services.AddTransient(typeof(ITsStockDetailRepository), typeof(TsStockDetailRepository));
context.Services.AddTransient(typeof(ITLTransactionRepository), typeof(TLTransactionRepository));
context.Services.AddTransient(typeof(ITbStockMoveRepository), typeof(TbStockMoveRepository));
context.Services.AddTransient(typeof(ITSUNIAPIRepository), typeof(TSUNIAPIRepository));
}
}
}

23
src/WmsWebApi.EntityFrameworkCore/Repositories/TSUNIAPIRepository.cs

@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using WmsWebApi.EntityFrameworkCore;
using WmsWebApi.WMS;
using WmsWebApi.WMS.IRepository;
namespace WmsWebApi.Repositories
{
public class TSUNIAPIRepository : EfCoreRepository<WmsWebApiDbContext, TS_UNI_API>, ITSUNIAPIRepository
{
public TSUNIAPIRepository(IDbContextProvider<WmsWebApiDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<int> AddAsync(List<TS_UNI_API> TSUNIAPIs)
{
await InsertManyAsync(TSUNIAPIs);
return TSUNIAPIs.Count;
}
}
}
Loading…
Cancel
Save