These days to finish a "custom formula calculation" scheme, feel more interesting, here to share under!
The solution is for some users who need to define "calculation formulas" themselves, and then through this formula to calculate the results of this demand, particularly applicable with some products of the BOM (in the production of the BOM, you need to set the BOM in the number of each item, when this BOM in more complex time directly to set the number of items , this can not be satisfied, because some materials are related to some of them, so the data also want to use the formula to establish the relationship and the number of.
For example, a product consists of B and C, there is a certain correlation between B and C, the number of C is 2 with B, when this happens, users want to modify the number of B, and then linkage to modify the number of C, but these formulas need to allow users to define their own. The problem with this kind of test is that it can be done by this.
Probably can solve the problem, we should understand it! So how to use and rationale?
Let's start with the user perspective:
1, the user defines the following structure of the product BOM:
2, now go to need the relevant product set quantity formula, so as to achieve the effect of the linkage change
Formula for related products:
Product C:return [Product b]+[product D];
Product E:return [Product c]*2 + 10; .....
Here's a description of the formula: the parameters in the formula must be in "[]", must have return, in addition to these two, the other definition of the specification is the same as C #, because the internal is to convert these into code to execute. In fact, here, the definition of the formula for the user, or need to do some simple training, because the user to familiarize themselves with C # simple arithmetic calculation and some basic specifications.