1,Common promotion models
The promotion management system is used in many places. It is often reflected that many small and medium-sized enterprises have their own promotional activities when they go to the supermarket. To engage in promotional activities, it is best to have application software support, in this way, flexible management is convenient. However, manual processing is inefficient. The categories and examples of common promotions are as follows:
Model Classification |
Serial number |
Example |
Bundled promotions |
1 |
Purchase one for each of TK001 and TK002 at a discount of 10 RMB. (TK001 and TK002 are product codes. Different units have different definitions .) |
2 |
Purchase one for each of TK001 + TK002 and one for TK003. |
3 |
Purchase two TK001 items, one TK002 item, and two TK002 items. |
4 |
Purchase one TK001 + TK002 each and enjoy a discount. |
5 |
Purchase one for each TK001 + TK002 at a preferential price of 10 RMB. |
Single item Promotion |
1 |
Purchase TK001 product, promotion price 10 yuan. |
2 |
Off for purchase of TK001. |
3 |
Purchase TK001 at a discount of 5 RMB. |
4 |
Purchase two TK001 products and one TK003 product. |
Combined promotion |
1 |
If you purchase one of TK001, TK002, TK003, and TK004, you will receive a discount on either of the two parts. |
2 |
If you buy a PK01 product, off for either of the two items. |
3 |
Purchase PK01, PC02, PA03 card goods meet 3, each promotional price 20 yuan. |
4 |
Purchase any one of PK01, PC02, and PA03 brands. You can purchase TK014 products for 10 yuan. |
5 |
If you purchase any one of PK01, PC02, and PA03 goods, you will be given one of TK004, TK005, and TK006 goods. |
6 |
Purchase PK01, PC02 brand any 1 item, you can purchase at a special price of 2 yuan TK006, TK007 any item. |
Customer Unit Price Promotion |
1 |
If you purchase TK001 for at least RMB 200, you will be given one piece of TK006 for at least RMB 300, and one item for TK007, TK008, and TK009. |
2 |
The total price is 50 yuan, so you can purchase TK011 at a special price of 2 yuan. |
3 |
Purchase TK001 for over 200 RMB, discount for 30 RMB, full 400 RMB for 60 RMB, and full 600 RMB for 90 RMB. |
Promotion of customer orders |
1 |
Purchase PA01 brand goods, in addition to goods TK017, any 2 pieces of TK003 a gift. |
2 |
Purchase PA01 brand goods, in addition to the product TK017, you can purchase the product TK003 at a special price of 1 yuan. |
2,Software Model Abstraction
Based on the above business model, you can abstract the brand name, product name, product number, number of purchased items, actual unit price, original unit price, individual amount, discount type, discount, and remarks. Among them, the discount type can be divided into none, discount, special price, promotion, discount, gift, these types of features are as follows:
Name |
Description |
None |
No discounts. |
Discount |
Use discounts for discounts. |
Special offer |
Fixed a very low price. |
Promotion |
Similar to the special offer, but the price is not necessarily low, but it is slightly lower than the original price. |
Discount |
Subtract a certain amount from the original price. |
Complimentary |
Customers do not need money. |
Because there are gifts or direct price reduction activities, it is important to fix several special items.
Serial number |
Product NO. |
Description |
1 |
L00001 |
$0.01 |
2 |
L00010 |
$0.1 |
3 |
L00100 |
1 RMB |
4 |
L01000 |
10 yuan |
3,CKRuleModeling above
The definition of objects is relatively simple.
The custom category is the sales record information, including unit price, data, and discounts. This content can be added according to the needs of end users, such as product barcode and other information.
The primary table record is the basic information of the customer.
To implement the diversified rules mentioned above, we generally need to set them by the customer rather than by the software developer. Otherwise, the software developer will be busy, without any benefits. To allow the customer's Computer Administrator to set the settings, it is relatively easy to understand. On the logical comparison interface, you can determine the items in the shopping cart, such as the brand, product, and number of items. All operations on commodities use commodity numbers, which facilitates computer identification.
The conclusion and operations are wonderful, such as discounts, discounts, promotions, and special prices.
These logical judgments and operations are essential for foreground user settings.
4,Promotion System implementation
According to the needs of the promotion system, the business is quite normal. It is a lot of malls, and the activities that sellers often do are not very complicated. However, from the perspective of technical implementation, it seems that it is too horrible and difficult to handle. Some things seem to be simply expressed in natural language and cannot be followed up in procedures.
It seems that every promotion should be controlled by a class, so many classes can solve the problem. If a customer wants to add new rules one day, then the original class must be modified or changed. From a simple perspective, we can also use more complex design patterns to solve the problem.
From a more standard perspective, more business abstraction, architecture abstraction, and object abstraction should be done. However, if developers just solve the shortage of resources in this industry or company, is it difficult to perform more in-depth abstraction and analysis? The promotion project is basically not ready. If you rush to get started, the workload for subsequent changes will be very large. The work will become more and more, but it will never be profitable.
CKRule solves the promotion problem from the perspective of business rule management and encapsulates frequently changed rules into the rule management system. Changes in rules do not affect the main program code, both technicians and business experts can modify rules as needed, and can modify and deploy rules when the program is running. This greatly facilitates the development of the promotion system.
5,Software Implementation
The definition of a sales order contains the product information of the sales subject and details, and the product information should be calculated again using the sales promotion rules to determine whether the products can be discounted or have any discounts, if you can offer a discount, you can enjoy the discount. In the implemented computing, a conflict may occur, that is, when multiple preferential conditions are met, the current software does not determine the conflict and will take effect, one or two discounts may be selected for the actual calculation.
The business rules of promotion management can be configured when the program is running without affecting the compilation of other code. The configuration interface is to call the configuration content above CKRule.
Initialize Rule interface
_ CurPackage = new RuleFacade (). GetPkgInst (RuleInstName ); Foreach (var item in _ curPackage. RuleLib. PoolRules. Keywords) { ListViewItem _ lvi = new ListViewItem (); _ Lvi. Text = item. Name; _ Lvi. Tag = item; // _ Lvi. ImageKey = "PicProperty "; _ Lvi. Group = lvTips. Groups [0]; LvTips. Items. Add (_ lvi ); } Foreach (var item in _ curPackage. RuleLib. PoolRules. LgcOperaWords) { ListViewItem _ lvi = new ListViewItem (); _ Lvi. Text = item. Name; _ Lvi. Tag = item; // _ Lvi. ImageKey = "PicMethod "; _ Lvi. Group = lvTips. Groups [1]; LvTips. Items. Add (_ lvi ); } Foreach (var item in _ curPackage. RuleLib. PoolRules. ConclusionWords) { ListViewItem _ lvi = new ListViewItem (); _ Lvi. Text = item. Name; _ Lvi. Tag = item; // new List <CallDef> () {item }; // _ Lvi. ImageKey = "PicMethod "; _ Lvi. Group = lvTips. Groups [2]; LvTips. Items. Add (_ lvi ); } |
After saving the rule, you need to refresh the rule engine by using the following method.
New RuleFacade (). Refresh (RuleInstName ); |
Use the following name on the computing interface for rule calculation.
_ Cond = new RuleFacade (). Exec (FrmRulePoolSet. RuleInstName, _ cond ); |
Source code download