From f0fde866c86a75c696fc8c9814ae4b11a3fac629 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Sun, 23 Apr 2023 13:41:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86-=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E5=B7=A5=E5=8D=95=E6=8E=92=E4=BA=A7=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=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