|
|
|
@ -1116,25 +1116,34 @@ public partial class SeaExportService : ISeaExportService
|
|
|
|
|
//info.DeleteBy = long.Parse(user.UserId);
|
|
|
|
|
//tenantDb.Updateable(info).ExecuteCommand();
|
|
|
|
|
//tenantDb.Deleteable(info).IsLogic().ExecuteCommand("Deleted");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
|
var ctns = await tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == id).ToListAsync();
|
|
|
|
|
if (ctns.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctns).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var ctnPrices = await tenantDb.Queryable<BusinessCtnPrice>().Where(x => x.BusinessId == long.Parse(id)).ToListAsync();
|
|
|
|
|
if (ctnPrices.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctnPrices).ExecuteCommandAsync();
|
|
|
|
|
var ediInfo = await tenantDb.Queryable<SeaExportEdi>().Where(x => x.BusinessId == long.Parse(id)).FirstAsync();
|
|
|
|
|
if (ediInfo.IsNotNull())
|
|
|
|
|
await tenantDb.Deleteable(ediInfo).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var contacts = await tenantDb.Queryable<BusinessOrderContact>().Where(x => x.BusinessId == long.Parse(id)).ToListAsync();
|
|
|
|
|
if (contacts.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(contacts).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Deleteable(info).ExecuteCommandAsync();
|
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ctns = await tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == id).ToListAsync();
|
|
|
|
|
if (ctns.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctns).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var ctnPrices = await tenantDb.Queryable<BusinessCtnPrice>().Where(x => x.BusinessId == long.Parse(id)).ToListAsync();
|
|
|
|
|
if (ctnPrices.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctnPrices).ExecuteCommandAsync();
|
|
|
|
|
var ediInfo = await tenantDb.Queryable<SeaExportEdi>().Where(x => x.BusinessId == long.Parse(id)).FirstAsync();
|
|
|
|
|
if (ediInfo.IsNotNull())
|
|
|
|
|
await tenantDb.Deleteable(ediInfo).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var contacts = await tenantDb.Queryable<BusinessOrderContact>().Where(x => x.BusinessId == long.Parse(id)).ToListAsync();
|
|
|
|
|
if (contacts.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(contacts).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Deleteable(info).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await tenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(db);
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("删除失败!" + ",请联系管理员!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
@ -1184,12 +1193,44 @@ public partial class SeaExportService : ISeaExportService
|
|
|
|
|
|
|
|
|
|
//tenantDb.Deleteable(list).IsLogic().ExecuteCommand("Deleted");
|
|
|
|
|
//tenantDb.Deleteable<SeaExport>(list).IsLogic().ExecuteCommand("Deleted");
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
//foreach (var item in list)
|
|
|
|
|
//{
|
|
|
|
|
// item.Deleted = true;
|
|
|
|
|
// item.DeleteTime = DateTime.Now;
|
|
|
|
|
// item.DeleteBy = long.Parse(user.UserId);
|
|
|
|
|
// tenantDb.Updateable(item).ExecuteCommand();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
var ctns = await tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == item.Id.ToString()).ToListAsync();
|
|
|
|
|
if (ctns.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctns).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var ctnPrices = await tenantDb.Queryable<BusinessCtnPrice>().Where(x => x.BusinessId == item.Id).ToListAsync();
|
|
|
|
|
if (ctnPrices.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(ctnPrices).ExecuteCommandAsync();
|
|
|
|
|
var ediInfo = await tenantDb.Queryable<SeaExportEdi>().Where(x => x.BusinessId == item.Id).FirstAsync();
|
|
|
|
|
if (ediInfo.IsNotNull())
|
|
|
|
|
await tenantDb.Deleteable(ediInfo).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var contacts = await tenantDb.Queryable<BusinessOrderContact>().Where(x => x.BusinessId == item.Id).ToListAsync();
|
|
|
|
|
if (contacts.Count > 0)
|
|
|
|
|
await tenantDb.Deleteable(contacts).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Deleteable(item).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
item.Deleted = true;
|
|
|
|
|
item.DeleteTime = DateTime.Now;
|
|
|
|
|
item.DeleteBy = long.Parse(user.UserId);
|
|
|
|
|
tenantDb.Updateable(item).ExecuteCommand();
|
|
|
|
|
await tenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(db);
|
|
|
|
|
return await Task.FromResult(DataResult.Failed("删除失败!" + ",请联系管理员!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|