Prototyped the barcode idea; Added a basic production system.

This commit is contained in:
Wynne Crisman
2019-10-07 15:51:50 -07:00
parent 8211da6b39
commit 2e57558ef4
50 changed files with 8949 additions and 782 deletions

View File

@@ -132,12 +132,12 @@ const ProductsSchema = new SimpleSchema({
label: "Updated On",
optional: true
},
deactivated: {
deactivated: { //This is turned on first, if true it will hide the product in production views, but keep the product available in the sale views. It is intended to be turned on for products that are no longer produced, but for which we have remaining inventory.
type: Boolean,
label: "Deactivated",
optional: true
},
hidden: {
hidden: { //Deactivated must first be true. Hides the product everywhere in the system except in historical pages. The inventory should be all sold prior to hiding a product.
type: Boolean,
label: "Hidden",
optional: true
@@ -188,6 +188,10 @@ if(Meteor.isServer) {
if(measures) check(measures, [String]);
if(Roles.userIsInRole(this.userId, [Meteor.UserRoles.ROLE_UPDATE])) {
//Lookup the most likely next barcode id from the db, then attempt to insert with it. If it fails due to duplication, then increment and repeat.
//let cursor = Products.find({}, {barCodeId: 1}).sort({barCodeId: -1}).limit(1); //Since currently products are never removed, we shouldn't need to detect sequence gaps and fill them in (odds are we will never use more than 10k numbers anyway).
//let barCodeId = cursor.hasNext() ? cursor.next().barCodeId : 1;
//
Products.insert({name, tags, aliases, measures, createdAt: new Date()}, {bypassCollection2: true}, function(err, id) {
if(err) console.log(err);
});