This commit is contained in:
2024-09-10 17:41:41 +08:00
parent ddae9f34d7
commit ea9d330724
5 changed files with 121 additions and 66 deletions

View File

@@ -45,6 +45,7 @@ namespace Tnb.QcMgr
private readonly IWmsSaleService _wmsSaleService;
private readonly IWmsPurchaseService _wmsPurchaseService;
private readonly IPrdMoTaskService _prdMoTaskService;
private static SemaphoreSlim prdreportSemaphore = new(1);
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public QcCheckTaskService(ISqlSugarRepository<QcCheckExecH> repository,
IUserManager userManager,
@@ -257,6 +258,7 @@ namespace Tnb.QcMgr
[HttpPost]
public async Task SaveData(CheckTaskInput CheckTaskInput)
{
await prdreportSemaphore.WaitAsync();
ISqlSugarClient db = _repository.AsSugarClient();
try
{
@@ -270,6 +272,8 @@ namespace Tnb.QcMgr
{ "checking", 32 },
};
QcCheckExecH QcCheckExecH = await db.Queryable<QcCheckExecH>().Where(p => p.id == CheckTaskInput.mainid).FirstAsync();
if (QcCheckExecH == null)
throw Oops.Bah($"未找到质检任务:{CheckTaskInput.mainid}");
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();
QcCheckExecH.checknum = CheckTaskInput.checknum;
@@ -347,6 +351,19 @@ namespace Tnb.QcMgr
QcCheckExecH.qty = int.Parse(CheckTaskInput.checknum) - rqty;
QcCheckExecH.rqty = rqty;
_ = await db.Updateable(QcCheckExecH).ExecuteCommandAsync();
await db.Updateable<QcCheckExecH>()
.SetColumns(x => x.checknum == QcCheckExecH.checknum)
.SetColumns(x => x.status == QcCheckExecH.status)
.SetColumns(x => x.result == QcCheckExecH.result)
.SetColumns(x => x.execuser == QcCheckExecH.execuser)
.SetColumns(x => x.exectime == QcCheckExecH.exectime)
.SetColumns(x => x.check_type == QcCheckExecH.check_type)
.SetColumns(x => x.remark == QcCheckExecH.remark)
.SetColumns(x => x.attachment == QcCheckExecH.attachment)
.SetColumns(x => x.qty == QcCheckExecH.qty)
.SetColumns(x => x.rqty == QcCheckExecH.rqty)
.Where(x => x.id == CheckTaskInput.mainid)
.ExecuteCommandAsync();
_ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync();
_ = await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync();
//出厂检
@@ -450,6 +467,9 @@ namespace Tnb.QcMgr
Log.Error(e.Message,e);
throw Oops.Oh("执行失败:"+e.Message);
}
finally{
prdreportSemaphore.Release();
}
}
/// <summary>