修改报错消息,增加注释
This commit is contained in:
@@ -76,18 +76,19 @@ namespace Tnb.WarehouseMgr
|
||||
List<string> pointCodes = new List<string>();
|
||||
List<string> locCodes = new();
|
||||
WmsRoad road = new WmsRoad();
|
||||
//遍历字典,找出需要查询数据库拿的相关字段
|
||||
foreach (var d in dics)
|
||||
{
|
||||
var sCode = d["startpoint_code"].ToString() ?? string.Empty;
|
||||
var eCode = d["endpoint_code"].ToString() ?? string.Empty;
|
||||
var dis = d["distance"].ToString() ?? string.Empty;
|
||||
if(sCode == eCode) throw new AppFriendlyException("起始点位不能等于终止点位", 500);
|
||||
if (sCode.IsEmpty())
|
||||
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行起始点位编号不可为空", 500);
|
||||
if (eCode.IsEmpty())
|
||||
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行终止点位编号不可为空", 500);
|
||||
//if (sCode.IsEmpty())
|
||||
// throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据数据起始点位编号不可为空", 500);
|
||||
//if (eCode.IsEmpty())
|
||||
// throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据终止点位编号不可为空", 500);
|
||||
if (dis.IsEmpty())
|
||||
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行距离不可为空", 500);
|
||||
throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据距离不可为空", 500);
|
||||
pointCodes.Add(sCode);
|
||||
pointCodes.Add(eCode);
|
||||
d["create_time"] = DateTime.Now;
|
||||
@@ -100,12 +101,12 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
roads.ForEach(x =>
|
||||
{
|
||||
if (!points.Keys.Contains(x.startpoint_code) ) throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}行的起始点位编号有误", 500);
|
||||
if (!points.Keys.Contains(x.endpoint_code)) throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}行的终止点位编号有误", 500);
|
||||
if (!points.Keys.Contains(x.startpoint_code) ) throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}个数据的起始点位编号有误", 500);
|
||||
if (!points.Keys.Contains(x.endpoint_code)) throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}个数据的终止点位编号有误", 500);
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.org_id = _userManager.User.OrganizeId;
|
||||
x.startpoint_id = points[x.startpoint_code].ToString() ?? throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}行的起始点位编号有误", 500);
|
||||
x.endpoint_id = points[x.endpoint_code].ToString() ?? throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}行的终止点位编号有误", 500);
|
||||
x.startpoint_id = points[x.startpoint_code].ToString() ?? throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}个数据的起始点位编号有误", 500);
|
||||
x.endpoint_id = points[x.endpoint_code].ToString() ?? throw new AppFriendlyException($"第{roads.IndexOf(x) + 1}个数据的终止点位编号有误", 500);
|
||||
x.road_code = $"{x.startpoint_code}-{x.endpoint_code}";
|
||||
x.status = 1;
|
||||
x.create_id = _userManager.UserId;
|
||||
|
||||
Reference in New Issue
Block a user