mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Load (and cache) tracked BOM items for this build output
This commit is contained in:
		@@ -865,9 +865,44 @@ function loadBuildOutputTable(build_info, options={}) {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // List of "tracked bom items" required for this build order
 | 
				
			||||||
 | 
					    var bom_items = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function updateAllocationData(rows) {
 | 
				
			||||||
 | 
					        // Update stock allocation information for the build outputs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        console.log("updateAllocationData");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Request list of BOM data for this build order
 | 
				
			||||||
 | 
					        if (bom_items == null) {
 | 
				
			||||||
 | 
					            inventreeGet(
 | 
				
			||||||
 | 
					                '{% url "api-bom-list" %}',
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    part: build_info.part,
 | 
				
			||||||
 | 
					                    sub_part_detail: true,
 | 
				
			||||||
 | 
					                    sub_part_trackable: true,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    success: function(response) {
 | 
				
			||||||
 | 
					                        // Save the BOM items
 | 
				
			||||||
 | 
					                        bom_items = response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        // Callback to this function again
 | 
				
			||||||
 | 
					                        updateAllocationData(rows);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        console.log("BOM ITEMS:", bom_items);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var part_tests = null;
 | 
					    var part_tests = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function updateTestResultData(rows) {
 | 
					    function updateTestResultData(rows) {
 | 
				
			||||||
 | 
					        // Update test result information for the build outputs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        console.log("updateTestResultData");
 | 
					        console.log("updateTestResultData");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -880,15 +915,17 @@ function loadBuildOutputTable(build_info, options={}) {
 | 
				
			|||||||
                    required: true,
 | 
					                    required: true,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    async: false,
 | 
					 | 
				
			||||||
                    success: function(response) {
 | 
					                    success: function(response) {
 | 
				
			||||||
                        // Save the list of part tests
 | 
					                        // Save the list of part tests
 | 
				
			||||||
                        part_tests = response;
 | 
					                        part_tests = response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        // Callback to this function again
 | 
				
			||||||
                        updateTestResultData(rows);
 | 
					                        updateTestResultData(rows);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            );;
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rows.forEach(function(row) {
 | 
					        rows.forEach(function(row) {
 | 
				
			||||||
@@ -944,8 +981,6 @@ function loadBuildOutputTable(build_info, options={}) {
 | 
				
			|||||||
        return n;
 | 
					        return n;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var table_loaded = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $(table).inventreeTable({
 | 
					    $(table).inventreeTable({
 | 
				
			||||||
        url: '{% url "api-stock-list" %}',
 | 
					        url: '{% url "api-stock-list" %}',
 | 
				
			||||||
        queryParams: filters,
 | 
					        queryParams: filters,
 | 
				
			||||||
@@ -975,12 +1010,11 @@ function loadBuildOutputTable(build_info, options={}) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            console.log("onLoadSuccess");
 | 
					            console.log("onLoadSuccess");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            updateAllocationData(rows);
 | 
				
			||||||
            updateTestResultData(rows);
 | 
					            updateTestResultData(rows);
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        onRefresh: function() {
 | 
					        onRefresh: function() {
 | 
				
			||||||
            console.log("onRefresh");
 | 
					            console.log("onRefresh");
 | 
				
			||||||
            // var rows = $(table).bootstrapTable('getData');
 | 
					 | 
				
			||||||
            // updateTestResultData(rows);
 | 
					 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        columns: [
 | 
					        columns: [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user