Many believe that 1C can serve only accounting. In fact, it is not. The value of the 1C: Enterprise platform is underestimated. The purpose of the article is to show that 1C: Enterprise 8.3 can be successfully applied when building non-standard solutions on the Internet. 1C can be a convenient tool for many areas: from a small IT project to a developed multi-server system. I propose to discuss the flexibility and applicability of the 1C platform to the construction of web projects and startups. To enhance the effect of 1C is considered in conjunction with the .Net framework: Asp.Net MVC.
The article was written on the basis of several non-standard web projects: personal and corporate, successful and not so. Here you will not find guidelines for creating regular online stores, because this is a standard task well described in other sources. I include examples of non-standard projects: service of checking charges on a discount card from several 1C, a site of announcements for a newspaper, an internal site of voting for goods between sellers. This also includes strongly non-standard online stores: shops with several regions, currencies and prices; shops with goods from different bases 1C; shops unique products tied to production.
Startups are created under conditions of high uncertainty, and successful startups are accompanied by rapid growth. Many IT innovations within the company behave in the same way: after implementation, they will be in demand or written off as unnecessary. Due to the high uncertainty, no one can say whether the project will be successful or not. For the same reason, at the initial stage, no one wants to invest a lot of money. Investments are made gradually, taking into account the achieved or planned result.
I offer you a guide. The development of the project is divided into steps. Each step extends the limitations that arise after doing the previous ones.
')
Step 1. Create a configuration on 1C
This step is needed to create a data structure and an interface for quickly entering and editing data. In typical 1C configurations, the data structure is created, and only refinement is required. In new configurations you need to do everything from scratch.
To get started, you need to find 1C. It is desirable legally. There are several options:
- Your company already has acquired 1C for accounting. It is important that this is not a basic edition where configurations cannot be edited.
- Free version for training - has several limitations. The main limitations are single-user, there is no possibility of a COM connection and publishing via the web. This means that in step 2 it will be useless.
- A set of specialist in development and implementation. Sold only to students of training courses. The cost in the region of 3000 rubles. Has a license for 1 connection.
- Buy 1C Technological Delivery for 10,000 rubles or any Professional editors for the same amount. Delivery per user.
Configurations 1C are created and finished quickly. For a week course, for example, you can create a system for the accounting of goods. With the main types of objects, however, still have to figure out. When you create any object in 1C, you immediately get a table in the database and tools for entering and modifying data: the list and item forms. At the first stage, this greatly simplifies the work, since it removes the need for parallel development of the administrator interface. The most frequently used objects: directories, enumerations, registers of information, processing, user roles.
In many cases, it is better to start a new configuration with the free library BSP from 1C, which includes the main mechanisms of work. Commonly used BSP mechanisms: work with users, additional requisites, attached files, printing. Biting individual subsystems is a task of increased complexity: 1C creates monolithic configurations with a large number of interconnections.
It is important to write immediately managed application on managed forms. This approach will allow in the future to publish the interface via the Internet. 1C since version 8.2 allows you to work with a project from the Internet.
Do not hesitate to use Russian names in the 1C configuration. First of all, this is customary in 1C, and secondly, you can save on documentation. At the same time, the involvement of new developers in the project will be reduced.
At this stage, the platform allows you to create a data structure, fill objects with test data. Roles and rights of pre-installed users are laid down. The configuration automatically starts working as an administrative interface, where all data entered from the outside can be moderated. Such an administrative interface is easier to maintain and refine than to implement independently using PHP or Asp.Net. The developer at this stage has access to many universal treatments from the company 1C and from professional communities. For example, often will save the processing of group changes directories and documents.
Step 2. Publish 1C configuration via web server
By this step, the data structure was determined, it is convenient to enter data manually or automatically by means of 1C. The entered data is also convenient to edit and mark for deletion. Added user roles and defined their rights, for example, full rights and a normal user.
Not enough access to the project via the Internet. 1C, starting with version 8.2, allows you to publish yourself on the Internet. Publishing is done via Apache or IIS web server. Detailed manuals are in the documentation and the Internet. Take advantage of them. To access the project from the external network, you will need a dedicated IP address or a configured dynamic DNS.
From this moment the website starts to open. 1C creates its own interface automatically based on the managed forms that were used in the development of the configuration. New users are added manually in the configurator, their access rights are also set there. The functionality available to users is built on the basis of 1C subsystems and their roles.
Despite the fact that the interface is built automatically and is not as flexible as HTML, it can be used for demonstrations. In some cases, if development is underway for an intranet, the project ends at this step. Please note, if you leave everything as it is, each connection through the web interface will require an additional 1 1C license, so it is advisable to proceed to the next steps and remove this restriction.
Step 3. Create an Asp.Net MVC project
The previous step allowed to open the project via the Internet. However, the following restrictions apply. The web project is almost not manageable: it is built automatically 1C and has few options for customization. As a result, you can forget about SEO-optimization or rich design possibilities of HTML and CSS. In addition, a 1C web connection requires a lot of paid licenses. It is time to link 1C with Asp.Net MVC here and in the next step.
Why use a web framework, not a CMS? The web framework is very flexible and in the future you can change everything in the project, including the architecture. Startups in the face of uncertainty are very volatile, so flexibility is important here. When using a CMS, it will be necessary to deal with the structure of the CMS and with the platform on which the CMS is written, and then to maintain synchronous configuration of the 1C, CMS and, most importantly, the exchange between them. In addition, data is stored in several databases, which means there is a possibility of inconsistency.
Why Asp.Net, not PHP or Java? Because I understand C # more than other languages, and I know 2 ways to integrate Asp.Net with 1C more than with other platforms. And these 2 ways will provide an invaluable service in the following steps. In addition, Asp.Net and C # successfully work with the names of objects in Russian.
Why Asp.Net, but not http-services 1C? Because 1C is very slow and because in http-services most of the operations will have to be written independently: processing the cache with a given time, checking the security, etc. And all this multiplied by limited functionality: no multithreading, no LINQ, no regular image processing tools. Writing a URL (CNC) in http-services is difficult to manage, which will negatively affect SEO.
Create a new project Asp.Net MVC 5.2.3. Immediately lay in its foundation jQuery and Bootstrap. In the future, you will receive an application compatible with mobile devices and tablets. You will also get answers to most of your questions in professional communities that are larger than the 1C community 10 times. You will not need to invest in the design at the first stage: the standard Bootstrap elements look simple and stylish. You can customize the colors of the styles of Bootstrap - it allows you to do this through your website.
Do not be lazy to immediately add the code of Google Analytics and Yandex Metrics. The sooner statistics gather, the better.
Step 4. Link the Asp.Net MVC project with 1C
At the previous step, the Asp.Net project was created, but it has nothing to do with the data in 1C. Now is the time to link 2 platforms. It is important to agree on the division of duties: 1C manages data and implements the administrative interface, Asp.Net quickly serves web requests and implements the user interface.
Attracted to the project C # -flanders first surprised and can not find the administrator interface in the project. This interface is implemented in 1C, and more often implemented automatically by 1C. For example, you just added a directory object, and 1C can already open the add / edit form and the list form. The list form immediately supports 20 functions for filtering, sorting, searching and outputting to other formats. Editing form knows all the types of details used.
There are many ways to connect 1C and Asp.Net, but there are several approaches for interactive work. These ways: http-services (previously clumsy SOAP-protocol), COM-connection and Elisy Business Connector (EBC). I prefer to work with the Elisy Business Connector (EBC) not only because I am its author, and it is available to me for free (the component is paid). I am rather the author, because I know the disadvantages of other integration methods.
HTTP services operate on the 1C side and can return only 2 types: string or binary data. There is no means for working with binary data in 1C, it can only return the whole picture. The rest of the data must be serialized to a string. This can be XML or JSON. Any 1C code is very slow, especially when working with strings, so serialization in JSON code 1C can take minutes. Next, the line must be parsed on the Asp.Net side. The Business Connector is devoid of these shortcomings: it connects to any server function and can get a larger set of types without serialization: primitive types, structure, array, object references. On the Asp.Net side, the programmer will work with his familiar C # types.
COM-connection requires the installed client 1C on the computer where the web server is located. This can be problematic if hosting is used: none of the providers will allow you to install a third-party dll on a shared server with multiple users. The second disadvantage is that the client version must always match the server version. If the server version has changed, you need to update the client version. Business Connector is designed as an assembly .Net framework, copied with the project and does not require registration in the registry. The component needs to be updated rarely only if the 1C Configuration Compatibility Mode parameter has been updated.
There is a common problem of integrating the two platforms. If the code of business logic is located on 1C, i.e. on the 1C side, the request is executed, the result is processed and returned to Asp.Net, this may complicate the development of the site. Because to add even small changes, you must first update the 1C configuration, and maybe not one, if you work in a distributed system. Therefore, at the stage of active development, it is advisable to create common functions for executing an arbitrary request, request packet and arbitrary code on the 1C side, and store and execute 1C code and 1C requests on the Asp.Net side. The executable code will still check the user's rights on the 1C side according to his role.
Feel free to give names to C # files, classes and methods in Russian. It is better if they coincide with the Russian names of 1C objects. In the future, such synchronicity will save you from having to keep a dictionary of translations. You will not spend time searching for matches, for example, that the Categories class corresponds to the Directory Sections in 1C. You will not waste time searching for an English translation of the Order of the Buyer or the Nomenclature. This is also patriotic along with the addition of the flag of your country to the resources of the Asp.Net project.
Particularly noteworthy is the performance of the Asp.Net application. Cache everything you can on the Asp.Net side. Choose adequate cache time. For example, for rubrics or goods, the storage time in the cache can be a day, and for the remnants of goods 1 hour. Combine several 1C requests into a batch so that the requests are executed simultaneously in one call to the server.
Step 5. Add support for mobile devices
The site on Asp.Net has earned and reflects 1C data. This opens up the possibility for one more direction: support for mobile devices. According to my statistics, about half of users work with the site via mobile devices, and 7% through tablets.
Do not write a mobile application right away. First, it is better to study the needs of users, to create a mobile version of the site. Then grind the mobile version of the site. Only then, when the mobile site becomes stable, use it as a technical task for developing a mobile application.
In fact, we did half of the work on writing the mobile version of the site, initially laying into the project Bootstrap. If you open your project right now through a mobile application or tablet, the content will be reasonably displayed. It remains to add some styles of Bootstrap, specific to smaller screen sizes.
Step 6. Monetize the project
Suppose now that the project has become popular and users are ready to pay for your services. It would be nice to add payment acceptance and billing at this stage: set up accounting.
I will give an example of the importance of accounting. One foreign hosting, who did not know about 1C and did not read this manual, has been servicing my site for several years. It turned out that earlier when transporting websites to their competitor, I forgot about one project. He worked steadily all this time. It did not occur to the head that the site had lagged behind others in the move, until it wanted to make small changes. It turned out that the site was located in a company that I hadn’t paid for for several years, but they didn’t ask. I think that besides me they still have defaulters.
At this step, we will not particularly regret that they took 1C as a basis for the project. Because taking into account any balances: goods, money, IBE, bonuses is a common thing for the platform. This is accomplished by adding the accumulation register and the necessary documents to the 1C configuration. The balance and invoices can also be transferred to the user's account via Asp.Net.
With a high degree of probability, full-fledged accounting will not work out on your own. But this is not required, since there is a widespread 1C: Accounting. This is another reason to rejoice at the engine from 1C, since there is a regular method of exchange between platforms: data exchange exchange plans. Through the conversion rules, all exchanges of typical 1C configurations are configured. However, you still have to figure out, find correspondences between objects and make the appropriate settings.
Usually payment comes from payment systems. Do not rush to fully automate the entire process through Asp.Net. At the first stage, it is enough to manually transfer payments in 1C, which are reported by the system in e-mails. Invest resources in automation when there are many such operations. When automating you may need an SSL certificate and website translation to https. Do not mess with disparate payment systems, but choose the payment integrator at the first stage. The difference of 1-2%, which the integrator will take as a reward, is not significant for small revolutions.
Step 7. Develop the project
Technically, the project is ready and performs all the functions assigned to it. Do not stop there. The project must constantly evolve in order to compete with similar developments. For the development will need to make the right decisions. To make the decisions correct it is enough to take them on the basis of facts. Facts in our case may be the data obtained from the reports.
At the time of the creation of the Asp.Net project, we connected metrics to collect statistics from Google Analytics and Yandex Metric. They honestly worked, and now you can get the first sane reports based on them. Which pages are the most popular, what users are looking for, how to move between pages, from which cities and countries.
Although Google and Yandex metrics give out statistics, that's not all. There are internal reports 1C on SKD. They allow you to quickly receive samples by internal 1C objects often without writing code: debts by users, hierarchy of headings, distribution of objects by headings, the most popular products in baskets and favorites, users registered, but did not add anything to the basket, etc.
Step 8. Transfer 1C to DBMS
Before this step, most likely, the 1C database was file. To increase the speed of work, it is time to transfer it to a DBMS. 1C allows you to work with the DBMS through the server 1C, which you need to buy. View licensing is possible on the package “1C: Enterprise 8.3. Server MINI for 5 connections ”.
DBMS is better to choose MSSQL. The fact is that 1C has traditionally been working with this DBMS all the years, and it has accumulated the most experience compared to other databases. Another reason is that MSSQL is useful in the following steps for a multiple increase in performance.
Directions how to save on MSSQL:
- Choose a free MSSQL 2014 Express. It is necessary to look, whether restrictions of free edition under the project approach.
- Order Asp.Net hosting with the ability to host MSSQL databases. In the US, you can find 200 GB of MSSQL database for $ 14 per month.
Step 9. Repeatedly increase the exchange rate with 1C
At this stage, the project has stabilized. The data structure is made less changes. You can look in the direction of direct access to the database without the mediation of 1C. In many cases, work will accelerate 50-100 times. It is better not to perform this step until the data structure stabilizes. Maintaining direct access is more difficult than using the built-in capabilities of 1C when working with user requests and rights. Plus, there will be a problem in 1C distributed databases: the data recorded in the DBMS is not recognized by 1C as changed and will not go through the exchange plans.
1C did a lot to prevent direct access: in the database encoded the names of tables and fields. Moreover, the names may differ for different information bases on the basis of the same configuration. A convenient workaround does exist. It is based on Linq, settings for which can be obtained with the Elisy LinqTo1C utility.
The meaning and technique of LinqTo1C is disclosed in other articles:
Direct entry to the 1C: Enterprise Directory via Linq on the example of working with Asp.Net usersUnusually-economical use of 1C: Enterprise 8 on Asp.Net-hostingStep 10. Create a distributed system
After several years, your project will grow many times over, and the server will no longer cope with the load. CDN will not help either. To further develop, first run in parallel several Asp.Net web servers with access to one 1C. And then translate 1C into several connected servers joined by an exchange plan.
In the 1C configuration, the easiest way is to create a full exchange plan in which to connect all the objects. Care must also be taken that objects created by users have a unique code. In 1C environment, uniqueness is achieved by prefixes to the number. Objects are unique within a few nodes.
It will be necessary to solve the problem of the relationship of direct access to the DBMS and 1C exchange plans. The data recorded in the DBMS directly is not visible by the 1C platform as changed. I did not try to solve the problem, because I did not reach the last step due to the low popularity of projects in which I participated. I think by the time you have a million active users, you will know the solution.
Conclusion
As a result, we got a working project, coping with a large load. Asp.Net saved 1C license. The project architecture is flexible, allowing for relatively fast expansion and change of functionality. There are no restrictions on growth in the form of a CMS - change the architecture as the project is rethought.
The problem of billing, payment and accounting is solved in the same system. Users rejoice at the beautiful, lightweight, modern HTML5 + CSS3 interface, unaware that there is a web interface from 1C. All content is indexed by search engines. SEO events are held and the site is issued in the top search salaries. Mobile devices are supported through the mobile version of the site, and Google confirms this.
It's time to create a new project. Each subsequent project will require less investment than the first, since the entire infrastructure has already been purchased and configured, and the general classes and Asp.Net equipment will be transferred to a new project.