修改提单管理

dev
jianghaiqing 3 weeks ago
parent d563cb1b52
commit 6a3eafd629

@ -330,5 +330,71 @@ namespace DS.WMS.Core.Op.Dtos
/// 客服名称
/// </summary>
public string CustomerServiceName { get; set; }
/// <summary>
/// 船证签入日期
/// </summary>
public Nullable<DateTime> ShipCertCheckInDate { get; set; }
/// <summary>
/// 船证签入备注
/// </summary>
public string ShipCertCheckInNote { get; set; }
/// <summary>
/// 船证签入人
/// </summary>
public long ShipCertCheckInBy { get; set; }
/// <summary>
/// 船证签入人名称
/// </summary>
public string ShipCertCheckInUserName { get; set; }
/// <summary>
/// 船证签出日期
/// </summary>
public Nullable<DateTime> ShipCertCheckOutDate { get; set; }
/// <summary>
/// 船证签出备注
/// </summary>
public string ShipCertCheckOutNote { get; set; }
/// <summary>
/// 船证签出人
/// </summary>
public long ShipCertCheckOutBy { get; set; }
/// <summary>
/// 船证签出人名称
/// </summary>
public string ShipCertCheckOutUserName { get; set; }
/// <summary>
/// 是否船证已签入
/// </summary>
public bool IsShipCertCheckIn { get; set; }
/// <summary>
/// 是否船证已签出
/// </summary>
public bool IsShipCertCheckOut { get; set; }
/// <summary>
/// 是否已签入
/// </summary>
public bool IsCheckIn { get; set; }
/// <summary>
/// 是否已签出
/// </summary>
public bool IsCheckOut { get; set; }
/// <summary>
/// 是否换签(背书)
/// </summary>
public bool IsChangeEndorse { get; set; }
}
}

@ -32,5 +32,50 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
[Description("取消签出")]
CheckOutCancel,
/// <summary>
/// 船证签入
/// </summary>
[Description("签入")]
ShipCertCheckIn,
/// <summary>
/// 船证签出
/// </summary>
[Description("船证签出")]
ShipCertCheckOut,
/// <summary>
/// 取消船证签入
/// </summary>
[Description("取消船证签入")]
ShipCertCheckInCancel,
/// <summary>
/// 取消船证签出
/// </summary>
[Description("取消船证签出")]
ShipCertCheckOutCancel,
/// <summary>
/// 换签(背书)
/// </summary>
[Description("换签(背书)")]
ChangeEndorse,
/// <summary>
/// 船证签出
/// </summary>
[Description("取消换签(背书)")]
ChangeEndorseCancel,
/// <summary>
/// 驳回放单通知
/// </summary>
[Description("驳回放单通知")]
RejectReleaeNotice,
/// <summary>
/// 更改提单
/// </summary>
[Description("更改提单")]
BLModify,
/// <summary>
/// 状态更改
/// </summary>
[Description("状态更改")]
StatusModify,
}
}

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos.Enum
{
/// <summary>
/// 提单管理业务类型枚举
/// </summary>
public enum BLIssueBusiTypeEnum
{
/// <summary>
/// 海运出口
/// </summary>
[Description("海运出口")]
SeaExport
}
}

@ -56,6 +56,16 @@ namespace DS.WMS.Core.Op.Dtos
/// 未签出
/// </summary>
[Description("未签出")]
UnCheckOut
UnCheckOut,
/// <summary>
/// 换签(背书)
/// </summary>
[Description("换签(背书)")]
ChangeEndorse,
/// <summary>
/// 驳回放单通知
/// </summary>
[Description("驳回放单通知")]
RejectReleaeNotice
}
}

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos.Enum
{
/// <summary>
/// 单据类型
/// </summary>
public enum BLTypeEnum
{
/// <summary>
/// 提单
/// </summary>
[Description("提单")]
BL
}
}

