修改提单管理

dev
jianghaiqing 3 weeks ago
parent c07d2a0e33
commit ffa34eef2e

@ -35,7 +35,7 @@ namespace DS.WMS.Core.Op.Dtos
/// <summary>
/// 船证签入
/// </summary>
[Description("签入")]
[Description("船证签入")]
ShipCertCheckIn,
/// <summary>
/// 船证签出

@ -1499,6 +1499,13 @@ public class SeaExport : BaseOrgModel<long>
[SugarColumn(ColumnDescription = "提单签发状态", IsNullable = true, DefaultValue = "0")]
public int BLIssueStatus { get; set; }
/// <summary>
/// Desc:提单签发状态名称
/// </summary>
[Description("提单签发状态名称")]
[SugarColumn(ColumnDescription = "提单签发状态名称", IsNullable = true, Length = 30)]
public string BLIssueStatusName { get; set; }
/// <summary>
/// Desc:整票提交状态
/// </summary>

@ -536,4 +536,18 @@ public class SeaExportBillManage : BaseOrgModel<long>
[Description("集装箱")]
[SugarColumn(ColumnDescription = "集装箱", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string CntrTotal { get; set; }
/// <summary>
/// 提单签发状态
/// </summary>
[Description("提单签发状态")]
[SugarColumn(ColumnDescription = "提单签发状态", IsNullable = true, DefaultValue = "0")]
public int BLIssueStatus { get; set; }
/// <summary>
/// 提单签发状态名称
/// </summary>
[Description("提单签发状态名称")]
[SugarColumn(ColumnDescription = "提单签发状态名称", IsNullable = true, Length = 30)]
public string BLIssueStatusName { get; set; }
}

@ -586,6 +586,8 @@ namespace DS.WMS.Core.Op.Method
if (model.bookids.Count == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
DateTime nowDate = DateTime.Now;
if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
@ -596,13 +598,6 @@ namespace DS.WMS.Core.Op.Method
.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;
@ -654,6 +649,22 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.order.BLIssueStatus = (int)BLIssueStatusEnum.CheckIn;
data.order.BLIssueStatusName = BLIssueStatusEnum.CheckIn.GetDescription();
data.order.UpdateBy = long.Parse(user.UserId);
data.order.UpdateUserName = user.UserName;
data.order.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExport>(data.order).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
#endregion
@ -662,9 +673,8 @@ namespace DS.WMS.Core.Op.Method
if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
#region 主单处理
#region 分单处理
var orderList = tenantDb.Queryable<SeaExportBillManage>().ClearFilter(typeof(IOrgId))
.InnerJoin<SeaExport>((l, r) => l.BusinessId == r.Id)
.LeftJoin<BLIssueManageBase>((l, r, t) => l.Id == t.BookingId)
@ -672,12 +682,6 @@ namespace DS.WMS.Core.Op.Method
.Select((l, r, t) => new { order = r, sub = l,bl = t })
.ToList();
//if (orderList.Count != model.bookids.Length)
//{
// return DataResult.Failed("部分订单查询失败,请重新查询台账");
//}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
@ -730,6 +734,22 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.sub.BLIssueStatus = (int)BLIssueStatusEnum.CheckIn;
data.sub.BLIssueStatusName = BLIssueStatusEnum.CheckIn.GetDescription();
data.sub.UpdateBy = long.Parse(user.UserId);
data.sub.UpdateUserName = user.UserName;
data.sub.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExportBillManage>(data.sub).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
#endregion
@ -790,20 +810,93 @@ namespace DS.WMS.Core.Op.Method
if (model.bookids.Count == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var checkIds = model.bookids.Select(a => a.bookid).ToArray();
DateTime nowDate = DateTime.Now;
if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
#region 主单处理
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
.Where((l, r) => checkIds.Contains(l.Id) && l.Deleted == false)
.Select((l, r) => new { order = l, bl = r })
.ToList();
if (orderList.Count != model.bookids.Count)
foreach (var data in orderList)
{
return DataResult.Failed("部分订单查询失败,请重新查询台账");
var blModel = data.bl;
if (blModel != null && blModel.Id > 0)
{
if (blModel.IsCheckIn)
{
blModel.IsCheckIn = false;
blModel.CheckInBy = 0;
blModel.CheckInUserName = null;
blModel.CheckInDate = null;
blModel.CheckInNote = null;
blModel.Status = null;
blModel.StatusName = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsCheckIn,
x.CheckInBy,
x.CheckInUserName,
x.CheckInDate,
x.CheckInNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.CheckInCancel.ToString(),
ActionName = BLIssueActionEnum.CheckInCancel.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.order.BLIssueStatus = 0;
data.order.BLIssueStatusName = null;
data.order.UpdateBy = long.Parse(user.UserId);
data.order.UpdateUserName = user.UserName;
data.order.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExport>(data.order).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
}
#endregion
}
DateTime nowDate = DateTime.Now;
if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
#region 分单处理
var orderList = tenantDb.Queryable<SeaExportBillManage>().ClearFilter(typeof(IOrgId))
.InnerJoin<SeaExport>((l, r) => l.BusinessId == r.Id)
.LeftJoin<BLIssueManageBase>((l, r, t) => l.Id == t.BookingId)
.Where((l, r, t) => checkIds.Contains(l.Id) && l.Deleted == false)
.Select((l, r, t) => new { order = r, sub = l, bl = t })
.ToList();
foreach (var data in orderList)
{
@ -847,8 +940,27 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.sub.BLIssueStatus = 0;
data.sub.BLIssueStatusName = null;
data.sub.UpdateBy = long.Parse(user.UserId);
data.sub.UpdateUserName = user.UserName;
data.sub.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExport>(data.order).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
}
#endregion
}
return DataResult.Successed("成功");
@ -933,6 +1045,22 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.order.BLIssueStatus = (int)BLIssueStatusEnum.CheckOut;
data.order.BLIssueStatusName = BLIssueStatusEnum.CheckOut.GetDescription();
data.order.UpdateBy = long.Parse(user.UserId);
data.order.UpdateUserName = user.UserName;
data.order.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExport>(data.order).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
}
@ -941,7 +1069,7 @@ namespace DS.WMS.Core.Op.Method
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
#region 单处理
#region 单处理
var orderList = tenantDb.Queryable<SeaExportBillManage>().ClearFilter(typeof(IOrgId))
.InnerJoin<SeaExport>((l, r) => l.BusinessId == r.Id)
.LeftJoin<BLIssueManageBase>((l, r, t) => l.Id == t.BookingId)
@ -998,6 +1126,22 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.sub.BLIssueStatus = (int)BLIssueStatusEnum.CheckOut;
data.sub.BLIssueStatusName = BLIssueStatusEnum.CheckOut.GetDescription();
data.sub.UpdateBy = long.Parse(user.UserId);
data.sub.UpdateUserName = user.UserName;
data.sub.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExportBillManage>(data.sub).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
#endregion
@ -1020,7 +1164,11 @@ namespace DS.WMS.Core.Op.Method
if (model.bookids.Count == 0)
return DataResult.Failed("请求参数错误,请选择提单记录");
var checkIds = model.bookids.Select(a => a.bookid).ToArray();
DateTime nowDate = DateTime.Now;
if (model.bookids.Any(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("M", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
var orderList = tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId))
.LeftJoin<BLIssueManageBase>((l, r) => l.Id == r.BookingId)
@ -1033,7 +1181,82 @@ namespace DS.WMS.Core.Op.Method
return DataResult.Failed("部分订单查询失败,请重新查询台账");
}
DateTime nowDate = DateTime.Now;
foreach (var data in orderList)
{
var blModel = data.bl;
if (blModel != null && blModel.Id > 0)
{
if (blModel.IsCheckOut)
{
blModel.IsCheckOut = false;
blModel.CheckOutBy = 0;
blModel.CheckOutUserName = null;
blModel.CheckOutDate = null;
blModel.CheckOutNote = null;
blModel.Status = null;
blModel.StatusName = null;
await tenantDb.Updateable<BLIssueManageBase>(blModel)
.UpdateColumns(x => new
{
x.IsCheckOut,
x.CheckOutBy,
x.CheckOutUserName,
x.CheckOutDate,
x.CheckOutNote,
x.Status,
x.StatusName
}).ExecuteCommandAsync();
var log = new BLIssueManageLog
{
Pid = blModel.Id,
ActionCode = BLIssueActionEnum.CheckOutCancel.ToString(),
ActionName = BLIssueActionEnum.CheckOutCancel.GetDescription(),
Note = model.Notes,
Result = "成功",
CreateBy = long.Parse(user.UserId),
CreateUserName = user.UserName,
CreateTime = nowDate,
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.order.BLIssueStatus = 0;
data.order.BLIssueStatusName = null;
data.order.UpdateBy = long.Parse(user.UserId);
data.order.UpdateUserName = user.UserName;
data.order.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExport>(data.order).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
}
}
if (model.bookids.Any(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)))
{
var checkIds = model.bookids.Where(a => a.MHBillType.Equals("H", StringComparison.OrdinalIgnoreCase)).Select(a => a.bookid).ToArray();
#region 分单处理
var orderList = tenantDb.Queryable<SeaExportBillManage>().ClearFilter(typeof(IOrgId))
.InnerJoin<SeaExport>((l, r) => l.BusinessId == r.Id)
.LeftJoin<BLIssueManageBase>((l, r, t) => l.Id == t.BookingId)
.Where((l, r, t) => checkIds.Contains(l.Id) && l.Deleted == false)
.Select((l, r, t) => new { order = r, sub = l, bl = t })
.ToList();
foreach (var data in orderList)
{
@ -1077,8 +1300,26 @@ namespace DS.WMS.Core.Op.Method
};
await tenantDb.Insertable<BLIssueManageLog>(log).ExecuteCommandAsync();
data.sub.BLIssueStatus = 0;
data.sub.BLIssueStatusName = null;
data.sub.UpdateBy = long.Parse(user.UserId);
data.sub.UpdateUserName = user.UserName;
data.sub.UpdateTime = nowDate;
await tenantDb.Updateable<SeaExportBillManage>(data.sub).UpdateColumns(x => new
{
x.BLIssueStatus,
x.BLIssueStatusName,
x.UpdateBy,
x.UpdateUserName,
x.UpdateTime,
}).ExecuteCommandAsync();
}
}
}
#endregion
}
return DataResult.Successed("成功");

Loading…
Cancel
Save