diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs
index d8e1515f..ae2deba4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs
@@ -13,6 +13,6 @@ namespace Tnb.WarehouseMgr.Interfaces
///
///
///
- Task UpdateNullCarry(WmsCarryH carryObj, Func> updateTask=null, [CallerMemberName] string original = "");
+ Task> UpdateNullCarry(WmsCarryH carryObj, Func> updateTask = null, [CallerMemberName] string original = "");
}
}
\ No newline at end of file
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 19998f67..fc8ef8e4 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -243,7 +243,7 @@ namespace Tnb.WarehouseMgr
}
}
foreach (var (i, v) in dic)
- {
+ {
foreach (var it in v)
{
it.groups = groupCode;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
index 4c6f2c0b..9644e80e 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
@@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr
wmsCarryReplaceH.modify_id = null;
wmsCarryReplaceH.modify_time = null;
row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync();
- row = await UpdateNullCarry(oldCarry);
+ row = await UpdateNullCarry(oldCarry).Unwrap();
isOk = (row > 0);
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
}
@@ -156,9 +156,10 @@ namespace Tnb.WarehouseMgr
}
[NonAction]
- public async Task UpdateNullCarry(WmsCarryH carryObj, Func> updateTask = null, [CallerMemberName] string original = "")
+ public async Task> UpdateNullCarry(WmsCarryH carryObj, Func> updateTask = null, [CallerMemberName] string original = "")
{
- var row = -1;
+ var row = 1;
+ Task resTask = Task.FromResult(row);
try
{
carryObj.status = 0;
@@ -173,16 +174,8 @@ namespace Tnb.WarehouseMgr
carryObj.collocation_scheme_code = null;
carryObj.source_id = null;
carryObj.source_code = null;
- if (updateTask != null)
- {
- updateTask(carryObj);
- }
- else
- {
- row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync();
- }
- //Task.Run(() => _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync());
- //删除对应明细表
+ resTask = updateTask?.Invoke(carryObj) ?? _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync();
+ //*****删除对应明细表
//删除载具明细
await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync();
//删除载具分拣物料明细
@@ -193,10 +186,11 @@ namespace Tnb.WarehouseMgr
catch (Exception ex)
{
row = 0;
+ resTask = Task.FromResult(row);
Log.Error("更新空载具出错", ex);
throw;
}
- return row;
+ return resTask;
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
index 665a32ee..89de62ce 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
@@ -169,7 +169,7 @@ namespace Tnb.WarehouseMgr
var isOk = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
var carryId = input.carryIds[^input.carryIds.Count];
var carry = await _db.Queryable().SingleAsync(it => it.id == carryId);
- var row = await _wmsCarryService.UpdateNullCarry(carry);
+ var row = await _wmsCarryService.UpdateNullCarry(carry).Unwrap();
isOk = row > 0;
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
index d6c26e3a..9536663d 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -626,7 +626,7 @@ namespace Tnb.WarehouseMgr
//如果没有完成,修改为工作中
await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
}
- await _wareCarryService.UpdateNullCarry(carry);
+ await _wareCarryService.UpdateNullCarry(carry).Unwrap();
}
else if (outStatus == EnumOutStatus.分拣出)
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
index 23b83bb3..206fe46b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
@@ -91,16 +91,17 @@ namespace Tnb.WarehouseMgr
feedBox.modify_id = _userManager.UserId;
feedBox.modify_time = DateTime.Now;
var row = await _db.Updateable(feedBox)
- .UpdateColumns(it => new {
+ .UpdateColumns(it => new
+ {
it.material_id,
it.material_code,
it.qty,
it.batch,
- it.modify_id,
+ it.modify_id,
it.modify_time
}).ExecuteCommandAsync();
//更新载具
- row = await _carryService.UpdateNullCarry(carry);
+ row = await _carryService.UpdateNullCarry(carry).Unwrap();
isOk = (row > 0);
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
index cd498d19..cc149b94 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
@@ -306,17 +306,17 @@ namespace Tnb.WarehouseMgr
if (carrys?.Count > 0)
{
await _db.Ado.BeginTranAsync();
- var tasks = new List>();
+ var tasks = new List>>();
foreach (var carryIt in carrys)
{
tasks.Add(_carryService.UpdateNullCarry(carryIt, carryIt => Task.Run(() => _db.CopyNew().Updateable(carryIt).ExecuteCommandAsync())));
}
- var all = await Task.WhenAll(tasks);
- await _db.Ado.CommitTranAsync();
+ var all = await Task.WhenAll(tasks.Select(t => t.Unwrap()));
if (all.All(x => x > 0))
{
isOk = all?.Length > 0;
}
+ await _db.Ado.CommitTranAsync();
}
}
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);