重写点位业务的导入模块,修改重写在线开发接口的bug
This commit is contained in:
@@ -63,7 +63,6 @@ namespace Tnb.WarehouseMgr
|
||||
x.is_lock = 0;
|
||||
x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{locs.IndexOf(x) + 1}行的载具规格有误", 500);
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
x.modify_id = null;
|
||||
x.modify_time = null;
|
||||
x.is_mix = 1;
|
||||
|
||||
@@ -91,7 +91,6 @@ namespace Tnb.WarehouseMgr
|
||||
x.out_status = ((int)EnumOutStatus.正常).ToString();
|
||||
x.is_check = 1;
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
x.modify_id = null;
|
||||
x.modify_time = null;
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
@@ -35,34 +36,39 @@ namespace Tnb.WarehouseMgr
|
||||
List<Dictionary<string, object>> dics = input.list;
|
||||
List<WmsPointH> points = new List<WmsPointH>();
|
||||
WmsPointH pt = new WmsPointH();
|
||||
List<string> cCodes = new List<string>();
|
||||
List<string> aCodes = new List<string>();
|
||||
foreach (var d in dics)
|
||||
{
|
||||
var cCode = d["carrystd_id"].ToString() ?? string.Empty;
|
||||
if (cCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行载具规格不可为空", 500);
|
||||
cCodes.Add(cCode);
|
||||
var pCode = d["point_code"].ToString() ?? string.Empty;
|
||||
var pName = d["point_name"].ToString() ?? string.Empty;
|
||||
var aCode = d["area_code"].ToString() ?? string.Empty;
|
||||
var floor = d["floor"].ToString() ?? string.Empty;
|
||||
if (pCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行点位编号不可为空", 500);
|
||||
if (pName == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行点位名称不可为空", 500);
|
||||
if (aCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行管理区编号不可为空", 500);
|
||||
if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}行楼层不可为空", 500);
|
||||
aCodes.Add(aCode);
|
||||
d["create_time"] = DateTime.Now;
|
||||
d.Remove("modify_time");
|
||||
pt = d.Adapt<WmsPointH>();
|
||||
points.Add(pt);
|
||||
}
|
||||
var carryStdDic = await _db.Queryable<WmsCarrystd>().Where(it => cCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id);
|
||||
if (carryStdDic?.Count > 0)
|
||||
{
|
||||
var areas = await _db.Queryable<WmsAreaH>().Where(it => aCodes.Contains(it.code)).ToDictionaryAsync(x => x.code, x => x.id);
|
||||
points.ForEach(x =>
|
||||
{
|
||||
|
||||
if (!areas.Keys.Contains(x.area_code)) throw new AppFriendlyException($"第{points.IndexOf(x) + 1}行的管理区编号有误", 500);
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.org_id = _userManager.User.OrganizeId;
|
||||
x.is_lock = 0;
|
||||
|
||||
x.status = 1;
|
||||
x.point_x = 0;
|
||||
x.point_y = 0;
|
||||
x.point_z = 0;
|
||||
x.area_id = areas[x.area_code].ToString() ?? throw new AppFriendlyException($"第{points.IndexOf(x) + 1}行的管理区编号编号有误", 500);
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
x.modify_id = null;
|
||||
x.modify_time = null;
|
||||
|
||||
});
|
||||
}
|
||||
row = await _db.Insertable(points).ExecuteCommandAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -798,7 +798,7 @@ namespace JNPF.VisualDev
|
||||
{
|
||||
VisualDevImportDataOutput result = new VisualDevImportDataOutput();
|
||||
var overideSvc = OverideVisualDevManager.GetOrDefault(modelId);
|
||||
if (overideSvc != null && overideSvc.OverideFuncs.CreateAsync != null)
|
||||
if (overideSvc != null && overideSvc.OverideFuncs.ImportDataAsync != null)
|
||||
{
|
||||
await overideSvc.OverideFuncs.ImportDataAsync(list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user