Skip to content

Commit

Permalink
Merge pull request #174 from SeedTactics:features/lookup-workorder
Browse files Browse the repository at this point in the history
Features/lookup workorder
  • Loading branch information
wuzzeb authored Jul 26, 2024
2 parents 768be28 + 50838dd commit bdde099
Show file tree
Hide file tree
Showing 13 changed files with 490 additions and 71 deletions.
80 changes: 80 additions & 0 deletions client/csharp-api/api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3912,6 +3912,86 @@ public virtual async System.Threading.Tasks.Task<LogEntry> RecordWorkorderCommen
}
}

/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ActiveWorkorder>> GetActiveWorkorderAsync(string workorder)
{
return GetActiveWorkorderAsync(workorder, System.Threading.CancellationToken.None);
}

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ActiveWorkorder>> GetActiveWorkorderAsync(string workorder, System.Threading.CancellationToken cancellationToken)
{
if (workorder == null)
throw new System.ArgumentNullException("workorder");

var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));

var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "api/v1/log/workorder/{workorder}"
urlBuilder_.Append("api/v1/log/workorder/");
urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(workorder, System.Globalization.CultureInfo.InvariantCulture)));

PrepareRequest(client_, request_, urlBuilder_);

var url_ = urlBuilder_.ToString();
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);

PrepareRequest(client_, request_, url_);

var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
var disposeResponse_ = true;
try
{
var headers_ = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.IEnumerable<string>>();
foreach (var item_ in response_.Headers)
headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
headers_[item_.Key] = item_.Value;
}

ProcessResponse(client_, response_);

var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<System.Collections.Generic.ICollection<ActiveWorkorder>>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
return objectResponse_.Object;
}
else
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
}
}
finally
{
if (disposeResponse_)
response_.Dispose();
}
}
}
finally
{
if (disposeClient_)
client_.Dispose();
}
}

protected struct ObjectResponseResult<T>
{
public ObjectResponseResult(T responseObject, string responseText)
Expand Down
2 changes: 1 addition & 1 deletion client/insight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "vite",
"test": "vitest run",
"test:watch": "vitest watch",
"nswag": "./node_modules/nswag/bin/nswag.js aspnetcore2openapi /project:../../server/debug-mock /output:../../server/fms-insight-api.json && ./node_modules/nswag/bin/nswag.js openapi2tsclient /input:../../server/fms-insight-api.json /output:src/network/api.ts && ./node_modules/nswag/bin/nswag.js openapi2csclient /ParameterDateTimeFormat:'yyyy-MM-ddTHH:mm:ssZ' /input:../../server/fms-insight-api.json /namespace:BlackMaple.FMSInsight.API /output:../csharp-api/api.cs"
"nswag": "./node_modules/nswag/bin/nswag.js aspnetcore2openapi /project:../../server/debug-mock /output:../../server/fms-insight-api.json && ./node_modules/nswag/bin/nswag.js openapi2tsclient /UseAbortSignal:true /input:../../server/fms-insight-api.json /output:src/network/api.ts && ./node_modules/nswag/bin/nswag.js openapi2csclient /ParameterDateTimeFormat:'yyyy-MM-ddTHH:mm:ssZ' /input:../../server/fms-insight-api.json /namespace:BlackMaple.FMSInsight.API /output:../csharp-api/api.cs"
},
"packageManager": "[email protected]",
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions client/insight/src/cell-status/material-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ export const workorderInMaterialDialog = atom<Promise<string | null>>(async (get

const extraLogEventsFromUpdates = atom<ReadonlyArray<ILogEntry>>([]);

const localMatEvents = atom<Promise<ReadonlyArray<Readonly<ILogEntry>>>>(async (get) => {
const localMatEvents = atom<Promise<ReadonlyArray<Readonly<ILogEntry>>>>(async (get, { signal }) => {
const mat = await get(materialInDialogInfo);
if (mat === null) {
return [];
} else if (mat.materialID >= 0) {
return await LogBackend.logForMaterial(mat.materialID);
return await LogBackend.logForMaterial(mat.materialID, signal);
} else if (mat.serial && mat.serial !== "") {
return await LogBackend.logForSerial(mat.serial);
} else {
Expand All @@ -199,14 +199,14 @@ const localMatEvents = atom<Promise<ReadonlyArray<Readonly<ILogEntry>>>>(async (
});
const localMatEventsLoadable = loadable(localMatEvents);

const otherMatEvents = atom<Promise<ReadonlyArray<Readonly<ILogEntry>>>>(async (get) => {
const otherMatEvents = atom<Promise<ReadonlyArray<Readonly<ILogEntry>>>>(async (get, { signal }) => {
const serial = await get(serialInMaterialDialog);
if (serial === null || serial === "") return [];

const evts: Array<Readonly<ILogEntry>> = [];

for (const b of OtherLogBackends) {
evts.push.apply(await b.logForSerial(serial));
evts.push.apply(await b.logForSerial(serial, signal));
}

return evts;
Expand Down
Loading

0 comments on commit bdde099

Please sign in to comment.