This article describes how to realize the financial reconciliation module of the Inventory Management System, the financial reconciliation module includes two menu pages for supplier reconciliation and customer reconciliation. Vendor and customer reconciliation fields are the same, so you can share a page component class.
- Project code: JxcLite
- Open source address:/known/JxcLite
1. Configuration module
Run the project, configure the following module menu in [System Management - Module Management], refer to the previous tutorial for configuration tutorial.
Level 1 module | Secondary modules | coding | icon (computing) | Url | descriptive |
---|---|---|---|---|---|
financial management | Finance | property-safety | |||
Customer statements | CustomerAccount | unordered-list | /fms/CustomerAccount | Inquire and maintain customer statement information. | |
Vendor statements | SupplierAccount | unordered-list | /fms/SupplierAccount | Query and maintain vendor statement information. |
2. Entity classes
existJxcLite
sports eventEntities
Under the folder addcap (a poem)
Two entity class files , entity class code can be directly copied from the module management generated by the model settings code. Article only a brief description of the definition of the entity class , the specific code see the open source , the code definition is as follows:
namespace ;
/// <summary>
/// Statement header information class。
/// </summary>
public class JxAccountHead : EntityBase { }
/// <summary>
/// Statement form information class。
/// </summary>
public class JxAccountList : EntityBase { }
3. Table-building scripts
show (a ticket)sports event
Resources
folder of theresource file, copy and paste the table building script generated by the [module management - model settings]. The article only briefly describes the table building script, the specific script see the open source, as follows:
CREATE TABLE [JxAccountHead] (
[Id] varchar(50) NOT NULL PRIMARY KEY,
...
[Files] nvarchar(500) NULL
);
CREATE TABLE [JxAccountList] (
[Id] varchar(50) NOT NULL PRIMARY KEY,
...
[BillId] varchar(50) NOT NULL
);
4. Service interfaces
existJxcLite
sports eventServices
Add the Financial Management Module service interface below the folder with the file name defined asThis interface defines Api access methods for front and back-end interaction, including paging queries, batch deletion of entities, and saving entities. Specific method definitions are as follows:
namespace ;
public interface IFinanceService : IService
{
// Query customer or supplier statements by paging, filtered by query criteria Type field.
Task<PagingResult<JxAccountHead>> QueryAccountsAsync(PagingCriteria criteria) ;
//Get the default statement information based on the bill type.
Task<JxAccountHead> GetDefaultAccountAsync(string type);; //Batch delete statements by type.
// Delete the header and body information of the statement in batch.
Task<Result> DeleteAccountsAsync(List<JxAccountHead> models); //Save the statement header and body information.
//Save the statement header information
Task<Result> SaveAccountAsync(UploadInfo<JxAccountHead> info);
}
5. Service realization
existsports event
Services
Add the implementation class for the service interface of the financial management module under the folder with the filename defined as, the article only briefly describe the definition of the implementation of the class and inheritance, the specific implementation of the see open source, defined as follows:
namespace ;
class FinanceService(Context context) : ServiceBase(context), IFinanceService
{
public Task<PagingResult<JxAccountHead>> QueryAccountsAsync(PagingCriteria criteria) { }
public Task<JxAccountHead> GetDefaultAccountAsync(string type) { }
public Task<Result> DeleteAccountsAsync(List<JxAccountHead> models) { }
public Task<Result> SaveAccountAsync(UploadInfo<JxAccountHead> info) { }
}
double-click to openin the project
file in the
AddJxcLiteCore
method to register the service class, and the front-end component can create instances of the service through the dependency injection factory. The code is as follows:
public static class AppWeb
{
public static void AddJxcLiteCore(this IServiceCollection services)
{
<IFinanceService, FinanceService>();
}
}
6. Data dependency
existsports event
Repositories
Add the Financial Management Module data dependency class below the folder, with the filename defined as, the article only briefly describes the definition of the dependency class, the specific implementation of the see open source, the definition is as follows:
namespace ;
class FinanceRepository
{
internal static Task<PagingResult<JxAccountHead>> QueryAccountsAsync(Database db, PagingCriteria criteria) { }
internal static Task<List<JxBillList>> GetBillListsAsync(Database db, string headId) { }
//Get the maximum business order number based on the prefix
internal static Task<string> GetMaxAccountNoAsync(Database db, string prefix) { }
internal static Task DeleteAccountListsAsync(Database db, string headId) { }
internal static Task DeleteAccountListAsync(Database db, string headId, string billId) { }
}
7. List page
existsports event
Pages\Finance
Under the folder addBill list component , the component is a list of customer and supplier statements component common class , see the open source for specific implementation , part of the code is as follows :
namespace ;
public class AccountList : BaseTablePage<JxAccountHead>
{
private IFinanceService Service;
//Obtain reconciliation type(our customers、provider),Override this type by the specific statement page
protected virtual string Type { get; }
protected override async Task OnPageInitAsync()
{
await ();
Service = await CreateServiceAsync<IFinanceService>();//Create Service
= typeof(AccountForm);//Customizing form types
= QueryAccountsAsync; //Search method
//Here is the template for setting the list field display
(c => ).Template((b, r) => ());
(c => ).Type();
}
//additional
public async void New()
{
var row = await (Type);
(, row);
}
//compiler
public void Edit(JxAccountHead row) => (, row);
//Batch deletion and deletion
public void DeleteM() => ();
public void Delete(JxAccountHead row) => (, row);
//derive
public async void Export() => await ExportDataAsync();
private Task<PagingResult<JxAccountHead>> QueryAccountsAsync(PagingCriteria criteria)
{
//Setting Statement Type Inquiry Criteria
(nameof(), , Type);
return (criteria);
}
}
8. Table head assembly
first opensports event
Shared
Under the folderfile, add the statement header type form component with the following code:
namespace ;
public class AccountHeadTypeForm : AntForm<JxAccountHead> { }
relocatesports event
Pages\Finance
Under the folder addfile, see the open source for the implementation, part of the code is as follows:
@inherits BaseForm<JxAccountHead>
<AccountHeadTypeForm Form="Model" ShowAction>
<AntRow>
<DataItem Span="8" Label="statement number" Required>
<AntInput Disabled @bind-Value="@" />
</DataItem>
<DataItem Span="8" Label="status of documents">
<KTag Text="@" />
</DataItem>
<DataItem Span="8" Label="Reconciliation date" Required>
<AntDatePicker @bind-Value="@" />
</DataItem>
</AntRow>
<AntRow>
<DataItem Span="8" Label="Business Partners" Required>
<PartnerPicker Value="@" AllowClear Type="@"
ValueChanged="e=>=e[0].Name" />
</DataItem>
<DataItem Span="8" Label="Date of operation" Required>
<AntRangePicker @bind-RangeValue="@" />
</DataItem>
<DataItem Span="8" Label="total amount">
<AntDecimal @bind-Value="@" /> unit of money (in PRC: Chinese yuan, in USA: dollar, etc)
</DataItem>
</AntRow>
<AntRow>
<DataItem Span="8" Label="contract number">
<AntInput @bind-Value="@" />
</DataItem>
<DataItem Span="8" Label="invoice number">
<AntInput @bind-Value="@" />
</DataItem>
</AntRow>
<AntRow>
<DataItem Span="24" Label="note">
<AntTextArea @bind-Value="@" />
</DataItem>
</AntRow>
<AntRow>
<DataItem Span="24" Label="attachment (email)">
<KUpload @ref="upload" ReadOnly="" Value="@"
OpenFile IsButton="!" OnFilesChanged="OnFilesChanged" />
</DataItem>
</AntRow>
</AccountHeadTypeForm>
@code {
private KUpload upload;
private async void OnFilesChanged(List<FileDataInfo> files)
{
if ()
{
[nameof()] = files;
}
else
{
[nameof()] = files;
await (d => (), false);
}
}
}
9. Business order form component
relocatesports event
Shared
Under the folder addfile , the component is a list of billing details , the specific implementation of the open source , part of the code is as follows :
namespace ;
public class BillHeadTable : BaseTable<JxBillHead>
{
private IBillService Service;
[Parameter] public JxAccountHead Account { get; set; }
protected override async Task OnInitAsync()
{
await ();
Service = await CreateServiceAsync<IBillService>();
= true;
= QueryBillsAsync;
if (!ReadOnly)
{
(nameof(New));
(nameof(DeleteM));
= ;
}
(c => , true).Width(100);
(c => ).Width(100).Template((b, r) => ());
(c => ).Width(100).Type();
(c => ).Width(150);
(c => ).Width(100);
(c => ).Width(100);
(c => ).Width(100).Sum();
(c => ).Width(200);
if (!ReadOnly)
{
(nameof(Delete));
}
}
public void New() { }
public void DeleteM() { }
public void Edit(JxBillHead row) { }
public void Delete(JxBillHead row) { }
private Task<PagingResult<JxBillHead>> QueryBillsAsync(PagingCriteria criteria)
{
[nameof(BillQueryType)] = ;
("BizId", , );
return (criteria);
}
}
10. Forms component
relocatesports event
Pages\Finance
Under the folder addfile, the component for the statement pop-up form component, divided into the header information and reconciliation details of the two tabs, the code is as follows:
namespace ;
class AccountForm : BaseTabForm
{
[Parameter] public FormModel<JxAccountHead> Model { get; set; }
protected override async Task OnInitFormAsync()
{
await ();
("Table header information", BuildHead);
("Reconciliation details", BuildList);
= b => ();
}
private void BuildHead(RenderTreeBuilder builder)
{
<AccountHead>().Set(c => , Model).Build();
}
private void BuildList(RenderTreeBuilder builder)
{
<BillHeadTable>()
.Set(c => , )
.Set(c => , )
.Build();
}
}