This commit is contained in:
FanLian
2023-08-14 09:08:05 +08:00
18 changed files with 390 additions and 14 deletions

View File

@@ -87,7 +87,7 @@ public static class DictConst
/// </summary>
public const string ComplatedEnCode = "Complated";
/// <summary>
/// 任务单状态-待排产
/// 任务单状态-待下发
/// </summary>
public const string ToBeScheduledEncode = "ToBeScheduled";
/// <summary>

View File

@@ -203,4 +203,9 @@ public partial class EqpEquipment : BaseEntity<string>
/// </summary>
public string? responsibler_id { get; set; }
/// <summary>
/// 二维码
/// </summary>
public string? qrcode { get; set; }
}

View File

@@ -23,5 +23,12 @@ namespace Tnb.EquipMgr.Interfaces
/// </summary>
/// <returns></returns>
public Task<dynamic> GetWorklineAndEquipTree(Dictionary<string,string> dic);
/// <summary>
/// 根据二维码查设备
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
public Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic);
}
}

View File

@@ -233,5 +233,12 @@ namespace Tnb.EquipMgr
["list"] = list1,
});
}
[HttpPost]
public async Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic)
{
string qrcode = dic["qrcode"];
return await _repository.GetSingleAsync(x => x.qrcode == qrcode);
}
}
}

View File

@@ -0,0 +1,8 @@
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
public class ChangeEquipInput
{
public string mo_task_id { get; set; }
public string equip_id { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
public class ChangeMoldInput
{
public string mo_task_id { get; set; }
public string mold_id { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
public class ChangeWorklineInput
{
public string mo_task_id { get; set; }
public string workline_id { get; set; }
}
}

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Security;
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
@@ -86,7 +87,45 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string process_name { get; set;}
public string create_time { get; set; }
}
public class PrdMoTaskTreeOutput : TreeModel
{
/// <summary>
/// 生产任务单号
/// </summary>
public string? mo_task_code { get; set; }
public string? material_id { get; set; }
public string? mold_id { get; set; }
public string? eqp_id { get; set; }
/// <summary>
/// 物料
/// </summary>
public string? material_id_id { get; set; }
/// <summary>
/// 模具
/// </summary>
public string? mold_id_id { get; set; }
/// <summary>
/// 设备
/// </summary>
public string? eqp_id_id { get; set; }
/// <summary>
/// 预计开始时间
/// </summary>
public string? estimated_start_date { get; set; }
/// <summary>
/// 预计结束时间
/// </summary>
public string? estimated_end_date { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public string? create_time { get; set; }
}
}

View File

@@ -16,5 +16,10 @@ namespace Tnb.ProductionMgr.Entities.Dto
///任务单操作状态
/// </summary>
public string statusName { get; set; }
/// <summary>
/// 排产类型:1、注塑、挤出2、组装、包装
/// </summary>
public int? schedule_type { get; set; }
}
}

View File

@@ -9,14 +9,18 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string mo_task_code { get; set; }
public string mo_task_status { get; set; }
public string material_id { get; set; }
public string material_id_id { get; set; }
public string mold_id { get; set; }
public string mold_id_id { get; set; }
public int? plan_qty { get; set; }
public int? complete_qty { get; set; }
public int? scheduled_qty { get; set; }
public string workline_id { get; set; }
public string workline_id_id { get; set; }
public string estimated_start_date { get; set; }
public string estimated_end_date { get; set; }
public string eqp_id { get; set; }
public string eqp_id_id { get; set; }
public string create_time { get; set; }
}
}

View File

@@ -113,4 +113,10 @@ public partial class PrdReport : BaseEntity<string>
/// 物料单位
/// </summary>
public string? unit_id { get; set; }
/// <summary>
/// 工序id
/// </summary>
public string? process_id { get; set; }
}

View File

@@ -114,6 +114,14 @@ namespace Tnb.ProductionMgr.Entities
[SugarColumn(IsIgnore = true)]
public string workline_code { get; set; }
/// <summary>
/// 工位编号
/// </summary>
public string? station_code { get; set; }
/// <summary>
/// 工序编号
/// </summary>
public string? process_code { get; set; }
}
}

View File

@@ -23,6 +23,7 @@ using Tnb.ProductionMgr.Entities.Consts;
using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities;
using Tnb.BasicData;
using Tnb.EquipMgr.Entities;
namespace Tnb.ProductionMgr
{
@@ -141,9 +142,29 @@ namespace Tnb.ProductionMgr
throw new Exception("没有签收物料");
}
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
var station = await db.Queryable<OrganizeEntity>().SingleAsync(x => x.Id == input.station_id);
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == input.process_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = mo?.mo_code!;
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.equip_id))?.code!;
taskLog.mold_code = "";
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
taskLog.status = "生产投料";
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
taskLog.create_time = DateTime.Now;
taskLog.mo_task_id = moTask.id;
taskLog.mo_task_code = moTask.mo_task_code;
taskLog.station_code = station?.EnCode;
taskLog.process_code = process.code;
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
});

