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