@ -302,5 +302,72 @@ namespace DS.WMS.Core.Op.Entity
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "不含税其他币种利润", Length = 18, DecimalDigits = 3, IsNullable = true)]
public Nullable<decimal> NoTaxProfitOther { get; set; }
/// <summary>
/// 船证签入日期
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签入日期", IsNullable = true)]
public Nullable<DateTime> ShipCertCheckInDate { get; set; }
/// <summary>
/// 船证签入备注
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签入备注", IsNullable = true, Length = 500)]
public string ShipCertCheckInNote { get; set; }
/// <summary>
/// 船证签入人
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签入人", IsNullable = true)]
public long ShipCertCheckInBy { get; set; }
/// <summary>
/// 船证签入人名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签入人名称", IsNullable = true)]
public string ShipCertCheckInUserName { get; set; }
/// <summary>
/// 船证签出日期
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签出日期", IsNullable = true)]
public Nullable<DateTime> ShipCertCheckOutDate { get; set; }
/// <summary>
/// 船证签出备注
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签出备注", IsNullable = true, Length = 500)]
public string ShipCertCheckOutNote { get; set; }
/// <summary>
/// 船证签出人
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签出人", IsNullable = true)]
public long ShipCertCheckOutBy { get; set; }
/// <summary>
/// 船证签出人名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船证签出人名称", IsNullable = true)]
public string ShipCertCheckOutUserName { get; set; }
/// <summary>
/// 是否船证已签入
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "是否船证已签入", IsNullable = true)]
public bool IsShipCertCheckIn { get; set; }
/// <summary>
/// 是否船证已签出
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "是否船证已签出", IsNullable = true)]
public bool IsShipCertCheckOut { get; set; }
/// <summary>
/// 是否换签(背书)
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "是否换签(背书)", IsNullable = true)]
public bool IsChangeEndorse { get; set; }
}
}