View File

@@ -21,6 +21,12 @@ using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.BasicData;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using Tnb.EquipMgr.Entities;
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
using JNPF.Common.Filter;
using JNPF.Common.Security;
namespace Tnb.ProductionMgr
{
@@ -29,11 +35,13 @@ namespace Tnb.ProductionMgr
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient
[OverideVisualDev(ModuleId)]
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService
{
private readonly ISqlSugarRepository<PrdInstockH> _repository;
private readonly IUserManager _userManager;
private const string ModuleId = "25572529329173";
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public PrdInstockService(
ISqlSugarRepository<PrdInstockH> repository,
@@ -42,6 +50,46 @@ namespace Tnb.ProductionMgr
{
_repository = repository;
_userManager = userManager;
OverideFuncs.GetListAsync = GetList;
}
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
{
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
string moCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
var list = await _repository.AsSugarClient().Queryable<PrdMoTask>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d) => a.mo_task_code!.Contains(moCode))
.Select((a, b, c, d) => new PrdMoTaskTreeOutput()
{
id = a.id,
parentId = string.IsNullOrEmpty(a.parent_id) ? "0" : a.parent_id,
mo_task_code = a.mo_task_code,
material_id = b.name,
material_id_id = b.id,
mold_id = c.mold_name,
mold_id_id = c.id,
eqp_id = d.name,
eqp_id_id = d.id,
estimated_start_date = a.estimated_start_date!.ToString(),
estimated_end_date = a.estimated_end_date.ToString(),
create_time = a.create_time.ToString()
}).ToListAsync();
var treeList = list.ToTree();
treeList= treeList.Skip((input.currentPage-1)* input.pageSize).Take(input.pageSize).ToList();
SqlSugarPagedList<PrdMoTaskTreeOutput> pagedList = new()
{
list = treeList,
pagination = new Pagination
{
CurrentPage = input.currentPage,
PageSize = input.pageSize,
Total = treeList.Count
}
};
return PageResult<PrdMoTaskTreeOutput>.SqlSugarPageResult(pagedList);
}
[HttpPost]

View File

@@ -226,7 +226,11 @@ namespace Tnb.ProductionMgr
var list = await _repository.AsSugarClient().Queryable<PrdTaskLog>().Where(it => it.mo_task_id == taskId).ToListAsync();
var data = list.Adapt<List<PrdTaskOperOutput>>();
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
_repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : "");
_repository.AsSugarClient().ThenMapper(data, x =>
{
x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : x.status;
x.schedule_type = _repository.AsSugarClient().Queryable<PrdMoTask>().Single(y => y.id == x.mo_task_id).schedule_type;
});
return data;
}
/// <summary>
@@ -1360,6 +1364,7 @@ namespace Tnb.ProductionMgr
var row = -1;
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode)
{
@@ -1405,6 +1410,7 @@ namespace Tnb.ProductionMgr
report.status = 0;
report.material_id = prdMoTask.material_id;
report.unit_id = prdMoTask.unit_id;
report.process_id = mbomProcess?.process_id ?? "";
row = await db.Insertable(report).ExecuteCommandAsync();
@@ -1440,7 +1446,6 @@ namespace Tnb.ProductionMgr
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
{
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
{
var parentMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
@@ -1820,20 +1825,25 @@ namespace Tnb.ProductionMgr
(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(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)
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
{
id = a.id,
mo_task_code = a.mo_task_code,
material_id = b.code+"/"+b.name,
material_id_id = a.material_id,
mold_id = e.mold_code+"/"+e.mold_name,
mold_id_id = a.mold_id,
mo_task_status = d.FullName,
plan_qty = f.plan_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
scheduled_qty = a.scheduled_qty,
workline_id = a.workline_id==null ? "" :g.EnCode+"/"+g.FullName,
workline_id_id = a.workline_id,
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
eqp_id_id = a.eqp_id,
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
@@ -1924,5 +1934,145 @@ namespace Tnb.ProductionMgr
.Where(x => x.workline_id == id && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync();
}
/// <summary>
/// 更换机台
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> ChangeEquip(ChangeEquipInput input)
{
var db = _repository.AsSugarClient();
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
{
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
if (moTask.eqp_id == input.equip_id)
{
throw new Exception("与原机台相同");
}
await db.Updateable<PrdMoTask>().SetColumns(x => x.eqp_id == input.equip_id)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = mo?.mo_code!;
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.equip_id))?.code!;
taskLog.mold_code = "";
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
taskLog.status = "更换机台";
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
taskLog.create_time = DateTime.Now;
taskLog.mo_task_id = moTask.id;
taskLog.mo_task_code = moTask.mo_task_code;
taskLog.station_code = "";
taskLog.process_code = process?.code;
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
}
/// <summary>
/// 更换模具
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> ChangeMold(ChangeMoldInput input)
{
var db = _repository.AsSugarClient();
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
{
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
if (moTask.mold_id == input.mold_id)
{
throw new Exception("与原模具相同");
}
await db.Updateable<PrdMoTask>().SetColumns(x => x.mold_id == input.mold_id)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
var mold = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == input.mold_id);
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = mo?.mo_code!;
taskLog.eqp_code = "";
taskLog.mold_code = mold?.mold_code;
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
taskLog.status = "更换模具";
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
taskLog.create_time = DateTime.Now;
taskLog.mo_task_id = moTask.id;
taskLog.mo_task_code = moTask.mo_task_code;
taskLog.station_code = "";
taskLog.process_code = process?.code;
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
}
/// <summary>
/// 更换产线
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> ChangeWorkline(ChangeWorklineInput input)
{
var db = _repository.AsSugarClient();
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
{
var moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
if (moTask.workline_id == input.workline_id)
{
throw new Exception("与原产线相同");
}
await db.Updateable<PrdMoTask>().SetColumns(x => x.workline_id == input.workline_id)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
var mo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == moTask.mo_id);
var material = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.material_id);
var process = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == moTask.process_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = mo?.mo_code!;
taskLog.eqp_code = "";
taskLog.mold_code = "";
taskLog.item_code = material?.code!;
taskLog.item_standard = material?.material_standard!;
taskLog.status = "更换产线";
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
taskLog.create_time = DateTime.Now;
taskLog.mo_task_id = moTask.id;
taskLog.mo_task_code = moTask.mo_task_code;
taskLog.station_code = "";
taskLog.process_code = process?.code;
await db.Insertable<PrdTaskLog>(taskLog).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
}
}
}

View File

@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
/// </summary>
public class TimedTaskBackgroundService : BackgroundService
{
private IEventPublisher _eventPublisher;
private IEventPublisher _eventPublisher = default!;
protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.Run(() =>
{

View File

@@ -500,18 +500,37 @@ namespace Tnb.WarehouseMgr
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList();
var locWhIdMap = await _db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
List<WmsCarryH> carryIts = new();
List<WmsCarryCode> carryCodeIts = new();
for (int i = 0; i < multiList.Count; i++)
{
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
//更新条码的库位和仓库信息
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.id == multiList[i].carry_id).ToListAsync();
if (carryCodes?.Count > 0)
WmsCarryH carry = new()
{
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == multiList[i].endlocation_id);
await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
}
}
id = multiList[i].carry_id,
is_lock = 0,
location_id = multiList[i].endlocation_id,
location_code = multiList[i].endlocation_code
};
WmsCarryCode carryCode = new()
{
warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(),
location_id = multiList[i].endlocation_id,
location_code = multiList[i].endlocation_code
};
carryIts.Add(carry);
carryCodeIts.Add(carryCode);
//await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
////更新条码的库位和仓库信息
//var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.id == multiList[i].carry_id).ToListAsync();
//if (carryCodes?.Count > 0)
//{
// await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
//}
}
await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
//更新库位信息,使用状态为 使用,锁定状态为未锁定
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
for (int i = 0; i < multis.Count; i++)

