Browse Source

1.修改流程规则Model,增加FlowRuleID,修改RuleStationID改为StationID

2.修改流程规则维护
3.修改流程资料维护里的复制功能
PTD
Marvin 2 years ago
parent
commit
7ddcba0bd3
  1. 24
      AMESCoreStudio.Web/Controllers/BASController.cs
  2. 6
      AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml
  3. 8
      AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml
  4. 6
      AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs
  5. 18
      AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs
  6. 4
      AMESCoreStudio.WebApi/Models/BAS/Rules.cs

24
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<SelectListItem>();
var FlowStationItems = new List<SelectListItem>();
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<IActionResult> 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
{

6
AMESCoreStudio.Web/Views/BAS/BAS011C.cshtml

@ -16,9 +16,9 @@
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group form-inline my-sm-1">
<label asp-for="RuleStationID" class="control-label col-sm-3"></label>
<select asp-for="RuleStationID" asp-items="@ViewBag.RuleStationList" class="custom-select col-sm-9"></select>
<span asp-validation-for="RuleStationID" class="text-danger offset-sm-3 my-sm-1"></span>
<label asp-for="StationID" class="control-label col-sm-3"></label>
<select asp-for="StationID" asp-items="@ViewBag.FlowStationItems" class="custom-select col-sm-9"></select>
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="RuleDesc" class="control-label col-sm-3"></label>

8
AMESCoreStudio.Web/Views/BAS/BAS011U.cshtml

@ -16,13 +16,13 @@
<form enctype="multipart/form-data" method="post" asp-action="BAS011Save">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="RuleID" />
<input type="hidden" asp-for="RuleStationID" />
<input type="hidden" asp-for="StationID" />
<input type="hidden" asp-for="CreateDate" />
<div class="form-group form-inline my-sm-1">
<label asp-for="RuleStationID" class="control-label col-sm-3"></label>
<select asp-for="RuleStationID" asp-items="@ViewBag.RuleStationList" class="custom-select col-sm-9" disabled></select>
<span asp-validation-for="RuleStationID" class="text-danger offset-sm-3 my-sm-1"></span>
<label asp-for="StationID" class="control-label col-sm-3"></label>
<select asp-for="StationID" asp-items="@ViewBag.FlowStationItems" class="custom-select col-sm-9" disabled></select>
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span>
</div>
<div class="form-group form-inline my-sm-1">
<label asp-for="RuleDesc" class="control-label col-sm-3"></label>

6
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<Rules> 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;

18
AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs

@ -38,7 +38,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
public async Task<ActionResult<IEnumerable<Rules>>> GetRules()
{
IQueryable<Rules> 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<ActionResult<IEnumerable<Rules>>> 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<list.Length;i++)
{
list[i] = qdata[i].RuleStationID;
list[i] = qdata[i].StationID;
list1[i] = qdata[i].CurrStationId;
list2[i] = qdata[i].NextStationId;
status1[i] = qdata[i].RuleStatus;
@ -99,7 +99,7 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
IQueryable<Rules> 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<ActionResult<IEnumerable<Rules>>> 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;

4
AMESCoreStudio.WebApi/Models/BAS/Rules.cs

@ -20,10 +20,10 @@ namespace AMESCoreStudio.WebApi.Models.BAS
public int RuleID { get; set; }
/// <summary>
/// 流程ID
/// 流程編號
/// </summary>
[Column("FLOW_RULE_ID")]
[Display(Name = "流程ID")]
[Display(Name = "流程編號")]
[DataMember]
public int FlowRuleID { get; set; }

Loading…
Cancel
Save