@ -68,6 +68,7 @@ using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Dtos;
using iText.Layout.Element;
using AngleSharp.Html;
using DS.WMS.Core.Op.Dtos.Enum;
namespace DS.WMS.Core.Op.Method
{
@ -170,6 +171,10 @@ namespace DS.WMS.Core.Op.Method
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BusiType = BLIssueBusiTypeEnum.SeaExport.ToString(),
BusiTypeName = BLIssueBusiTypeEnum.SeaExport.GetDescription(),
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
});
start++;
@ -259,6 +264,8 @@ namespace DS.WMS.Core.Op.Method
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
@ -274,6 +281,9 @@ namespace DS.WMS.Core.Op.Method
blModel.CheckInUserName = user.UserName;
blModel.CheckInDate = nowDate;
blModel.CheckInNote = model.Notes;
blModel.Status = BLIssueStatusEnum.CheckIn.ToString();
blModel.StatusName = BLIssueStatusEnum.CheckIn.GetDescription();
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
@ -283,6 +293,8 @@ namespace DS.WMS.Core.Op.Method
x.CheckInUserName,
x.CheckInDate,
x.CheckInNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
@ -381,6 +393,8 @@ namespace DS.WMS.Core.Op.Method
blModel.CheckInUserName = null;
blModel.CheckInDate = null;
blModel.CheckInNote = null;
blModel.Status = null;
blModel.StatusName = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
@ -390,6 +404,8 @@ namespace DS.WMS.Core.Op.Method
x.CheckInUserName,
x.CheckInDate,
x.CheckInNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
@ -480,6 +496,8 @@ namespace DS.WMS.Core.Op.Method
blModel.CheckOutUserName = user.UserName;
blModel.CheckOutDate = nowDate;
blModel.CheckOutNote = model.Notes;
blModel.Status = BLIssueStatusEnum.CheckOut.ToString();
blModel.StatusName = BLIssueStatusEnum.CheckOut.GetDescription();
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
@ -489,6 +507,8 @@ namespace DS.WMS.Core.Op.Method
x.CheckOutUserName,
x.CheckOutDate,
x.CheckOutNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
@ -551,6 +571,8 @@ namespace DS.WMS.Core.Op.Method
blModel.CheckOutUserName = null;
blModel.CheckOutDate = null;
blModel.CheckOutNote = null;
blModel.Status = null;
blModel.StatusName = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
@ -560,6 +582,8 @@ namespace DS.WMS.Core.Op.Method
x.CheckOutUserName,
x.CheckOutDate,
x.CheckOutNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
@ -592,7 +616,98 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> ShipCertCheckIn(ShipCertCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (!blModel.IsShipCertCheckIn)
{
blModel.IsShipCertCheckIn = true;
blModel.IsShipCertificate = true;
blModel.ShipCertCheckInBy = long.Parse(user.UserId);
blModel.ShipCertCheckInUserName = user.UserName;
blModel.ShipCertCheckInDate = nowDate;
blModel.ShipCertCheckInNote = model.Notes;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsShipCertificate,
x.IsShipCertCheckIn,
x.ShipCertCheckInBy,
x.ShipCertCheckInUserName,
x.ShipCertCheckInDate,
x.ShipCertCheckInNote,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ShipCertCheckIn.ToString(),
ActionName = BLIssueActionEnum.ShipCertCheckIn.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
@ -604,7 +719,67 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> ShipCertCheckInCancel(ShipCertCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel != null && blModel.Id > 0)
{
if (blModel.IsShipCertCheckIn)
{
blModel.IsShipCertCheckIn = false;
blModel.ShipCertCheckInBy = 0;
blModel.ShipCertCheckInUserName = null;
blModel.ShipCertCheckInDate = null;
blModel.ShipCertCheckInNote = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsShipCertCheckIn,
x.ShipCertCheckInBy,
x.ShipCertCheckInUserName,
x.ShipCertCheckInDate,
x.ShipCertCheckInNote,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ShipCertCheckInCancel.ToString(),
ActionName = BLIssueActionEnum.ShipCertCheckInCancel.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
}
return DataResult.Successed("成功");
}
#endregion
@ -616,7 +791,95 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> ShipCertCheckOut(ShipCertCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (!blModel.IsShipCertCheckOut)
{
blModel.IsShipCertCheckOut = true;
blModel.IsShipCertificate = true;
blModel.ShipCertCheckOutBy = long.Parse(user.UserId);
blModel.ShipCertCheckOutUserName = user.UserName;
blModel.ShipCertCheckOutDate = nowDate;
blModel.ShipCertCheckOutNote = model.Notes;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsShipCertificate,
x.IsShipCertCheckOut,
x.ShipCertCheckOutBy,
x.ShipCertCheckOutUserName,
x.ShipCertCheckOutDate,
x.ShipCertCheckOutNote,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ShipCertCheckOut.ToString(),
ActionName = BLIssueActionEnum.ShipCertCheckOut.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
@ -628,7 +891,67 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> ShipCertCheckOutCancel(ShipCertCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel != null && blModel.Id > 0)
{
if (blModel.IsShipCertCheckOut)
{
blModel.IsShipCertCheckOut = false;
blModel.ShipCertCheckOutBy = 0;
blModel.ShipCertCheckOutUserName = null;
blModel.ShipCertCheckOutDate = null;
blModel.ShipCertCheckOutNote = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsShipCertCheckOut,
x.ShipCertCheckOutBy,
x.ShipCertCheckOutUserName,
x.ShipCertCheckOutDate,
x.ShipCertCheckOutNote,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ShipCertCheckOutCancel.ToString(),
ActionName = BLIssueActionEnum.ShipCertCheckOutCancel.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
}
return DataResult.Successed("成功");
}
#endregion
@ -640,9 +963,105 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> BLCheckChangeEndorse(BLCheckInOutDto model)
{
return null;
}
#endregion
/*
*/
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
if (orderList.Any(p => !p.bl.IsCheckIn))
{
string s = string.Join(",", orderList.Where(p => !p.bl.IsCheckIn)
.Select(b => b.bl.BLNo).ToArray());
return DataResult.Failed($"提单号:{s} 不能操作,只有已提单已签入才能进行 提单换签(背书)");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (blModel.IsCheckIn)
{
blModel.Status = BLIssueStatusEnum.ChangeEndorse.ToString();
blModel.StatusName = BLIssueStatusEnum.ChangeEndorse.GetDescription();
blModel.IsChangeEndorse = true;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.Status,
x.StatusName,
x.IsChangeEndorse,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ChangeEndorse.ToString(),
ActionName = BLIssueActionEnum.ChangeEndorse.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
#region 取消提单换签(背书)
/// <summary>
@ -652,7 +1071,103 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> BLCheckChangeEndorseCancel(BLCheckInOutDto model)
{
return null;
/*
*/
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
if (orderList.Any(p => !p.bl.IsCheckIn))
{
string s = string.Join(",", orderList.Where(p => !p.bl.IsCheckIn)
.Select(b => b.bl.BLNo).ToArray());
return DataResult.Failed($"提单号:{s} 不能操作,只有已提单已签入才能进行 提单换签(背书)");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (blModel.IsChangeEndorse)
{
blModel.Status = null;
blModel.StatusName = null;
blModel.IsChangeEndorse = false;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.Status,
x.StatusName,
x.IsChangeEndorse,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.ChangeEndorseCancel.ToString(),
ActionName = BLIssueActionEnum.ChangeEndorseCancel.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
@ -664,7 +1179,100 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> BLRejectReleaseNotice(BLCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
if (orderList.Any(p => !p.bl.IsCheckIn))
{
string s = string.Join(",", orderList.Where(p => !p.bl.IsCheckIn)
.Select(b => b.bl.BLNo).ToArray());
return DataResult.Failed($"提单号:{s} 不能操作,只有已提单已签入才能进行 驳回放单通知");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (blModel.IsCheckIn)
{
blModel.Status = BLIssueStatusEnum.RejectReleaeNotice.ToString();
blModel.StatusName = BLIssueStatusEnum.RejectReleaeNotice.GetDescription();
blModel.IsChangeEndorse = true;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.Status,
x.StatusName,
x.IsChangeEndorse,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.RejectReleaeNotice.ToString(),
ActionName = BLIssueActionEnum.RejectReleaeNotice.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
@ -676,7 +1284,98 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> BLModify(BLCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
if (orderList.Any(p => !p.bl.IsCheckIn))
{
string s = string.Join(",", orderList.Where(p => !p.bl.IsCheckIn)
.Select(b => b.bl.BLNo).ToArray());
return DataResult.Failed($"提单号:{s} 不能操作,只有已提单已签入才能进行 更改提单(其他)");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (blModel.IsCheckIn)
{
blModel.Status = BLIssueStatusEnum.BLModify.ToString();
blModel.StatusName = BLIssueStatusEnum.BLModify.GetDescription();
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.Status,
x.StatusName,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.RejectReleaeNotice.ToString(),
ActionName = BLIssueActionEnum.RejectReleaeNotice.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion
@ -688,7 +1387,98 @@ namespace DS.WMS.Core.Op.Method
/// <returns>返回回执</returns>
public async Task<DataResult> BLModifyStatus(BLCheckInOutDto model)
{
return null;
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (model.bookids.Length == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => model.bookids.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Length)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
if (orderList.Any(p => !p.bl.IsCheckIn))
{
string s = string.Join(",", orderList.Where(p => !p.bl.IsCheckIn)
.Select(b => b.bl.BLNo).ToArray());
return DataResult.Failed($"提单号:{s} 不能操作,只有已提单已签入才能进行 状态更改");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel == null || blModel.Id == 0)
{
var dto = new BLIssueManageBaseInputDto
{
BookingId = data.order.Id,
BLNo = data.order.MBLNO,
CustomerId = data.order.CustomerId,
CustomerName = data.order.CustomerName,
SaleId = data.order.SaleId,
Sale = data.order.Sale,
IssueType = data.order.IssueType,
IssueTypeCode = data.order.IssueTypeCode,
IssuePlaceCode = data.order.IssuePlaceCode,
IssuePlace = data.order.IssuePlace,
LoadPortId = data.order.LoadPortId,
LoadPortCode = data.order.LoadPortCode,
LoadPort = data.order.LoadPort,
DischargePortId = data.order.DischargePortId,
DischargePortCode = data.order.DischargePortCode,
DischargePort = data.order.DischargePort,
CustomerService = data.order.CustomerService,
CustomerServiceName = data.order.CustomerServiceName,
BLType = BLTypeEnum.BL.ToString(),
BLTypeName = BLTypeEnum.BL.GetDescription(),
};
var saveRlt = await Save(dto);
if (saveRlt.Succeeded)
blModel = saveRlt.Data;
}
if (blModel.IsCheckIn)
{
blModel.Status = BLIssueStatusEnum.StatusModify.ToString();
blModel.StatusName = BLIssueStatusEnum.StatusModify.GetDescription();
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.Status,
x.StatusName,
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.StatusModify.ToString(),
ActionName = BLIssueActionEnum.StatusModify.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
}
}
return DataResult.Successed("成功");
}
#endregion

Loading…
Cancel
Save