This commit is contained in:
qianjiawei
2023-11-08 16:51:20 +08:00
parent 60ff5d69bb
commit be8b061de3
2 changed files with 32 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.QcMgr.Entities;
using Tnb.QcMgr.Interfaces;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.QcMgr
{
@@ -29,12 +31,16 @@ namespace Tnb.QcMgr
private const string ModuleId = "26745613138709";
private readonly ISqlSugarRepository<QcCheckExecH> _repository;
private readonly IUserManager _userManager;
private readonly IWmsSaleService _wmsSaleService;
private readonly IWmsPurchaseService _wmsPurchaseService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager)
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager, IWmsSaleService wmsSaleService, IWmsPurchaseService wmsPurchaseService)
{
_repository = repository;
_userManager = userManager;
OverideFuncs.GetListAsync = GetListAsync;
_wmsSaleService= wmsSaleService;
_wmsPurchaseService= wmsPurchaseService;
}
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
@@ -197,6 +203,14 @@ namespace Tnb.QcMgr
ISqlSugarClient db = _repository.AsSugarClient();
try
{
Dictionary<string, int> dic = new()
{
{ "ok", 1 },
{ "no", 2 },
{ "barelyOk", 4 },
{ "await", 8 },
{ "temporarily", 16 }
};
QcCheckExecH QcCheckExecH = await db.Queryable<QcCheckExecH>().Where(p => p.id == CheckTaskInput.mainid).FirstAsync();
DictionaryTypeEntity DictionaryType = await db.Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
DictionaryDataEntity DictionaryData = await db.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync();
@@ -267,6 +281,22 @@ namespace Tnb.QcMgr
_ = await db.Updateable(QcCheckExecH).ExecuteCommandAsync();
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
_ = await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync();
//出厂检
if (QcCheckExecH.checktype == "26589783783701" && !string.IsNullOrEmpty(QcCheckExecH.extras))
{
MesCheckdCallbackUpinput mesCheckdCallbackUpinput = new MesCheckdCallbackUpinput();
mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
await _wmsSaleService.MesCheckdSaleCallback(mesCheckdCallbackUpinput);
}
//入厂检
else if (QcCheckExecH.checktype == "26589773352981" && !string.IsNullOrEmpty(QcCheckExecH.extras))
{
MesCheckdCallbackUpinput mesCheckdCallbackUpinput = new MesCheckdCallbackUpinput();
mesCheckdCallbackUpinput.maintableid = QcCheckExecH.extras;
mesCheckdCallbackUpinput.check_conclusion = dic.Where(p => p.Key == CheckTaskInput.result).Any() ? dic.Where(p => p.Key == CheckTaskInput.result).First().Value : 0;
await _wmsPurchaseService.MesCheckdPurchaseCallback(mesCheckdCallbackUpinput);
}
await db.Ado.CommitTranAsync();
}
catch (Exception)

View File

@@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
<ProjectReference Include="..\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
</ItemGroup>