diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs index cf2926d9..922b8e48 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs @@ -29,13 +29,25 @@ public static class DictConst /// 工单状态-待排产 /// public const string WaitProductId = "25019244276501"; - + /// + /// 工单状态-强制接单 + /// + public const string MoCloseId = "25501969636645"; + /// /// 工单状态 已下发字典Id /// public const string IssueId = "25019232867093"; /// + /// 工单状态已下发 + /// + public const string MoIssueEnCode = "Issue"; + /// + /// 工单状态-关闭 + /// + public const string MoClosedEnCode = "Close"; + /// /// 任务单状态-待开工编码 /// public const string ToBeStartedEnCode = "ToBeStarted"; @@ -55,6 +67,8 @@ public static class DictConst /// 任务单状态-待排产 /// public const string ToBeScheduledEncode = "ToBeScheduled"; + + #endregion diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs index 3183ffbe..6521a6e3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs @@ -15,5 +15,11 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 生产工单Id列表 /// public List WorkOrderIds { get; set; } + /// + /// 操作形式 + ///
Release 下发 + ///
Closed 强制接单 + ///
+ public string Behavior { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs new file mode 100644 index 00000000..ed41e45d --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + /// + /// 生产提报输入参数 + /// + public class PrdReportCrInput + { + /// + /// 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 remark { 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:生产任务Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string icmo_id { get; set; } + + /// + /// Desc:生产数量 + /// Default: + /// Nullable:True + /// + public int prd_qty { get; set; } + + /// + /// Desc:已报工数量 + /// Default: + /// Nullable:True + /// + public int reported_work_qty { get; set; } + + /// + /// Desc:提报数量 + /// Default: + /// Nullable:True + /// + public int reported_qty { get; set; } + + /// + /// Desc:生产任务编码 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + + /// + /// Desc:生产任务量 + /// Default: + /// Nullable:True + /// + public int icmo_qty { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs new file mode 100644 index 00000000..9c5f2f6c --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + public class PrdReportOutput + { + /// + /// 任务计划数 + /// + public int? icmo_qty { get; set; } + /// + /// 已报工数量 + /// + public int? reported_work_qty { get; set; } + /// + /// 提报数 + /// + public int? reported_qty { get; set; } + /// + /// 生产数量 + /// + public int? prd_qty { get; set; } + + public int? scrap_qty { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs index 5cc2494f..9e9848e2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs @@ -195,6 +195,8 @@ namespace Tnb.ProductionMgr.Entities.Dto /// public string eqp_type_code { get; set; } + + } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs new file mode 100644 index 00000000..60b0998e --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + /// + /// 自检报废输入类 + /// + public class SelfTestScrappedInput + { + /// + /// Desc:任务单号 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public int scrap_qty { get; set; } + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string remark { get; set; } + /// + /// 自检报废集合 + /// + public List categoryItems { get; set; } + + } + + + public class SelfTestScrappedInputItem + { + public string defective_category { get; set; } + + /// + /// Desc:分类数量 + /// Default: + /// Nullable:True + /// + public int? category_qty { get; set; } + public List items { get; set; } + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedOutput.cs new file mode 100644 index 00000000..b4f12c3e --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedOutput.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DbModels; +using Tnb.ProductionMgr.Entities; + +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +{ + /// + /// 提报记录统计明细 + /// + public class SelfTestScrappedOutput + { + /// + /// Desc:任务单号 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public int scrap_qty { get; set; } + /// + /// 自检报废集合 + /// + public List categoryItems { get; set; } + + } + + public class SelfTestScrappedOutputItem + { + public string defective_category { get; set; } + + /// + /// Desc:分类数量 + /// Default: + /// Nullable:True + /// + public int? category_qty { get; set; } + public List items { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs new file mode 100644 index 00000000..398e3f35 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs @@ -0,0 +1,118 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities +{ + /// + ///生产提报记录 + /// + [SugarTable("prd_report")] + public partial class PrdReport + { + public PrdReport(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:时间戳 + /// Default: + /// Nullable:True + /// + public DateTime? timestamp {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 remark {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:生产任务Id + /// Default:NULL::character varying + /// Nullable:True + /// + public string icmo_id {get;set;} + + /// + /// Desc:生产数量 + /// Default: + /// Nullable:True + /// + public int prd_qty {get;set;} + + /// + /// Desc:已报工数量 + /// Default: + /// Nullable:True + /// + public int? reported_work_qty {get;set;} + + /// + /// Desc:报工数量 + /// Default: + /// Nullable:True + /// + //public int? reported_qty {get;set;} + + /// + /// Desc:生产任务编码 + /// Default: + /// Nullable:True + /// + public string icmo_code {get;set;} + + /// + /// Desc:生产任务量 + /// Default: + /// Nullable:True + /// + public int? icmo_qty {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs new file mode 100644 index 00000000..4d69693c --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs @@ -0,0 +1,76 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities +{ + /// + /// + /// + [SugarTable("prd_report_record")] + public partial class PrdReportRecord + { + public PrdReportRecord(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:产品编码 + /// Default: + /// Nullable:True + /// + public string item_code {get;set;} + + /// + /// Desc:产品名称 + /// Default: + /// Nullable:True + /// + public string item_name {get;set;} + + /// + /// Desc:设备编码 + /// Default: + /// Nullable:True + /// + public string eqp_code {get;set;} + + /// + /// Desc:计划开始时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_start_time {get;set;} + + /// + /// Desc:计划结束时间 + /// Default: + /// Nullable:True + /// + public DateTime? plan_end_time {get;set;} + + /// + /// Desc:计划生产数量 + /// Default: + /// Nullable:True + /// + public int? plan_qty {get;set;} + + /// + /// Desc:完成数量 + /// Default: + /// Nullable:True + /// + public int? completed_qty {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs new file mode 100644 index 00000000..c7896ac7 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs @@ -0,0 +1,59 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace DbModels +{ + /// + ///TODO + /// + [SugarTable("prd_self_test_scrapped")] + public class PrdScrapped + { + /// + /// Desc:编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:任务单号 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + + + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public int scrap_qty { get; set; } + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string remark { get; set; } + + /// + /// Desc:创建用户 + /// Default: + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveCagetory.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveCagetory.cs new file mode 100644 index 00000000..be450414 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveCagetory.cs @@ -0,0 +1,60 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace DbModels +{ + /// + ///TODO + /// + [SugarTable("prd_self_test_scrapped_defective_cagetory")] + public partial class PrdScrappedDefectiveCagetory + { + + /// + /// Desc:编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:任务单号 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + + /// + /// Desc:次品分类 + /// Default: + /// Nullable:True + /// + public string defective_category { get; set; } + + /// + /// Desc:分类数量 + /// Default: + /// Nullable:True + /// + public int? category_qty { get; set; } + + + /// + /// Desc:创建用户 + /// Default: + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveItem.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveItem.cs new file mode 100644 index 00000000..fa09afdb --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrappedDefectiveItem.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace DbModels +{ + /// + ///TODO + /// + [SugarTable("prd_self_test_scrapped_defective_item")] + public partial class PrdScrappedDefectiveItem + { + + /// + /// Desc:编号 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:自检报废id + /// Default: + /// Nullable:True + /// + public string defective_cagetory_id { get;set;} + + /// + /// Desc:次品项 + /// Default: + /// Nullable:True + /// + public string defective_item {get;set;} + + /// + /// Desc:次品项数量 + /// Default: + /// Nullable:True + /// + public int defective_item_qty {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdSelfTestScrappedRecord.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdSelfTestScrappedRecord.cs new file mode 100644 index 00000000..ad58cb05 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdSelfTestScrappedRecord.cs @@ -0,0 +1,104 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities +{ + /// + /// + /// + [SugarTable("prd_self_test_scrapped_record")] + public partial class PrdSelfTestScrappedRecord + { + public PrdSelfTestScrappedRecord(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string id {get;set;} + + /// + /// Desc:产品编码 + /// Default: + /// Nullable:True + /// + public string item_code {get;set;} + + /// + /// Desc:产品名称 + /// Default: + /// Nullable:True + /// + public string item_name {get;set;} + + /// + /// Desc:设备编码 + /// Default: + /// Nullable:True + /// + public string eqp_code {get;set;} + + /// + /// Desc:模具名称 + /// Default: + /// Nullable:True + /// + public string mold_name {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 int? plan_qty {get;set;} + + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public int scrap_qty { get;set;} + + /// + /// Desc:生产任务单状态 + /// Default: + /// Nullable:True + /// + public string status {get;set;} + + /// + /// Desc:创建人Id + /// Default: + /// Nullable:True + /// + public string create_id {get;set;} + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time {get;set;} + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs index 2d464bb2..d3c75d4b 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs @@ -232,6 +232,10 @@ namespace Tnb.ProductionMgr.Entities /// 同组标识 /// public string group_flag { get; set; } + /// + /// 任务单号 + /// + public string icmo_code { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrapped.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrapped.cs new file mode 100644 index 00000000..9075903d --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrapped.cs @@ -0,0 +1,73 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities +{ + /// + /// 自检报废 + /// + [SugarTable("self_test_scrapped")] + public partial class SelfTestScrapped + { + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:任务单号 + /// Default: + /// Nullable:True + /// + public string icmo_code { get; set; } + + /// + /// Desc:次品分类 + /// Default: + /// Nullable:True + /// + public string defective_category { get; set; } + + /// + /// Desc:分类数量 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "category_qty")] + public int? category_qty { get; set; } + + /// + /// Desc:报废数量 + /// Default: + /// Nullable:True + /// + public int? scrap_qty { get; set; } + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string remark { get; set; } + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string create_id { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrappedItem.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrappedItem.cs new file mode 100644 index 00000000..1847cde0 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/SelfTestScrappedItem.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities +{ + /// + ///自检报废子表项 + /// + [SugarTable("self_test_scrapped_item")] + public partial class SelfTestScrappedItem + { + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:自检报废id + /// Default: + /// Nullable:True + /// + public string defective_cagetory_id { get; set; } + + /// + /// Desc:次品项 + /// Default: + /// Nullable:True + /// + public string defective_item { get; set; } + + /// + /// Desc:次品项数量 + /// Default: + /// Nullable:True + /// + public int defective_item_qty { get; set; } + + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs new file mode 100644 index 00000000..7c58d8d1 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Spire.License; + +namespace Tnb.ProductionMgr.Entities.Enums +{ + public enum MoBehavior + { + /// + /// 下发 + /// + Release=1, + /// + /// 强制结单 + /// + Closed=2, + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Behavior.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/PrdTaskBehavior.cs similarity index 92% rename from ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Behavior.cs rename to ProductionMgr/Tnb.ProductionMgr.Entities/Enums/PrdTaskBehavior.cs index 1af1896b..70d861ba 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Behavior.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/PrdTaskBehavior.cs @@ -1,6 +1,6 @@ namespace Tnb.ProductionMgr.Entities.Enums { - public enum Behavior + public enum PrdTaskBehavior { /// /// 任务下发 diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 6b1d2dd3..9f249502 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -1,5 +1,7 @@ using System.Reflection.Emit; +using System.Text; using Aop.Api.Domain; +using DbModels; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -14,13 +16,18 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Mapster; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging.Abstractions; +using NPOI.SS.Formula.Functions; +using Org.BouncyCastle.Crypto.Generators; using Senparc.Weixin.Work.AdvancedAPIs.MailList; using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entities; using Tnb.BasicData.Entitys.Entity; using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Entities.Enums; using Tnb.ProductionMgr.Interfaces; @@ -81,16 +88,16 @@ namespace Tnb.ProductionMgr public async Task GetMoldListByItemId(string itemId) { var db = _repository.AsSugarClient(); - var list = await db.Queryable().InnerJoin((a, b) => a.item_id == b.id) + 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 { mold_id = a.id, mold_code = a.mold_code, mold_name = a.mold_name, - item_name = b.product_name, + item_name = b.name, cavity_qty = a.cavity_qty, - item_code = b.product_code, + item_code = b.code, }) .ToListAsync(); return list; @@ -180,6 +187,75 @@ namespace Tnb.ProductionMgr _repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : ""); return data; } + /// + /// 根据任务单号获取提报记录明细 + /// + /// 任务单号 + /// + /// returns: + ///
{ + ///
icmo_qty:任务计划数量 + ///
reported_work_qty:已报工数量 + ///
reported_qty:报工数量 + ///
prd_qty:生产数量 + ///
} + ///
+ [HttpGet("{icmoCode}")] + public async Task GetPrdReportByIcmoCode(string icmoCode) + { + var db = _repository.AsSugarClient(); + var res = await db.Queryable().Where(it => it.icmo_code == icmoCode).Select(it => new PrdReportOutput + { + icmo_qty = it.icmo_qty, + reported_work_qty = it.reported_work_qty, + //reported_qty = it.reported_qty, + prd_qty = it.prd_qty, + scrap_qty = SqlFunc.Subqueryable().Select(x => x.scrap_qty), + }) + .Mapper(it => + { + it.icmo_qty = it.icmo_qty ?? (db.Queryable().First(it => it.icmo_code == icmoCode)?.scheduled_qty < 1 ? 0 : it.icmo_qty ?? db.Queryable().First(it => it.icmo_code == icmoCode).scheduled_qty); + it.reported_work_qty = it.reported_work_qty ?? 0; + //it.reported_qty = it.reported_qty ?? 0; + it.prd_qty = it.prd_qty ?? 0; + it.scrap_qty = it.scrap_qty ?? 0; + }) + .FirstAsync(); + res ??= new PrdReportOutput + { + icmo_qty = db.Queryable().First(it => it.icmo_code == icmoCode)?.scheduled_qty, + reported_work_qty = 0, + //reported_qty = 0, + prd_qty = 0, + scrap_qty = 0, + }; + return res; + } + /// + /// 获取提报生产记录 + /// + /// + /// + [HttpGet("{icmoCode}")] + public async Task GetReportRecord(string icmoCode) + { + var db = _repository.AsSugarClient(); + var output = new SelfTestScrappedOutput(); + output.icmo_code = icmoCode; + var scrap = (await db.Queryable().FirstAsync(it => it.icmo_code == icmoCode)); + output.scrap_qty = scrap != null ? scrap.scrap_qty : 0; + output.categoryItems = new List(); + var categorys = await db.Queryable().Where(it => it.icmo_code == icmoCode).ToListAsync(); + foreach (var category in categorys) + { + var categoryItem = category.Adapt(); + categoryItem.items = new List(); + var items = await db.Queryable().Where(it => it.defective_cagetory_id == category.id).ToListAsync(); + categoryItem.items.AddRange(items); + output.categoryItems.Add(categoryItem); + } + return output; + } #endregion @@ -197,6 +273,10 @@ namespace Tnb.ProductionMgr { throw new ArgumentNullException(nameof(input)); } + if (input.Behavior.IsNullOrWhiteSpace()) + { + throw new ArgumentException($"{nameof(input.Behavior)},not be null or empty"); + } var db = _repository.AsSugarClient(); //获取同组工单的Id,一起下发 @@ -207,8 +287,26 @@ namespace Tnb.ProductionMgr input.WorkOrderIds = input.WorkOrderIds.Concat(moIds).ToList(); } + + Tuple getMoStatus(MoBehavior behavior) + { + Tuple multi = null; + switch (behavior) + { + case MoBehavior.Release: + multi = Tuple.Create(DictConst.IssueId, DictConst.ToBeScheduledEncode); + break; + case MoBehavior.Closed: + multi = Tuple.Create(DictConst.MoCloseId, DictConst.ClosedEnCode); + break; + } + return multi!; + } + var behavior = input.Behavior.ToEnum(); + var multi = getMoStatus(behavior); + var row = await db.Updateable() - .SetColumns(it => new PrdMo { mo_status = DictConst.IssueId, icmo_status = DictConst.ToBeScheduledEncode }) + .SetColumns(it => new PrdMo { mo_status = multi.Item1, icmo_status = multi.Item2 }) .Where(it => input.WorkOrderIds.Contains(it.id)) .ExecuteCommandAsync(); return (row > 0); @@ -309,6 +407,7 @@ namespace Tnb.ProductionMgr entity.create_id = _userManager.UserId; entity.create_time = DateTime.Now; entity.prd_task_id = input.id; + var db = _repository.AsSugarClient(); try { @@ -368,6 +467,26 @@ namespace Tnb.ProductionMgr } else { + if (!input.mo_code.IsNullOrEmpty()) + { + var icmoCode = await db.Queryable().Where(it => !string.IsNullOrEmpty(it.icmo_code) && it.icmo_code.Contains(input.mo_code)).OrderByDescending(it => it.icmo_code).Select(it => it.icmo_code).FirstAsync(); + if (icmoCode.IsNullOrEmpty()) + { + entity.icmo_code = $"{input.mo_code}-01"; + } + else + { + var pos = icmoCode.IndexOf("-", StringComparison.Ordinal); + if (pos > -1) + { + var sb = new StringBuilder(); + var num = icmoCode.AsSpan().Slice(pos + 1).ToString().ParseToInt(); + var code = icmoCode.AsSpan().Slice(pos + 1).ToString(); + var n = (num + 1).ToString().PadLeft(2, '0'); + entity.icmo_code = sb.Append(code).Append(n).ToString(); + } + } + } row = await db.Storageable(entity).ExecuteCommandAsync(); var taskLogEntity = input.Adapt(); taskLogEntity.id ??= SnowflakeIdHelper.NextId(); @@ -454,7 +573,7 @@ namespace Tnb.ProductionMgr } catch (Exception ex) { - Log.Error("生产任务发布时发生错误", ex); + JNPF.Logging.Log.Error("生产任务发布时发生错误", ex); await db.Ado.RollbackTranAsync(); } } @@ -483,18 +602,18 @@ namespace Tnb.ProductionMgr { throw new ArgumentException($"{nameof(input.Behavior)} not be null or empty"); } - string SetTaskStatus(Behavior behavior) => behavior switch + string SetTaskStatus(PrdTaskBehavior behavior) => behavior switch { - Behavior.Release => DictConst.ToBeStartedEnCode, - Behavior.Start => DictConst.InProgressEnCode, - Behavior.Closed => DictConst.ClosedEnCode, - Behavior.Compled => DictConst.ComplatedEnCode, + PrdTaskBehavior.Release => DictConst.ToBeStartedEnCode, + PrdTaskBehavior.Start => DictConst.InProgressEnCode, + PrdTaskBehavior.Closed => DictConst.ClosedEnCode, + PrdTaskBehavior.Compled => DictConst.ComplatedEnCode, _ => throw new NotImplementedException(), }; - Behavior behavior = input.Behavior.ToEnum(); + PrdTaskBehavior behavior = input.Behavior.ToEnum(); var status = SetTaskStatus(behavior); var db = _repository.AsSugarClient(); - if (behavior == Behavior.Compled) + if (behavior == PrdTaskBehavior.Compled) { var list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync(); if (list?.Count > 0) @@ -508,9 +627,9 @@ namespace Tnb.ProductionMgr } } row = await db.Updateable() - .SetColumns(it => new PrdTask { status = status }) - .Where(it => input.TaskIds.Contains(it.id)) - .ExecuteCommandAsync(); + .SetColumns(it => new PrdTask { status = status }) + .Where(it => input.TaskIds.Contains(it.id)) + .ExecuteCommandAsync(); return (row > 0); } @@ -551,6 +670,166 @@ namespace Tnb.ProductionMgr row = await db.Updateable(icmoItem).ExecuteCommandAsync(); return (row > 0); } + /// + /// 生产提报 + /// + /// + /// + /// input: + ///
{ + ///
icmo_id:生产任务ID + ///
icmo_code:任务单号 + ///
prd_qty:生产数量 + ///
reported_work_qty:已报工数量 + ///
reported_qty:提报数量 + ///
icmo_qty:生产任务量 + ///
} + ///
+ [HttpPost] + public async Task PrdReport(PrdReportCrInput input) + { + var row = -1; + var db = _repository.AsSugarClient(); + var report = await db.Queryable().FirstAsync(it => it.icmo_code == input.icmo_code); + if (report is not null) + { + report.reported_work_qty += input.reported_qty; + report.prd_qty += input.reported_qty; + + } + else + { + report = input.Adapt(); + report.id = SnowflakeIdHelper.NextId(); + report.reported_work_qty = input.reported_qty; + report.prd_qty = input.reported_qty; + } + row = await db.Storageable(report).ExecuteCommandAsync(); + var prdTask = await db.Queryable().FirstAsync(it => it.icmo_code == input.icmo_code); + var record = prdTask.Adapt(); + if (prdTask != null) + { + record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == prdTask.eqp_id))?.eqp_code; + record.completed_qty = input.reported_qty; + row = await db.Insertable(record).ExecuteCommandAsync(); + } + return row > 0; + } + /// + /// 自检报废提交 + /// + /// 自检报废输入参数 + /// true/false + /// + /// input: + ///
{ + ///
"icmo_code": 任务单号, + ///
"scrap_qty": 报废数量, + ///
"remark": 备注, + ///
"categoryItems": [ + ///
{ + ///
"defective_category":次品分类, + ///
"category_qty": 分类数量, + ///
"items": [ + ///
{ + ///
"defective_item": 次品项, + ///
"defective_item_qty": 次品项数量 + ///
} + ///
] + ///
} + ///
] + ///
} + ///
+ [HttpPost] + public async Task SelfTestScrapped(SelfTestScrappedInput input) + { + var db = _repository.AsSugarClient(); + var prdScrapped = await db.Queryable().FirstAsync(it => it.icmo_code == input.icmo_code); + if (prdScrapped is null) + { + prdScrapped = input.Adapt(); + prdScrapped.id = SnowflakeIdHelper.NextId(); + prdScrapped.create_id = _userManager.UserId; + prdScrapped.create_time = DateTime.Now; + } + + var result = await db.Ado.UseTranAsync(async () => + { + var categorys = new List(); + foreach (var categoryItem in input.categoryItems) + { + categorys = await db.Queryable().Where(it => it.icmo_code == input.icmo_code).ToListAsync(); + if (categorys?.Count > 0) + { + foreach (var category in categorys) + { + var defectiveItems = categoryItem.items?.Select(x => x.defective_item).ToList(); + var list = await db.Queryable().Where(it => defectiveItems!.Contains(it.defective_item)).ToListAsync(); + category.category_qty = list?.Sum(it => it.defective_item_qty) + categoryItem.items.Sum(x => x.defective_item_qty); + if (list?.Count > 0) + { + if (categoryItem.items?.Count > 0) + { + foreach (var x in categoryItem.items) + { + var item = list.Find(f => f.defective_item == x.defective_item); + if (item != null) + { + item.defective_item_qty += x.defective_item_qty; + } + } + await db.Updateable(list).ExecuteCommandAsync(); + } + } + } + await db.Updateable(categorys).ExecuteCommandAsync(); + } + else + { + + var category = categoryItem.Adapt(); + category.id = SnowflakeIdHelper.NextId(); + category.icmo_code = input.icmo_code; + category.create_id = _userManager.UserId; + category.create_time = DateTime.Now; + category.category_qty = categoryItem.items?.Sum(x => x.defective_item_qty); + categorys!.Add(category); + var items = new List(); + if (categoryItem.items?.Count > 0) + { + foreach (var item in categoryItem.items) + { + var defectiveItem = item.Adapt(); + defectiveItem.id = SnowflakeIdHelper.NextId(); + defectiveItem.defective_cagetory_id = category.id; + items.Add(defectiveItem); + } + await db.Insertable(items).ExecuteCommandAsync(); + } + await db.Insertable(category).ExecuteCommandAsync(); + } + } + + //var scrapQty = await db.Queryable().SumAsync(it => it.defective_item_qty); + //prdScrapped.scrap_qty = scrapQty; + var report = await db.Queryable().FirstAsync(it => it.icmo_code == input.icmo_code); + if (report != null) + { + report.prd_qty += input.scrap_qty; + await db.Updateable(report).ExecuteCommandAsync(); + } + await db.Storageable(prdScrapped).ExecuteCommandAsync(); + var prdTask = await db.Queryable().FirstAsync(it => it.icmo_code == input.icmo_code); + var record = prdTask.Adapt(); + if (prdTask != null) + { + record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == prdTask.eqp_id))?.eqp_code; + record.scrap_qty = input.scrap_qty; + await db.Insertable(record).ExecuteCommandAsync(); + } + }); + return result.IsSuccess; + } #endregion diff --git a/visualdev/Tnb.VisualDev.Entitys/Entity/HmiEntity.cs b/visualdev/Tnb.VisualDev.Entitys/Entity/HmiEntity.cs new file mode 100644 index 00000000..e0f359c4 --- /dev/null +++ b/visualdev/Tnb.VisualDev.Entitys/Entity/HmiEntity.cs @@ -0,0 +1,67 @@ +using JNPF.Common.Const; +using JNPF.Common.Contracts; +using SqlSugar; + +namespace JNPF.VisualDev.Entitys; + +/// +/// 门户表. +/// +[SugarTable("base_hmi")] +[Tenant(ClaimConst.TENANTID)] +public class HmiEntity : CLDEntityBase +{ + /// + /// 描述. + /// + [SugarColumn(ColumnName = "F_DESCRIPTION")] + public string Description { get; set; } + + /// + /// 排序码. + /// + [SugarColumn(ColumnName = "F_SORTCODE")] + public long? SortCode { get; set; } + + /// + /// 名称. + /// + [SugarColumn(ColumnName = "F_FULLNAME")] + public string FullName { get; set; } + + /// + /// 编码. + /// + [SugarColumn(ColumnName = "F_ENCODE")] + public string EnCode { get; set; } + + /// + /// 分类(数据字典维护). + /// + [SugarColumn(ColumnName = "F_CATEGORY")] + public string Category { get; set; } + + /// + /// 表单配置JSON. + /// + [SugarColumn(ColumnName = "F_FORMDATA")] + public string FormData { get; set; } + + /// + /// 类型(0-页面设计,1-自定义路径). + /// + [SugarColumn(ColumnName = "F_Type")] + public int? Type { get; set; } + + /// + /// 静态页面路径. + /// + [SugarColumn(ColumnName = "F_CustomUrl")] + public string CustomUrl { get; set; } + + /// + /// 链接类型(0-页面,1-外链). + /// + [SugarColumn(ColumnName = "F_LinkType")] + public int? LinkType { get; set; } +} \ No newline at end of file diff --git a/visualdev/Tnb.VisualDev/HmiService.cs b/visualdev/Tnb.VisualDev/HmiService.cs new file mode 100644 index 00000000..58e53dd9 --- /dev/null +++ b/visualdev/Tnb.VisualDev/HmiService.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Aspose.Cells; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using Microsoft.AspNetCore.Mvc; + +namespace Tnb.VisualDev +{ + /// + /// 业务实现:人机界面 + /// + [ApiDescriptionSettings(Tag = "VisualDev", Name = "Hmi", Order = 173)] + [Route("api/visualdev/[controller]")] + + public class HmiService : IDynamicApiController, ITransient + { + + } +}