diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/ESopListOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/ESopListOutput.cs
new file mode 100644
index 00000000..ce0b6e4f
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/ESopListOutput.cs
@@ -0,0 +1,19 @@
+namespace Tnb.BasicData.Entities.Dto
+{
+ public class ESopListOutput
+ {
+ public string id { get; set; } = string.Empty;
+ public string code { get; set; } = string.Empty;
+ public string name { get; set; } = string.Empty;
+ public string mbom_id { get; set; } = string.Empty;
+ public string mbom_process_id { get; set; } = string.Empty;
+ public string version { get; set; } = string.Empty;
+ public string enabled { get; set; } = string.Empty;
+ public string attachment { get; set; } = string.Empty;
+ public string? remark { get; set; }
+ public string create_id { get; set; } = string.Empty;
+ public string create_time { get; set; } = string.Empty;
+ public string mbom_id_id { get; set; } = string.Empty;
+ public string mbom_process_id_id { get; set; } = string.Empty;
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs
new file mode 100644
index 00000000..33d28b4d
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs
@@ -0,0 +1,20 @@
+namespace Tnb.BasicData.Entities.Dto
+{
+ public class EsopHistoryListQueryInput
+ {
+ public string mbom_id { get; set; } = string.Empty;
+ public string mbom_process_id { get; set; } = string.Empty;
+
+ ///
+ /// 当前页码:pageIndex.
+ ///
+ public virtual int currentPage { get; set; } = 1;
+
+ ///
+ /// 每页行数.
+ ///
+ public virtual int pageSize { get; set; } = 50;
+
+ public string? queryJson { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs
new file mode 100644
index 00000000..7a36813c
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs
@@ -0,0 +1,36 @@
+namespace Tnb.BasicData.Entities.Dto
+{
+ public class UploadNewVersionInput
+ {
+ ///
+ /// 编号
+ ///
+ public string code { get; set; } = string.Empty;
+
+ ///
+ /// 名称
+ ///
+ public string name { get; set; } = string.Empty;
+ ///
+ /// 生产bomid
+ ///
+ public string mbom_id { get; set; } = string.Empty;
+
+ ///
+ /// 生产bom工序id
+ ///
+ public string mbom_process_id { get; set; } = string.Empty;
+
+ ///
+ /// 附件对象.
+ ///
+ public string attachment { get; set; } = string.Empty;
+
+ public string version { get; set; } = string.Empty;
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs
index 88178349..fcbaa875 100644
--- a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs
@@ -67,6 +67,8 @@ namespace Tnb.BasicData.Entities.Dto
public class MbomProcessOutDto
{
+ public string id { get; set; }
+
///
/// Desc:生产bomid
/// Default:
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs
index bc7e7c38..02eb6f38 100644
--- a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs
@@ -67,6 +67,8 @@ namespace Tnb.BasicData.Entities.Dto
public class MbomProcessDto
{
+ public string id { get; set; }
+
///
/// Desc:生产bomid
/// Default:
@@ -102,6 +104,11 @@ namespace Tnb.BasicData.Entities.Dto
///
public int byproduct_status { get; set; }
+ ///
+ /// 工艺路线子表id
+ ///
+ public string route_detail_id { get; set; }
+
///
/// Desc:投产方式
/// Default:NULL::character varying
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasESop.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasESop.cs
new file mode 100644
index 00000000..44b13897
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasESop.cs
@@ -0,0 +1,92 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.BasicData.Entities;
+
+///
+/// esop
+///
+[SugarTable("bas_e_sop")]
+public partial class BasESop : BaseEntity
+{
+ public BasESop()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 编号
+ ///
+ public string code { get; set; } = string.Empty;
+
+ ///
+ /// 名称
+ ///
+ public string name { get; set; } = string.Empty;
+
+ ///
+ /// 生产bomid
+ ///
+ public string mbom_id { get; set; } = string.Empty;
+
+ ///
+ /// 生产bom工序id
+ ///
+ public string mbom_process_id { get; set; } = string.Empty;
+
+ ///
+ /// 附件对象.
+ ///
+ public string attachment { get; set; } = string.Empty;
+
+ ///
+ /// 版本
+ ///
+ public string version { get; set; } = string.Empty;
+
+ ///
+ /// 是否有效
+ ///
+ public int enabled { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 流程任务Id
+ ///
+ public string? f_flowtaskid { get; set; }
+
+ ///
+ /// 流程引擎Id
+ ///
+ public string? f_flowid { get; set; }
+
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs
index a91ff507..c6c79b0a 100644
--- a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs
@@ -48,5 +48,10 @@ public partial class BasMbomProcess : BaseEntity
/// 投产方式
///
public string? production_method { get; set; }
+
+ ///
+ /// 工艺路线子表id
+ ///
+ public string route_detail_id { get; set; }
}
diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs
new file mode 100644
index 00000000..ac47c8f2
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs
@@ -0,0 +1,22 @@
+using Tnb.BasicData.Entities.Dto;
+
+namespace Tnb.BasicData.Interfaces
+{
+ public interface IBasESopService
+ {
+ ///
+ /// 上传新版本
+ ///
+ ///
+ ///
+ public Task UploadNewVersion(UploadNewVersionInput input);
+
+ ///
+ /// 获取历史记录
+ ///
+ ///
+ ///
+ public Task GetHistoryList(EsopHistoryListQueryInput input);
+
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasESopService.cs b/BasicData/Tnb.BasicData/BasESopService.cs
new file mode 100644
index 00000000..61b94458
--- /dev/null
+++ b/BasicData/Tnb.BasicData/BasESopService.cs
@@ -0,0 +1,169 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Enums;
+using JNPF.Common.Filter;
+using JNPF.Common.Security;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Interfaces.System;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.BasicData.Entities.Dto;
+using Tnb.BasicData.Interfaces;
+
+namespace Tnb.BasicData
+{
+ ///
+ /// esop关联
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModelId)]
+ public class BasESopService : IBasESopService,IOverideVisualDevService,IDynamicApiController, ITransient
+ {
+ public const string ModelId = "26919620992277";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+
+ public BasESopService(
+ IUserManager userManager,
+ ISqlSugarRepository repository)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ OverideFuncs.GetListAsync = GetList;
+ }
+
+ ///
+ /// ESOP列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetList(VisualDevModelListQueryInput input)
+ {
+ var db = _repository.AsSugarClient();
+ Dictionary? queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject>();
+ string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
+ string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
+ string version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
+ var list = await db.Queryable((a, b, c, d,e) => new object[]
+ {
+ JoinType.Left, a.mbom_id == b.id,
+ JoinType.Left, a.mbom_process_id == c.id,
+ JoinType.Left, a.create_id == d.Id,
+ JoinType.Left, c.process_id == e.id,
+ })
+ .WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
+ .WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name))
+ .WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version))
+ .Where((a,b,c)=>a.enabled==1)
+ .Select((a, b, c, d,e) => new ESopListOutput
+ {
+ id = a.id,
+ code = a.code,
+ name = a.name,
+ mbom_id = b.version,
+ mbom_process_id = e.process_name,
+ version = a.version,
+ enabled = a.enabled==1 ? "是" : "否",
+ attachment = a.attachment,
+ remark = a.remark,
+ create_id = d.RealName,
+ create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
+ mbom_id_id = a.mbom_id,
+ mbom_process_id_id = a.mbom_process_id
+ }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
+
+ return PageResult.SqlSugarPageResult(list);
+ }
+
+ [HttpPost]
+ public async Task GetHistoryList(EsopHistoryListQueryInput input)
+ {
+ var db = _repository.AsSugarClient();
+ Dictionary? queryJson = new Dictionary();
+ if (input!=null && !string.IsNullOrEmpty(input.queryJson))
+ {
+ queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? "");
+ }
+ string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
+ string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
+ string version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : "";
+ var list = await db.Queryable((a, b, c, d,e) => new object[]
+ {
+ JoinType.Left, a.mbom_id == b.id,
+ JoinType.Left, a.mbom_process_id == c.id,
+ JoinType.Left, a.create_id == d.Id,
+ JoinType.Left, c.process_id == e.id,
+ })
+ .WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
+ .WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name))
+ .WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version))
+ .Where((a,b,c)=>a.mbom_id==input.mbom_id && a.mbom_process_id==input.mbom_process_id)
+ .Select((a, b, c, d,e) => new ESopListOutput
+ {
+ id = a.id,
+ code = a.code,
+ name = a.name,
+ mbom_id = b.version,
+ mbom_process_id = e.process_name,
+ version = a.version,
+ enabled = a.enabled==1 ? "是" : "否",
+ attachment = a.attachment,
+ remark = a.remark,
+ create_id = d.RealName,
+ create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"),
+ mbom_id_id = a.mbom_id
+ }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
+
+ return PageResult.SqlSugarPageResult(list);
+ }
+
+ [HttpPost]
+ public async Task UploadNewVersion(UploadNewVersionInput input)
+ {
+ if (_repository.IsAny(x => x.mbom_id == input.mbom_id && x.mbom_process_id == input.mbom_process_id && x.version == input.version))
+ {
+ throw Oops.Bah("已存在该版本");
+ }
+
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ await _repository.UpdateAsync(x => new BasESop()
+ {
+ enabled = 0,
+ }, x => x.mbom_id == input.mbom_id && x.mbom_process_id == input.mbom_process_id);
+
+ BasESop basESop = new BasESop()
+ {
+ code = input.code,
+ name = input.name,
+ version = input.version,
+ attachment = input.attachment,
+ mbom_id = input.mbom_id,
+ mbom_process_id = input.mbom_process_id,
+ remark = input.remark,
+ create_id = _userManager.UserId,
+ create_time = DateTime.Now,
+ org_id = _userManager.GetUserInfo().Result.organizeId,
+ enabled = 1,
+ };
+
+ await _repository.InsertAsync(basESop);
+
+ });
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+
+ return result.IsSuccess ? "上传成功" : result.ErrorMessage;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasMbomService.cs b/BasicData/Tnb.BasicData/BasMbomService.cs
index 313b0211..7c441b64 100644
--- a/BasicData/Tnb.BasicData/BasMbomService.cs
+++ b/BasicData/Tnb.BasicData/BasMbomService.cs
@@ -114,6 +114,7 @@ namespace Tnb.BasicData
{
mbomProcessOutDtos.Add(new MbomProcessOutDto()
{
+ id = process.id,
mbom_id = mbom.id,
process_id = process.process_id,
preparation_time = process.preparation_time,
@@ -159,7 +160,8 @@ namespace Tnb.BasicData
var result = await _db.Queryable()
.LeftJoin((a, b) => a.id == b.mbom_id)
.LeftJoin((a, b, c) => a.route_id == c.id)
- .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ // .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ .LeftJoin((a, b, c, d) => b.route_detail_id == d.id)
.LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id)
.Where((a, b, c, d, e) => a.id == bomId)
.Select((a, b, c, d, e) => new SubBomListOutput
@@ -293,6 +295,7 @@ namespace Tnb.BasicData
station = process?.station ?? "",
byproduct_status = process.byproduct_status,
production_method = process.production_method,
+ route_detail_id = process.route_detail_id,
});
@@ -379,7 +382,7 @@ namespace Tnb.BasicData
}, x => x.id == mbomSaveDataInput.id);
}
- List processes = new List();
+ // List processes = new List();
List inputs = new List();
List outputs = new List();
@@ -387,19 +390,29 @@ namespace Tnb.BasicData
{
foreach (var process in mbomSaveDataInput.processes)
{
- string mbomProcessId = SnowflakeIdHelper.NextId();
- processes.Add(new BasMbomProcess()
- {
- id = mbomProcessId,
- org_id = orgId ?? "",
- mbom_id = mbomSaveDataInput?.id ?? "",
- process_id = process?.process_id ?? "",
- preparation_time = process?.preparation_time ?? 0,
- station = process.station,
- byproduct_status = process.byproduct_status,
- production_method = process.production_method,
-
- });
+ string mbomProcessId = process.id;
+ // string mbomProcessId = SnowflakeIdHelper.NextId();
+ // processes.Add(new BasMbomProcess()
+ // {
+ // id = mbomProcessId,
+ // org_id = orgId ?? "",
+ // mbom_id = mbomSaveDataInput?.id ?? "",
+ // process_id = process?.process_id ?? "",
+ // preparation_time = process?.preparation_time ?? 0,
+ // station = process.station,
+ // byproduct_status = process.byproduct_status,
+ // production_method = process.production_method,
+ // route_detail_id = process.route_detail_id,
+ //
+ // });
+
+ decimal preparation_time = process?.preparation_time ?? 0;
+ await _repository.AsSugarClient().Updateable()
+ .SetColumns(x => x.preparation_time == preparation_time)
+ .SetColumns(x => x.station == process.station)
+ .SetColumns(x => x.byproduct_status == process.byproduct_status)
+ .SetColumns(x => x.production_method == process.production_method)
+ .Where(x => x.id == process.id).ExecuteCommandAsync();
if (process.inputs != null)
{
@@ -442,14 +455,14 @@ namespace Tnb.BasicData
if (mbomSaveDataInput != null && !string.IsNullOrEmpty(mbomSaveDataInput.id))
{
- await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
+ // await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
}
- if (processes.Count > 0)
- {
- await _repository.AsSugarClient().Insertable(processes).ExecuteCommandAsync();
- }
+ // if (processes.Count > 0)
+ // {
+ // await _repository.AsSugarClient().Insertable(processes).ExecuteCommandAsync();
+ // }
if (inputs.Count > 0)
{
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 8060e370..d31635e0 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -852,7 +852,8 @@ namespace Tnb.ProductionMgr
var subTaskList = await _db.Queryable()
.LeftJoin((a, b) => a.id == b.mbom_id)
.LeftJoin((a, b, c) => a.route_id == c.id)
- .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ // .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ .LeftJoin((a, b, c, d) => b.route_detail_id == d.id)
.LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id)
.Where((a, b, c, d, e) => a.id == input.bom_id)
.Select((a, b, c, d, e) => new SubBomListOutput