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; }