Ok, so now I have more information. This is the problem:
"Hi Bruce,
Where an Inventory Item is a Pallet Buy, they are setup as a Kitset.
This is flagged by ‘IN_Main.BOMObject’ = 3
e.g. ATHP
This then pulls the SOH from a Component Product Code
The Link can be found in the ‘IN_Components’ table
e.g. ATH
The Sales Order must have both the Master Sales Line and The Component Line(s) – There may be more than one component to a Kit.
Example Script of the link
SELECT IN_Main.InventoryID, IN_Main.PartNo, IN_Main.Description, IN_Components.Quantity, IN_Components.LineNumber, IN_Main_1.InventoryID AS Component_INID, IN_Main_1.PartNo AS Component_INPartNo,
IN_Main_1.Description AS Component_INDescription
FROM IN_Components INNER JOIN
IN_Main ON IN_Components.InventoryID = IN_Main.InventoryID INNER JOIN
IN_Main AS IN_Main_1 ON IN_Components.ComponentID = IN_Main_1.InventoryID
Where IN_Main.PartNo = 'ATHP'
Example of the issue…..
SELECT QO_Lines.InvoiceLineID, QO_Lines.GroupNo, QO_Lines.LineNum, QO_Lines.CommentLine, QO_Lines.PartNo, QO_Lines.Description, QO_Lines.KittingStatus, QO_Lines.KittingUnits, QO_Lines.KitStyle, QO_Lines.KitLineID,
QO_Main.InvoiceID, QO_Main.DebtorID, QO_Main.StaffID, QO_Main.InvoiceNo
FROM QO_Lines INNER JOIN
QO_History ON QO_Lines.InvoiceHistoryID = QO_History.InvoiceHistoryID INNER JOIN
QO_Main ON QO_History.InvoiceID = QO_Main.InvoiceID
Where KitStyle <> 0 and InvoiceNo = '0000000132'
Order by QO_Main.InvoiceNo
InvoiceLineID GroupNo LineNum CommentLine PartNo Description KittingStatus KittingUnits KitStyle KitLineID InvoiceID DebtorID StaffID InvoiceNo
5e2876f6d47b44df9909 1 45 0 SHA PINE WOODSHAVINGS BALES (SMALL) 14 KG 2 1 3 6ce52a2672aa4c0ea4d0 57ef0f687e704c9ea202 8d3c8d0d1e474f73bc25 fb7cca6ee4494c069fdc 132
6ce52a2672aa4c0ea4d0 1 44 0 SHAP PINE WOODSHAVINGS SMALL PALLET BUY 1 0 3 57ef0f687e704c9ea202 8d3c8d0d1e474f73bc25 fb7cca6ee4494c069fdc 132
7f74864a815e42b3b4c9 1 33 0 SHAP PINE WOODSHAVINGS BALES (SMALL) 1 BALE 1 0 3 57ef0f687e704c9ea202 8d3c8d0d1e474f73bc25 fb7cca6ee4494c069fdc 132
In the Above example the Kit Line ID is missing……. And the Product “SHAP” is entered twice
As you have added the line 33 when importing….
But Salce Staff then have to manually add the SHAP – Line44, which then adds the Line SHA – Line45, to get the product to transfer to the Sales Order."
So my question now is:
I want to extract an inventory item. I want to ensure that ALL information is available including components or anything else that I might need to send through in a quote. I want to take this extracted inventory data, store it on the website database so it can be used to formulate future quote orders so that there is nothing left out and I dont end up getting errors.
This is the SQL from one of my current inventory extraction plugins:
- Code: Select all
var query = @"
SELECT
main.LastSavedDateTime,
main.InventoryID,
main.PartNo,
main.Description,
main.Status,
main.DefaultPrice,
main.RRPPrice,
main.Aux2,
main.BackOrderable,
price.ForwardPriceDate,
price.CurrentPriceDate,
price.Price1, price.ForwardPrice1,
price.Price2, price.ForwardPrice2,
price.Price3, price.ForwardPrice3,
price.Price4, price.ForwardPrice4,
price.Price5, price.ForwardPrice5,
price.Price6, price.ForwardPrice6,
price.Price7, price.ForwardPrice7,
price.Price8, price.ForwardPrice8,
price.Price9, price.ForwardPrice9,
uom.Name AS UOM_Name,
uom.QuantityInnersPerUnitOfMeasure AS UOM_QuantityInners,
uom.IsSell AS UOM_IsSell,
uom.IsPurchase AS UOM_IsPurchase,
uom.Barcode AS UOM_Barcode,
uom.IsEnabled AS UOM_IsEnabled,
uom.ItemNo AS UOM_ItemNo
FROM IN_Main main
LEFT JOIN IN_SellingPrices price
ON price.InventoryID = main.InventoryID
OUTER APPLY (
SELECT TOP 1 *
FROM IN_UnitOfMeasure u
WHERE u.IN_Main_InventoryID = main.InventoryID
AND u.IsEnabled = 1
AND u.Name = 'PALLET'
ORDER BY u.Name
) uom
WHERE main.InventoryID = @InventoryID;
;";
var result = Db.SqlList<MyCustomModel>(query, new { InventoryID = request.InventoryID });
return result.ConvertTo<GetInventoryByIdLimitFieldsResponse>();
This is the model:
- Code: Select all
public class MyCustomModel
{
public DateTime LastSavedDateTime { get; set; }
public string InventoryID { get; set; }
public string PartNo { get; set; }
public string Description { get; set; }
public int Status { get; set; }
public decimal DefaultPrice { get; set; }
public decimal RRPPrice { get; set; }
public string Aux2 { get; set; }
public bool BackOrderable { get; set; }
public string UOM_Name { get; set; }
public int UOM_QuantityInners { get; set; }
public bool UOM_IsSell { get; set; }
public bool UOM_IsPurchase { get; set; }
public string UOM_Barcode { get; set; }
public bool UOM_IsEnabled { get; set; }
public int UOM_ItemNo {get; set;}
public DateTime ForwardPriceDate { get; set; }
public DateTime CurrentPriceDate { get; set; }
public decimal Price1 { get; set; }
public decimal ForwardPrice1 { get; set; }
public decimal Price2 { get; set; }
public decimal ForwardPrice2 { get; set; }
public decimal Price3 { get; set; }
public decimal ForwardPrice3 { get; set; }
public decimal Price4 { get; set; }
public decimal ForwardPrice4 { get; set; }
public decimal Price5 { get; set; }
public decimal ForwardPrice5 { get; set; }
public decimal Price6 { get; set; }
public decimal ForwardPrice6 { get; set; }
public decimal Price7 { get; set; }
public decimal ForwardPrice7 { get; set; }
public decimal Price8 { get; set; }
public decimal ForwardPrice8 { get; set; }
public decimal Price9 { get; set; }
public decimal ForwardPrice9 { get; set; }
}
Instead of me spending hours working out and testing, could someone tell me what SQL and model will get ALL of the information I need to capture everything I need so that I can store this info and use it in future quotes?
Also, is there an example of all of the JSON that needs to be sent so that nothing is left out?
Thank you.