创建退舱确认任务

dev
cjy 1 month ago
parent 0728712199
commit 49fcd467c5

@ -63,5 +63,13 @@ namespace DS.WMS.Core.Op.Interface
/// <returns></returns>
public Task<DataResult> RefundPoolAsync(IdModel req);
/// <summary>
/// 创建退舱确认任务
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> CreateRefundConfirmAsync(IdModel req);
}
}

@ -488,10 +488,7 @@ namespace DS.WMS.Core.Op.Method
}, tenantDb);
return await Task.FromResult(DataResult.Successed(result.Message));
}
}
}
#endregion
@ -511,8 +508,7 @@ namespace DS.WMS.Core.Op.Method
return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist));
if (callback.FlowStatus == FlowStatusEnum.Approve)
{
await seaComService.SetGoodsStatus("YSTC", callback.BusinessId, tenantDb);
{
var userList = new List<long>();
if (info.OrderProgress =="2")//已出号未申报 发起退舱入池任务 推给当票商务
{
@ -548,7 +544,26 @@ namespace DS.WMS.Core.Op.Method
{
return await Task.FromResult(DataResult.Failed(result.Message));
}
}
}
#region 更新退舱标识
await seaComService.SetGoodsStatus("YSTC", callback.BusinessId, tenantDb);
var oldOrder = info.Adapt<SeaExport>();
info.IsRefund = true;
int rows = await tenantDb.Updateable(info).UpdateColumns(x => new
{
x.IsRefund,
}).ExecuteCommandAsync();
await seaComService.SaveSeaExportLogAsync(new SeaExportSaveLog()
{
OperateType = "Update",
OldOrder = oldOrder,
NewOrder = info,
SourceCode = "RefundAuditCallbackAsync",
SourceName = "退仓审核通过",
}, tenantDb);
#endregion
}
else
{
@ -611,5 +626,49 @@ namespace DS.WMS.Core.Op.Method
return DataResult.Success;
}
/// <summary>
/// 创建退舱确认任务
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult> CreateRefundConfirmAsync(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(req.Id)).FirstAsync();
if (info.IsNull())
return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist));
if (info.IsRefund == false)
{
return await Task.FromResult(DataResult.Failed("订单状态必须为退舱标识!"));
}
var task = await tenantDb.Queryable<BusinessTask>().Where(x => x.BusinessId == long.Parse(req.Id) && x.TaskType == TaskBaseTypeEnum.RETURN_CABIN).FirstAsync();
if (task.IsNotNull() && task.TaskStatus == TaskStatusEnum.Complete)
{
return await Task.FromResult(DataResult.Failed("退舱确认任务已完成!"));
}
var userList = new List<long>();
userList.Add(info.OperatorId);
//发起退舱确认任务
var taskReq = new TaskCreationRequest()
{
BusinessId = info.Id,
BusinessType = BusinessType.OceanShippingExport,
TaskTypeName = TaskBaseTypeEnum.RETURN_CABIN.ToString(),
TaskTitle = $"【{TaskBaseTypeEnum.RETURN_CABIN.GetDescription()}】{info?.CustomerNo}",
TaskDescription = $"【{TaskBaseTypeEnum.RETURN_CABIN.GetDescription()}】{info?.CustomerNo}",
RecvUserIdList = userList.ToArray()
};
var res = await taskService.CreateTaskAsync(taskReq, false);
if (!res.Succeeded)
return await Task.FromResult(DataResult.Failed(res.Message));
return DataResult.Success;
}
}
}

@ -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);

@ -109,5 +109,17 @@ namespace DS.WMS.OpApi.Controllers
{
return await _invokeService.RefundPoolAsync(req);
}
/// <summary>
/// 创建退舱确认任务
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("CreateRefundConfirm")]
public async Task<DataResult> CreateRefundConfirm([FromBody] IdModel req)
{
return await _invokeService.CreateRefundConfirmAsync(req);
}
}
}
Loading…
Cancel
Save