wolflu05 / inventree-bulk-plugin

A bulk creation plugin for InvenTree, which helps you generating locations, categories and even parts in bulk by using customized naming strategies and ensure them along your complete storage tree.
MIT License
17 stars 1 forks source link

[FEATURE] Allow word to be used in dimension field #4

Closed eeintech closed 1 year ago

eeintech commented 1 year ago

In addition to ranges and generic names, add single count dimensions with words in them, example:

image

wolflu05 commented 1 year ago

This would be one option, I imagined this like comma separated values in combination with the a-c syntax, so that we can do something like a-f,hello,k-o,world. What do you think of that?

eeintech commented 1 year ago

This would be one option, I imagined this like comma separated values in combination with the a-c syntax, so that we can do something like a-f,hello,k-o,world. What do you think of that?

Yup that's a good idea!

wolflu05 commented 1 year ago

Hello @eeintech,

I'm currently implementing this and asking myself, how should this behave if there are "Infinity-generators" being used? I have three options in mind, what do you think would be best?

E.g.: dimensions=a-c,NUMERIC,hello,1-3,world and count=10

  1. Infinity generators take up the remaining space to generate count elements => a,b,c,1,2,hello,1,2,3,world

However, what should happen if we use two infinity generators?

  1. I already have a new syntax planned for configuring generators (where they should start, step width, leading/pending filling with zeros) NUMERIC{count_from=5,step=2}. Then I could also add an option for count like that: a-c,NUMERIC{count=5},hello,1-3,world => a,b,c,1,2,3,4,5,hello,1.

If I would do so next issue would be how to differentiate between words and names of Infinity generators? My idea was to use some kind of unpacking syntax like python with an * before the infinity generators. a-c,*NUMERIC{count=5},hello,1-3,world. (Disadvantage: * cannot be used as first character of a word)

  1. Infinity generators are not allowed in such lists
eeintech commented 1 year ago

@wolflu05 I would keep it simple and limit options else support and tests will be become very challenging, also for maintenance purposes. IMO it's okay to separate and have to repeat an operation twice, so I would go with this:

  1. dimensions=a-c,hello,1-3,world => count is skipped
  2. dimensions=NUMERIC => count is mandatory
  3. dimensions=a-c,NUMERIC,hello (mixing finite and infinite quantities) => NOT allowed
wolflu05 commented 1 year ago

@eeintech I planned the inputs from beginning to be able to have adjustable templates which can be reused. E.g. your drawer shelves are available in 15/48/60 drawers per shelve. So you only need one template and you can adjust the number of drawers without looking deeper into the options of the template. But, if your shelves always have at the bottom one big drawer (like one user mentioned on the inventree discussion), you need to mix infinity generators and finite generator patterns. (Currently the input options are not fully integrated into all parameters, but I will do that soon)

What do you think about my proposed configuration syntax for infinity generators? Or should the be more input fields (also means the page is getting bigger and reduces overview) to configure step width, starting position? But then I can't use them in such lists.

To 1 from your reply: Currently the count parameter can already limit finite dimensions.

eeintech commented 1 year ago

I'm not sure to grasp what you are saying so I'm not sure what makes more sense. I think you should go with what you have in mind for the moment for the syntax and then see if you run into edge cases than cannot be solved otherwise than changing the syntax.

wolflu05 commented 1 year ago

@eeintech I implemented a much more powerful and extension-able generators setup in #7. Maybe you can give it a look what do you think? I added documentation about this change also to the readme.

Maybe I should do documentation with docusaurus some time to make it more readable.

eeintech commented 1 year ago

@wolflu05 Sorry won't have much time to review and comment in the next few weeks, thanks for letting me know though.

wolflu05 commented 1 year ago

This is now implemented. See #7