|
|
@@ -76,7 +76,7 @@ namespace TeamAAS_VP.Services
|
|
|
/// - 捕获 <see cref="OperationCanceledException"/> 返回 "Canceled",捕获其它异常则返回异常消息。
|
|
|
/// - 若实例已被释放则抛出 <see cref="ObjectDisposedException"/>。
|
|
|
/// </remarks>
|
|
|
- public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, CancellationToken cancellationToken = default)
|
|
|
+ public async Task<(bool IsSuccess, string Response)> StationGetAsync(int num, string sn, string comp, CancellationToken cancellationToken = default)
|
|
|
{
|
|
|
// 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
|
|
|
if (_disposed) throw new ObjectDisposedException(nameof(MesService));
|
|
|
@@ -97,13 +97,25 @@ namespace TeamAAS_VP.Services
|
|
|
}
|
|
|
|
|
|
string url = "";
|
|
|
- if (device.F == "PTL")
|
|
|
+ string[] station = new string[3];
|
|
|
+ string[] fixtureId = new string[3];
|
|
|
+ station = device.Station.Split(',');
|
|
|
+ fixtureId = device.FixtureId.Split(',');
|
|
|
+
|
|
|
+ if (num == 0)//组装站
|
|
|
{
|
|
|
- url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&comp={device.comp}:{comp}&p=unit_process_check,message,model";
|
|
|
+ if (device.F == "PTL")
|
|
|
+ {
|
|
|
+ url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&comp={device.comp}:{comp}&p=unit_process_check,message,model";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&p=unit_process_check,message,model";
|
|
|
+ }
|
|
|
}
|
|
|
- else
|
|
|
+ else//保压站
|
|
|
{
|
|
|
- url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&p=unit_process_check,message,model";
|
|
|
+ url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&p=unit_process_check,message,model";
|
|
|
}
|
|
|
|
|
|
LogHelper.WriteLogMes($"【询问URL】{url}");
|
|
|
@@ -149,11 +161,11 @@ namespace TeamAAS_VP.Services
|
|
|
/// <param name="sn">序列号(SN)。</param>
|
|
|
/// <param name="timeoutInSeconds">请求超时,单位为秒。</param>
|
|
|
/// <returns>与 <see cref="StationGetAsync(string, CancellationToken)"/> 相同的返回语义。</returns>
|
|
|
- public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, double timeoutInSeconds)
|
|
|
+ public async Task<(bool IsSuccess, string Response)> StationGetAsync(int num, string sn, string comp, double timeoutInSeconds)
|
|
|
{
|
|
|
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
|
|
|
{
|
|
|
- return await StationGetAsync(sn, comp, cts.Token);
|
|
|
+ return await StationGetAsync(num, sn, comp, cts.Token);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -179,7 +191,7 @@ namespace TeamAAS_VP.Services
|
|
|
/// - 捕获 <see cref="OperationCanceledException"/> 返回 "Canceled",捕获其它异常则返回异常消息。
|
|
|
/// - 若实例已被释放则抛出 <see cref="ObjectDisposedException"/>。
|
|
|
/// </remarks>
|
|
|
- public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp,string gap,string press,string presstime,string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
|
|
|
+ public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int num, string sn, string comp, string gap, string press, string presstime, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
|
|
|
{
|
|
|
// 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
|
|
|
if (_disposed) throw new ObjectDisposedException(nameof(MesService));
|
|
|
@@ -201,18 +213,33 @@ namespace TeamAAS_VP.Services
|
|
|
|
|
|
string res = isSuccess ? "PASS" : "FAIL";
|
|
|
string url = "";
|
|
|
- if (device.F == "PTL")
|
|
|
+ string[] station = new string[3];
|
|
|
+ string[] fixtureId = new string[3];
|
|
|
+ station = device.Station.Split(',');
|
|
|
+ fixtureId = device.FixtureId.Split(',');
|
|
|
+
|
|
|
+ if (num == 0)//组装站
|
|
|
{
|
|
|
- url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PTL&comp={device.comp}:{comp}" +
|
|
|
- $"&gap={gap}&pressure={press}&pressure_time={presstime}&assy_pressure={assypress}" +
|
|
|
+ if (device.F == "PTL")
|
|
|
+ {
|
|
|
+ url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&f=PTL&comp={device.comp}:{comp}" +
|
|
|
+ $"&gap={gap}&assy_pressure={assypress}" +
|
|
|
$"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&f=PQC" +
|
|
|
+ $"&gap={gap}&assy_pressure={assypress}" +
|
|
|
+ $"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PQC" +
|
|
|
- $"&gap={gap}&pressure={press}&pressure_time={presstime}&assy_pressure={assypress}" +
|
|
|
- $"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
|
|
|
+ url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={station[num]}&fixtureid={fixtureId[num]}&sn={sn}&f=PQC" +
|
|
|
+ $"&pressure={press}&pressure_time={presstime}" +
|
|
|
+ $"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
|
|
|
}
|
|
|
+
|
|
|
LogHelper.WriteLogMes($"【上传URL】{url}");
|
|
|
SendTaskMessage($"【上传URL】{url}", MessageLevel.Info);
|
|
|
(bool IsSuccess, string Response) result = (false, string.Empty);
|
|
|
@@ -260,11 +287,11 @@ namespace TeamAAS_VP.Services
|
|
|
/// <param name="stop_time">结束时间。</param>
|
|
|
/// <param name="timeoutInSeconds">请求超时,单位为秒。</param>
|
|
|
/// <returns>与 <see cref="SubmitGetAsync(string, bool, DateTime, DateTime, CancellationToken)"/> 相同的返回语义。</returns>
|
|
|
- public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp, string gap, string press, string presstime, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
|
|
|
+ public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(int num, string sn, string comp, string gap, string press, string presstime, string assypress, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
|
|
|
{
|
|
|
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
|
|
|
{
|
|
|
- return await SubmitGetAsync(sn, comp, gap, press, presstime, assypress, isSuccess, start_time, stop_time, cts.Token);
|
|
|
+ return await SubmitGetAsync(num, sn, comp, gap, press, presstime, assypress, isSuccess, start_time, stop_time, cts.Token);
|
|
|
}
|
|
|
}
|
|
|
|