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
131 lines
4.6 KiB
C#
131 lines
4.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic.Sales.Receipts;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.Warehousing;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.BusinessLogic.WebServices.Warehousing;
|
|
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.Tests.EndToEnd.Infrastructure;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket136900;
|
|
|
|
public class Ticket136900Tests : EndToEndTest
|
|
{
|
|
public Ticket136900Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
BarcodeBL.GetCurrentDateForSerialNumberGeneration = () => new DateTime(2023, 3, 14);
|
|
}
|
|
|
|
public const int ArticleI3D = 4363;
|
|
public const int CustomerI3D = 10006;
|
|
|
|
public override void Execute()
|
|
{
|
|
// In this ticket the problem was, that our barcode-logic couldn't deal with the fact
|
|
// that a receipt might have more than 2000 barcodes
|
|
|
|
var order = this.CreateOrder();
|
|
var savedOrder = this.SaveOrder(order);
|
|
this.Verifier.Verify("SavedOrder", savedOrder);
|
|
|
|
var newVersion = this.CreateNewVersion(savedOrder);
|
|
var secondSavedOrder = this.SaveOrder(newVersion);
|
|
this.Verifier.Verify("UpdatedOrder", secondSavedOrder);
|
|
|
|
}
|
|
|
|
private ReceiptOrderDTO CreateOrder()
|
|
{
|
|
// Create new barcodes
|
|
const int barcodeCount = 2500; // 2000 is our own limit, 2100 the one from SQL-Server, so lets go above both of them
|
|
var barcodes = this.WithSession(s => s.GetBL<BarcodeWebServiceBL>().CreateAutomaticNewSerialNumbers(
|
|
amount: barcodeCount,
|
|
ArticleI3D,
|
|
warehouseI3D: -1,
|
|
reason: "Test",
|
|
adjustStockInventory: true,
|
|
returnSerialNumbersWithAdditionalInformations: false,
|
|
this.GetLoggedInUser().User).ThrowIfError());
|
|
|
|
// Create a order
|
|
var order = (ReceiptOrderDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
|
|
CentronObjectKindNumeric.OrderClass,
|
|
this.GetLoggedInUser(),
|
|
CustomerI3D,
|
|
new CreateReceiptData
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
addressI3D: null,
|
|
contactPersonI3D: null,
|
|
insertSalutationAndAgreement: false,
|
|
ignoreDefaultContract: true,
|
|
insertCustomerDiscount: false).ThrowIfError()).Receipt;
|
|
|
|
// Insert article into order
|
|
var receiptItem = (ReceiptOrderItemDTO)this.WithSession(s => s.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
order,
|
|
isExternalArticle: false,
|
|
ArticleI3D,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D: -1,
|
|
this.GetLoggedInUser(),
|
|
CreateArticleReceiptItemsConfig.None()).ThrowIfError()).ReceiptItems.Single();
|
|
|
|
order.Items = new List<ReceiptOrderItemDTO>
|
|
{
|
|
receiptItem
|
|
};
|
|
|
|
// Insert barcodes into order
|
|
receiptItem.Barcodes = barcodes
|
|
.Select(f => new ReceiptItemBarcode
|
|
{
|
|
BarcodeCaption = f.Serialnumber,
|
|
IsActive = true,
|
|
BarcodeI3D = f.I3D,
|
|
})
|
|
.ToList();
|
|
receiptItem.QuantityComplete = barcodes.Count;
|
|
|
|
return order;
|
|
}
|
|
|
|
private ReceiptOrderDTO SaveOrder(ReceiptOrderDTO order)
|
|
{
|
|
var savedOrder = (ReceiptOrderDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
order,
|
|
this.GetLoggedInUser().User,
|
|
new SaveReceiptData
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
autoLockIfNewReceipt: false,
|
|
CreatedThroughApplication.WebServices,
|
|
receiptTemplateFolderI3D: null).ThrowIfError()).Receipt;
|
|
|
|
return savedOrder;
|
|
}
|
|
|
|
private ReceiptOrderDTO CreateNewVersion(ReceiptOrderDTO savedOrder)
|
|
{
|
|
var newVersion = (ReceiptOrderDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().CreateNewVersion(
|
|
CentronObjectKindNumeric.OrderClass,
|
|
savedOrder.I3D,
|
|
null,
|
|
null,
|
|
this.GetLoggedInUser().User,
|
|
new CreateNewVersionData())).ThrowIfError().Receipt;
|
|
|
|
return newVersion;
|
|
}
|
|
} |