diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index 5be0613d..90955be0 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -1392,7 +1392,7 @@ namespace AMESCoreStudio.Web.Controllers [ResponseCache(Duration = 0)] [HttpGet] - public async Task GetRuleStationsByFlowAsync(int flowId, int page = 0, int limit = 10) + public async Task GetRuleStationsByFlowAsync(string unitNo,int flowId, int page = 0, int limit = 10) { var flow_id = ""; HttpContext.Request.Cookies.TryGetValue("FlowID4BAS010", out flow_id); @@ -1426,9 +1426,13 @@ namespace AMESCoreStudio.Web.Controllers HttpContext.Response.Cookies.Delete("FlowID4BAS010"); - var result_total = await _basApi.GetRuleStationsByFlow(flowId, 0, limit); + //var result_total = await _basApi.GetRuleStationsByFlow(flowId, 0, limit); - var result = await _basApi.GetRuleStationsByFlow(flowId, page, limit); + //var result = await _basApi.GetRuleStationsByFlow(flowId, page, limit); + + var result_total = await _basApi.GetRuleStationsByFlow2(unitNo + "_" + flowId.ToString(), 0, limit); + + var result = await _basApi.GetRuleStationsByFlow2(unitNo + "_" + flowId.ToString(), page, limit); if (result.Count > 0) { diff --git a/AMESCoreStudio.Web/Controllers/SYSController.cs b/AMESCoreStudio.Web/Controllers/SYSController.cs index 59d11db1..5e59ed7f 100644 --- a/AMESCoreStudio.Web/Controllers/SYSController.cs +++ b/AMESCoreStudio.Web/Controllers/SYSController.cs @@ -18,15 +18,33 @@ namespace AMESCoreStudio.Web.Controllers private readonly ILogger _logger; public readonly ISYS _sysApi; public readonly IPCS _pcsApi; + public readonly IBAS _basApi; + private readonly IStringLocalizer _sharedLocalizer; - public SYSController(ILogger logger, ISYS sysApi , IPCS pcsApi, IStringLocalizer sharedLocalizer) + public SYSController(ILogger logger, IBAS basApi, ISYS sysApi , IPCS pcsApi, IStringLocalizer sharedLocalizer) { _logger = logger; _sysApi = sysApi; _pcsApi = pcsApi; + _basApi = basApi; _sharedLocalizer = sharedLocalizer; } + private async Task GetFactoryList() + { + var result = await _basApi.GetFactoryInfoes(); + + var FactoryItems = new List(); + FactoryItems.Add(new SelectListItem("N/A", "-1")); + + foreach (var item in result) + { + FactoryItems.Add(new SelectListItem(item.FactoryNameCh, item.FactoryID.ToString())); + } + + ViewBag.FactoryList = FactoryItems; + } + /// /// /// @@ -1021,6 +1039,8 @@ namespace AMESCoreStudio.Web.Controllers public async Task SYS008C() { await GetDeptList(); + await GetFactoryList(); + return View(); } @@ -1029,6 +1049,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task SYS008UAsync(int id) { await GetDeptList(); + await GetFactoryList(); var result = await _sysApi.GetUserInfo(id); @@ -1044,6 +1065,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task SYS008SAsync(int id) { await GetDeptList(); + await GetFactoryList(); var result = await _sysApi.GetUserInfo(id); result[0].UserStatusID = EnumUserStatus.Disabled; diff --git a/AMESCoreStudio.Web/HttpApis/IBAS.cs b/AMESCoreStudio.Web/HttpApis/IBAS.cs index be41f6da..12bd5864 100644 --- a/AMESCoreStudio.Web/HttpApis/IBAS.cs +++ b/AMESCoreStudio.Web/HttpApis/IBAS.cs @@ -420,6 +420,13 @@ namespace AMESCoreStudio.Web [WebApiClient.Attributes.HttpGet("api/RuleStations/Flow/{id}")] ITask> GetRuleStationsByFlow(int id, int page = 0, int limit = 10); + /// + /// 根据流程ID獲取流程站別資料 + /// + /// + [WebApiClient.Attributes.HttpGet("api/RuleStations/Flow2/{id}")] + ITask> GetRuleStationsByFlow2(string id, int page = 0, int limit = 10); + /// /// 獲取流程站別資料 /// diff --git a/AMESCoreStudio.Web/Views/BAS/BAS010.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS010.cshtml index 9831c5c2..918bbe68 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS010.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS010.cshtml @@ -251,6 +251,7 @@ if (flowId.value != 0) { $("#flow").val(flowId.value); } + //基本数据表格 var table = hg.table.datatable('test', '流程站別管理', '/BAS/GetRuleStationsByFlow/' + flowId.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); diff --git a/AMESCoreStudio.Web/Views/SYS/SYS008C.cshtml b/AMESCoreStudio.Web/Views/SYS/SYS008C.cshtml index f265d85b..ad2ff5b0 100644 --- a/AMESCoreStudio.Web/Views/SYS/SYS008C.cshtml +++ b/AMESCoreStudio.Web/Views/SYS/SYS008C.cshtml @@ -55,6 +55,11 @@ +
+ + + +
@Html.ValidationMessage("error")
diff --git a/AMESCoreStudio.Web/Views/SYS/SYS008S.cshtml b/AMESCoreStudio.Web/Views/SYS/SYS008S.cshtml index b2c56243..99f0f0eb 100644 --- a/AMESCoreStudio.Web/Views/SYS/SYS008S.cshtml +++ b/AMESCoreStudio.Web/Views/SYS/SYS008S.cshtml @@ -53,6 +53,11 @@
+
+ + + +
diff --git a/AMESCoreStudio.Web/Views/SYS/SYS008U.cshtml b/AMESCoreStudio.Web/Views/SYS/SYS008U.cshtml index d7dfa2b3..bba2d5b9 100644 --- a/AMESCoreStudio.Web/Views/SYS/SYS008U.cshtml +++ b/AMESCoreStudio.Web/Views/SYS/SYS008U.cshtml @@ -35,7 +35,7 @@
- +
@@ -53,6 +53,11 @@
+
+ + + +
diff --git a/AMESCoreStudio.Web/Views/SYS/SYS011.cshtml b/AMESCoreStudio.Web/Views/SYS/SYS011.cshtml index e1d8c94e..db3d3bd3 100644 --- a/AMESCoreStudio.Web/Views/SYS/SYS011.cshtml +++ b/AMESCoreStudio.Web/Views/SYS/SYS011.cshtml @@ -25,7 +25,7 @@
- +
diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs index 81bcc72c..74782844 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs @@ -111,6 +111,108 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS } + /// + /// 根據製程代碼+流程ID獲取該流程站別資料 + /// + /// + /// + /// + /// + [HttpGet("Flow2/{id}")] + public async Task>> GetRuleStationByFlow2(string id, int page = 0, int limit = 10) + { + IQueryable q = _context.RuleStations; + + IQueryable q1 = _context.FlowRules; + string[] param = id.Split('_'); + + if (param[0] != "*" && param[0] != "" && param[0] != null) + { + q1 = q1.Where(p => p.UnitNo.Equals(param[0])); + + var flow = await q1.ToListAsync(); + + if (flow.Count == 0) + { + q = q.Where(p => p.FlowRuleID.Equals(-1)); + + if (page > 0) + { + q = q.OrderBy(p => p.Sequence).Skip((page - 1) * limit).Take(limit); + } + else + { + q = q.OrderBy(p => p.Sequence); + } + } + else + { + int[] list = new int[flow.Count]; + for (int i = 0; i < list.Length; i++) + { + list[i] = flow[i].FlowRuleID; + } + + if (int.Parse(param[1]) > 0) + { + q = q.Where(p => p.FlowRuleID.Equals(int.Parse(param[1]))); + } + else + { + q = q.Where(p => list.Contains(p.FlowRuleID)); + } + + if (page > 0) + { + q = q.OrderBy(p => p.Sequence).Skip((page - 1) * limit).Take(limit); + } + else + { + q = q.OrderBy(p => p.Sequence); + } + } + } + else + { + if (int.Parse(param[1]) > 0) + { + q = q.Where(p => p.FlowRuleID.Equals(int.Parse(param[1]))); + } + if (page > 0) + { + q = q.OrderBy(p => p.Sequence).Skip((page - 1) * limit).Take(limit); + } + else + { + q = q.OrderBy(p => p.Sequence); + } + } + + try + { + var ruleStation = await q.ToListAsync(); + + foreach (var data in ruleStation) + { + data.Station = _context.Stationses.Where(p1 => p1.StationID.Equals(data.StationID)).FirstOrDefault(); + } + + if (ruleStation == null) + { + return NotFound(); + } + + return ruleStation; + } + catch (Exception e1) + { + string msg = e1.Message; + } + + return NotFound(); + + + } /// /// 根據流程站別ID獲取指定單一資料 ///