|
@ -11,6 +11,7 @@ using AMESCoreStudio.WebApi.DTO.AMES; |
|
|
using AMESCoreStudio.CommonTools.Result; |
|
|
using AMESCoreStudio.CommonTools.Result; |
|
|
using System.Data.Common; |
|
|
using System.Data.Common; |
|
|
using System.Reflection; |
|
|
using System.Reflection; |
|
|
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
|
|
|
|
|
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
{ |
|
|
{ |
|
@ -22,6 +23,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
public class WipStationController : ControllerBase |
|
|
public class WipStationController : ControllerBase |
|
|
{ |
|
|
{ |
|
|
private readonly AMESContext _context; |
|
|
private readonly AMESContext _context; |
|
|
|
|
|
private readonly IConfiguration _config; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
///
|
|
|
///
|
|
@ -29,6 +31,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES |
|
|
/// <param name="context"></param>
|
|
|
/// <param name="context"></param>
|
|
|
public WipStationController(AMESContext context) |
|
|
public WipStationController(AMESContext context) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_config = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory).AddJsonFile("appsettings.json").Build(); |
|
|
_context = context; |
|
|
_context = context; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -272,26 +275,31 @@ FROM JHAMES.WIP_STATION"; |
|
|
[HttpGet("GetWipStation4QRS014GroupS")] |
|
|
[HttpGet("GetWipStation4QRS014GroupS")] |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupS(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupS(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
{ |
|
|
{ |
|
|
|
|
|
string fpyStation = _config["FPYStation"].ToString(); |
|
|
|
|
|
string[] fpy_station = fpyStation.Split(','); |
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
|
|
|
|
|
|
var q = from q1 in _context.WipStations |
|
|
var q = from q1 in _context.WipStations |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
|
|
|
join q4 in _context.Stationses on q1.StationID equals q4.StationID |
|
|
select new |
|
|
select new |
|
|
{ |
|
|
{ |
|
|
q1.WipID, |
|
|
q1.WipID, |
|
|
q2.WerksNO, |
|
|
q2.WerksNO, |
|
|
q2.UnitNO, |
|
|
|
|
|
q2.CustomerMedical, |
|
|
q2.CustomerMedical, |
|
|
|
|
|
q2.UnitNO, |
|
|
q3.ItemNO, |
|
|
q3.ItemNO, |
|
|
q3.ModelNO, |
|
|
q3.ModelNO, |
|
|
q1.StationID, |
|
|
q1.StationID, |
|
|
|
|
|
q4.StationName, |
|
|
q1.RuleStatus, |
|
|
q1.RuleStatus, |
|
|
q1.FirstCnt, |
|
|
q1.FirstCnt, |
|
|
q1.CreateDate |
|
|
q1.CreateDate |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
q = q.Where(w => w.CustomerMedical == "N" && w.UnitNO == "S"); |
|
|
q = q.Where(w => w.CustomerMedical == "N" && w.UnitNO == "S"); |
|
|
|
|
|
q = q.Where(w => fpy_station.Contains(w.StationName)); |
|
|
|
|
|
|
|
|
if (itemNo != null) |
|
|
if (itemNo != null) |
|
|
{ |
|
|
{ |
|
@ -346,11 +354,15 @@ FROM JHAMES.WIP_STATION"; |
|
|
[HttpGet("GetWipStation4QRS014GroupB")] |
|
|
[HttpGet("GetWipStation4QRS014GroupB")] |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupB(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupB(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
{ |
|
|
{ |
|
|
|
|
|
string fpyStation = _config["FPYStation"].ToString(); |
|
|
|
|
|
string[] fpy_station = fpyStation.Split(','); |
|
|
|
|
|
|
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
|
|
|
|
|
|
var q = from q1 in _context.WipStations |
|
|
var q = from q1 in _context.WipStations |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
|
|
|
join q4 in _context.Stationses on q1.StationID equals q4.StationID |
|
|
select new |
|
|
select new |
|
|
{ |
|
|
{ |
|
|
q1.WipID, |
|
|
q1.WipID, |
|
@ -360,12 +372,14 @@ FROM JHAMES.WIP_STATION"; |
|
|
q3.ItemNO, |
|
|
q3.ItemNO, |
|
|
q3.ModelNO, |
|
|
q3.ModelNO, |
|
|
q1.StationID, |
|
|
q1.StationID, |
|
|
|
|
|
q4.StationName, |
|
|
q1.RuleStatus, |
|
|
q1.RuleStatus, |
|
|
q1.FirstCnt, |
|
|
q1.FirstCnt, |
|
|
q1.CreateDate |
|
|
q1.CreateDate |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
q = q.Where(w => w.CustomerMedical == "N" && w.UnitNO == "B"); |
|
|
q = q.Where(w => w.CustomerMedical == "N" && w.UnitNO == "B"); |
|
|
|
|
|
q = q.Where(w => fpy_station.Contains(w.StationName)); |
|
|
|
|
|
|
|
|
if (itemNo != null) |
|
|
if (itemNo != null) |
|
|
{ |
|
|
{ |
|
@ -420,11 +434,15 @@ FROM JHAMES.WIP_STATION"; |
|
|
[HttpGet("GetWipStation4QRS014GroupM")] |
|
|
[HttpGet("GetWipStation4QRS014GroupM")] |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupM(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
public async Task<ResultModel<dynamic>> GetWipStation4QRS014GroupM(string itemNo, string dateStart, string dateEnd, string modelNo, string werksNo) |
|
|
{ |
|
|
{ |
|
|
|
|
|
string fpyStation = _config["FPYStation"].ToString(); |
|
|
|
|
|
string[] fpy_station = fpyStation.Split(','); |
|
|
|
|
|
|
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
|
|
|
|
|
|
|
|
var q = from q1 in _context.WipStations |
|
|
var q = from q1 in _context.WipStations |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q2 in _context.WipInfos on q1.WipID equals q2.WipID |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
join q3 in _context.WipAtts on q2.WipNO equals q3.WipNO |
|
|
|
|
|
join q4 in _context.Stationses on q1.StationID equals q4.StationID |
|
|
select new |
|
|
select new |
|
|
{ |
|
|
{ |
|
|
q1.WipID, |
|
|
q1.WipID, |
|
@ -434,12 +452,14 @@ FROM JHAMES.WIP_STATION"; |
|
|
q3.ItemNO, |
|
|
q3.ItemNO, |
|
|
q3.ModelNO, |
|
|
q3.ModelNO, |
|
|
q1.StationID, |
|
|
q1.StationID, |
|
|
|
|
|
q4.StationName, |
|
|
q1.RuleStatus, |
|
|
q1.RuleStatus, |
|
|
q1.FirstCnt, |
|
|
q1.FirstCnt, |
|
|
q1.CreateDate |
|
|
q1.CreateDate |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
q = q.Where(w => w.CustomerMedical == "Y"); |
|
|
q = q.Where(w => w.CustomerMedical == "Y"); |
|
|
|
|
|
q = q.Where(w => fpy_station.Contains(w.StationName)); |
|
|
|
|
|
|
|
|
if (itemNo != null) |
|
|
if (itemNo != null) |
|
|
{ |
|
|
{ |
|
|