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
102 lines
4.1 KiB
C#
102 lines
4.1 KiB
C#
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Logistics.LogisticSettings;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts.DataAndResults;
|
|
using Centron.Data.WebServices.Sales.Receipts;
|
|
using Centron.Data.WebServices.Sales.Receipts.Offers;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.Extensions;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket122697
|
|
{
|
|
public class Ticket122697Tests : EndToEndTest
|
|
{
|
|
public Ticket122697Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
const int CustomerI3D = 10006;
|
|
const int ArticleI3D = 4343;
|
|
const int WarehouseI3D = 7; //The article 4343 is not available in warehouse 7
|
|
|
|
public override void Execute()
|
|
{
|
|
// An error was shown when creating a offer with an article that is currently not available in the position-warehouse
|
|
// That's a bit misleading, because offers don't book any articles, so the warehouse shouldn't be checked
|
|
this.SetupDatabase();
|
|
|
|
this.ExecuteTestForReceiptKind(CentronObjectKindNumeric.OfferClass);
|
|
this.ExecuteTestForReceiptKind(CentronObjectKindNumeric.InvoiceClass);
|
|
}
|
|
|
|
private void ExecuteTestForReceiptKind(CentronObjectKindNumeric receiptKind)
|
|
{
|
|
var receipt = this.GetReceipt(CustomerI3D, receiptKind, ArticleI3D, WarehouseI3D);
|
|
var saveResult = this.SaveReceipt(receipt);
|
|
|
|
this.Verifier.Verify($"SaveResult_{receiptKind}", saveResult);
|
|
}
|
|
|
|
private void SetupDatabase()
|
|
{
|
|
// Deactivate that articles are automatically added to warehouses
|
|
using var session = new BLSession();
|
|
var settings = session.GetBL<LogisticSettingsBL>().GetSettings();
|
|
settings.AutoNewSecondstockArticle = false;
|
|
session.GetBL<LogisticSettingsBL>().UpdateSettings(settings);
|
|
}
|
|
|
|
private Result<SaveReceiptResultDTO> SaveReceipt(ReceiptBaseDTO receipt)
|
|
{
|
|
using var session = new BLSession();
|
|
var saveResult = session.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
receipt,
|
|
this.GetLoggedInUser().User,
|
|
new SaveReceiptData { IgnoreCallbacks = true },
|
|
autoLockIfNewReceipt: false,
|
|
application: CreatedThroughApplication.CentronNet,
|
|
receiptTemplateFolderI3D: null);
|
|
|
|
return saveResult;
|
|
}
|
|
|
|
private ReceiptBaseDTO GetReceipt(int customerI3D, CentronObjectKindNumeric receiptKind, int articleI3D, int warehouseI3D)
|
|
{
|
|
using var session = new BLSession();
|
|
var newReceiptResult = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
|
|
receiptKind,
|
|
this.GetLoggedInUser(),
|
|
customerI3D,
|
|
new CreateReceiptData { IgnoreCallbacks = true },
|
|
addressI3D:null,
|
|
contactPersonI3D:null,
|
|
insertSalutationAndAgreement:false,
|
|
ignoreDefaultContract:false,
|
|
insertCustomerDiscount:false);
|
|
|
|
var newReceipt = newReceiptResult.Data.Receipt;
|
|
|
|
var articleItemsResult = session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
newReceipt,
|
|
isExternalArticle: false,
|
|
articleI3D,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D,
|
|
this.GetLoggedInUser());
|
|
|
|
var items = newReceipt.GetReceiptItems().ToList();
|
|
items.AddRange(articleItemsResult.Data.ReceiptItems.ToList());
|
|
newReceipt.SetReceiptItems(items);
|
|
|
|
return newReceipt;
|
|
}
|
|
}
|
|
} |