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
144 lines
5.3 KiB
C#
144 lines
5.3 KiB
C#
using System.Collections.Generic;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.BusinessLogic.WebServices.Warehousing;
|
|
using Centron.Data.WebServices.Sales.Receipts.CreditVouchers;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Interfaces.Sales.Receipts.InsertReceipts;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.EntitiesWrongPlace.Sales.Receipts.DataAndResults;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket139258;
|
|
|
|
public class Ticket139258Tests : EndToEndTest
|
|
{
|
|
public Ticket139258Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreColumn("Datum");
|
|
}
|
|
|
|
public const int ArticleI3D = 17;
|
|
public const int BarcodeI3D = 84;
|
|
public const int InvoiceI3D = 43;
|
|
|
|
public override void Execute()
|
|
{
|
|
// In this ticket the problem was the following:
|
|
// 1. create invoice with some barcode (we already have a test-invoice in the database)
|
|
// 2. create credit-voucher from that invoice (barcode is open again)
|
|
// 3. close the barcode manually in the UI
|
|
// 4. create a new version of the credit-voucher from 2.
|
|
// => Barcode is open again
|
|
//
|
|
// This is incorrect, the barcode should stay closed
|
|
|
|
this.PrepareDatabase();
|
|
|
|
this.VerifyBarcode("1_Original");
|
|
|
|
var creditVoucher = this.ForwardInvoiceToCreditVoucher(InvoiceI3D);
|
|
this.VerifyBarcode("2_AfterCreditVoucher");
|
|
|
|
this.BookOutBarcodeManually(BarcodeI3D, ArticleI3D);
|
|
this.VerifyBarcode("3_AfterManualClose");
|
|
|
|
this.CreateNewVersionOfCreditVoucherAndSave(creditVoucher);
|
|
this.VerifyBarcode("4_AfterNewVersionOfCreditVoucher");
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
this.Sql("ALTER TABLE GutKopf DROP COLUMN LcmStatus");
|
|
|
|
this.Sql($"UPDATE dbo.RechKopf SET ZahlKondID = 5, Bar = 0 WHERE I3D = {InvoiceI3D}");
|
|
}
|
|
|
|
private void VerifyBarcode(string name)
|
|
{
|
|
this.Verifier.VerifyTable($"{name}_Barcode", "dbo.Barcode", $"I3D = {BarcodeI3D}");
|
|
this.Verifier.VerifyTable($"{name}_BarcodeHistory", "dbo.BarcodeHistory", $"BarcodeI3D = {BarcodeI3D}");
|
|
this.Verifier.VerifyTable($"{name}_SeriennummerToPosition", "dbo.SeriennummerToPosition", $"SNI3D = {BarcodeI3D}");
|
|
}
|
|
|
|
private ReceiptCreditVoucherDTO ForwardInvoiceToCreditVoucher(int invoiceI3D)
|
|
{
|
|
var creditVoucher = (ReceiptCreditVoucherDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().ForwardReceipt(
|
|
CentronObjectKindNumeric.CreditVoucherClass,
|
|
this.GetLoggedInUser().User,
|
|
new ForwardReceiptData
|
|
{
|
|
CreateReceiptData = new CreateReceiptData
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
CreateReceiptItemsFromExistingItemsData = new List<CreateReceiptItemsFromExistingItemsData>
|
|
{
|
|
new()
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
},
|
|
IgnoreCallbacks = true
|
|
},
|
|
new List<ReceiptToForward>
|
|
{
|
|
new ReceiptToForward
|
|
{
|
|
ReceiptKind = CentronObjectKindNumeric.InvoiceClass,
|
|
ReceiptI3D = invoiceI3D,
|
|
}
|
|
},
|
|
null,
|
|
InsertReceiptTakeoverOptions.Reference,
|
|
true,
|
|
false)).ThrowIfError().Receipt;
|
|
|
|
return this.SaveCreditVoucher(creditVoucher);
|
|
}
|
|
|
|
private void BookOutBarcodeManually(int barcodeI3D, int articleI3D)
|
|
{
|
|
this.WithSession(s => s.GetBL<BarcodeWebServiceBL>().CheckOutSerialNumbers(
|
|
new List<int> { barcodeI3D },
|
|
"Some reason",
|
|
adjustStockInventory: true,
|
|
this.GetLoggedInUser().User,
|
|
returnWithAdditionalInformations: false,
|
|
articleI3D)).ThrowIfError();
|
|
}
|
|
|
|
private ReceiptCreditVoucherDTO CreateNewVersionOfCreditVoucherAndSave(ReceiptCreditVoucherDTO creditVoucher)
|
|
{
|
|
var newVersion = (ReceiptCreditVoucherDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().CreateNewVersion(
|
|
creditVoucher.ReceiptKind,
|
|
creditVoucher.I3D,
|
|
version: null,
|
|
newContactPersonI3D: null,
|
|
this.GetLoggedInUser().User,
|
|
new CreateNewVersionData
|
|
{
|
|
IgnoreCallbacks = true
|
|
})).ThrowIfError().Receipt;
|
|
|
|
return this.SaveCreditVoucher(newVersion);
|
|
}
|
|
|
|
private ReceiptCreditVoucherDTO SaveCreditVoucher(ReceiptCreditVoucherDTO creditVoucher)
|
|
{
|
|
var savedCreditVoucher = (ReceiptCreditVoucherDTO)this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
creditVoucher,
|
|
this.GetLoggedInUser().User,
|
|
new SaveReceiptData
|
|
{
|
|
IgnoreCallbacks = true,
|
|
},
|
|
autoLockIfNewReceipt: false,
|
|
CreatedThroughApplication.WebServices,
|
|
receiptTemplateFolderI3D: null)).ThrowIfError().Receipt;
|
|
return savedCreditVoucher;
|
|
}
|
|
} |