From 119de0aef4f3ad2aaed2cd474a99a03004a6f695 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Fri, 21 Apr 2023 16:20:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9ebom=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/ParentMaterial/EbomTreeOutput.cs | 84 ++++++ ...reeQueryInput.cs => EbomTreeQueryInput.cs} | 4 +- .../ParentMaterialTreeOutput.cs | 37 --- ...{BasParentMaterialItems.cs => BasEbomD.cs} | 10 +- .../{BasParentMaterial.cs => BasEbomH.cs} | 6 +- .../Tnb.BasicData.Entitys/Entity/BasRoute.cs | 183 ++++++----- ...arentMaterialService.cs => EbomService.cs} | 71 ++++- .../Tnb.BasicData/ProcessManageService.cs | 284 +++++++++--------- 8 files changed, 403 insertions(+), 276 deletions(-) create mode 100644 BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs rename BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/{ParentMaterialTreeQueryInput.cs => EbomTreeQueryInput.cs} (72%) delete mode 100644 BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs rename BasicData/Tnb.BasicData.Entitys/Entity/{BasParentMaterialItems.cs => BasEbomD.cs} (92%) rename BasicData/Tnb.BasicData.Entitys/Entity/{BasParentMaterial.cs => BasEbomH.cs} (96%) rename BasicData/Tnb.BasicData/{ParentMaterialService.cs => EbomService.cs} (52%) diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs new file mode 100644 index 00000000..532f18c3 --- /dev/null +++ b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeOutput.cs @@ -0,0 +1,84 @@ +namespace Tnb.BasicData.Entitys.Dto +{ + public class EbomTreeOutput + { + /// + /// 物料名称 + /// + public string material_id { get; set; } + /// + /// 规格描述 + /// + public string material_id_extras { get; set; } + /// + /// 物料id + /// + public string material_id_id { get; set; } + /// + /// 最小包装 + /// + public decimal? material_id_minpacking { get; set; } + /// + /// 备注 + /// + public string material_id_remark { get; set; } + /// + /// 单位 + /// + public string material_id_unitid { get; set; } + /// + /// 是否有下级 + /// + public bool hasChildren { get; set; } + + /// + /// Desc:投料管控 + /// Default:NULL::character varying + /// Nullable:True + /// + public string feeding_control {get;set;} + + /// + /// Desc:损耗率 + /// Default:NULL::character varying + /// Nullable:True + /// + public string loss_rate {get;set;} + + /// + /// Desc:数量 + /// Default:NULL::character varying + /// Nullable:True + /// + public string quantity {get;set;} + + /// + /// Desc:需要称量 + /// Default:NULL::character varying + /// Nullable:True + /// + public string require_weight {get;set;} + + /// + /// Desc:替代物料 + /// Default:NULL::character varying + /// Nullable:True + /// + public string substitute_material {get;set;} + + /// + /// Desc:工艺路线 + /// Default:NULL::character varying + /// Nullable:True + /// + public string routing {get;set;} + + /// + /// Desc:版本号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string version {get;set;} + + } +} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs similarity index 72% rename from BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs rename to BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs index ca9d6a46..9c4dfea5 100644 --- a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/EbomTreeQueryInput.cs @@ -1,11 +1,11 @@ namespace Tnb.BasicData.Entitys.Dto { - public class ParentMaterialTreeQueryInput + public class EbomTreeQueryInput { /// /// 物料清单id /// - public string parentMaterialId { get; set; } + public string ebomId { get; set; } /// /// 物料id /// diff --git a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs b/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs deleted file mode 100644 index dc5dbd4d..00000000 --- a/BasicData/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Tnb.BasicData.Entitys.Dto -{ - public class ParentMaterialTreeOutput - { - /// - /// 物料名称 - /// - public string material_id { get; set; } - /// - /// 规格描述 - /// - public string material_id_extras { get; set; } - /// - /// 物料id - /// - public string material_id_id { get; set; } - /// - /// 最小包装 - /// - public decimal? material_id_minpacking { get; set; } - /// - /// 备注 - /// - public string material_id_remark { get; set; } - /// - /// 单位 - /// - public string material_id_unitid { get; set; } - /// - /// 是否有下级 - /// - public bool hasChildren { get; set; } - - - - } -} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs similarity index 92% rename from BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs rename to BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs index d3d7cc48..f1f9510a 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomD.cs @@ -6,10 +6,10 @@ namespace Tnb.BasicData.Entitys.Entity /// ///物料清单子表 /// - [SugarTable("bas_parent_material_items")] - public class BasParentMaterialItems : BaseEntity + [SugarTable("bas_ebom_d")] + public class BasEbomD : BaseEntity { - public BasParentMaterialItems(){ + public BasEbomD(){ } @@ -34,8 +34,8 @@ namespace Tnb.BasicData.Entitys.Entity /// Default:NULL::character varying /// Nullable:True /// - [SugarColumn(ColumnName="parent_material_id")] - public string ParentMaterialId {get;set;} + [SugarColumn(ColumnName="ebom_id")] + public string EbomId {get;set;} /// /// Desc:物料编号/名称 diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs similarity index 96% rename from BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs rename to BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs index d62c9140..92d97646 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasEbomH.cs @@ -6,10 +6,10 @@ namespace Tnb.BasicData.Entitys.Entity /// ///物料清单父表 /// - [SugarTable("bas_parent_material")] - public class BasParentMaterial : BaseEntity + [SugarTable("bas_ebom_h")] + public class BasEbomH : BaseEntity { - public BasParentMaterial(){ + public BasEbomH(){ } diff --git a/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs b/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs index 64c0d56a..cf1ccfba 100644 --- a/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs +++ b/BasicData/Tnb.BasicData.Entitys/Entity/BasRoute.cs @@ -7,82 +7,119 @@ using Tnb.Common.Contracts; namespace Tnb.BasicData.Entitys.Entity { - /// - /// 工艺路线资料 + /// + ///工艺路线 /// [SugarTable("bas_route")] public class BasRoute : BaseEntity { - /// - /// 工艺路线代码 - /// - [SugarColumn(ColumnName = "route_code")] - public string RouteCode { get; set; } - /// - /// 工艺路线名称 - /// - [SugarColumn(ColumnName = "route_name")] - public string RouteName { get; set; } - /// - /// 工艺路线版本 - /// - [SugarColumn(ColumnName = "version")] - public string Version { get; set; } - /// - /// 工艺路线类型: 标准途程:Standard 返工途程:Rework 试制途程:Trial 返修途程:RMA - /// - [SugarColumn(ColumnName = "route_type")] - public string RouteType { get; set; } - /// - /// 创建时间 - /// - [SugarColumn(ColumnName = "create_time")] - public DateTime CreateTime { get; set; } - /// - /// 修改时间 - /// - [SugarColumn(ColumnName = "modify_time")] - public DateTime? ModifyTime { get; set; } - /// - /// 扩展字段 - /// - [SugarColumn(ColumnName = "extras")] - public string? Extras { get; set; } - /// - /// 租户ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "tenant_id")] - public string? TenantId { get; set; } - /// - /// 所属组织ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "org_id")] - public string? OrgId { get; set; } - /// - /// 备注 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "remark")] - public string? Remark { get; set; } - /// - /// 时间戳(用于并发控制) - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "timestamp")] - public string? Timestamp { get; set; } - /// - /// 创建用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "create_id")] - public string? CreateId { get; set; } - /// - /// 修改用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "modify_id")] - public string? ModifyId { get; set; } + public BasRoute(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true,ColumnName="id")] + public string Id {get;set;} + + /// + /// Desc:编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="code")] + public string Code {get;set;} + + /// + /// Desc:名称 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="name")] + public string Name {get;set;} + + /// + /// Desc:有效开始时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="start_time")] + public DateTime? StartTime {get;set;} + + /// + /// Desc:有效结束时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="end_time")] + public DateTime? EndTime {get;set;} + + /// + /// Desc:0 未发布 1 已发布 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="status")] + public string Status {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="create_time")] + public DateTime? CreateTime {get;set;} + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName="modify_time")] + public DateTime? ModifyTime {get;set;} + + /// + /// Desc:是否永远有效 + /// Default: + /// Nullable:False + /// + [SugarColumn(ColumnName="is_always_valid")] + public int IsAlwaysValid {get;set;} + + /// + /// Desc:所属组织ID + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="org_id")] + public string OrgId {get;set;} + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="create_id")] + public string CreateId {get;set;} + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="modify_id")] + public string ModifyId {get;set;} + + /// + /// Desc:备注 + /// Default:NULL::character varying + /// Nullable:True + /// + [SugarColumn(ColumnName="remark")] + public string Remark {get;set;} + } } diff --git a/BasicData/Tnb.BasicData/ParentMaterialService.cs b/BasicData/Tnb.BasicData/EbomService.cs similarity index 52% rename from BasicData/Tnb.BasicData/ParentMaterialService.cs rename to BasicData/Tnb.BasicData/EbomService.cs index 9bc16c38..8ec1efd0 100644 --- a/BasicData/Tnb.BasicData/ParentMaterialService.cs +++ b/BasicData/Tnb.BasicData/EbomService.cs @@ -14,15 +14,15 @@ namespace Tnb.BasicData /// /// 物料清单 /// - [ApiDescriptionSettings(Tag = "BasicData", Name = "ParentMaterial", Order = 701)] + [ApiDescriptionSettings(Tag = "BasicData", Name = "Ebom", Order = 701)] [Route("api/basic/[controller]")] - public class ParentMaterialService : IDynamicApiController, ITransient + public class EbomService : IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; - public ParentMaterialService( + public EbomService( ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) { _repository = repository; @@ -36,7 +36,7 @@ namespace Tnb.BasicData /// 获取物料清单树. /// [HttpPost("[action]")] - public async Task GetTree(ParentMaterialTreeQueryInput queryInput) + public async Task GetTree(EbomTreeQueryInput queryInput) { var db = _repository.AsSugarClient(); var dic = await _dictionaryDataService.GetDicByKey(DicTypeKey.MeasurementUnit); @@ -49,11 +49,12 @@ namespace Tnb.BasicData if (string.IsNullOrEmpty(queryInput.materialId)) { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ParentMaterialId==b.Id) + var data = await db.Queryable() + .LeftJoin((a,b)=>a.EbomId==b.Id) .LeftJoin((a,b,c)=>a.MaterialId==c.Id) - .Where((a,b,c)=>a.ParentMaterialId==queryInput.parentMaterialId) - .Select((a,b,c)=>new ParentMaterialTreeOutput + .LeftJoin((a,b,c,d)=>a.MaterialId==d.MaterialId) + .Where((a,b,c)=>a.EbomId==queryInput.ebomId) + .Select((a,b,c,d)=>new EbomTreeOutput { material_id = c.MaterialName, material_id_extras = c.Extras, @@ -61,7 +62,14 @@ namespace Tnb.BasicData material_id_minpacking = c.Minpacking, material_id_remark = c.Remark, material_id_unitid = c.Unitid, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), + feeding_control = a.FeedingControl, + loss_rate = a.LossRate, + quantity = a.Quantity, + require_weight = a.RequireWeight, + substitute_material = a.SubstituteMaterial, + routing = d.Routing, + version = d.Version, + hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), }).Mapper(it => { it.material_id_unitid = dic[it.material_id_unitid].ToString(); @@ -70,11 +78,12 @@ namespace Tnb.BasicData } else { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ParentMaterialId==b.Id) + var data = await db.Queryable() + .LeftJoin((a,b)=>a.EbomId==b.Id) .LeftJoin((a,b,c)=>a.MaterialId==c.Id) - .Where((a,b,c)=>b.MaterialId==queryInput.materialId && a.ParentMaterialId==b.Id) - .Select((a,b,c)=>new ParentMaterialTreeOutput + .LeftJoin((a,b,c,d)=>a.MaterialId==d.MaterialId) + .Where((a,b,c)=>b.MaterialId==queryInput.materialId && a.EbomId==b.Id) + .Select((a,b,c,d)=>new EbomTreeOutput { material_id = c.MaterialName, material_id_extras = c.Extras, @@ -82,7 +91,14 @@ namespace Tnb.BasicData material_id_minpacking = c.Minpacking, material_id_remark = c.Remark, material_id_unitid = c.Unitid, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), + feeding_control = a.FeedingControl, + loss_rate = a.LossRate, + quantity = a.Quantity, + require_weight = a.RequireWeight, + substitute_material = a.SubstituteMaterial, + routing = d.Routing, + version = d.Version, + hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(), }).Mapper(it => { it.material_id_unitid = dic[it.material_id_unitid].ToString(); @@ -92,5 +108,32 @@ namespace Tnb.BasicData } + + [HttpPost("[action]")] + public async Task> GetEbomVersionAndRouteName(string materialId) + { + var db = _repository.AsSugarClient(); + + var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == DbName.TNBMON); + if (momDbLink != null) + { + db = _dbManager.ChangeDataBase(momDbLink); + } + + var ebom = await db.Queryable() + .LeftJoin((a,b)=>a.Routing==b.Id) + .Where((a,b) => a.MaterialId == materialId) + .Select((a,b)=>new + { + a.Version, + b.Name, + }).SingleAsync(); + return new Dictionary() + { + ["version"] = ebom?.Version, + ["routeName"] = ebom?.Name + , + }; + } } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData/ProcessManageService.cs b/BasicData/Tnb.BasicData/ProcessManageService.cs index 0ea22015..791773c5 100644 --- a/BasicData/Tnb.BasicData/ProcessManageService.cs +++ b/BasicData/Tnb.BasicData/ProcessManageService.cs @@ -1,142 +1,142 @@ -using System.CodeDom; -using Aop.Api.Domain; -using Aop.Api.Request; -using Aspose.Cells; -using JNPF.Common.Core.Manager; -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula.Functions; -using Spire.Presentation; -using SqlSugar; -using Tnb.BasicData.Entitys.Dto.ProcessManage; -using Tnb.BasicData.Entitys.Entity; -using Tnb.BasicData.Entitys.Model; - -namespace Tnb.BasicData -{ - /// - /// MOM基础数据-工艺管理 - /// - - [ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)] - [Route("api/basic/[controller]")] - public class ProcessManageService : IOverideVisualDevService, IDynamicApiController, ITransient - { - private readonly ISqlSugarRepository _repository; - private readonly DataBaseManager _dbManager; - private readonly IDictionaryDataService _dictionaryDataService; - private readonly string _dictionaryTypeId; - - public ProcessManageService( - IDictionaryDataService dictionaryDataService, - ISqlSugarRepository repository, - DataBaseManager dbManager) - { - _dictionaryDataService = dictionaryDataService; - _repository = repository; - _dbManager = dbManager; - _dictionaryTypeId = "24950639717653"; - } - - public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc(); - - /// - /// 获取工艺路线树形结构 - /// - /// 工艺路线模版树形结构 - /// - ///
[{ - ///
"RouteType": 工艺路线类型, - ///
"Name": 工艺路线类型名称, - ///
"RouteName": 工艺路线名称, - ///
"RouteCode": 工艺路线代码, - ///
"Version": 工艺路线版本, - ///
"id": "25325800913429", - ///
"parentId": null, - ///
"hasChildren": true, - ///
"children": [{ - ///
"RouteType": 工艺路线类型, - ///
"Name": 工艺路线名称|工艺路线版本, - ///
"RouteName": "显示器集成", - ///
"RouteCode": 工艺路线代码, - ///
"Version": 工艺路线版本, - ///
"id": 当前节点Id,不用可以忽略, - ///
"parentId": "父节点Id,不用可以忽略", - ///
"hasChildren": 是否包含子节点,true/false, - ///
"children": [{ - ///
"Version": 工艺路线版本, - ///
} - ///
], - ///
"num": 子节点数量,不用可以忽略, - ///
"isLeaf": 是否页节点,不用可以忽略 true/false - ///
} - ///
] - ///
} - ///
] - ///
- [HttpGet("route-tree")] - public async Task GetRouteTreeList() - { - var result = new List(); - var dictaryDataList = await _dictionaryDataService.GetList(_dictionaryTypeId); - var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName); - SqlSugarScope sugarClient = null!; - var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == "tnb_mom"); - if (momDbLink != null) - { - sugarClient = _dbManager.ChangeDataBase(momDbLink); - } - var list = await sugarClient.Queryable().ToListAsync(); - if (list?.Count > 0) - { - var routeGroups = list.GroupBy(g => g.RouteType); - var dic1 = routeGroups.ToDictionary(x => x.Key, x => Tuple.Create(new RouteLineTreeOutput - { - id = SnowflakeIdHelper.NextId(), - RouteType = x.Key, - Name = dictaryData.ContainsKey(x.Key) ? dictaryData[x.Key] : string.Empty - }, x.GroupBy(g => new { g.RouteName, g.RouteCode }))); - result.AddRange(dic1.Values.Select(t => t.Item1)); - foreach (var routeGroup in routeGroups) - { - if (dic1.ContainsKey(routeGroup.Key)) - { - var nodes = new List(); - foreach (var item in dic1[routeGroup.Key].Item2) - { - var node = new RouteLineTreeOutput(); - node.id = SnowflakeIdHelper.NextId(); - node.parentId = dic1[routeGroup.Key].Item1.id; - node.Name = $"{item.Key.RouteName}|{item.Key.RouteCode}"; - node.RouteName = item.Key.RouteName; - node.RouteCode = item.Key.RouteCode; - nodes.Add(node); - } - result.AddRange(nodes); - var dic2 = nodes.ToDictionary(x => x.Name, x => x.id); - foreach (var item in dic1[routeGroup.Key].Item2) - { - if (dic2.ContainsKey($"{item.Key.RouteName}|{item.Key.RouteCode}")) - { - result.AddRange(item.Select(x => new RouteLineTreeOutput - { - id = SnowflakeIdHelper.NextId(), - parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"], - Name = x.Version, - Version = x.Version, - })); - } - } - } - } - } - return new { list = result.ToTree() }; - } - } -} \ No newline at end of file +// using System.CodeDom; +// using Aop.Api.Domain; +// using Aop.Api.Request; +// using Aspose.Cells; +// using JNPF.Common.Core.Manager; +// using JNPF.Common.Security; +// using JNPF.DependencyInjection; +// using JNPF.DynamicApiController; +// using JNPF.Systems.Entitys.System; +// using JNPF.Systems.Interfaces.System; +// using JNPF.VisualDev; +// using Microsoft.AspNetCore.Authorization; +// using Microsoft.AspNetCore.Mvc; +// using NPOI.SS.Formula.Functions; +// using Spire.Presentation; +// using SqlSugar; +// using Tnb.BasicData.Entitys.Dto.ProcessManage; +// using Tnb.BasicData.Entitys.Entity; +// using Tnb.BasicData.Entitys.Model; +// +// namespace Tnb.BasicData +// { +// /// +// /// MOM基础数据-工艺管理 +// /// +// +// [ApiDescriptionSettings(Tag = "BasicData", Name = "ProcessManage", Order = 700)] +// [Route("api/basic/[controller]")] +// public class ProcessManageService : IOverideVisualDevService, IDynamicApiController, ITransient +// { +// private readonly ISqlSugarRepository _repository; +// private readonly DataBaseManager _dbManager; +// private readonly IDictionaryDataService _dictionaryDataService; +// private readonly string _dictionaryTypeId; +// +// public ProcessManageService( +// IDictionaryDataService dictionaryDataService, +// ISqlSugarRepository repository, +// DataBaseManager dbManager) +// { +// _dictionaryDataService = dictionaryDataService; +// _repository = repository; +// _dbManager = dbManager; +// _dictionaryTypeId = "24950639717653"; +// } +// +// public OverideVisualDevFunc OverideFuncs => new OverideVisualDevFunc(); +// +// /// +// /// 获取工艺路线树形结构 +// /// +// /// 工艺路线模版树形结构 +// /// +// ///
[{ +// ///
"RouteType": 工艺路线类型, +// ///
"Name": 工艺路线类型名称, +// ///
"RouteName": 工艺路线名称, +// ///
"RouteCode": 工艺路线代码, +// ///
"Version": 工艺路线版本, +// ///
"id": "25325800913429", +// ///
"parentId": null, +// ///
"hasChildren": true, +// ///
"children": [{ +// ///
"RouteType": 工艺路线类型, +// ///
"Name": 工艺路线名称|工艺路线版本, +// ///
"RouteName": "显示器集成", +// ///
"RouteCode": 工艺路线代码, +// ///
"Version": 工艺路线版本, +// ///
"id": 当前节点Id,不用可以忽略, +// ///
"parentId": "父节点Id,不用可以忽略", +// ///
"hasChildren": 是否包含子节点,true/false, +// ///
"children": [{ +// ///
"Version": 工艺路线版本, +// ///
} +// ///
], +// ///
"num": 子节点数量,不用可以忽略, +// ///
"isLeaf": 是否页节点,不用可以忽略 true/false +// ///
} +// ///
] +// ///
} +// ///
] +// ///
+// [HttpGet("route-tree")] +// public async Task GetRouteTreeList() +// { +// var result = new List(); +// var dictaryDataList = await _dictionaryDataService.GetList(_dictionaryTypeId); +// var dictaryData = dictaryDataList.ToDictionary(x => x.EnCode, x => x.FullName); +// SqlSugarScope sugarClient = null!; +// var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == "tnb_mom"); +// if (momDbLink != null) +// { +// sugarClient = _dbManager.ChangeDataBase(momDbLink); +// } +// var list = await sugarClient.Queryable().ToListAsync(); +// if (list?.Count > 0) +// { +// var routeGroups = list.GroupBy(g => g.RouteType); +// var dic1 = routeGroups.ToDictionary(x => x.Key, x => Tuple.Create(new RouteLineTreeOutput +// { +// id = SnowflakeIdHelper.NextId(), +// RouteType = x.Key, +// Name = dictaryData.ContainsKey(x.Key) ? dictaryData[x.Key] : string.Empty +// }, x.GroupBy(g => new { g.RouteName, g.RouteCode }))); +// result.AddRange(dic1.Values.Select(t => t.Item1)); +// foreach (var routeGroup in routeGroups) +// { +// if (dic1.ContainsKey(routeGroup.Key)) +// { +// var nodes = new List(); +// foreach (var item in dic1[routeGroup.Key].Item2) +// { +// var node = new RouteLineTreeOutput(); +// node.id = SnowflakeIdHelper.NextId(); +// node.parentId = dic1[routeGroup.Key].Item1.id; +// node.Name = $"{item.Key.RouteName}|{item.Key.RouteCode}"; +// node.RouteName = item.Key.RouteName; +// node.RouteCode = item.Key.RouteCode; +// nodes.Add(node); +// } +// result.AddRange(nodes); +// var dic2 = nodes.ToDictionary(x => x.Name, x => x.id); +// foreach (var item in dic1[routeGroup.Key].Item2) +// { +// if (dic2.ContainsKey($"{item.Key.RouteName}|{item.Key.RouteCode}")) +// { +// result.AddRange(item.Select(x => new RouteLineTreeOutput +// { +// id = SnowflakeIdHelper.NextId(), +// parentId = dic2[$"{item.Key.RouteName}|{item.Key.RouteCode}"], +// Name = x.Version, +// Version = x.Version, +// })); +// } +// } +// } +// } +// } +// return new { list = result.ToTree() }; +// } +// } +// } \ No newline at end of file From e915a1949ca7e4a0cbf7c4f95dcd6c8cd833cce1 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Fri, 21 Apr 2023 16:54:05 +0800 Subject: [PATCH 2/5] 1 --- .gitignore | 3 ++- .../Configurations/AppSetting.json | 21 ------------------- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 apihost/Tnb.API.Entry/Configurations/AppSetting.json diff --git a/.gitignore b/.gitignore index d4a5457b..55c425d0 100644 --- a/.gitignore +++ b/.gitignore @@ -368,4 +368,5 @@ JetBrains Rider *.sln.DotSettings *.sln.DotSettings.VS2015.user *.sln.DotSettings.VS2017.user -*.sln.DotSettings.VS2019.user \ No newline at end of file +*.sln.DotSettings.VS2019.user +/apihost/Tnb.API.Entry/Configurations/AppSetting.json diff --git a/apihost/Tnb.API.Entry/Configurations/AppSetting.json b/apihost/Tnb.API.Entry/Configurations/AppSetting.json deleted file mode 100644 index da71e465..00000000 --- a/apihost/Tnb.API.Entry/Configurations/AppSetting.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "AppSettings": { - "InjectMiniProfiler": true, - "SupportPackageNamePrefixs": [ "Tnb" ] - }, - "Kestrel": { - "Endpoints": { - "Http": { - "Url": "http://localhost:9231" - } - } - }, - "YitId": { - "WorkerId": 1, //必须 全局唯一,必须 程序设定,理论最大值 2^WorkerIdBitLength-1 - "WorkerIdBitLength": 4, //机器码位长,决定 WorkerId 的最大值,默认值6,取值范围 [1, 16] - "SeqBitLength": 4 //序列数位长,默认值6,取值范围 [3, 21](建议不小于4),决定每毫秒基础生成的ID个数 - }, - "UnifyResultSettings": { - "ShowExceptionDetail": true - } -} \ No newline at end of file From a1bf240ff2539a9f20d4e499164bf0a2a8a47242 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Fri, 21 Apr 2023 16:54:16 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MoCrInput.cs} | 2 +- .../Dto/PrdManage/MoldListOutput.cs | 20 + .../Dto/PrdManage/PrdTaskReleaseUpInput.cs | 19 + .../PrdManage/ProductionSchedulingCrInput.cs | 211 +++++++++++ .../WorkOrder/ProductionSchedulingCrInput.cs | 68 ---- .../Tnb.ProductionMgr.Entitys/Entity/Molds.cs | 181 +++++++++ .../Entity/PrdMoEntity.cs | 5 + .../Entity/PrdTask.cs | 344 +++++++++--------- .../IPrdMoService.cs | 2 +- .../Tnb.ProductionMgr/PrdMoService.cs | 96 ++++- .../Manager/DataBase/DataBaseManager.cs | 6 +- .../Department/DepartmentCrInput.cs | 5 + .../Department/DepartmentInfoOutput.cs | 4 + .../Permission/Organize/OrganizeListOutput.cs | 5 + .../Permission/DepartmentService.cs | 6 +- .../Tnb.Systems/Permission/OrganizeService.cs | 37 +- system/Tnb.Systems/System/DataBaseService.cs | 4 +- 17 files changed, 750 insertions(+), 265 deletions(-) rename ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/{WorkOrder/WorkOrderIssueCrInput.cs => PrdManage/MoCrInput.cs} (91%) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoldListOutput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskReleaseUpInput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs delete mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/ProductionSchedulingCrInput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/WorkOrderIssueCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoCrInput.cs similarity index 91% rename from ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/WorkOrderIssueCrInput.cs rename to ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoCrInput.cs index d3c9084c..f6577dcc 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/WorkOrderIssueCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoCrInput.cs @@ -9,7 +9,7 @@ namespace Tnb.ProductionPlanMgr.Entitys.Dto.WorkOrder /// /// 生产工单下发输入参数 /// - public class WorkOrderIssueCrInput + public class MoCrInput { /// /// 生产工单Id列表 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoldListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoldListOutput.cs new file mode 100644 index 00000000..ee6ab026 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/MoldListOutput.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.ProductionMgr.Entitys.Entity; + +namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder +{ + /// + /// 模具列表输出参数 + /// + public class MoldListOutput : Molds + { + /// + /// 产品 名称 + /// + public string item_name { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskReleaseUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskReleaseUpInput.cs new file mode 100644 index 00000000..339cb189 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskReleaseUpInput.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage +{ + /// + /// 生产任务单下发输入参数 + /// + public class PrdTaskReleaseUpInput + { + /// + /// 生产任务ID列表 + /// + public List TaskIds { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs new file mode 100644 index 00000000..eaa724db --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder +{ + /// + /// 生产工单排产输入参数 + /// + public class ProductionSchedulingCrInput + { + + /// + /// Desc:工单类型 1、注塑/挤出工单 2、组装/包装工单 + /// Default: + /// Nullable:True + /// + public int? mo_type { get; set; } + + /// + /// Desc:计划开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_start_date { get; set; } + + /// + /// Desc:计划结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_end_date { get; set; } + + /// + /// Desc:预计开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? estimated_start_date { get; set; } + + /// + /// Desc:预计结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? estimated_end_date { get; set; } + + /// + /// Desc:实际开工时间 + /// Default: + /// Nullable:True + /// + public DateTime? start_date { get; set; } + + /// + /// Desc:实际完工时间 + /// Default: + /// Nullable:True + /// + public DateTime? end_date { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } + + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } + + /// + /// Desc:生产任务单状态 + /// Default: + /// Nullable:True + /// + public string status { get; set; } + + /// + /// Desc:工单Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_id { get; set; } + + /// + /// Desc:工单代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_code { get; set; } + + /// + /// Desc:模具Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_id { get; set; } + + /// + /// Desc:模具名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_name { get; set; } + + /// + /// Desc:设备Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_id { get; set; } + + /// + /// Desc:设备名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_name { get; set; } + + /// + /// Desc:产线编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string line_id { get; set; } + + /// + /// Desc:产线名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string line_name { get; set; } + + /// + /// Desc:产品Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_id { get; set; } + + /// + /// Desc:产品名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_name { get; set; } + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id { get; set; } + + /// + /// Desc:生产车间 + /// Default:NULL::character varying + /// Nullable:True + /// + public string workshop { get; set; } + + /// + /// Desc:模穴数 + /// Default: + /// Nullable:True + /// + public int? mold_cavity_num { get; set; } + + /// + /// Desc:计划生产数量 + /// Default: + /// Nullable:True + /// + public int? plan_num { get; set; } + + /// + /// Desc:吨位 + /// Default: + /// Nullable:True + /// + public decimal? tonnage { get; set; } + /// + /// 已排产数量 + /// + public int scheduled_num { get; set; } + + + } + +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/ProductionSchedulingCrInput.cs deleted file mode 100644 index ac852eb4..00000000 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/WorkOrder/ProductionSchedulingCrInput.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder -{ - /// - /// 生产工单排产输入参数 - /// - public class ProductionSchedulingCrInput - { - /// - /// 生产任务主键Id - /// - public string? Id { get; set; } - /// - /// 工单类型 1、注塑/挤出 2、组装/包装 - /// - public int MoType { get; set; } - /// - /// 工单Id - /// - public int MoId { get; set; } - /// - /// 产品编号 - /// - public string ItemId { get; set; } - /// - /// 产品名称 - /// - public string ItemName { get; set; } - - #region 注塑工单 - /// - /// 模具Id - /// - public string MoldId { get; set; } - /// - /// 模具名称 - /// - public string MoldName { get; set; } - /// - /// 设备Id - /// - public string EqpId { get; set; } - /// - /// 设备名称 - /// - public string EqpName { get; set; } - #endregion - - #region 组装包装工单 - /// - /// 产线编号 - /// - public string LineId { get; set; } - /// - /// 产线名称 - /// - public string LineName { get; set; } - #endregion - - - } - -} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs new file mode 100644 index 00000000..fa48090e --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs @@ -0,0 +1,181 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entitys.Entity +{ + /// + ///模具信息表 + /// + [SugarTable("tool_molds")] + public partial class Molds + { + public Molds(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:生产模数 + /// Default: + /// Nullable:True + /// + public int? production_modulus {get;set;} + + /// + /// Desc:保养模次 + /// Default: + /// Nullable:True + /// + public int? maintain_num {get;set;} + + /// + /// Desc:日定额 + /// Default: + /// Nullable:True + /// + public decimal? daily_rate {get;set;} + + /// + /// Desc:工时定额(H/PCS) + /// Default: + /// Nullable:True + /// + public decimal? hour_norm {get;set;} + + /// + /// Desc:成长周期 + /// Default: + /// Nullable:True + /// + public int? growth_cycle {get;set;} + + /// + /// Desc:型腔数 + /// Default: + /// Nullable:True + /// + public int? cavity_num {get;set;} + + /// + /// Desc:模具寿命 + /// Default: + /// Nullable:True + /// + public int? mold_life {get;set;} + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string remark {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time {get;set;} + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time {get;set;} + + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras {get;set;} + + /// + /// Desc:模具编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_code {get;set;} + + /// + /// Desc:模具名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_name {get;set;} + + /// + /// Desc:产品Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_id {get;set;} + + /// + /// Desc:设备Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_id {get;set;} + + /// + /// Desc:设备代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_code {get;set;} + + /// + /// Desc:磨具使用状态 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_status {get;set;} + + /// + /// Desc:模具剩余寿命 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_remaining_life {get;set;} + + /// + /// Desc:库房编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string warehosue_id {get;set;} + + /// + /// Desc:库位编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string location_id {get;set;} + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id {get;set;} + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs index 2fc1ef74..f9cffcc0 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs @@ -30,6 +30,11 @@ namespace Tnb.ProductionMgr.Entitys.Entity [SugarColumn(ColumnName = "mo_code")] public string MoCode { get; set; } /// + /// 产品Id + /// + [SugarColumn(ColumnName = "item_id")] + public string ItemId { get; set; } + /// /// 产品代码, BAS_MATERIA.MATERIALCODE BAS_ITEM.ITEMCODE /// [SugarColumn(ColumnName = "item_code")] diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs index 0fea1d8f..e9851538 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs @@ -11,193 +11,211 @@ namespace Tnb.ProductionMgr.Entitys.Entity [SugarTable("prd_task")] public partial class PrdTask { - public PrdTask(){ + public PrdTask() + { - } - /// - /// Desc:主键 - /// Default: - /// Nullable:False - /// - [SugarColumn(IsPrimaryKey=true,ColumnName="id")] - public string Id {get;set;} + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } - /// - /// Desc:工单类型 1、注塑/挤出工单 2、组装/包装工单 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="mo_type")] - public int? MoType {get;set;} + /// + /// Desc:工单类型 1、注塑/挤出工单 2、组装/包装工单 + /// Default: + /// Nullable:True + /// + public int? mo_type { get; set; } - /// - /// Desc:计划开始时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="plan_start_date")] - public DateTime? PlanStartDate {get;set;} + /// + /// Desc:计划开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_start_date { get; set; } - /// - /// Desc:计划结束时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="plan_end_date")] - public DateTime? PlanEndDate {get;set;} + /// + /// Desc:计划结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_end_date { get; set; } - /// - /// Desc:预计开始时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="estimated_start_date")] - public DateTime? EstimatedStartDate {get;set;} + /// + /// Desc:预计开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? estimated_start_date { get; set; } - /// - /// Desc:预计结束时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="estimated_end_date")] - public DateTime? EstimatedEndDate {get;set;} + /// + /// Desc:预计结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? estimated_end_date { get; set; } - /// - /// Desc:实际开工时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="start_date")] - public DateTime? StartDate {get;set;} + /// + /// Desc:实际开工时间 + /// Default: + /// Nullable:True + /// + public DateTime? start_date { get; set; } - /// - /// Desc:实际完工时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="end_date")] - public DateTime? EndDate {get;set;} + /// + /// Desc:实际完工时间 + /// Default: + /// Nullable:True + /// + public DateTime? end_date { get; set; } - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="create_time")] - public DateTime? CreateTime {get;set;} + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } - /// - /// Desc:修改时间 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="modify_time")] - public DateTime? ModifyTime {get;set;} + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } - /// - /// Desc:扩展字段 - /// Default: - /// Nullable:True - /// - [SugarColumn(ColumnName="extras")] - public string Extras {get;set;} + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } - /// - /// Desc:工单Id - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="mo_id")] - public string MoId {get;set;} + /// + /// Desc:生产任务单状态 + /// Default: + /// Nullable:True + /// + public string status { get; set; } - /// - /// Desc:工单代码 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="mo_code")] - public string MoCode {get;set;} + /// + /// Desc:工单Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_id { get; set; } - /// - /// Desc:模具Id - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="mold_id")] - public string MoldId {get;set;} + /// + /// Desc:工单代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_code { get; set; } - /// - /// Desc:模具名称 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="mold_name")] - public string MoldName {get;set;} + /// + /// Desc:模具Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_id { get; set; } - /// - /// Desc:设备Id - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="eqp_id")] - public string EqpId {get;set;} + /// + /// Desc:模具名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_name { get; set; } - /// - /// Desc:设备名称 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="eqp_name")] - public string EqpName {get;set;} + /// + /// Desc:设备Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_id { get; set; } - /// - /// Desc:产线编号 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="line_id")] - public string LineId {get;set;} + /// + /// Desc:设备名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_name { get; set; } - /// - /// Desc:产线名称 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="line_name")] - public string LineName {get;set;} + /// + /// Desc:产线编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string line_id { get; set; } - /// - /// Desc:产品Id - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="item_id")] - public string ItemId {get;set;} + /// + /// Desc:产线名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string line_name { get; set; } - /// - /// Desc:产品名称 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="item_name")] - public string ItemName {get;set;} + /// + /// Desc:产品Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_id { get; set; } - /// - /// Desc:创建用户 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="create_id")] - public string CreateId {get;set;} + /// + /// Desc:产品名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_name { get; set; } - /// - /// Desc:修改用户 - /// Default:NULL::character varying - /// Nullable:True - /// - [SugarColumn(ColumnName="modify_id")] - public string ModifyId {get;set;} + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id { get; set; } + + /// + /// Desc:生产车间 + /// Default:NULL::character varying + /// Nullable:True + /// + public string workshop { get; set; } + + /// + /// Desc:模穴数 + /// Default: + /// Nullable:True + /// + public int? mold_cavity_num { get; set; } + + /// + /// Desc:计划生产数量 + /// Default: + /// Nullable:True + /// + public int? plan_num { get; set; } + + /// + /// Desc:吨位 + /// Default: + /// Nullable:True + /// + public decimal? tonnage { get; set; } + /// + /// 已排产数量 + /// + public int scheduled_num { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoService.cs index 097de8cb..fc9da814 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoService.cs @@ -7,6 +7,6 @@ namespace Tnb.ProductionPlanMgr.Interfaces /// public interface IPrdMoService { - Task WorkOrderIssue(WorkOrderIssueCrInput input); + Task WorkOrderIssue(MoCrInput input); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 31807629..05fcb878 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -1,5 +1,7 @@ -using JNPF.Common.Core.Manager; +using System.Dynamic; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; +using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -9,6 +11,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NPOI.OpenXmlFormats.Shared; using SqlSugar; +using Tnb.ProductionMgr.Entitys.Dto.PrdManage; using Tnb.ProductionMgr.Entitys.Dto.WorkOrder; using Tnb.ProductionMgr.Entitys.Entity; using Tnb.ProductionPlanMgr.Entitys.Dto.WorkOrder; @@ -25,10 +28,12 @@ namespace Tnb.ProductionPlanMgr { private readonly ISqlSugarRepository _repository; private readonly IDataBaseManager _dataBaseManager; - public PrdMoService(ISqlSugarRepository repository, IDataBaseManager dataBaseManager) + private readonly IUserManager _userManager; + public PrdMoService(ISqlSugarRepository repository, IDataBaseManager dataBaseManager,IUserManager userManager) { _repository = repository; _dataBaseManager = dataBaseManager; + _userManager = userManager; } /// /// 生产工单创建-生产工单下发 @@ -36,7 +41,7 @@ namespace Tnb.ProductionPlanMgr /// 生产工单下发输入参数 /// [HttpPut("workorder-issue")] - public async Task WorkOrderIssue(WorkOrderIssueCrInput input) + public async Task WorkOrderIssue(MoCrInput input) { if (input is null) { @@ -52,26 +57,97 @@ namespace Tnb.ProductionPlanMgr /// /// 生产工单-生产排产 /// - /// + /// + ///
{ + ///
Id:生产任务主键Id + ///
MoType:工单类型 1、注塑/挤出 2、组装/包装 + ///
MoId:工单Id + ///
ItemId:产品编号 + ///
ItemName:产品名称 + ///
MoldId:模具Id + ///
MoldName:模具名称 + ///
EqpId:设备Id + ///
EqpName:设备名称 + ///
LineId:产线编号 + ///
LineName:产线名称 + ///
} + /// /// + [HttpPost("scheduling")] public async Task ProductionScheduling(ProductionSchedulingCrInput input) { var entity = input.Adapt(); - entity.Id = input.Id ?? SnowflakeIdHelper.NextId(); + entity.id ??= SnowflakeIdHelper.NextId(); + entity.status = "ToBeScheduled"; //任务单状态默认,待排产 + entity.create_id = _userManager.UserId; + entity.create_time = DateTime.Now; + var db = await GetDbContext(); var row = await db.Storageable(entity).ExecuteCommandAsync(); + if (row > 0) + { + //修改工单状态为已排产,同事修改已排产数量 + row = await db.Updateable().SetColumns(it => new PrdMoEntity + { + MoStatus = "25019252113685", + InputQty = entity.scheduled_num + }) + .Where(it => it.Id == entity.mo_id).ExecuteCommandAsync(); + } + return row > 0; + } + /// + /// 生产任务下发 + /// + /// + [HttpPost("task-release")] + public async Task PrdTaskRelease(PrdTaskReleaseUpInput input) + { + if (input is null) + { + throw new ArgumentNullException(nameof(input)); + } + var db = await GetDbContext(); + var row = await db.Updateable() + .SetColumns(it => new PrdTask { status = "ToBeStarted" }) + .Where(it => input.TaskIds.Contains(it.id)) + .ExecuteCommandAsync(); return (row > 0); } - private async Task GetDbContext() + + + /// + /// 根据产品ID获取模具列表 + /// + /// 产品ID + /// + [HttpGet("moldlist/{itemId}")] + public async Task GetMoldListByItemId(string itemId) { - var link = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == "tnb_mes"); + var db = await GetDbContext("tnb_mom"); + List items = await db.Queryable().AS("bas_item").Select(new List() + { + new SelectModel{ FiledName="id" }, + new SelectModel{ FiledName="item_name" }, + }).ToListAsync(); + var itemDic = items.ToDictionary(x => x.id, x => x.item_name); + db = await GetDbContext("tnb_eqp"); + var moldList = await db.Queryable().Where(it => it.item_id == itemId).ToListAsync(); + var list = moldList.Adapt>(); + db.ThenMapper(list, x => x.item_name = itemDic.ContainsKey(x.item_id) ? itemDic[x.item_id] : ""); + + return list; + + } + + + private async Task GetDbContext(string dbName = "tnb_mes") + { + var link = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == dbName); var db = _dataBaseManager.ChangeDataBase(link); return db; } } - - - } \ No newline at end of file diff --git a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs index f6460e7d..a81244e4 100644 --- a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs +++ b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs @@ -49,8 +49,8 @@ public class DataBaseManager : IDataBaseManager, ITransient IUserManager userManager, ISqlSugarClient context) { - _sqlSugarClient = (SqlSugarScope)context; - _userManager = userManager; + _sqlSugarClient = ((SqlSugarScope)context); + _userManager = userManager; _connectionStrings = connectionOptions.Value; } @@ -419,7 +419,7 @@ WHERE pcolumn.table_name='{0}' ORDER BY ordinal_position"; { if (link != null && _sqlSugarClient.CurrentConnectionConfig.ConfigId != link.Id) _sqlSugarClient = ChangeDataBase(link); - return _sqlSugarClient.DbMaintenance.GetPrimaries(tableName); + return _sqlSugarClient.CopyNew().DbMaintenance.GetPrimaries(tableName); } /// diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs index 59a0335e..52277daa 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs @@ -46,4 +46,9 @@ public class DepartmentCrInput /// 组织类型 /// public string category { get; set; } + /// + /// 组织类型名称 + /// added by ly on 20230421 + /// + public string typeName { get; set; } } \ No newline at end of file diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentInfoOutput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentInfoOutput.cs index 286425bd..bd0ae0c1 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentInfoOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentInfoOutput.cs @@ -57,4 +57,8 @@ public class DepartmentInfoOutput /// added by ly on 20230420 /// public string category { get; set; } + /// + /// 组织类型名称 + /// + public string categoryName { get; set; } } \ No newline at end of file diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Organize/OrganizeListOutput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Organize/OrganizeListOutput.cs index b6c986e6..b4b5813c 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Organize/OrganizeListOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Organize/OrganizeListOutput.cs @@ -73,4 +73,9 @@ public class OrganizeListOutput : TreeModel /// 集团名 (组织树最后一个). /// public string lastFullName { get; set; } + /// + /// 组织类型名称 + /// added by ly on 20230421 + /// + public string categoryName { get; set; } } \ No newline at end of file diff --git a/system/Tnb.Systems/Permission/DepartmentService.cs b/system/Tnb.Systems/Permission/DepartmentService.cs index 23042e79..fb217eff 100644 --- a/system/Tnb.Systems/Permission/DepartmentService.cs +++ b/system/Tnb.Systems/Permission/DepartmentService.cs @@ -9,6 +9,7 @@ using JNPF.Systems.Entitys.Dto.Department; using JNPF.Systems.Entitys.Dto.Organize; using JNPF.Systems.Entitys.Dto.SysConfig; using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using Mapster; @@ -212,6 +213,9 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra var res = entity.Adapt(); if (entity.ParentId.Equals("-1")) res.organizeIdTree = new List() { res.id }; else res.organizeIdTree = (await _repository.GetSingleAsync(p => p.Id == entity.ParentId)).OrganizeIdTree.Split(",").ToList(); + //modified by ly on 20230421 + var dic = await _repository.AsSugarClient().Queryable().Where(it => it.DictionaryTypeId == "24754619407381").ToDictionaryAsync(x => x.EnCode, x => x.FullName); + res.categoryName = dic.ContainsKey(res.category) ? dic[res.category].ToString() : ""; return res; } @@ -578,7 +582,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra /// public async Task> GetCompanyAllDep(string id) { - return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null); + return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null); } #endregion } \ No newline at end of file diff --git a/system/Tnb.Systems/Permission/OrganizeService.cs b/system/Tnb.Systems/Permission/OrganizeService.cs index fd50240f..190a515c 100644 --- a/system/Tnb.Systems/Permission/OrganizeService.cs +++ b/system/Tnb.Systems/Permission/OrganizeService.cs @@ -12,6 +12,7 @@ using JNPF.LinqBuilder; using JNPF.Systems.Entitys.Dto.Organize; using JNPF.Systems.Entitys.Dto.SysConfig; using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using Mapster; @@ -88,6 +89,8 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie // 获取分级管理组织 var dataScope = _userManager.DataScope.Where(x => x.Select).Select(x => x.organizeId).Distinct().ToList(); + //modified by ly on 20230421 查询区域类型数据字典 + var dic = await _repository.AsSugarClient().Queryable().Where(it => it.DictionaryTypeId == "24754619407381").ToDictionaryAsync(x => x.EnCode, x => x.FullName); List? data = await _repository.AsQueryable().Where(t => t.DeleteMark == null) .WhereIF(!_userManager.IsAdministrator, a => dataScope.Contains(a.Id)) @@ -105,7 +108,9 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie sortCode = x.SortCode, icon = SqlFunc.IIF(x.Category.Equals("company"), "icon-ym icon-ym-tree-organization3", "icon-ym icon-ym-tree-department1"), type = x.Category - }).ToListAsync(); + }) + .Mapper(x => x.categoryName = dic.ContainsKey(x.category) ? dic[x.category].ToString() : "") + .ToListAsync(); if (!string.IsNullOrEmpty(input.keyword)) data = data.TreeWhere(t => t.fullName.Contains(input.keyword) || t.enCode.Contains(input.keyword), t => t.id, t => t.parentId); @@ -290,19 +295,19 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie queryWhere = queryWhere.And(x => x.DeleteMark == null); List? data = await _repository.AsQueryable().Where(queryWhere) .WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)).Select(a => new OrganizeListOutput - { - id = a.Id, - organizeIdTree = a.OrganizeIdTree, - type = a.Category, - parentId = a.ParentId, - lastFullName = a.FullName, - fullName = a.FullName, - enabledMark = a.EnabledMark, - creatorTime = a.CreatorTime, - icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1", - sortCode = a.SortCode, - isLeaf = true - }).ToListAsync(); + { + id = a.Id, + organizeIdTree = a.OrganizeIdTree, + type = a.Category, + parentId = a.ParentId, + lastFullName = a.FullName, + fullName = a.FullName, + enabledMark = a.EnabledMark, + creatorTime = a.CreatorTime, + icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1", + sortCode = a.SortCode, + isLeaf = true + }).ToListAsync(); // 获取所有组织 List? allOrgList = GetOrgListTreeName(); @@ -393,7 +398,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie }); }); - if(adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); #endregion #region 第三方同步 @@ -629,7 +634,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie [NonAction] public async Task> GetListAsync(Expression> expression = null) { - var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression!=null, expression); + var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression != null, expression); return await query.OrderBy(o => o.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc).ToListAsync(); } diff --git a/system/Tnb.Systems/System/DataBaseService.cs b/system/Tnb.Systems/System/DataBaseService.cs index 2e5cf242..81d87794 100644 --- a/system/Tnb.Systems/System/DataBaseService.cs +++ b/system/Tnb.Systems/System/DataBaseService.cs @@ -417,8 +417,8 @@ public class DataBaseService : IDynamicApiController, ITransient sugarClient.MappingTables.Add(entityName, item.Name); foreach (var col in sugarClient.DbMaintenance.GetColumnInfosByTableName(item.Name)) { - var colName = CustomFormatName(col.DbColumnName); - sugarClient.MappingColumns.Add(colName /*类的属性首字母大写*/, col.DbColumnName, entityName); + //var colName = CustomFormatName(col.DbColumnName); + sugarClient.MappingColumns.Add(col.DbColumnName /*类的属性首字母大写*/, col.DbColumnName, entityName); } } sugarClient.DbFirst.Where(input.TableName) From f0fde866c86a75c696fc8c9814ae4b11a3fac629 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Sun, 23 Apr 2023 13:41:40 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=B7=A5=E5=8D=95=E6=8E=92=E4=BA=A7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/PrdManage/PrdTaskOperInput.cs | 40 +++ .../Dto/PrdManage/PrdTaskOperOutput.cs | 20 ++ .../PrdManage/ProductionSchedulingCrInput.cs | 48 +-- .../Dto/PrdManage/TaskOperRecordOutput.cs | 45 +++ .../Entity/BasItem.cs | 132 +++++++ .../Tnb.ProductionMgr.Entitys/Entity/Molds.cs | 287 +++++++-------- .../Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs | 326 ++++++++++++++++++ .../Entity/PrdMoEntity.cs | 244 ------------- .../Entity/PrdTask.cs | 106 +++--- .../Entity/PrdTaskLog.cs | 108 ++++++ .../Tnb.ProductionMgr/PrdMoService.cs | 182 +++++++--- .../System/IDictionaryDataService.cs | 7 + .../System/DictionaryDataService.cs | 11 +- 13 files changed, 1039 insertions(+), 517 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperOutput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/TaskOperRecordOutput.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/BasItem.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs delete mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTaskLog.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs new file mode 100644 index 00000000..5ee8f14d --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage +{ + /// + /// 生产操作记录查询参数 + /// + public class PrdTaskOperInput + { + /// + /// 工单号 + /// + public string mo_no { get; set; } + /// + /// 任务单号 + /// + public string task_no { get; set; } + /// + /// 产品编号 + /// + public string item_code { get; set; } + /// + /// 设备编号 + /// + public string eqp_code { get; set; } + /// + /// 计划生产开始日期 + /// + public DateTime? plan_start_date{ get; set; } + /// + /// 计划生产结束日期 + /// + public DateTime? plan_end_date { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperOutput.cs new file mode 100644 index 00000000..63669644 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperOutput.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.ProductionMgr.Entitys.Entity; + +namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage +{ + /// + /// 生产操作记录输出类 + /// + public class PrdTaskOperOutput : PrdTaskLog + { + /// + ///任务单操作状态 + /// + public string statusName { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs index eaa724db..cf3e32a6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs @@ -11,7 +11,11 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// public class ProductionSchedulingCrInput { - + /// + /// + /// + public string id { get; set; } + /// /// Desc:工单类型 1、注塑/挤出工单 2、组装/包装工单 /// Default: @@ -47,40 +51,6 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// public DateTime? estimated_end_date { get; set; } - /// - /// Desc:实际开工时间 - /// Default: - /// Nullable:True - /// - public DateTime? start_date { get; set; } - - /// - /// Desc:实际完工时间 - /// Default: - /// Nullable:True - /// - public DateTime? end_date { get; set; } - - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - public DateTime? create_time { get; set; } - - /// - /// Desc:修改时间 - /// Default: - /// Nullable:True - /// - public DateTime? modify_time { get; set; } - - /// - /// Desc:扩展字段 - /// Default: - /// Nullable:True - /// - public string extras { get; set; } /// /// Desc:生产任务单状态 @@ -158,6 +128,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// Nullable:True /// public string item_name { get; set; } + /// + /// 产品规格型号 + /// + public string item_standard { get; set; } /// /// Desc:创建用户 @@ -204,6 +178,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// 已排产数量 /// public int scheduled_num { get; set; } + /// + /// 设备型号 + /// + public string eqp_type_code { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/TaskOperRecordOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/TaskOperRecordOutput.cs new file mode 100644 index 00000000..7cd561cf --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/TaskOperRecordOutput.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.ProductionMgr.Entitys.Entity; + +namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage +{ + public class TaskOperRecordOutput + { + /// + /// 任务单状态名称 + /// + public string statusName { get; set; } + /// + /// Desc:工单Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_id { get; set; } + /// + /// 任务单号 + /// + public string taskId { get; set; } + /// + /// Desc:设备编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_code { get; set; } + /// + /// 模具编号 + /// + public string mold_code { get; set; } + /// + /// 产品型号 + /// + public string item_code { get; set; } + /// + /// 操作人姓名 + /// + public string operatorName { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/BasItem.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/BasItem.cs new file mode 100644 index 00000000..89152d3c --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/BasItem.cs @@ -0,0 +1,132 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entitys.Entity +{ + /// + ///产品信息 + /// + [SugarTable("bas_item")] + public partial class BasItem + { + public BasItem(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:产品代码 + /// Default: + /// Nullable:False + /// + public string item_code {get;set;} + + /// + /// Desc:产品分类ID + /// Default: + /// Nullable:False + /// + public string categoryid {get;set;} + + /// + /// Desc:关联比例 + /// Default: + /// Nullable:True + /// + public decimal? relation_ratio {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time {get;set;} + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time {get;set;} + + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras {get;set;} + + /// + /// Desc:所属组织ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string org_id {get;set;} + + /// + /// Desc:产品名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_name {get;set;} + + /// + /// Desc:产品规格型号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_standard {get;set;} + + /// + /// Desc:物料ID,BAS_MATERIAL.ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string material_id {get;set;} + + /// + /// Desc:产品类型: 半成品:SemiManufacture 成品:FinishedProduct + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_type {get;set;} + + /// + /// Desc:备注 + /// Default:NULL::character varying + /// Nullable:True + /// + public string remark {get;set;} + + /// + /// Desc:时间戳(用于并发控制) + /// Default:NULL::character varying + /// Nullable:True + /// + public string timestamp {get;set;} + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id {get;set;} + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs index fa48090e..331adba6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs @@ -11,171 +11,176 @@ namespace Tnb.ProductionMgr.Entitys.Entity [SugarTable("tool_molds")] public partial class Molds { - public Molds(){ + public Molds() + { - } - /// - /// Desc:主键 - /// Default: - /// Nullable:False - /// - [SugarColumn(IsPrimaryKey=true)] - public string id {get;set;} + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } - /// - /// Desc:生产模数 - /// Default: - /// Nullable:True - /// - public int? production_modulus {get;set;} + /// + /// Desc:生产模数 + /// Default: + /// Nullable:True + /// + public int? production_modulus { get; set; } - /// - /// Desc:保养模次 - /// Default: - /// Nullable:True - /// - public int? maintain_num {get;set;} + /// + /// Desc:保养模次 + /// Default: + /// Nullable:True + /// + public int? maintain_num { get; set; } - /// - /// Desc:日定额 - /// Default: - /// Nullable:True - /// - public decimal? daily_rate {get;set;} + /// + /// Desc:日定额 + /// Default: + /// Nullable:True + /// + public decimal? daily_rate { get; set; } - /// - /// Desc:工时定额(H/PCS) - /// Default: - /// Nullable:True - /// - public decimal? hour_norm {get;set;} + /// + /// Desc:工时定额(H/PCS) + /// Default: + /// Nullable:True + /// + public decimal? hour_norm { get; set; } - /// - /// Desc:成长周期 - /// Default: - /// Nullable:True - /// - public int? growth_cycle {get;set;} + /// + /// Desc:成长周期 + /// Default: + /// Nullable:True + /// + public int? growth_cycle { get; set; } - /// - /// Desc:型腔数 - /// Default: - /// Nullable:True - /// - public int? cavity_num {get;set;} + /// + /// Desc:型腔数 + /// Default: + /// Nullable:True + /// + public int? cavity_num { get; set; } - /// - /// Desc:模具寿命 - /// Default: - /// Nullable:True - /// - public int? mold_life {get;set;} + /// + /// Desc:模具寿命 + /// Default: + /// Nullable:True + /// + public int? mold_life { get; set; } - /// - /// Desc:备注 - /// Default: - /// Nullable:True - /// - public string remark {get;set;} + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string remark { get; set; } - /// - /// Desc:创建时间 - /// Default: - /// Nullable:True - /// - public DateTime? create_time {get;set;} + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } - /// - /// Desc:修改时间 - /// Default: - /// Nullable:True - /// - public DateTime? modify_time {get;set;} + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } - /// - /// Desc:扩展字段 - /// Default: - /// Nullable:True - /// - public string extras {get;set;} + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } - /// - /// Desc:模具编号 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mold_code {get;set;} + /// + /// Desc:模具编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_code { get; set; } - /// - /// Desc:模具名称 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mold_name {get;set;} + /// + /// Desc:模具名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_name { get; set; } - /// - /// Desc:产品Id - /// Default:NULL::character varying - /// Nullable:True - /// - public string item_id {get;set;} + /// + /// Desc:产品Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_id { get; set; } + /// + /// 产品code + /// + public string item_code { get; set; } - /// - /// Desc:设备Id - /// Default:NULL::character varying - /// Nullable:True - /// - public string eqp_id {get;set;} + /// + /// Desc:设备Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_id { get; set; } - /// - /// Desc:设备代码 - /// Default:NULL::character varying - /// Nullable:True - /// - public string eqp_code {get;set;} + /// + /// Desc:设备代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_code { get; set; } - /// - /// Desc:磨具使用状态 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mold_status {get;set;} + /// + /// Desc:磨具使用状态 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_status { get; set; } - /// - /// Desc:模具剩余寿命 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mold_remaining_life {get;set;} + /// + /// Desc:模具剩余寿命 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_remaining_life { get; set; } - /// - /// Desc:库房编号 - /// Default:NULL::character varying - /// Nullable:True - /// - public string warehosue_id {get;set;} + /// + /// Desc:库房编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string warehosue_id { get; set; } - /// - /// Desc:库位编号 - /// Default:NULL::character varying - /// Nullable:True - /// - public string location_id {get;set;} + /// + /// Desc:库位编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string location_id { get; set; } - /// - /// Desc:创建用户 - /// Default:NULL::character varying - /// Nullable:True - /// - public string create_id {get;set;} + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id { get; set; } - /// - /// Desc:修改用户 - /// Default:NULL::character varying - /// Nullable:True - /// - public string modify_id {get;set;} + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs new file mode 100644 index 00000000..ab91c1ef --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs @@ -0,0 +1,326 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entitys.Entity +{ + /// + ///MES生产工单 + /// + [SugarTable("prd_mo")] + public partial class PrdMo + { + public PrdMo() + { + + + } + /// + /// Desc:Id + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:工单代码 + /// Default: + /// Nullable:False + /// + public string mo_code { get; set; } + /// + /// 产品ID + /// + public string item_id { get; set; } + + /// + /// Desc:产品代码, BAS_MATERIA.MATERIALCODE BAS_ITEM.ITEMCODE + /// Default: + /// Nullable:False + /// + public string item_code { get; set; } + + /// + /// Desc:工单类型:1-正常工单、2-返工工单、3-试制工单 + /// Default: + /// Nullable:False + /// + public string mo_type { get; set; } + + /// + /// Desc:生产状态 Initial: 初始, Confirm:确认 Release: 下发, Open: 生产中, Close: 关单, Pending: 暂停 + /// Default: + /// Nullable:False + /// + public string mo_status { get; set; } + + /// + /// Desc:生产数量 + /// Default: + /// Nullable:False + /// + public decimal plan_qty { get; set; } + + /// + /// Desc:已投入数量 + /// Default: + /// Nullable:True + /// + public decimal? input_qty { get; set; } + + /// + /// Desc:已完工数量 + /// Default: + /// Nullable:True + /// + public decimal? complete_qty { get; set; } + + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public decimal? scrap_qty { get; set; } + + /// + /// Desc:计划开始时间 + /// Default: + /// Nullable:False + /// + public DateTime plan_start_date { get; set; } + + /// + /// Desc:计划结束时间 + /// Default: + /// Nullable:False + /// + public DateTime plan_end_date { get; set; } + + /// + /// Desc:实际开工日期 + /// Default: + /// Nullable:True + /// + public DateTime? act_start_date { get; set; } + + /// + /// Desc:实际完工日期 + /// Default: + /// Nullable:True + /// + public DateTime? act_end_date { get; set; } + + /// + /// Desc:订单行号 + /// Default: + /// Nullable:True + /// + public int? order_seq { get; set; } + + /// + /// Desc:关联比例 + /// Default: + /// Nullable:True + /// + public decimal? relation_ratio { get; set; } + + /// + /// Desc:下发日期 + /// Default: + /// Nullable:True + /// + public DateTime? mo_down_date { get; set; } + + /// + /// Desc:排程开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? seduling_start_date { get; set; } + + /// + /// Desc:排程结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? seduling_end_date { get; set; } + + /// + /// Desc:是否生派工单 + /// Default: + /// Nullable:True + /// + public int? is_create_dispatch { get; set; } + + /// + /// Desc:子工单序号(1开始,最大+1,不强制连续) + /// Default: + /// Nullable:True + /// + public int? seq { get; set; } + + /// + /// Desc:租户ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string tenant_id { get; set; } + + /// + /// Desc:ismerge + /// Default: + /// Nullable:True + /// + public int? is_merge { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } + + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } + + /// + /// Desc:所属组织ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string org_id { get; set; } + + /// + /// Desc:产品附属信息 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_attribute { get; set; } + + /// + /// Desc:生产部门ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string dept_id { get; set; } + + /// + /// Desc:客户代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string customer_code { get; set; } + + /// + /// Desc:订单号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string order_no { get; set; } + + /// + /// Desc:BOM版本 + /// Default:NULL::character varying + /// Nullable:True + /// + public string bom_version { get; set; } + + /// + /// Desc:下发人员ID + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_down_user_id { get; set; } + + /// + /// Desc:下发人员名称 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_down_user_name { get; set; } + + /// + /// Desc:备注 + /// Default:NULL::character varying + /// Nullable:True + /// + public string remark { get; set; } + + /// + /// Desc:工作中心代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string work_center_code { get; set; } + + /// + /// Desc:主工单代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string parent_mo_code { get; set; } + + /// + /// Desc:数据来源 10-计划,20-插入,30-导入 + /// Default:NULL::character varying + /// Nullable:True + /// + public string data_sources { get; set; } + + /// + /// Desc:产线代码 + /// Default:NULL::character varying + /// Nullable:True + /// + public string production_linecode { get; set; } + + /// + /// Desc:组合工单 + /// Default:NULL::character varying + /// Nullable:True + /// + public string combine_mo_code { get; set; } + + /// + /// Desc:时间戳 + /// Default:NULL::character varying + /// Nullable:True + /// + public string time_stamp { get; set; } + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:修改用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string modify_id { get; set; } + + /// + /// Desc:工单组号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_group_no { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs deleted file mode 100644 index f9cffcc0..00000000 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMoEntity.cs +++ /dev/null @@ -1,244 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using SqlSugar; -using Tnb.Common.Contracts; - -namespace Tnb.ProductionMgr.Entitys.Entity -{ - /// - /// MES生产工单 - /// - [SugarTable("prd_mo")] - public class PrdMoEntity : BaseEntity - { - /// - /// 租户ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "tenant_id")] - public string TenantId { get; set; } - /// - /// 所属组织ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "org_id")] - public string OrgId { get; set; } - /// - /// 工单代码 - /// - [SugarColumn(ColumnName = "mo_code")] - public string MoCode { get; set; } - /// - /// 产品Id - /// - [SugarColumn(ColumnName = "item_id")] - public string ItemId { get; set; } - /// - /// 产品代码, BAS_MATERIA.MATERIALCODE BAS_ITEM.ITEMCODE - /// - [SugarColumn(ColumnName = "item_code")] - public string ItemCode { get; set; } - /// - /// 产品附属信息 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "item_attribute")] - public string ItemAttribute { get; set; } - /// - /// 工单类型:1-正常工单、2-返工工单、3-试制工单 - /// - [SugarColumn(ColumnName = "mo_type")] - public string MoType { get; set; } - /// - /// 生产状态 Initial: 初始, Confirm:确认 Release: 下发, Open: 生产中, Close: 关单, Pending: 暂停 - /// - [SugarColumn(ColumnName = "mo_status")] - public string MoStatus { get; set; } - /// - /// 生产数量 - /// - [SugarColumn(ColumnName = "plan_qty")] - public decimal PlanQty { get; set; } - /// - /// 已投入数量 - /// - [SugarColumn(ColumnName = "input_qty")] - public decimal? InputQty { get; set; } - /// - /// 已完工数量 - /// - [SugarColumn(ColumnName = "complete_qty")] - public decimal? CompleteQty { get; set; } - /// - /// 报废数量 - /// - [SugarColumn(ColumnName = "scrap_qty")] - public decimal? ScrapQty { get; set; } - /// - /// 计划开始时间 - /// - [SugarColumn(ColumnName = "plan_start_date")] - public DateTime PlanStartDate { get; set; } - /// - /// 计划结束时间 - /// - [SugarColumn(ColumnName = "plan_end_date")] - public DateTime PlanEndDate { get; set; } - /// - /// 实际开工日期 - /// - [SugarColumn(ColumnName = "act_start_date")] - public DateTime? ActStartDate { get; set; } - /// - /// 实际完工日期 - /// - [SugarColumn(ColumnName = "act_end_date")] - public DateTime? ActEndDate { get; set; } - /// - /// 生产部门ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "dept_id")] - public string DeptId { get; set; } - /// - /// 客户代码 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "customer_code")] - public string CustomerCode { get; set; } - /// - /// 订单号 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "order_no")] - public string OrderNo { get; set; } - /// - /// 订单行号 - /// - [SugarColumn(ColumnName = "order_seq")] - public int? OrderSeq { get; set; } - /// - /// BOM版本 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "bom_version")] - public string BomVersion { get; set; } - /// - /// 关联比例 - /// - [SugarColumn(ColumnName = "relation_ratio")] - public decimal? RelationRatio { get; set; } - /// - /// 下发人员ID - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "mo_down_user_id")] - public string MoDownUserId { get; set; } - /// - /// 下发人员名称 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "mo_down_user_name")] - public string MoDownUserName { get; set; } - /// - /// 下发日期 - /// - [SugarColumn(ColumnName = "mo_down_date")] - public DateTime? MoDownDate { get; set; } - /// - /// 备注 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "remark")] - public string Remark { get; set; } - /// - /// 工作中心代码 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "work_center_code")] - public string WorkCenterCode { get; set; } - /// - /// 主工单代码 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "parent_mo_code")] - public string ParentMoCode { get; set; } - /// - /// 排程开始时间 - /// - [SugarColumn(ColumnName = "seduling_start_date")] - public DateTime? SedulingStartDate { get; set; } - /// - /// 排程结束时间 - /// - [SugarColumn(ColumnName = "seduling_end_date")] - public DateTime? SedulingEndDate { get; set; } - /// - /// 是否生派工单 - /// - [SugarColumn(ColumnName = "is_create_dispatch")] - public int? IsCreateDispatch { get; set; } - /// - /// 子工单序号(1开始,最大+1,不强制连续) - /// - [SugarColumn(ColumnName = "seq")] - public int? Seq { get; set; } - /// - /// 数据来源 10-计划,20-插入,30-导入 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "data_sources")] - public string DataSources { get; set; } - /// - /// 产线代码 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "production_linecode")] - public string ProductionLinecode { get; set; } - /// - /// ismerge - /// - [SugarColumn(ColumnName = "is_merge")] - public int? IsMerge { get; set; } - /// - /// 组合工单 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "combine_mo_code")] - public string CombineMoCode { get; set; } - /// - /// 时间戳 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "time_stamp")] - public string TimeStamp { get; set; } - /// - /// 创建用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "create_id")] - public string CreateId { get; set; } - /// - /// 创建时间 - /// - [SugarColumn(ColumnName = "create_time")] - public DateTime? CreateTime { get; set; } - /// - /// 修改用户 - /// 默认值: NULL::character varying - /// - [SugarColumn(ColumnName = "modify_id")] - public string ModifyId { get; set; } - /// - /// 修改时间 - /// - [SugarColumn(ColumnName = "modify_time")] - public DateTime? ModifyTime { get; set; } - /// - /// 扩展字段 - /// - [SugarColumn(ColumnName = "extras")] - public string Extras { get; set; } - } -} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs index e9851538..d16b5fcc 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs @@ -95,11 +95,39 @@ namespace Tnb.ProductionMgr.Entitys.Entity public string extras { get; set; } /// - /// Desc:生产任务单状态 + /// Desc:模穴数 /// Default: /// Nullable:True /// - public string status { get; set; } + public int? mold_cavity_num { get; set; } + + /// + /// Desc:计划生产数量 + /// Default: + /// Nullable:True + /// + public int? plan_num { get; set; } + + /// + /// Desc:完成数量 + /// Default: + /// Nullable:True + /// + public int? comple_num { get; set; } + + /// + /// Desc:吨位 + /// Default: + /// Nullable:True + /// + public decimal? tonnage { get; set; } + + /// + /// Desc:已排产数 + /// Default: + /// Nullable:True + /// + public int? scheduled_num { get; set; } /// /// Desc:工单Id @@ -108,13 +136,6 @@ namespace Tnb.ProductionMgr.Entitys.Entity /// public string mo_id { get; set; } - /// - /// Desc:工单代码 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mo_code { get; set; } - /// /// Desc:模具Id /// Default:NULL::character varying @@ -122,26 +143,16 @@ namespace Tnb.ProductionMgr.Entitys.Entity /// public string mold_id { get; set; } - /// - /// Desc:模具名称 - /// Default:NULL::character varying - /// Nullable:True - /// - public string mold_name { get; set; } - /// /// Desc:设备Id /// Default:NULL::character varying /// Nullable:True /// public string eqp_id { get; set; } - /// - /// Desc:设备名称 - /// Default:NULL::character varying - /// Nullable:True - /// - public string eqp_name { get; set; } + /// 设备型号 + /// + public string eqp_type_code { get; set; } /// /// Desc:产线编号 @@ -150,26 +161,20 @@ namespace Tnb.ProductionMgr.Entitys.Entity /// public string line_id { get; set; } - /// - /// Desc:产线名称 - /// Default:NULL::character varying - /// Nullable:True - /// - public string line_name { get; set; } - /// /// Desc:产品Id /// Default:NULL::character varying /// Nullable:True /// public string item_id { get; set; } - /// - /// Desc:产品名称 - /// Default:NULL::character varying - /// Nullable:True - /// - public string item_name { get; set; } + /// 产品编号 + /// + public string item_code { get; set; } + /// + /// 产品规格型号 + /// + public string item_standard { get; set; } /// /// Desc:创建用户 @@ -185,6 +190,13 @@ namespace Tnb.ProductionMgr.Entitys.Entity /// public string modify_id { get; set; } + /// + /// Desc:生产任务单状态 + /// Default:NULL::character varying + /// Nullable:True + /// + public string status { get; set; } + /// /// Desc:生产车间 /// Default:NULL::character varying @@ -193,29 +205,15 @@ namespace Tnb.ProductionMgr.Entitys.Entity public string workshop { get; set; } /// - /// Desc:模穴数 - /// Default: + /// Desc:操作人姓名 + /// Default:NULL::character varying /// Nullable:True /// - public int? mold_cavity_num { get; set; } - + public string operator_name { get; set; } /// - /// Desc:计划生产数量 - /// Default: - /// Nullable:True - /// - public int? plan_num { get; set; } - - /// - /// Desc:吨位 - /// Default: - /// Nullable:True - /// - public decimal? tonnage { get; set; } - /// - /// 已排产数量 + /// 生产任务ID /// - public int scheduled_num { get; set; } + public string prd_task_id { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTaskLog.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTaskLog.cs new file mode 100644 index 00000000..29ae6dfc --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTaskLog.cs @@ -0,0 +1,108 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entitys.Entity +{ + /// + ///生产任务操作记录 + /// + [SugarTable("prd_task_log")] + public partial class PrdTaskLog + { + public PrdTaskLog(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time {get;set;} + + /// + /// Desc:扩展字段 + /// Default: + /// Nullable:True + /// + public string extras {get;set;} + + /// + /// Desc:工单号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mo_code {get;set;} + + /// + /// Desc:设备编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string eqp_code {get;set;} + + /// + /// Desc:模具编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string mold_code {get;set;} + + /// + /// Desc:产品编号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_code {get;set;} + + /// + /// Desc:产品规格型号 + /// Default:NULL::character varying + /// Nullable:True + /// + public string item_standard {get;set;} + + ///// + ///// Desc:设备型号 + ///// Default:NULL::character varying + ///// Nullable:True + ///// + //public string eqp_type_code {get;set;} + + /// + /// Desc:任务单状态 + /// Default:NULL::character varying + /// Nullable:True + /// + public string? status {get;set;} + + /// + /// Desc:操作人姓名 + /// Default:NULL::character varying + /// Nullable:True + /// + public string operator_name {get;set;} + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string create_id {get;set;} + /// + /// 生产任务ID + /// + public string task_id { get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 05fcb878..fbacba4b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -1,11 +1,14 @@ using System.Dynamic; +using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; +using JNPF.Logging; using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -26,14 +29,22 @@ namespace Tnb.ProductionPlanMgr [Route("api/production/[controller]")] public class PrdMoService : IPrdMoService, IDynamicApiController, ITransient { - private readonly ISqlSugarRepository _repository; + private readonly ISqlSugarRepository _repository; private readonly IDataBaseManager _dataBaseManager; private readonly IUserManager _userManager; - public PrdMoService(ISqlSugarRepository repository, IDataBaseManager dataBaseManager,IUserManager userManager) + private readonly IDictionaryDataService _dictionaryDataService; + + public PrdMoService( + ISqlSugarRepository repository, + IDataBaseManager dataBaseManager, + IUserManager userManager, + IDictionaryDataService dictionaryDataService + ) { _repository = repository; _dataBaseManager = dataBaseManager; _userManager = userManager; + _dictionaryDataService = dictionaryDataService; } /// /// 生产工单创建-生产工单下发 @@ -47,13 +58,49 @@ namespace Tnb.ProductionPlanMgr { throw new ArgumentNullException(nameof(input)); } - var db = await GetDbContext(); - var row = await db.Updateable() - .SetColumns(it => new PrdMoEntity { MoStatus = "25019232867093" }) - .Where(it => input.WorkOrderIds.Contains(it.Id)) - .ExecuteCommandAsync(); + var db = _repository.AsSugarClient(); + var row = await db.Updateable() + .SetColumns(it => new PrdMo { mo_status = "25019232867093" }) + .Where(it => input.WorkOrderIds.Contains(it.id)) + .ExecuteCommandAsync(); return (row > 0); } + /// + /// 关联同组工单 + /// + /// 关联同组工单输入参数 + /// + [HttpPost("relevancy")] + public async Task RelevancySameGroupMo(MoCrInput input) + { + var row = -1; + var list = await _repository.AsSugarClient().Queryable() + .InnerJoin((a, b) => a.item_code == b.item_code) + .Where((a, b) => input.WorkOrderIds.Contains(a.id)) + .Select((a, b) => new + { + planDate = a.plan_start_date, + moldId = b.id, + }).ToListAsync(); + if (list?.Count > 0) + { + var planDate = list.FirstOrDefault()?.planDate; + var moId = list.FirstOrDefault()?.moldId; + + var all = list.Skip(1).All(x => x.planDate == planDate && x.moldId == moId); + if (all) + { + var groupId = SnowflakeIdHelper.NextId(); + row = await _repository.AsSugarClient().Updateable() + .SetColumns(c => new PrdMo { mo_group_no = groupId }) + .Where(it => input.WorkOrderIds.Contains(it.id)) + .ExecuteCommandAsync(); + } + } + return row > 0; + } + + /// /// 生产工单-生产排产 /// @@ -77,23 +124,49 @@ namespace Tnb.ProductionPlanMgr [HttpPost("scheduling")] public async Task ProductionScheduling(ProductionSchedulingCrInput input) { - var entity = input.Adapt(); - entity.id ??= SnowflakeIdHelper.NextId(); - entity.status = "ToBeScheduled"; //任务单状态默认,待排产 - entity.create_id = _userManager.UserId; - entity.create_time = DateTime.Now; - - var db = await GetDbContext(); - var row = await db.Storageable(entity).ExecuteCommandAsync(); - if (row > 0) + var row = -1; + if (input.mo_type.HasValue && input.mo_type.Value == 1) { - //修改工单状态为已排产,同事修改已排产数量 - row = await db.Updateable().SetColumns(it => new PrdMoEntity + input.id ??= SnowflakeIdHelper.NextId(); + var entity = input.Adapt(); + entity.status = "ToBeScheduled"; //任务单状态默认,待排产 + entity.create_id = _userManager.UserId; + entity.create_time = DateTime.Now; + + var db = _repository.AsSugarClient(); + try { - MoStatus = "25019252113685", - InputQty = entity.scheduled_num - }) - .Where(it => it.Id == entity.mo_id).ExecuteCommandAsync(); + await db.Ado.BeginTranAsync(); + row = await db.Storageable(entity).ExecuteCommandAsync(); + var taskLogEntity = input.Adapt(); + taskLogEntity.id ??= SnowflakeIdHelper.NextId(); + taskLogEntity.status ??= "ToBeStarted"; + taskLogEntity.create_id = _userManager.UserId; + taskLogEntity.create_time = DateTime.Now; + taskLogEntity.operator_name = _userManager.RealName; + + //任务状态变更时插入操作记录 + if (!db.Queryable().Where(it => it.task_id == input.id && it.status == taskLogEntity.status).Any()) + { + row = await db.Insertable(taskLogEntity).ExecuteCommandAsync(); + } + if (row > 0) + { + //修改工单状态为已排产,同事修改已排产数量 + row = await db.Updateable().SetColumns(it => new PrdMo + { + mo_status = "25019252113685", + input_qty = entity.scheduled_num + }) + .Where(it => it.id == entity.mo_id).ExecuteCommandAsync(); + } + await db.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + Log.Error("生产任务发布时发生错误", ex); + await db.Ado.RollbackTranAsync(); + } } return row > 0; } @@ -108,7 +181,7 @@ namespace Tnb.ProductionPlanMgr { throw new ArgumentNullException(nameof(input)); } - var db = await GetDbContext(); + var db = _repository.AsSugarClient(); ; var row = await db.Updateable() .SetColumns(it => new PrdTask { status = "ToBeStarted" }) .Where(it => input.TaskIds.Contains(it.id)) @@ -118,36 +191,63 @@ namespace Tnb.ProductionPlanMgr + /// /// 根据产品ID获取模具列表 /// /// 产品ID /// + /// + ///
return results: + ///
[ + ///
{ + ///
mold_code:模具编号 + ///
mold_name:模具名称 + ///
item_name:产品名称 + ///
item_code:产品编号 + ///
cavity_num:模穴数 + ///
} + ///
] + ///
[HttpGet("moldlist/{itemId}")] public async Task GetMoldListByItemId(string itemId) { - var db = await GetDbContext("tnb_mom"); - List items = await db.Queryable().AS("bas_item").Select(new List() - { - new SelectModel{ FiledName="id" }, - new SelectModel{ FiledName="item_name" }, - }).ToListAsync(); - var itemDic = items.ToDictionary(x => x.id, x => x.item_name); - db = await GetDbContext("tnb_eqp"); - var moldList = await db.Queryable().Where(it => it.item_id == itemId).ToListAsync(); - var list = moldList.Adapt>(); - db.ThenMapper(list, x => x.item_name = itemDic.ContainsKey(x.item_id) ? itemDic[x.item_id] : ""); - + var db = _repository.AsSugarClient(); + var list = await db.Queryable().InnerJoin((a, b) => a.item_id == b.id) + .Where((a, b) => a.item_id == itemId) + .Select((a, b) => new MoldListOutput + { + id = a.id, + mold_code = a.mold_code, + mold_name = a.mold_name, + item_name = b.item_name, + item_code = b.item_code, + cavity_num = a.cavity_num, + }) + .ToListAsync(); return list; } - - - private async Task GetDbContext(string dbName = "tnb_mes") + /// + /// 查看工单操作记录 + /// + /// 操作记录查询输入参数 + /// + [HttpGet("record/{moId}")] + public async Task GetMoOperRecord(PrdTaskOperInput input) { - var link = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == dbName); - var db = _dataBaseManager.ChangeDataBase(link); - return db; + var list = await _repository.AsSugarClient().Queryable().LeftJoin((a, b) => a.prd_task_id == b.id) + .WhereIF(!string.IsNullOrWhiteSpace(input.mo_no), a => a.mo_id == input.mo_no) + .WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_no) + .WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code) + .WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code) + .WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value) + .WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value) + .ToListAsync(); + var data = list.Adapt>(); + var dic = await _dictionaryDataService.GetDicByTypeId("25572555259157"); + _repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : ""); + return data; } } } \ No newline at end of file diff --git a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs index 3a0a4abb..851291dc 100644 --- a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs +++ b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs @@ -31,4 +31,11 @@ public interface IDictionaryDataService /// /// Task> GetDicByKey(string key); + + /// + /// 根据typeId获取字典 + /// + /// + /// + Task> GetDicByTypeId(string typeId); } \ No newline at end of file diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs index 977f0c5f..080fd651 100644 --- a/system/Tnb.Systems/System/DictionaryDataService.cs +++ b/system/Tnb.Systems/System/DictionaryDataService.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Core.Manager; +using JNPF.ClayObject.Extensions; +using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager.Files; using JNPF.Common.Enums; using JNPF.Common.Manager; @@ -338,9 +339,15 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll return await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.EnCode == key && b.DeleteMark == null) - .ToDictionaryAsync((it)=>it.EnCode,it=>it.FullName); + .ToDictionaryAsync((it) => it.EnCode, it => it.FullName); } + public async Task> GetDicByTypeId(string typeId) => + await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId).ToDictionaryAsync(x => x.EnCode, x => x.FullName); + + + + #endregion #region PrivateMethod From 2723aa7862a53697861f4b79c8010cb87da7bcac Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Sun, 23 Apr 2023 16:38:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=8E=92=E4=BA=A7=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/PrdManage/PrdTaskOperInput.cs | 4 ++ .../PrdManage/ProductionSchedulingCrInput.cs | 12 +++++ .../Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs | 2 +- .../Tnb.ProductionMgr/PrdMoService.cs | 48 +++++++++++++------ .../System/DictionaryDataService.cs | 2 +- visualdev/Tnb.VisualDev/RunService.cs | 9 +++- 6 files changed, 58 insertions(+), 19 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs index 5ee8f14d..96e358aa 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskOperInput.cs @@ -35,6 +35,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage /// 计划生产结束日期 /// public DateTime? plan_end_date { get; set; } + /// + /// 任务ID + /// + public string task_id { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs index cf3e32a6..a57de08b 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs @@ -79,6 +79,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// Nullable:True /// public string mold_id { get; set; } + /// + /// 模具编号 + /// + public string mold_code { get; set; } /// /// Desc:模具名称 @@ -93,6 +97,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// Nullable:True /// public string eqp_id { get; set; } + /// + /// 设备编号 + /// + public string eqp_code { get; set; } /// /// Desc:设备名称 @@ -121,6 +129,10 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder /// Nullable:True /// public string item_id { get; set; } + /// + /// 产品编号 + /// + public string item_code { get; set; } /// /// Desc:产品名称 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs index ab91c1ef..fe118fcb 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs @@ -33,7 +33,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity /// /// 产品ID /// - public string item_id { get; set; } + //public string item_id { get; set; } /// /// Desc:产品代码, BAS_MATERIA.MATERIALCODE BAS_ITEM.ITEMCODE diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index fbacba4b..7720a362 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -137,29 +137,46 @@ namespace Tnb.ProductionPlanMgr try { await db.Ado.BeginTranAsync(); + row = await db.Storageable(entity).ExecuteCommandAsync(); var taskLogEntity = input.Adapt(); taskLogEntity.id ??= SnowflakeIdHelper.NextId(); + taskLogEntity.task_id = input.id; taskLogEntity.status ??= "ToBeStarted"; taskLogEntity.create_id = _userManager.UserId; taskLogEntity.create_time = DateTime.Now; taskLogEntity.operator_name = _userManager.RealName; - + //任务状态变更时插入操作记录 if (!db.Queryable().Where(it => it.task_id == input.id && it.status == taskLogEntity.status).Any()) { row = await db.Insertable(taskLogEntity).ExecuteCommandAsync(); } + if (row > 0) { - //修改工单状态为已排产,同事修改已排产数量 + var obj = (await db.Queryable().FirstAsync(it => it.id == input.mo_id)); + obj.input_qty += entity.scheduled_num; + var moStatus = ""; + //判断,已排产数量>=计划数量时将状态改为 已完成 + if (obj.input_qty >= obj.plan_qty) + { + moStatus = "25019252113685"; + + } + else + { + //修改工单状态为已排产,同事修改已排产数量 + moStatus = "25019244276501"; + } row = await db.Updateable().SetColumns(it => new PrdMo { - mo_status = "25019252113685", - input_qty = entity.scheduled_num + mo_status = moStatus, + input_qty = obj.input_qty }) .Where(it => it.id == entity.mo_id).ExecuteCommandAsync(); } + await db.Ado.CommitTranAsync(); } catch (Exception ex) @@ -231,19 +248,20 @@ namespace Tnb.ProductionPlanMgr /// /// 查看工单操作记录 /// - /// 操作记录查询输入参数 + /// 任务ID /// - [HttpGet("record/{moId}")] - public async Task GetMoOperRecord(PrdTaskOperInput input) + [HttpGet("record/{taskId}")] + public async Task GetMoOperRecord(string taskId) { - var list = await _repository.AsSugarClient().Queryable().LeftJoin((a, b) => a.prd_task_id == b.id) - .WhereIF(!string.IsNullOrWhiteSpace(input.mo_no), a => a.mo_id == input.mo_no) - .WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_no) - .WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code) - .WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code) - .WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value) - .WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value) - .ToListAsync(); + //var list = await _repository.AsSugarClient().Queryable().LeftJoin((a, b) => a.prd_task_id == b.id) + // .WhereIF(!string.IsNullOrWhiteSpace(input.mo_no),b=>b.id == input.task_no) + // .WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_id) + // .WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code) + // .WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code) + // .WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value) + // .WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value) + // .ToListAsync(); + var list = await _repository.AsSugarClient().Queryable().Where(it => it.id == taskId).ToListAsync(); var data = list.Adapt>(); var dic = await _dictionaryDataService.GetDicByTypeId("25572555259157"); _repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : ""); diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs index 080fd651..6840545f 100644 --- a/system/Tnb.Systems/System/DictionaryDataService.cs +++ b/system/Tnb.Systems/System/DictionaryDataService.cs @@ -343,7 +343,7 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll } public async Task> GetDicByTypeId(string typeId) => - await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId).ToDictionaryAsync(x => x.EnCode, x => x.FullName); + await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId && x.DeleteMark == null).ToDictionaryAsync(x => x.EnCode, x => x.FullName); diff --git a/visualdev/Tnb.VisualDev/RunService.cs b/visualdev/Tnb.VisualDev/RunService.cs index 65f351e4..73ee49bc 100644 --- a/visualdev/Tnb.VisualDev/RunService.cs +++ b/visualdev/Tnb.VisualDev/RunService.cs @@ -2919,8 +2919,12 @@ public class RunService : IRunService, ITransient else { //modified by ly on 20230407 - itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value; - itemValue = itemValue.Trim('"'); + if (itemValue.IsMatch(@"\[(.+)\]")) + { + itemValue = Regex.Match(itemValue, @"\[(.+)\]").Groups[1].Value; + itemValue = itemValue.Trim('"'); + } + conModels.Add(new ConditionalCollections() { ConditionalList = new List>() @@ -2939,6 +2943,7 @@ public class RunService : IRunService, ITransient break; default: { + if (item.Value.IsNullOrEmpty()) continue; var itemValue = item.Value.ToString().Contains("[") ? item.Value.ToJsonString() : item.Value.ToString(); if (model.searchType == 1)