This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
@@ -125,7 +127,7 @@ namespace AyaNova.Api.Controllers
|
||||
else
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));;
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -150,6 +152,25 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Part serial numbers for part id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Part</returns>
|
||||
[HttpGet("serials/{id}")]
|
||||
public async Task<IActionResult> GetPartSerials([FromRoute] long id)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Part))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
var o = await ct.PartSerial.AsNoTracking().Where(z => z.PartId == id).OrderBy(z => z.Serial).Select(z => z.Serial).ToListAsync();
|
||||
// if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace AyaNova.Models
|
||||
public virtual DbSet<Notification> Notification { get; set; }
|
||||
public virtual DbSet<NotifyDeliveryLog> NotifyDeliveryLog { get; set; }
|
||||
public virtual DbSet<Part> Part { get; set; }
|
||||
public virtual DbSet<PartSerial> PartSerial { get; set; }
|
||||
public virtual DbSet<PartAssembly> PartAssembly { get; set; }
|
||||
public virtual DbSet<PartAssemblyItem> PartAssemblyItem { get; set; }
|
||||
public virtual DbSet<PM> PM { get; set; }
|
||||
|
||||
22
server/AyaNova/models/PartSerial.cs
Normal file
22
server/AyaNova/models/PartSerial.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
|
||||
public class PartSerial
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public long PartId { get; set; }
|
||||
[Required]
|
||||
public string Serial { get; set; }
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
@@ -22,8 +22,8 @@ namespace AyaNova.Util
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 15;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 666;
|
||||
internal const long EXPECTED_INDEX_COUNT = 115;
|
||||
internal const long EXPECTED_COLUMN_COUNT = 669;
|
||||
internal const long EXPECTED_INDEX_COUNT = 117;
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
@@ -665,6 +665,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
"cost decimal(19,4) not null, retail decimal(19,4) not null, unitofmeasure text, upc text " +
|
||||
" )");
|
||||
|
||||
//PARTSERIAL
|
||||
await ExecQueryAsync("CREATE TABLE apartserial (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial text not null, "+
|
||||
"partid bigint not null REFERENCES apart on delete cascade, CONSTRAINT UNQ_PartSerialPart UNIQUE (partid, serial) )");//ensure not duplicate partid/serial combo
|
||||
|
||||
//PARTASSEMBLY
|
||||
await ExecQueryAsync("CREATE TABLE apartassembly (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " +
|
||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
|
||||
|
||||
@@ -1536,6 +1536,19 @@ namespace AyaNova.Util
|
||||
log.LogError(err);
|
||||
throw new System.Exception(err);
|
||||
}
|
||||
|
||||
// 50% chance it has serial numbers
|
||||
//MIGRATE_OUTSTANDING this is just temporary until inventory is coded fully
|
||||
if (Fake.Random.Number() == 1)
|
||||
{
|
||||
var serialCount = Fake.Random.Number(1, 5);
|
||||
for (int y = 0; y < serialCount; y++)
|
||||
{
|
||||
await ct.PartSerial.AddAsync(new PartSerial() { PartId = NewObject.Id, Serial = Fake.Finance.Account().ToString() + y.ToString() });
|
||||
|
||||
}
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user