From a1bf240ff2539a9f20d4e499164bf0a2a8a47242 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Fri, 21 Apr 2023 16:54:16 +0800 Subject: [PATCH] =?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)