Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
13
BasicData/Tnb.BasicData.Entities/Dto/ThirdResult.cs
Normal file
13
BasicData/Tnb.BasicData.Entities/Dto/ThirdResult.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace Tnb.BasicData.Entities
|
||||||
|
{
|
||||||
|
public class ThirdResult
|
||||||
|
{
|
||||||
|
public int Code { get; set; }
|
||||||
|
public string msgResult { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// public enum ThirdResultCode
|
||||||
|
// {
|
||||||
|
// OK = 200
|
||||||
|
// }
|
||||||
|
}
|
||||||
78
BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs
Normal file
78
BasicData/Tnb.BasicData.Entities/Entity/ThirdWebapiRecord.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.BasicData.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方接口请求记录
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("third_webapi_record")]
|
||||||
|
public class ThirdWebapiRecord : BaseEntity<string>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方名
|
||||||
|
/// </summary>
|
||||||
|
public string third_name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求方式
|
||||||
|
/// </summary>
|
||||||
|
public string method { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
public string url { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求数据
|
||||||
|
/// </summary>
|
||||||
|
public string request_data { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收数据
|
||||||
|
/// </summary>
|
||||||
|
public string response_data { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回码
|
||||||
|
/// </summary>
|
||||||
|
public int response_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应时长
|
||||||
|
/// </summary>
|
||||||
|
public long response_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否发送 0 否 1是
|
||||||
|
/// </summary>
|
||||||
|
public int is_send { get; set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态 0 失败或未发送 1 成功
|
||||||
|
/// </summary>
|
||||||
|
public int status { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送成功时类型 自动 手动
|
||||||
|
/// </summary>
|
||||||
|
public string send_type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后发送时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? last_send_time { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
80
BasicData/Tnb.BasicData/ThirdApiRecordService.cs
Normal file
80
BasicData/Tnb.BasicData/ThirdApiRecordService.cs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
|
using JNPF.Systems.Interfaces.Permission;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
|
||||||
|
namespace Tnb.BasicData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方接口发送记录
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
public class ThirdApiRecordService : IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<ThirdWebapiRecord> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
public ThirdApiRecordService(
|
||||||
|
ISqlSugarRepository<ThirdWebapiRecord> repository,
|
||||||
|
IUserManager userManager
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<string> Send(string id)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
string response = "";
|
||||||
|
ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id);
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||||
|
switch (record.method.ToUpper())
|
||||||
|
{
|
||||||
|
case "GET":
|
||||||
|
response = HttpUtils.RequestGet(record.url);
|
||||||
|
break;
|
||||||
|
case "POST":
|
||||||
|
response = HttpUtils.RequestPost(record.url, record.request_data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
stopwatch.Stop();
|
||||||
|
var elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||||
|
ThirdResult thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||||
|
if (thirdResult.Code == 200)
|
||||||
|
{
|
||||||
|
await db.Updateable<ThirdWebapiRecord>()
|
||||||
|
.SetColumns(x => x.response_data == response)
|
||||||
|
.SetColumns(x => x.response_code == thirdResult.Code)
|
||||||
|
.SetColumns(x => x.last_send_time == now)
|
||||||
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
|
.SetColumns(x => x.send_type == "手动")
|
||||||
|
.SetColumns(x => x.status == 1)
|
||||||
|
.Where(x=>x.id==record.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await db.Updateable<ThirdWebapiRecord>()
|
||||||
|
.SetColumns(x => x.response_data == response)
|
||||||
|
.SetColumns(x => x.response_code == thirdResult.Code)
|
||||||
|
.SetColumns(x => x.last_send_time == now)
|
||||||
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
|
.Where(x=>x.id==record.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return thirdResult.Code == 200 ? "成功" : "失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class ChangeWorkerInput
|
||||||
|
{
|
||||||
|
public string mo_task_id { get; set; }
|
||||||
|
public string worker_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
public int? complete_qty { get; set; }
|
public int? complete_qty { get; set; }
|
||||||
public int? scheduled_qty { get; set; }
|
public int? scheduled_qty { get; set; }
|
||||||
public string workline_id { get; set; }
|
public string workline_id { get; set; }
|
||||||
|
public string worker_id { get; set; }
|
||||||
public string workline_id_id { get; set; }
|
public string workline_id_id { get; set; }
|
||||||
public string estimated_start_date { get; set; }
|
public string estimated_start_date { get; set; }
|
||||||
public string estimated_end_date { get; set; }
|
public string estimated_end_date { get; set; }
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace Tnb.ProductionMgr.Entities.Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string erp_line_pk { get; set; }
|
public string erp_line_pk { get; set; }
|
||||||
|
|
||||||
|
public string user_id { get; set; }
|
||||||
|
|
||||||
public DateTime create_time { get; set; }
|
public DateTime create_time { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2568,13 +2568,14 @@ namespace Tnb.ProductionMgr
|
|||||||
.LeftJoin<PrdMo>((a, b, c, d, e, f) => a.mo_id == f.id)
|
.LeftJoin<PrdMo>((a, b, c, d, e, f) => a.mo_id == f.id)
|
||||||
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g) => a.workline_id == g.Id)
|
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g) => a.workline_id == g.Id)
|
||||||
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g, h) => a.eqp_id == h.id)
|
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g, h) => a.eqp_id == h.id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c, d, e, f, g, h,i)=>a.worker_id==i.Id)
|
||||||
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
|
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
|
||||||
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count <= 0 && worklineIds.Count <= 0,
|
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count <= 0 && worklineIds.Count <= 0,
|
||||||
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
|
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
|
||||||
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
|
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
|
||||||
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
|
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
|
||||||
.Where((a) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_code == DictConst.ToBeScheduledEncode || a.mo_task_code == DictConst.MoStatusPauseCode)
|
.Where((a) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_code == DictConst.ToBeScheduledEncode || a.mo_task_code == DictConst.MoStatusPauseCode)
|
||||||
.Select((a, b, c, d, e, f, g, h) => new WorkOrderAdjustmentListOutput
|
.Select((a, b, c, d, e, f, g, h,i) => new WorkOrderAdjustmentListOutput
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
mo_task_code = a.mo_task_code,
|
mo_task_code = a.mo_task_code,
|
||||||
@@ -2594,6 +2595,7 @@ namespace Tnb.ProductionMgr
|
|||||||
eqp_id_id = a.eqp_id,
|
eqp_id_id = a.eqp_id,
|
||||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
schedule_type = a.schedule_type,
|
schedule_type = a.schedule_type,
|
||||||
|
worker_id = i.RealName
|
||||||
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
@@ -2844,6 +2846,53 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage);
|
return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更换员工
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> ChangeWorker(ChangeWorkerInput input)
|
||||||
|
{
|
||||||
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
PrdMoTask moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||||
|
if (moTask.worker_id == input.worker_id)
|
||||||
|
{
|
||||||
|
throw new Exception("与原员工相同");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_ = await db.Updateable<PrdMoTask>().SetColumns(x => x.worker_id == input.worker_id)
|
||||||
|
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
PrdMo mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
|
||||||
|
BasMaterial? material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
|
||||||
|
BasMaterial process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
|
||||||
|
PrdTaskLog taskLog = new()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
mo_code = mo?.mo_code!,
|
||||||
|
eqp_code = "",
|
||||||
|
mold_code = "",
|
||||||
|
item_code = material?.code!,
|
||||||
|
item_standard = material?.material_specification!,
|
||||||
|
status = "更换员工",
|
||||||
|
operator_name = _userManager.RealName,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
mo_task_id = moTask.id,
|
||||||
|
mo_task_code = moTask.mo_task_code,
|
||||||
|
station_code = "",
|
||||||
|
process_code = process?.code
|
||||||
|
};
|
||||||
|
|
||||||
|
_ = await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
|
||||||
|
return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据id获取任务单相关信息
|
/// 根据id获取任务单相关信息
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using Aop.Api.Domain;
|
using Aop.Api.Domain;
|
||||||
using JNPF;
|
using JNPF;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
@@ -432,6 +433,62 @@ namespace Tnb.ProductionMgr
|
|||||||
await _prdMoTaskService.PrdReport(input);
|
await _prdMoTaskService.PrdReport(input);
|
||||||
return "true";
|
return "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> SendThirdApi(string thirdNmaes)
|
||||||
|
{
|
||||||
|
string[] thirdNameArr = thirdNmaes.Split("-");
|
||||||
|
List<ThirdWebapiRecord> records = await _db.Queryable<ThirdWebapiRecord>().Where(x => thirdNameArr.Contains(x.third_name) && x.status == 0 && x.is_send == 1).ToListAsync();
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
Stopwatch stopwatch = null;
|
||||||
|
string response = "";
|
||||||
|
var elapsedMilliseconds = 0l;
|
||||||
|
ThirdResult thirdResult = null;
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
now = DateTime.Now;
|
||||||
|
stopwatch = Stopwatch.StartNew();
|
||||||
|
switch (record.method.ToUpper())
|
||||||
|
{
|
||||||
|
case "GET":
|
||||||
|
response = HttpUtils.RequestGet(record.url);
|
||||||
|
break;
|
||||||
|
case "POST":
|
||||||
|
response = HttpUtils.RequestPost(record.url, record.request_data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
stopwatch.Stop();
|
||||||
|
elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||||
|
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||||
|
if (thirdResult.Code == 200)
|
||||||
|
{
|
||||||
|
await _db.Updateable<ThirdWebapiRecord>()
|
||||||
|
.SetColumns(x => x.response_data == response)
|
||||||
|
.SetColumns(x => x.response_code == thirdResult.Code)
|
||||||
|
.SetColumns(x => x.last_send_time == now)
|
||||||
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
|
.SetColumns(x => x.send_type == "自动")
|
||||||
|
.SetColumns(x => x.status == 1)
|
||||||
|
.Where(x=>x.id==record.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _db.Updateable<ThirdWebapiRecord>()
|
||||||
|
.SetColumns(x => x.response_data == response)
|
||||||
|
.SetColumns(x => x.response_code == thirdResult.Code)
|
||||||
|
.SetColumns(x => x.last_send_time == now)
|
||||||
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
|
.Where(x=>x.id==record.id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return "true";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,6 +468,15 @@
|
|||||||
/// 血路管自动生产线2线
|
/// 血路管自动生产线2线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string XUELUGUAN2XIAN = "25966313322789";
|
public const string XUELUGUAN2XIAN = "25966313322789";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方 bip
|
||||||
|
/// </summary>
|
||||||
|
public const string BIP = "BIP";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方 bip
|
||||||
|
/// </summary>
|
||||||
|
public const string BIP_DOMAIN = "http://192.168.1.11:8087/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Const;
|
||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DataEncryption;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.JsonSerialization;
|
using JNPF.JsonSerialization;
|
||||||
@@ -7,7 +11,9 @@ using JNPF.Systems.Entitys.Permission;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Cors;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Npgsql.TypeHandlers;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
|
||||||
namespace JNPF.Systems.Common;
|
namespace JNPF.Systems.Common;
|
||||||
|
|
||||||
@@ -82,5 +88,67 @@ public class TestService : IDynamicApiController, ITransient
|
|||||||
user.Account = "2312321";
|
user.Account = "2312321";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public string test1()
|
||||||
|
{
|
||||||
|
return "测试成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> insertUser()
|
||||||
|
{
|
||||||
|
List<TempErpUser> users = _sugar.Queryable<TempErpUser>().ToList();
|
||||||
|
List<UserEntity> insertUsers = new List<UserEntity>();
|
||||||
|
List<UserRelationEntity> insertUserRelations = new List<UserRelationEntity>();
|
||||||
|
List<ErpExtendField> insertErpExtendFields = new List<ErpExtendField>();
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
UserEntity userEntity = new UserEntity();
|
||||||
|
userEntity.Id = SnowflakeIdHelper.NextId();
|
||||||
|
userEntity.Account = user.code;
|
||||||
|
userEntity.RealName = user.name;
|
||||||
|
userEntity.Gender = 1;
|
||||||
|
userEntity.OrganizeId = "25193668006933";
|
||||||
|
userEntity.RoleId = "30327535942933";
|
||||||
|
userEntity.Secretkey = Guid.NewGuid().ToString();
|
||||||
|
userEntity.Password = MD5Encryption.Encrypt(MD5Encryption.Encrypt(CommonConst.DEFAULTPASSWORD) + userEntity.Secretkey);
|
||||||
|
userEntity.EntryDate = DateTime.Now;
|
||||||
|
userEntity.EnabledMark = 1;
|
||||||
|
userEntity.CreatorTime = DateTime.Now;
|
||||||
|
insertUsers.Add(userEntity);
|
||||||
|
|
||||||
|
UserRelationEntity userRelationEntity = new UserRelationEntity();
|
||||||
|
userRelationEntity.Id = SnowflakeIdHelper.NextId();
|
||||||
|
userRelationEntity.UserId = userEntity.Id;
|
||||||
|
userRelationEntity.ObjectType = "Role";
|
||||||
|
userRelationEntity.ObjectId = "30327535942933";
|
||||||
|
userRelationEntity.CreatorTime = DateTime.Now;
|
||||||
|
insertUserRelations.Add(userRelationEntity);
|
||||||
|
|
||||||
|
ErpExtendField extendField = new ErpExtendField();
|
||||||
|
extendField.id = SnowflakeIdHelper.NextId();
|
||||||
|
extendField.org_id = "25398501929509";
|
||||||
|
extendField.table_name = "base_user";
|
||||||
|
extendField.table_id = userEntity.Id;
|
||||||
|
extendField.user_id = user.id;
|
||||||
|
insertErpExtendFields.Add(extendField);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _sugar.Insertable(insertUsers).ExecuteCommandAsync();
|
||||||
|
await _sugar.Insertable(insertUserRelations).ExecuteCommandAsync();
|
||||||
|
await _sugar.Insertable(insertErpExtendFields).ExecuteCommandAsync();
|
||||||
|
return "测试成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[SugarTable("temp_erp_user")]
|
||||||
|
public class TempErpUser : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public string code { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user