Codebasis als Dateien ins Arbeitsrepo statt als Gitlink

QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142)
getrackt, ohne .gitmodules und ohne erreichbares Remote. Der
Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar
gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege
der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen.

Umstellung:
- Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert
  (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6)
- Gitlink aus dem Index entfernt
- Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB

Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte
bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
This commit is contained in:
Christoph Schwörer
2026-08-26 07:43:51 +02:00
parent 18edae75b6
commit f045b99a25
24664 changed files with 5846716 additions and 1 deletions
@@ -0,0 +1,71 @@
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
using Centron.Data.WebServices.Sales.Receipts.Orders;
using Centron.Interfaces;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class DefaultWorkflow_AllGood : EndToEndTest
{
public DefaultWorkflow_AllGood(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDatabase();
var orderI3D = this.CreateAndSaveOrder(1);
var deliveryListI3D = this.ForwardOrderToDeliveryListAndSave(2, orderI3D);
this.RemovePositionsFromDeliveryList(3, deliveryListI3D);
this.RemovePositionsFromOrder(4, orderI3D);
}
private void PrepareDatabase()
{
PartListBarcodeTestHelper.PrepareDatabase(this);
}
private int CreateAndSaveOrder(int step)
{
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
AssertBarcodesInPartList();
return savedOrder.I3D;
}
private int ForwardOrderToDeliveryListAndSave(int step, int orderI3D)
{
var deliveryList = ForwardOrderToDeliveryList(orderI3D);
var savedDeliveryList = SaveReceipt(deliveryList);
AssertBarcodesInPartList();
return savedDeliveryList.I3D;
}
private void RemovePositionsFromDeliveryList(int step, int deliveryListI3D)
{
var newDeliveryListVersion = (ReceiptDeliveryListDTO)CreateNewVersion(CentronObjectKindNumeric.DeliveryListClass, deliveryListI3D);
newDeliveryListVersion.Items.Clear();
SaveReceipt(newDeliveryListVersion);
AssertBarcodesInPartList();
}
private void RemovePositionsFromOrder(int step, int orderI3D)
{
var newOrderVersion = (ReceiptOrderDTO)CreateNewVersion(CentronObjectKindNumeric.OrderClass, orderI3D);
newOrderVersion.Items.Clear();
SaveReceipt(newOrderVersion);
AssertBarcodesNotInPartList();
}
}
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Centron.Core.Extensions;
using Centron.Host.Services;
using Centron.Interfaces.BL;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class FailedWorkflow_InvalidOwnerBarcodeI3D : EndToEndTest
{
public FailedWorkflow_InvalidOwnerBarcodeI3D(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
// All these test-cases should fail
this.OwnerBarcodeI3DNotInReceipt();
this.OwnerBarcodeI3DInReceiptButNoPartListInReceipt();
this.OwnerBarcodeI3DInReceiptButNotInPartListHead();
this.OwnerBarcodeI3DInReceiptButAsNestedPartList();
this.OwnerBarcodeI3DButArticleSettingIsFalse();
}
private void OwnerBarcodeI3DNotInReceipt()
{
var order = CreateOrder();
order.Items[0].Barcodes.Clear(); //Remove the barcode that is the OwnerBarcodeI3D
var exception = SaveReceiptShouldFail(order);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Die zugeordnete Seriennummer wurde in diesem Beleg nicht gefunden.", exception.Message);
}
private void OwnerBarcodeI3DInReceiptButNoPartListInReceipt()
{
var order = CreateOrder();
order.Items[0].Expanded = null;
order.Items[1].Indent = 0; //Remove the part-list
var exception = SaveReceiptShouldFail(order);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Stücklistenkopf wurde nicht gefunden.", exception.Message);
}
private void OwnerBarcodeI3DInReceiptButNotInPartListHead()
{
var order = CreateOrder();
// Create a copy of the OwnerBarcodeI3D, and move it to the end of the items
var itemCopy = CopyExtensions.Clone(order.Items[0], KnownTypes.GetKnownTypes(null).ToArray());
itemCopy.Expanded = null;
order.Items.Add(itemCopy);
// Remove the OwnerBarcodeI3D from the original part-list-head
order.Items[0].Barcodes.Clear();
var exception = SaveReceiptShouldFail(order);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Die zugeordnete Seriennummer wurde in diesem Beleg nicht gefunden.", exception.Message);
}
private void OwnerBarcodeI3DInReceiptButAsNestedPartList()
{
var order = CreateOrder();
// Create a copy of the child-item, and make it a nested part-list
var itemCopy = CopyExtensions.Clone(order.Items[0], KnownTypes.GetKnownTypes(null).ToArray());
itemCopy.Indent = 0;
itemCopy.Barcodes = new List<ReceiptItemBarcode>();
order.Items.Insert(0, itemCopy);
// Adjust items
order.Items[0].Expanded = true;
order.Items[1].Expanded = true;
order.Items[1].Indent = 1;
order.Items[1].Barcodes = new List<ReceiptItemBarcode>();
order.Items[2].Indent = 2;
// Remove the OwnerBarcodeI3D from the original part-list-head
order.Items[0].Barcodes = new List<ReceiptItemBarcode>();
var exception = SaveReceiptShouldFail(order);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Die zugeordnete Seriennummer wurde in diesem Beleg nicht gefunden.", exception.Message);
}
private void OwnerBarcodeI3DButArticleSettingIsFalse()
{
this.Sql($"UPDATE dbo.ARTIK SET SNStueckliste = 0 WHERE I3D = {PartListArticleI3D}");
var order = CreateOrder();
var exception = SaveReceiptShouldFail(order);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Stücklistenkopf-Artikel hat den Haken \'Stückliste verwaltet Seriennummern\' nicht aktiviert.", exception.Message);
}
}
@@ -0,0 +1,40 @@
using System.Collections.Generic;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class FailedWorkflow_OwnerBarcodeI3DChangedInDeliveryList : EndToEndTest
{
public FailedWorkflow_OwnerBarcodeI3DChangedInDeliveryList(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
var deliveryList = ForwardOrderToDeliveryList(savedOrder.I3D);
deliveryList.Items[0].Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleAlternativeBarcodeI3D,
IsActive = true,
}
};
deliveryList.Items[1].Barcodes[0].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
deliveryList.Items[1].Barcodes[1].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
var exception = SaveReceiptShouldFail(deliveryList);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Diese Seriennummer ist bereits einer anderen Seriennummer zugeordnet.", exception.Message);
}
}
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class FailedWorkflow_OwnerBarcodeI3DChangedInInvoice : EndToEndTest
{
public FailedWorkflow_OwnerBarcodeI3DChangedInInvoice(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
var deliveryList = ForwardOrderToDeliveryList(savedOrder.I3D);
var savedDeliveryList = SaveReceipt(deliveryList);
var invoice = ForwardDeliveryListToInvoice(savedDeliveryList.I3D);
invoice.Items[0].Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleAlternativeBarcodeI3D,
IsActive = true,
}
};
invoice.Items[1].Barcodes[0].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
invoice.Items[1].Barcodes[1].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
var exception = SaveReceiptShouldFail(invoice);
Assert.Equal("Fehler mit Stückliste verwaltet Seriennummern: Diese Seriennummer ist bereits einer anderen Seriennummer zugeordnet.", exception.Message);
}
}
@@ -0,0 +1,274 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Centron.BusinessLogic;
using Centron.BusinessLogic.Administration.Settings;
using Centron.BusinessLogic.Sales.Receipts;
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
using Centron.BusinessLogic.Warehousing;
using Centron.BusinessLogic.WebServices.Sales.Receipts;
using Centron.Data.WebServices.Sales.Receipts;
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
using Centron.Data.WebServices.Sales.Receipts.Invoices;
using Centron.Data.WebServices.Sales.Receipts.Orders;
using Centron.Interfaces;
using Centron.Interfaces.Administration.Environment;
using Centron.Interfaces.BL;
using Centron.Interfaces.Sales.Receipts;
using Centron.Interfaces.Sales.Receipts.InsertReceipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Centron.Tests.EndToEnd.Infrastructure.Verifier;
using CentronSoftware.Centron.WebServices.EntitiesWrongPlace.Sales.Receipts.DataAndResults;
using CentronSoftware.Centron.WebServices.Extensions;
using Xunit;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public static class PartListBarcodeTestHelper
{
public const int CustomerI3D = 10026;
public const int PartListArticleI3D = 52;
public const int PartListArticleBarcodeI3D = 504;
public const int PartListArticleAlternativeBarcodeI3D = 443;
public const int ChildArticleI3D = 139;
public const int ChildArticleBarcodeI3D1 = 511;
public const int ChildArticleBarcodeI3D2 = 512;
public static void PrepareDatabase(EndToEndTest allGoodTest)
{
allGoodTest.Sql($"UPDATE dbo.ARTIK SET StkListe = 1, SNStueckliste = 1 WHERE I3D = {PartListArticleI3D}");
allGoodTest.Sql($"UPDATE dbo.ARTIK SET BarcodeScanen = 1 WHERE I3D = {ChildArticleI3D}");
allGoodTest.Sql($"UPDATE dbo.Stammdat SET WertMemo = '' WHERE I3D = {(int)AppSettingsConst.DeliveryListStartFreeText}");
allGoodTest.Sql($"UPDATE dbo.Stammdat SET WertText = '' WHERE I3D = {(int)AppSettingsConst.DeliveryListEndFreeText}");
// Set DTALastschrift to 0, so we are not required to select a correct sepa-mandate (Bankverbindung/Mandat)
allGoodTest.Sql("UPDATE dbo.Zahkond SET DTALastschrift = 0");
allGoodTest.Sql("ALTER TABLE RechKopf DROP COLUMN LcmStatus");
}
public static ReceiptOrderDTO CreateOrder()
{
using var session = new BLSession();
var currentUser = CommonMethodsHelper.GetUser(session);
var createNewReceiptResult = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
CentronObjectKindNumeric.OrderClass,
currentUser,
CustomerI3D,
new CreateReceiptData
{
IgnoreCallbacks = true,
},
addressI3D: null,
contactPersonI3D: null,
insertSalutationAndAgreement: false,
ignoreDefaultContract: true,
insertCustomerDiscount: false);
var order = (ReceiptOrderDTO)createNewReceiptResult.ThrowIfError().Receipt;
var partListItem = (ReceiptOrderItemDTO)session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
order,
isExternalArticle: false,
PartListArticleI3D,
externalArticleKind: null,
externalArticleId: null,
warehouseI3D: -1,
currentUser,
CreateArticleReceiptItemsConfig.None()).ThrowIfError().ReceiptItems.First();
var childItem = (ReceiptOrderItemDTO)session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
order,
isExternalArticle: false,
ChildArticleI3D,
externalArticleKind: null,
externalArticleId: null,
warehouseI3D: -1,
currentUser,
CreateArticleReceiptItemsConfig.None()).ThrowIfError().ReceiptItems.First();
partListItem.InternalPosition = 0;
partListItem.Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleBarcodeI3D,
IsActive = true,
}
};
childItem.InternalPosition = 1;
childItem.Indent = 1;
childItem.QuantityComplete = 2;
childItem.Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = ChildArticleBarcodeI3D1,
IsActive = true,
OwnerBarcodeI3D = PartListArticleBarcodeI3D
},
new()
{
BarcodeI3D = ChildArticleBarcodeI3D2,
IsActive = true,
OwnerBarcodeI3D = PartListArticleBarcodeI3D
},
};
order.Items = new List<ReceiptOrderItemDTO>
{
partListItem,
childItem
};
return order;
}
public static ReceiptDeliveryListDTO ForwardOrderToDeliveryList(int orderI3D) => (ReceiptDeliveryListDTO)ForwardReceipt(CentronObjectKindNumeric.OrderClass, orderI3D, CentronObjectKindNumeric.DeliveryListClass);
public static ReceiptInvoiceDTO ForwardDeliveryListToInvoice(int deliveryListI3D) => (ReceiptInvoiceDTO)ForwardReceipt(CentronObjectKindNumeric.DeliveryListClass, deliveryListI3D, CentronObjectKindNumeric.InvoiceClass);
public static ReceiptBaseDTO ForwardReceipt(CentronObjectKindNumeric fromKind, int fromI3D, CentronObjectKindNumeric toKind)
{
using var session = new BLSession();
return session.GetBL<ReceiptWebServiceBL>().ForwardReceipt(
toKind,
CommonMethodsHelper.GetUser(session).User,
new ForwardReceiptData
{
IgnoreCallbacks = true,
CreateReceiptData = new CreateReceiptData
{
IgnoreCallbacks = true,
},
CreateReceiptItemsFromExistingItemsData = new List<CreateReceiptItemsFromExistingItemsData>
{
new()
{
IgnoreCallbacks = true,
},
},
},
new List<ReceiptToForward>
{
new()
{
ReceiptKind = fromKind,
ReceiptI3D = fromI3D
},
},
receiptProjectLayoutItemI3DsToForward: null,
InsertReceiptTakeoverOptions.Reference,
onlyTakeoverAvailableQuantity: false,
ignoreDefaultContract: true).ThrowIfError().Receipt;
}
public static ReceiptBaseDTO SaveReceipt(ReceiptBaseDTO receipt)
{
using var session = new BLSession();
return session.GetBL<ReceiptWebServiceBL>().SaveReceipt(
receipt,
CommonMethodsHelper.GetUser(session).User,
new SaveReceiptData(),
autoLockIfNewReceipt: false,
CreatedThroughApplication.WebServices,
receiptTemplateFolderI3D: null).ThrowIfError().Receipt;
}
public static ResultException SaveReceiptShouldFail(ReceiptBaseDTO receipt)
{
try
{
SaveReceipt(receipt);
throw new Exception("This should not be reached. An error was expected in SaveReceipt");
}
catch (ResultException exception)
{
return exception;
}
}
public static ReceiptBaseDTO CreateNewVersion(CentronObjectKindNumeric receiptKind, int receiptI3D)
{
using var session = new BLSession();
return session.GetBL<ReceiptWebServiceBL>().CreateNewVersion(
receiptKind,
receiptI3D,
version: null,
newContactPersonI3D: null,
CommonMethodsHelper.GetUser(session).User,
new CreateNewVersionData
{
IgnoreCallbacks = true,
}).ThrowIfError().Receipt;
}
public static void AssertBarcodesInPartList() => AssertBarcodes(barcode1InPartList:true, barcode2InPartList:true);
public static void AssertBarcodesNotInPartList() => AssertBarcodes(barcode1InPartList:false, barcode2InPartList:false);
public static void AssertBarcodes(bool barcode1InPartList, bool barcode2InPartList, int? mainBarcodeI3D = null)
{
using var session = new BLSession();
mainBarcodeI3D ??= PartListArticleBarcodeI3D;
var mainBarcode = session.GetBL<BarcodeBL>().GetBarCode2ByI3D(mainBarcodeI3D.Value);
var alternativeBarcode = session.GetBL<BarcodeBL>().GetBarCode2ByI3D(mainBarcodeI3D.Value == PartListArticleBarcodeI3D ? PartListArticleAlternativeBarcodeI3D : PartListArticleBarcodeI3D);
var childBarcode1 = session.GetBL<BarcodeBL>().GetBarCode2ByI3D(ChildArticleBarcodeI3D1);
var childBarcode2 = session.GetBL<BarcodeBL>().GetBarCode2ByI3D(ChildArticleBarcodeI3D2);
if (barcode1InPartList || barcode2InPartList)
{
Assert.Equal(1, mainBarcode.SNPartsList);
}
else
{
Assert.True(mainBarcode.SNPartsList is null or 0);
}
Assert.True(alternativeBarcode.SNPartsList is null or 0);
if (barcode1InPartList)
{
Assert.Equal(mainBarcodeI3D.Value, childBarcode1.OwnerPositionI3D);
}
else
{
Assert.Null(childBarcode1.OwnerPositionI3D);
}
if (barcode2InPartList)
{
Assert.Equal(mainBarcodeI3D.Value, childBarcode2.OwnerPositionI3D);
}
else
{
Assert.Null(childBarcode2.OwnerPositionI3D);
}
}
public static void SplitUpPartList(ReceiptBaseDTO receipt)
{
var items = receipt.GetReceiptItems();
items[0].Set((IReceiptItemWithFormatting f) => f.Expanded, null);
items[1].Set((IReceiptItemWithFormatting f) => f.Indent, 0);
items[1].Get((IReceiptItemWithBarcodes f) => f.Barcodes)[0].OwnerBarcodeI3D = null;
items[1].Get((IReceiptItemWithBarcodes f) => f.Barcodes)[1].OwnerBarcodeI3D = null;
}
public static void CreatePartList(ReceiptBaseDTO receipt)
{
var items = receipt.GetReceiptItems();
items[0].Set((IReceiptItemWithFormatting f) => f.Expanded, true);
items[1].Set((IReceiptItemWithFormatting f) => f.Indent, 1);
items[1].Get((IReceiptItemWithBarcodes f) => f.Barcodes)[0].OwnerBarcodeI3D = PartListArticleBarcodeI3D;
items[1].Get((IReceiptItemWithBarcodes f) => f.Barcodes)[1].OwnerBarcodeI3D = PartListArticleBarcodeI3D;
}
}
@@ -0,0 +1,45 @@
using System.Collections.Generic;
using Centron.Data.WebServices.Sales.Receipts.Orders;
using Centron.Interfaces;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_ChangeOwnerBarcodeI3DInNewVersion : EndToEndTest
{
public SpecialWorkflow_ChangeOwnerBarcodeI3DInNewVersion(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
// Change the Barcode in the Part-List head
var newOrderVersion = (ReceiptOrderDTO)CreateNewVersion(CentronObjectKindNumeric.OrderClass, savedOrder.I3D);
newOrderVersion.Items[0].Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleAlternativeBarcodeI3D,
IsActive = true
}
};
// And update the OwnerBarcodeI3Ds
newOrderVersion.Items[1].Barcodes[0].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
newOrderVersion.Items[1].Barcodes[1].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
SaveReceipt(newOrderVersion);
// The barcodes should be in the part-list, but with the AlternativeBarcodeI3D now
AssertBarcodes(barcode1InPartList:true, barcode2InPartList:true, mainBarcodeI3D:PartListArticleAlternativeBarcodeI3D);
}
}
@@ -0,0 +1,44 @@
using System.Collections.Generic;
using Centron.Data.WebServices.Sales.Receipts.Orders;
using Centron.Interfaces;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_ChangeOwnerBarcodeI3DInSameVersion : EndToEndTest
{
public SpecialWorkflow_ChangeOwnerBarcodeI3DInSameVersion(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
var savedOrder = (ReceiptOrderDTO)SaveReceipt(order);
// Change the Barcode in the Part-List head, but don't create a new version
savedOrder.Items[0].Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleAlternativeBarcodeI3D,
IsActive = true
}
};
// And update the OwnerBarcodeI3Ds
savedOrder.Items[1].Barcodes[0].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
savedOrder.Items[1].Barcodes[1].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
SaveReceipt(savedOrder);
// The barcodes should be in the part-list, but with the AlternativeBarcodeI3D now
AssertBarcodes(barcode1InPartList:true, barcode2InPartList:true, mainBarcodeI3D:PartListArticleAlternativeBarcodeI3D);
}
}
@@ -0,0 +1,62 @@
using System.Collections.Generic;
using System.Linq;
using Centron.Core.Extensions;
using Centron.Data.WebServices.Sales.Receipts.Orders;
using Centron.Host.Services;
using Centron.Interfaces.Sales.Receipts;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_ChangeOwnerBarcodeI3DWithNewPosition : EndToEndTest
{
public SpecialWorkflow_ChangeOwnerBarcodeI3DWithNewPosition(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
var savedOrder = (ReceiptOrderDTO)SaveReceipt(order);
// Change the Barcode in the Part-List head, but don't create a new version
savedOrder.Items[0].Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleAlternativeBarcodeI3D,
IsActive = true
}
};
// And update the OwnerBarcodeI3Ds
savedOrder.Items[1].Barcodes[0].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
savedOrder.Items[1].Barcodes[1].OwnerBarcodeI3D = PartListArticleAlternativeBarcodeI3D;
// And have the old barcode in another position
var itemCopy = CopyExtensions.Clone(savedOrder.Items[0], KnownTypes.GetKnownTypes(null).ToArray());
itemCopy.I3D = 0;
itemCopy.Indent = 0;
itemCopy.InternalPosition = 2;
itemCopy.Expanded = false;
itemCopy.Barcodes = new List<ReceiptItemBarcode>
{
new()
{
BarcodeI3D = PartListArticleBarcodeI3D,
IsActive = true
}
};
savedOrder.Items.Add(itemCopy);
SaveReceipt(savedOrder);
// The barcodes should be in the part-list, but with the AlternativeBarcodeI3D now
AssertBarcodes(barcode1InPartList:true, barcode2InPartList:true, mainBarcodeI3D:PartListArticleAlternativeBarcodeI3D);
}
}
@@ -0,0 +1,63 @@
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
using Centron.Interfaces;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_CreatePartListInDeliveryList : EndToEndTest
{
public SpecialWorkflow_CreatePartListInDeliveryList(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDatabase();
var orderI3D = this.CreateAndSaveOrder();
int deliveryListI3D = this.ForwardToDeliveryListAndSplitUpPartList(orderI3D);
this.RemovePositionsFromDeliveryList(deliveryListI3D);
}
private void PrepareDatabase()
{
PartListBarcodeTestHelper.PrepareDatabase(this);
}
private int CreateAndSaveOrder()
{
var order = CreateOrder();
SplitUpPartList(order);
var savedOrder = SaveReceipt(order);
AssertBarcodesNotInPartList();
return savedOrder.I3D;
}
private int ForwardToDeliveryListAndSplitUpPartList(int orderI3D)
{
var deliveryList = ForwardOrderToDeliveryList(orderI3D);
CreatePartList(deliveryList);
var savedDeliveryList = SaveReceipt(deliveryList);
AssertBarcodesInPartList();
return savedDeliveryList.I3D;
}
private void RemovePositionsFromDeliveryList(int deliveryListI3D)
{
var newDeliveryListVersion = (ReceiptDeliveryListDTO)CreateNewVersion(CentronObjectKindNumeric.DeliveryListClass, deliveryListI3D);
newDeliveryListVersion.Items.Clear();
SaveReceipt(newDeliveryListVersion);
// We removed the positions from this delivery-list, which means they go back into the order
// But there, they are NOT in a part-list, so the barcodes should also not be in a part-list
AssertBarcodesNotInPartList();
}
}
@@ -0,0 +1,26 @@
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_NoOwnerBarcodeI3D : EndToEndTest
{
public SpecialWorkflow_NoOwnerBarcodeI3D(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
PrepareDatabase(this);
var order = CreateOrder();
order.Items[1].Barcodes[0].OwnerBarcodeI3D = null; // Is not assigned to an owner yet (should be possible)
// order.Items[1].Barcodes[1] is assigned to the owner still
SaveReceipt(order);
AssertBarcodes(barcode1InPartList:false, barcode2InPartList:true);
}
}
@@ -0,0 +1,78 @@
using Centron.Data.WebServices.Sales.Receipts.Invoices;
using Centron.Interfaces;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.Extensions;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes;
public class SpecialWorkflow_SplitUpAndCreateInInvoice : EndToEndTest
{
public SpecialWorkflow_SplitUpAndCreateInInvoice(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDatabase();
var orderI3D = this.CreateAndSaveOrder();
int deliveryListI3D = this.ForwardToDeliveryListAndSplitUpPartList(orderI3D);
var invoiceI3D = this.ForwardToInvoiceAndCreatePartListAgain(deliveryListI3D);
this.RemovePositionsFromInvoice(invoiceI3D);
}
private void PrepareDatabase()
{
PartListBarcodeTestHelper.PrepareDatabase(this);
}
private int CreateAndSaveOrder()
{
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
AssertBarcodesInPartList();
return savedOrder.I3D;
}
private int ForwardToDeliveryListAndSplitUpPartList(int orderI3D)
{
var deliveryList = ForwardOrderToDeliveryList(orderI3D);
SplitUpPartList(deliveryList);
var savedDeliveryList = SaveReceipt(deliveryList);
// Even tho we removed the part-list in this delivery-list, it still exists in the order
// So the barcodes should still technically be in the part-list
AssertBarcodesInPartList();
return savedDeliveryList.I3D;
}
private int ForwardToInvoiceAndCreatePartListAgain(int deliveryListI3D)
{
var invoice = ForwardDeliveryListToInvoice(deliveryListI3D);
CreatePartList(invoice);
var savedInvoice = SaveReceipt(invoice);
AssertBarcodesInPartList();
return savedInvoice.I3D;
}
private void RemovePositionsFromInvoice(int invoiceI3D)
{
var invoice = (ReceiptInvoiceDTO)CreateNewVersion(CentronObjectKindNumeric.InvoiceClass, invoiceI3D);
invoice.Items.Clear();
SaveReceipt(invoice);
// Should still be in the part-list because of the order
AssertBarcodesInPartList();
}
}
@@ -0,0 +1,65 @@
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
using Centron.Interfaces;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
using static Centron.Tests.EndToEnd.Tests.PartListBarcodes.PartListBarcodeTestHelper;
namespace Centron.Tests.EndToEnd.Tests.PartListBarcodes.BadSplitUpPartListInDeliveryList;
public class SpecialWorkflow_SplitUpPartListInDeliveryList : EndToEndTest
{
public SpecialWorkflow_SplitUpPartListInDeliveryList(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDatabase();
var orderI3D = this.CreateAndSaveOrder();
int deliveryListI3D = this.ForwardToDeliveryListAndSplitUpPartList(orderI3D);
this.RemovePositionsFromDeliveryList(deliveryListI3D);
}
private void PrepareDatabase()
{
PartListBarcodeTestHelper.PrepareDatabase(this);
}
private int CreateAndSaveOrder()
{
var order = CreateOrder();
var savedOrder = SaveReceipt(order);
AssertBarcodesInPartList();
return savedOrder.I3D;
}
private int ForwardToDeliveryListAndSplitUpPartList(int orderI3D)
{
var deliveryList = ForwardOrderToDeliveryList(orderI3D);
SplitUpPartList(deliveryList);
var savedDeliveryList = SaveReceipt(deliveryList);
// Even tho we removed the part-list in this delivery-list, it still exists in the order
// So the barcodes should still technically be in the part-list
AssertBarcodesInPartList();
return savedDeliveryList.I3D;
}
private void RemovePositionsFromDeliveryList(int deliveryListI3D)
{
var newDeliveryListVersion = (ReceiptDeliveryListDTO)CreateNewVersion(CentronObjectKindNumeric.DeliveryListClass, deliveryListI3D);
newDeliveryListVersion.Items.Clear();
SaveReceipt(newDeliveryListVersion);
// We removed the positions from this delivery-list, which means they go back into the order
// The barcodes should still be in the part-list
AssertBarcodesInPartList();
}
}