View File

@@ -536,6 +536,20 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
isOK = await _repository.AsSugarClient().Updateable<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
}
}
await _repository.AsSugarClient().Deleteable<OrganizeRelationEntity>(p => p.OrganizeId == id && p.ObjectType == "Eqp").ExecuteCommandAsync();
var OrganizeRelationEntitys = new List<OrganizeRelationEntity>();
foreach (var item in eqpIds)
{
OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
organizeRelationEntity.OrganizeId = id;
organizeRelationEntity.ObjectType = "Eqp";
organizeRelationEntity.ObjectId = item;
organizeRelationEntity.CreatorTime = DateTime.Now;
organizeRelationEntity.CreatorUserId = _userManager.UserId;
OrganizeRelationEntitys.Add(organizeRelationEntity);
}
await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
}
var processVal = jsonObj.GetValue("rowprocess");
if (processVal is not null)
@@ -570,6 +584,25 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
isOK = await _repository.AsSugarClient().Updateable<BasProcessStation>(it => new BasProcessStation { station_id = "", station_code = "" }).Where(it => curProcIds.Contains(it.process_id)).ExecuteCommandAsync();
}
}
var correlation= jsonObj.GetValue("correlation");
if (correlation is not null)
{
await _repository.AsSugarClient().Deleteable<OrganizeRelationEntity>(p => p.OrganizeId == id && p.ObjectType == "User").ExecuteCommandAsync();
var OrganizeRelationEntitys=new List<OrganizeRelationEntity>();
for (int i = 0; i < correlation.Count(); i++)
{
OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
organizeRelationEntity.OrganizeId = id;
organizeRelationEntity.ObjectType = "User";
organizeRelationEntity.ObjectId = correlation[i].ToString();
organizeRelationEntity.CreatorTime = DateTime.Now;
organizeRelationEntity.CreatorUserId = _userManager.UserId;
OrganizeRelationEntitys.Add(organizeRelationEntity);
}
await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
}
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
}