Work In Progress
parent
b8ec9517eb
commit
6b17bd95a1
20
Parts.cs
20
Parts.cs
|
@ -2,6 +2,7 @@
|
|||
using appsrv.attributes;
|
||||
using sharpwawi.models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace sharpwawi
|
||||
{
|
||||
|
@ -25,6 +26,25 @@ namespace sharpwawi
|
|||
return new Part();
|
||||
}
|
||||
|
||||
[PublishedMember]
|
||||
public Part ByKey(string key)
|
||||
{
|
||||
foreach (Part p in AllParts)
|
||||
if (p.Key.Equals(key))
|
||||
return p;
|
||||
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
|
||||
[PublishedMember]
|
||||
public IEnumerable<Part> ByKeyword(string keyword)
|
||||
{
|
||||
return AllParts.Where((p) => (p.Key.Contains(keyword) || p.Name.Contains(keyword) || p.Description.Contains(keyword)|| p.Dimensions.Contains(keyword)|| p.Standards.Contains(keyword)));
|
||||
}
|
||||
|
||||
[PublishedMember]
|
||||
public IEnumerable<Part> AllParts => WaWi.Mapper.Query<Part>();
|
||||
|
||||
[PublishedMember]
|
||||
public Part TestPart { get; } = new Part("P001-456-8765", "Der universelle Testartikel");
|
||||
}
|
||||
|
|
26
WaWi.cs
26
WaWi.cs
|
@ -6,40 +6,40 @@ using mapper;
|
|||
using mapper.database;
|
||||
using appsrv.test;
|
||||
using mapper.database.model;
|
||||
using mapper.persistence;
|
||||
|
||||
namespace sharpwawi
|
||||
{
|
||||
public class WaWi
|
||||
{
|
||||
public Mapper Mapper { get; protected set; }
|
||||
|
||||
[PublishedMember]
|
||||
public readonly Parts Parts;
|
||||
|
||||
|
||||
Configuration mapperConfiguration;
|
||||
public Mapper Mapper { get; protected set; }
|
||||
//public Mapper Mapper { get; protected set; }
|
||||
|
||||
public WaWi()
|
||||
{
|
||||
Parts = new Parts(this);
|
||||
|
||||
PrepareMapper();
|
||||
|
||||
TestMapper();
|
||||
Parts = new Parts(this);
|
||||
|
||||
}
|
||||
|
||||
private void PrepareMapper()
|
||||
{
|
||||
/* mapperConfiguration = new Configuration()
|
||||
.AddClass(typeof(Entity))
|
||||
.AddClass(typeof(Part))
|
||||
.AddClass(typeof(Assembly))
|
||||
.AddClass(typeof(AssemblyComponent))
|
||||
.SetConnectionProvider(new PGSQLConnectionProvider("feuerbach.lupus","demo","demo","demo"));
|
||||
|
||||
Mapper = new Mapper(mapperConfiguration);
|
||||
*/
|
||||
Mapper = new Mapper(new PostgresAdapter("demo", "feuerbach.lupus", "demo", "demo"));
|
||||
Mapper.Register(typeof(Part));
|
||||
|
||||
Mapper.StorageAdapter.Setup(Mapper);
|
||||
}
|
||||
|
||||
public void SaveObject(object o)
|
||||
{
|
||||
Mapper.Save(o);
|
||||
}
|
||||
|
||||
|
||||
|
|
1
WaWi.xml
1
WaWi.xml
|
@ -8,6 +8,7 @@
|
|||
<Provider Name="ReflectiveResource">sharpwawi.WaWi</Provider>
|
||||
<Parameter Name="templates">templates</Parameter>
|
||||
<Parameter Name="instantiate">true</Parameter>
|
||||
<Parameter Name="method_save">SaveObject</Parameter>
|
||||
</Resource>
|
||||
</Resource>
|
||||
</SharpWebApplication>
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace sharpwawi.models
|
|||
public class AssemblyComponent
|
||||
{
|
||||
[PrimaryKey]
|
||||
public Assembly Assembly { get; private set; }
|
||||
public PartAssembly Assembly { get; private set; }
|
||||
[PrimaryKey]
|
||||
public Part Component { get; private set; }
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace sharpwawi.models
|
|||
{
|
||||
}
|
||||
|
||||
public AssemblyComponent(Assembly assembly,Part component, double quantity)
|
||||
public AssemblyComponent(PartAssembly assembly,Part component, double quantity)
|
||||
{
|
||||
this.Assembly = assembly;
|
||||
this.Component = component;
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using mapper.attributes;
|
||||
using appsrv.templates.editors;
|
||||
namespace sharpwawi.models
|
||||
{
|
||||
[MappingConstraint(FieldMappingConstraint = MappingConstraints.ANNOTATEDONLY,PropertyMappingConstraint = MappingConstraints.ALL)]
|
||||
public class Entity
|
||||
{
|
||||
[PrimaryKey]
|
||||
public String Key { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Key;
|
||||
|
||||
public String Description { get; set; }
|
||||
public String Name;
|
||||
|
||||
public String Description;
|
||||
|
||||
public IDictionary<string, string> userFields = new Dictionary<string, string>();
|
||||
|
||||
|
|
|
@ -8,14 +8,18 @@ namespace sharpwawi.models
|
|||
[MappingConstraint(FieldMappingConstraint = MappingConstraints.ANNOTATEDONLY,PropertyMappingConstraint = MappingConstraints.ANNOTATEDONLY)]
|
||||
public class Part : Entity
|
||||
{
|
||||
public ISet<Assembly> Assemblies { get; private set; } = new HashSet<Assembly>();
|
||||
public ISet<PartAssembly> Assemblies { get; private set; } = new HashSet<PartAssembly>();
|
||||
|
||||
[Mapped]
|
||||
public Assembly CurrentAssembly { get; set; }
|
||||
public PartAssembly CurrentAssembly;
|
||||
|
||||
[Mapped]
|
||||
public Part ReplacedBy;
|
||||
|
||||
public String Standards; // Teil entspricht diesen Normen
|
||||
public String Dimensions; // Dimensionierung / Abmasse (ggf. gem. Norm)
|
||||
|
||||
|
||||
public Part()
|
||||
{
|
||||
}
|
||||
|
@ -28,7 +32,7 @@ namespace sharpwawi.models
|
|||
public int HighestAssemblyRevision {
|
||||
get {
|
||||
int highest = 0;
|
||||
foreach (Assembly assembly in Assemblies)
|
||||
foreach (PartAssembly assembly in Assemblies)
|
||||
if (assembly.Revision > highest)
|
||||
highest = assembly.Revision;
|
||||
return highest;
|
||||
|
@ -36,14 +40,14 @@ namespace sharpwawi.models
|
|||
}
|
||||
|
||||
[PublishedMember]
|
||||
public int Priority => 1;
|
||||
public int Priority;
|
||||
|
||||
[PublishedMember]
|
||||
public double Rank => 2.345;
|
||||
public double Rank;
|
||||
|
||||
|
||||
public Assembly CreateAssembly(){
|
||||
Assembly assembly = new Assembly(this);
|
||||
public PartAssembly CreateAssembly(){
|
||||
PartAssembly assembly = new PartAssembly(this);
|
||||
Assemblies.Add(assembly);
|
||||
return assembly;
|
||||
}
|
||||
|
|
|
@ -6,22 +6,23 @@ using mapper.attributes;
|
|||
namespace sharpwawi.models
|
||||
{
|
||||
[MappingConstraintAttribute(FieldMappingConstraint = MappingConstraints.DONTMAP,PropertyMappingConstraint = MappingConstraints.ANNOTATEDONLY)]
|
||||
public class Assembly
|
||||
public class PartAssembly
|
||||
{
|
||||
[Mapped]
|
||||
[PrimaryKey]
|
||||
public Part Part { get; private set; }
|
||||
public Part Part;
|
||||
|
||||
[Mapped]
|
||||
[PrimaryKey]
|
||||
public int Revision { get; private set; }
|
||||
public int Revision;
|
||||
|
||||
IList<AssemblyComponent> components = new List<AssemblyComponent>();
|
||||
|
||||
protected Assembly()
|
||||
protected PartAssembly()
|
||||
{
|
||||
}
|
||||
|
||||
internal Assembly(Part part)
|
||||
internal PartAssembly(Part part)
|
||||
{
|
||||
Part = part;
|
||||
Revision = part.HighestAssemblyRevision + 1;
|
||||
|
@ -49,8 +50,8 @@ namespace sharpwawi.models
|
|||
return false;
|
||||
}
|
||||
|
||||
public Assembly Clone(){
|
||||
Assembly clone = Part.CreateAssembly();
|
||||
public PartAssembly Clone(){
|
||||
PartAssembly clone = Part.CreateAssembly();
|
||||
|
||||
foreach (AssemblyComponent assemblyComponent in components)
|
||||
clone.AddComponent(assemblyComponent.Component, assemblyComponent.Quantity);
|
|
@ -41,7 +41,7 @@
|
|||
<Compile Include="models\stock\StockLocation.cs" />
|
||||
<Compile Include="models\stock\StockShelf.cs" />
|
||||
<Compile Include="models\stock\WareHouse.cs" />
|
||||
<Compile Include="models\Assembly.cs" />
|
||||
<Compile Include="models\PartAssembly.cs" />
|
||||
<Compile Include="models\AssemblyComponent.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,14 +1,50 @@
|
|||
<?frame /layout.hfrm ?>
|
||||
<div class="left box navigation">
|
||||
<div class="group">
|
||||
<div>Recherche</div>
|
||||
<input type="text" id="qpart" class="narrow" alt="schlüssel / bezeichnung"/>
|
||||
</div>
|
||||
<form action="/WaWi/Parts">
|
||||
<div class="group">
|
||||
<div>Recherche</div>
|
||||
<input type="text" name="keyword" class="narrow" alt="schlüssel / bezeichnung" value="<?=request.GetParameterValue("keyword")?>"/>
|
||||
<input type="submit" value="suchen..."/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="group">
|
||||
<div><a href="/WaWi/Parts/Create">anlegen</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<?framed?>
|
||||
<?if request.HasParameter("keyword") ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Schlüssel</td>
|
||||
<td>Bezeichnung</td>
|
||||
<td>Beschreibung</td>
|
||||
<td>Dimensionen</td>
|
||||
<td>Normen / Standardisierung</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<?iterate part this.ByKeyword(request.GetParameterValue("keyword"))?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/WaWi/Parts/ByKey/<?=part.Key?>"><?=part.Key?></a>
|
||||
</td>
|
||||
<td>
|
||||
<?=part.Name?>
|
||||
</td>
|
||||
<td>
|
||||
<?=StrMax(part.Description, 32, "...")?>
|
||||
</td>
|
||||
<td>
|
||||
<?=part.Dimensions?>
|
||||
</td>
|
||||
<td>
|
||||
<?=part.Standards?>
|
||||
</td>
|
||||
</tr>
|
||||
<?end?>
|
||||
</table>
|
||||
<?end?>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?frame /layout.hfrm ?>
|
||||
<?set pagetitle "Artikel Details"?>
|
||||
|
||||
<h1>[ <?=this.Key?> ] <?=this.Name?></h1>
|
||||
<h1>[ <?=this.Key?> ] <?=this.Name?> <?if this.Dimensions?><i><?=this.Dimensions?></i><?end?><?if this.Standards ?> [ <?=this.Standards?> ]<?end?></h1>
|
||||
|
||||
<form action="<?=REDIT_PATH?>" method="POST" ENCTYPE="multipart/form-data"/>
|
||||
|
||||
<div class="block">
|
||||
<div class="group">
|
||||
|
||||
<div class="group column">
|
||||
<div class="title">Allgemeine Angaben</div>
|
||||
|
||||
<div class="block">
|
||||
|
@ -19,6 +20,22 @@
|
|||
<?editor this.Name?>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<label>Beschreibung</label>
|
||||
<?editor this.Description "MultiLine"?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group column">
|
||||
<div class="block">
|
||||
<label>Eingehaltene Normen</label>
|
||||
<?editor this.Standards?>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<label>Dimensionen</label>
|
||||
<?editor this.Dimensions?>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<label>TEST: Rank</label>
|
||||
<?editor this.Rank?>
|
||||
|
@ -27,35 +44,10 @@
|
|||
<label>TEST: Priority</label>
|
||||
<?editor this.Priority?>
|
||||
</div>
|
||||
<!--
|
||||
<div class="group">
|
||||
<div class="title">Freie Felder</div>
|
||||
<div class="block">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Feldname</th>
|
||||
<th>Wert</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?iterate uf o.userFields?>
|
||||
<tr>
|
||||
<td><?=uf.Key?></td>
|
||||
<td><?=uf.Value?></td>
|
||||
</tr>
|
||||
<?end?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
<input type="submit" value="Absenden"/>
|
||||
</div>
|
||||
|
||||
<input type="submit" value="Aktualisieren"/>
|
||||
<input type="submit" name="REDIT_SUBMIT" value="save"/>
|
||||
|
||||
</form>
|
||||
|
|
|
@ -18,6 +18,41 @@ div {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
a, a:visited {
|
||||
color: #00a5fe;
|
||||
}
|
||||
|
||||
/*
|
||||
a::before {
|
||||
content: "\00bb";
|
||||
}
|
||||
*/
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-right: 20px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 3px;
|
||||
|
||||
border-bottom: 1px dotted black;
|
||||
}
|
||||
|
||||
thead > tr > td{
|
||||
padding-bottom: 2px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
textarea {
|
||||
min-width: 360px;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.left {
|
||||
float:left;
|
||||
width: 230px;
|
||||
|
@ -131,7 +166,7 @@ div {
|
|||
}
|
||||
|
||||
.box,.block{
|
||||
display: block;
|
||||
display: flex;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
@ -147,6 +182,23 @@ div {
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.group.column {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.group.column + .group.column {
|
||||
border-top: none;
|
||||
border-left: 1px solid #6fb9df;
|
||||
|
||||
padding-top: 0px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.left .box, .left.box, .left .group, .left.group {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
|
@ -191,6 +243,7 @@ div {
|
|||
height: 100%;
|
||||
|
||||
padding: 4px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.navigation > .navigation {
|
||||
|
@ -205,10 +258,28 @@ div {
|
|||
}
|
||||
|
||||
|
||||
.table {
|
||||
display: inline-flex;
|
||||
flex-flow: row;
|
||||
}
|
||||
|
||||
.table > div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#wawi {
|
||||
z-index: 1;
|
||||
font-size: 24px;
|
||||
}
|
||||
#wawi:hover {
|
||||
color: #D02020;
|
||||
|
|
Loading…
Reference in New Issue