From 7ddcba0bd3e72f030888d3e02194baf9f530e427 Mon Sep 17 00:00:00 2001 From: Marvin Date: Wed, 21 Sep 2022 09:51:44 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B=E8=A7=84?= =?UTF-8?q?=E5=88=99Model,=E5=A2=9E=E5=8A=A0FlowRuleID,=E4=BF=AE=E6=94=B9R?= =?UTF-8?q?uleStationID=E6=94=B9=E4=B8=BAStationID=202.=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=A7=84=E5=88=99=E7=BB=B4=E6=8A=A4=203.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E7=A8=8B=E8=B5=84=E6=96=99=E7=BB=B4?= =?UTF-8?q?=E6=8A=A4=E9=87=8C=E7=9A=84=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/BASController.cs | 24 +++++++------------ AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml | 6 ++--- AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml | 8 +++---- .../Controllers/BAS/FlowRulesController.cs | 6 ++--- .../Controllers/BAS/RulesController.cs | 18 +++++++------- AMESCoreStudio.WebApi/Models/BAS/Rules.cs | 4 ++-- 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/AMESCoreStudio.Web/Controllers/BASController.cs b/AMESCoreStudio.Web/Controllers/BASController.cs index a784cd38..64eb2204 100644 --- a/AMESCoreStudio.Web/Controllers/BASController.cs +++ b/AMESCoreStudio.Web/Controllers/BASController.cs @@ -171,16 +171,16 @@ namespace AMESCoreStudio.Web.Controllers ViewBag.StationList = StationItems; } - private async Task GetRuleStationList(int id) + private async Task GetFlowStationList(int id) { var result = await _basApi.GetRuleStationsByFlow(id, 0, 10); - var RuleStationItems = new List(); + var FlowStationItems = new List(); for (int i = 0; i < result.Count; i++) { - RuleStationItems.Add(new SelectListItem(result[i].Station.UnitNo + result[i].Station.StationName, result[i].RuleStationID.ToString())); + FlowStationItems.Add(new SelectListItem(result[i].Station.UnitNo + result[i].Station.StationName, result[i].StationID.ToString())); } - ViewBag.RuleStationList = RuleStationItems; + ViewBag.FlowStationItems = FlowStationItems; } private async Task GetNextStationList(int id) @@ -1435,7 +1435,7 @@ namespace AMESCoreStudio.Web.Controllers public async Task BAS011C(int id) { await GetFlowRuleList(); - await GetRuleStationList(id); + await GetFlowStationList(id); await GetNextStationList(id); return View(); @@ -1452,9 +1452,9 @@ namespace AMESCoreStudio.Web.Controllers //var result1 = await _basApi.GetRules(result[0].RuleStationID, result[0].RuleStatus, result[0].NextStationID); - var result2 = await _basApi.GetRuleStation(result[0].RuleStationID); + var result2 = await _basApi.GetRuleStation(result[0].StationID); int flowId = result2[0].FlowRuleID; - await GetRuleStationList(flowId); + await GetFlowStationList(flowId); await GetNextStationList(flowId); if (result.Count == 0) @@ -1510,16 +1510,10 @@ namespace AMESCoreStudio.Web.Controllers if (result.Success) { - var temp = await _basApi.GetRuleStation(model.RuleStationID); - if (temp.Count > 0) - { - HttpContext.Response.Cookies.Append("FlowID4BAS011", temp[0].FlowRuleID.ToString()); - } + HttpContext.Response.Cookies.Append("FlowID4BAS011", model.FlowRuleID.ToString()); var _msg = model.CreateDate == System.DateTime.MinValue ? "添加成功!" : "修改成功!"; - return RedirectToAction("Refresh", "Home", new { msg = _msg }); - //return RedirectToPage("/BAS/BAS010"); - + return RedirectToAction("Refresh", "Home", new { msg = _msg }); } else { diff --git a/AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml index d1081d51..4be814a7 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml @@ -16,9 +16,9 @@
- - - + + +
diff --git a/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml b/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml index 821fb4e9..be7ff97c 100644 --- a/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml +++ b/AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml @@ -16,13 +16,13 @@
- +
- - - + + +
diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs index 06b062cc..3e3a1b06 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs @@ -221,7 +221,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS for (int i = 0; i < copyRuleStation.Count; i++) { - int copyRuleStationId = copyRuleStation[i].RuleStationID; + int copyStationId = copyRuleStation[i].StationID; int ruleStationId = helper.GetIDKey("RULE_STATION_ID").Result; RuleStation ruleStation = new RuleStation(); @@ -238,7 +238,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS IQueryable q1 = _context.Ruleses; - q1 = q1.Where(p => p.RuleStationID.Equals(copyRuleStationId)); + q1 = q1.Where(p => p.StationID.Equals(copyStationId)); var copyRules = await q1.ToListAsync(); @@ -247,7 +247,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS Rules rules = new Rules(); rules = copyRules[j]; rules.RuleID = helper.GetIDKey("RULE_ID").Result; - rules.RuleStationID = ruleStationId; + rules.StationID = ruleStationId; rules.CreateDate = DateTime.Now; rules.CreateUserId = flowRule.CreateUserId; rules.UpdateDate = DateTime.Now; diff --git a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs index b11db0e9..6f24e27e 100644 --- a/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs +++ b/AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs @@ -38,7 +38,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS public async Task>> GetRules() { IQueryable q = _context.Ruleses; - q = q.OrderBy(p => p.RuleStationID + p.RuleSeq); + q = q.OrderBy(p => p.StationID + p.RuleSeq); var rules = await q.ToListAsync(); @@ -67,11 +67,11 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS public async Task>> GetRulesByFlow(int id, int page = 0, int limit = 10) { var query = from q1 in _context.Ruleses - join q2 in _context.RuleStations on q1.RuleStationID equals q2.RuleStationID + join q2 in _context.RuleStations on q1.StationID equals q2.StationID join q3 in _context.Stationses on q1.NextStationID equals q3.StationID select new { q2.FlowRuleID, - q1.RuleStationID, + q1.StationID, q1.RuleSeq, q1.RuleStatus, CurrStationId = q2.StationID, @@ -91,7 +91,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS for (int i=0;i q = _context.Ruleses; //q = q.Where(p => list.Contains(p.RuleStationID) && status1.Contains(p.RuleStatus)); - q = q.Where(p => list.Contains(p.RuleStationID) && list2.Contains(p.NextStationID) && status1.Contains(p.RuleStatus)); + q = q.Where(p => list.Contains(p.StationID) && list2.Contains(p.NextStationID) && status1.Contains(p.RuleStatus)); //q = q.OrderBy(o => o.RuleStationID + o.RuleSeq); //q = q.OrderBy(o => o.RuleSeq); @@ -117,7 +117,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS for (int j = 0; j < rules.Count; j++) { //rules[j].CurrStation = _context.Stationses.Where(p1 => p1.StationID.Equals(list1[j])).FirstOrDefault(); - rules[j].RuleDesc = _context.RuleStations.Where(p1 => p1.RuleStationID.Equals(rules[j].RuleStationID)).FirstOrDefault().StationDesc; + rules[j].RuleDesc = _context.RuleStations.Where(p1 => p1.StationID.Equals(rules[j].StationID)).FirstOrDefault().StationDesc; rules[j].NextStation.StationName = _context.Stationses.Where(p2 => p2.StationID.Equals(rules[j].NextStationID)).FirstOrDefault().StationName; } @@ -168,11 +168,11 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS if (nextStationId == -1) { - q = q.Where(p => p.RuleStationID.Equals(id) && p.RuleStatus.Equals(ruleStatus)); + q = q.Where(p => p.StationID.Equals(id) && p.RuleStatus.Equals(ruleStatus)); } else { - q = q.Where(p => p.RuleStationID.Equals(id) && p.RuleStatus.Equals(ruleStatus) && p.NextStationID.Equals(nextStationId)); + q = q.Where(p => p.StationID.Equals(id) && p.RuleStatus.Equals(ruleStatus) && p.NextStationID.Equals(nextStationId)); } var rules = await q.ToListAsync(); @@ -194,7 +194,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS public async Task>> GetRulesByFlowRuleID(int id) { var q = from q1 in _context.Ruleses - join q2 in _context.RuleStations on q1.RuleStationID equals q2.RuleStationID + join q2 in _context.RuleStations on new { q1.FlowRuleID, q1.StationID } equals new { q2.FlowRuleID, q2.StationID } where q2.FlowRuleID == id select q1; diff --git a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs index 8c528dc0..e0a6b10a 100644 --- a/AMESCoreStudio.WebApi/Models/BAS/Rules.cs +++ b/AMESCoreStudio.WebApi/Models/BAS/Rules.cs @@ -20,10 +20,10 @@ namespace AMESCoreStudio.WebApi.Models.BAS public int RuleID { get; set; } /// - /// 流程ID + /// 流程編號 /// [Column("FLOW_RULE_ID")] - [Display(Name = "流程ID")] + [Display(Name = "流程編號")] [DataMember] public int FlowRuleID { get; set; }