From 128540d5564177753a58318a2740519eef6e017a Mon Sep 17 00:00:00 2001 From: marvinhong Date: Wed, 13 Oct 2021 12:54:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B=E8=B5=84?= =?UTF-8?q?=E6=96=99=E7=BB=B4=E6=8A=A4=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=B1=9E=E6=80=A7=202.=E4=BF=AE=E6=94=B9=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=AB=99=E5=88=AB=E7=BB=B4=E6=8A=A4=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=B5=81=E7=A8=8B=E5=8F=82=E6=95=B0=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E5=8F=98=E6=95=B0=203.=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=A7=84=E5=88=99=E7=BB=B4=E6=8A=A4=EF=BC=8C=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E8=B5=84=E6=96=99=E5=91=88=E7=8E=B0=EF=BC=882=E4=B8=AA?= =?UTF-8?q?=E6=A0=8F=E4=BD=8D=E7=BB=84=E5=90=88Key)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BASController.cs | 27 ++++++++++++++++--- AMESCoreStudio.Web/Views/BAS/BAS009.cshtml | 6 +++++ AMESCoreStudio.Web/Views/BAS/BAS009C.cshtml | 5 ++++ AMESCoreStudio.Web/Views/BAS/BAS009U.cshtml | 5 ++++ .../Controllers/BAS/RulesController.cs | 9 ++++++- AMESCoreStudio.WebApi/Models/AMESContext.cs | 4 +++ AMESCoreStudio.WebApi/Models/BAS/FlowRule.cs | 10 +++++++ AMESCoreStudio.WebApi/Models/BAS/Rules.cs | 5 ++-- 8 files changed, 64 insertions(+), 7 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index 3b45e9ed..c6abe0e7 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -15,15 +15,34 @@ namespace AMESCoreStudio.Web.Controllers private readonly ILogger _logger; public readonly IBAS _basApi; public readonly ISYS _sysApi; - public BASController(ILogger logger, IBAS basApi, ISYS sysApi) + public readonly IPCS _pcsApi; + + public BASController(ILogger logger, IBAS basApi, ISYS sysApi,IPCS pcsApi) { _logger = logger; _basApi = basApi; _sysApi = sysApi; + _pcsApi = pcsApi; } #region 下拉選項 + /// + /// 工單屬性 + /// + /// + private async Task GetProcessTypes() + { + var result = await _pcsApi.GetProcessTypes(); + + var ProcessType = new List(); + for (int i = 0; i < result.Count; i++) + { + ProcessType.Add(new SelectListItem(result[i].ProcessTypeName, result[i].ProcessTypeNO.ToString())); + } + ViewBag.ProcessTypeList = ProcessType; + } + private async Task GetFactoryList() { var result = await _basApi.GetFactoryInfoes(); @@ -846,6 +865,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task BAS009C(string id) { await GetFactoryUnitList(); + await GetProcessTypes(); var model = new FlowRule(); if (id != null) @@ -864,6 +884,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task BAS009UAsync(int id) { await GetFactoryUnitList(); + await GetProcessTypes(); var result = await _basApi.GetFlowRule(id); @@ -1096,9 +1117,9 @@ namespace AMESCoreStudio.Web.Controllers [ResponseCache(Duration = 0)] [HttpGet] - public async Task GetRuleStationsByFlowAsync(int id) + public async Task GetRuleStationsByFlowAsync(int flowId) { - var result = await _basApi.GetRuleStationsByFlow(id); + var result = await _basApi.GetRuleStationsByFlow(flowId); if (result.Count > 0) { diff --git a/AMESCoreStudio.Web/Views/BAS/BAS009.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS009.cshtml index a25ec9c1..afd75f7e 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS009.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS009.cshtml @@ -102,6 +102,12 @@ width:160, sort: true }, + { + field: 'processTypeNo', + title: ' 工單屬性', + width: 160, + sort: true + }, { field: 'right', width: 160, diff --git a/AMESCoreStudio.Web/Views/BAS/BAS009C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS009C.cshtml index 8a675265..f2d427c8 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS009C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS009C.cshtml @@ -45,6 +45,11 @@ +
+ + + +
@Html.ValidationMessage("error")
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS009U.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS009U.cshtml index 337cab21..e1f66d3d 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS009U.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS009U.cshtml @@ -48,6 +48,11 @@
+
+ + + +
diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs index ebdae173..e886b68b 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs @@ -69,6 +69,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS select new { q1.RuleStationID, q1.RuleSeq, + q1.RuleStatus, CurrStationId = q2.StationID, NextStationId = q3.StationID }; @@ -78,15 +79,21 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS int[] list = new int[qdata.Count]; int[] list1 = new int[qdata.Count]; int[] list2 = new int[qdata.Count]; + string[] status1 = new string[qdata.Count]; + for (int i=0;i q = _context.Ruleses; - q = q.Where(p=>list.Contains(p.RuleStationID)); + //q = q.Where(p => list.Contains(p.RuleStationID) && status1.Contains(p.RuleStatus)); + q = q.Where(p => list.Contains(p.RuleStationID)); + q = q.OrderBy(o => o.RuleSeq); + var rules = await q.ToListAsync(); for(int j=0;j() .HasOne(m => m.Module); */ + + modelBuilder.Entity().HasKey(c => new { c.RuleStationID, c.RuleStatus }); } /// @@ -191,5 +193,7 @@ namespace AMESCoreStudio.WebApi /// 流程規則資料 /// public DbSet Ruleses { get; set; } + } + } diff --git a/AMESCoreStudio.WebApi/Models/BAS/FlowRule.cs b/AMESCoreStudio.WebApi/Models/BAS/FlowRule.cs index b273a5b6..802373e4 100644 --- a/AMESCoreStudio.WebApi/Models/BAS/FlowRule.cs +++ b/AMESCoreStudio.WebApi/Models/BAS/FlowRule.cs @@ -78,6 +78,16 @@ namespace AMESCoreStudio.WebApi.Models.BAS [DataMember] public string FlowType { get; set; } + /// + /// 工單屬性 + /// + [Column("PROCESS_TYPE_NO")] + [DataMember] + [Display(Name = "工單屬性")] + [Required(ErrorMessage = "{0},不能空白")] + [StringLength(1, ErrorMessage = "{0},不能大于{1}")] + public string ProcessTypeNo { get; set; } + /// /// 建立人員 /// diff --git a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs index f1a8dc0c..1c038e6d 100644 --- a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs +++ b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs @@ -14,8 +14,7 @@ namespace AMESCoreStudio.WebApi.Models.BAS /// /// 流程站別編號 /// - [Key] - [Column("RULE_STATION_ID")] + [Key,Column("RULE_STATION_ID",Order =0)] [Display(Name = "流程站別編號")] [DataMember] public int RuleStationID { get; set; } @@ -33,7 +32,7 @@ namespace AMESCoreStudio.WebApi.Models.BAS /// /// 規則狀態 /// - [Column("RULE_STATUS")] + [Key,Column("RULE_STATUS",Order =1)] [Display(Name = "規則狀態")] [DataMember] public string RuleStatus { get; set; }