public static PIItemLocationInfo Create(PXResult result)
        {
            InventoryItem     inventoryItem   = result.GetItem <InventoryItem>();
            INSubItem         subItem         = result.GetItem <INSubItem>();
            INLocation        location        = result.GetItem <INLocation>();
            INLotSerialStatus lotSerialStatus = result.GetItem <INLotSerialStatus>();

            return(new PIItemLocationInfo
            {
                InventoryID = (int)inventoryItem.InventoryID,
                SubItemID = subItem?.SubItemID,
                LocationID = (int)location.LocationID,
                QueryResult = result,

                InventoryCD = inventoryItem.InventoryCD,
                SubItemCD = subItem?.SubItemCD,
                LocationCD = location.LocationCD,
                LotSerialNbr = lotSerialStatus?.LotSerialNbr,
                Description = inventoryItem.Descr
            });
        }
Esempio n. 2
0
        public void Add(PXResult <ARTran, InventoryItem, SOLine, INTran, INTranSplit, INLotSerialStatus, SOSalesPerTran> res)
        {
            InventoryItem     invItem   = res;
            INTranSplit       split     = res;
            INTran            tran      = res;
            SOLine            line      = res;
            ARTran            artran    = res;
            INLotSerialStatus lotStatus = res;
            SOSalesPerTran    sptran    = res;

            Record item = null;

            if (!records.TryGetValue(artran, out item))
            {
                item = new Record(artran, line, invItem, sptran);
                if (tran.LineNbr != null)
                {
                    INTransaction intran = new INTransaction(tran);
                    intran.Splits.Add(new Tuple <INTranSplit, bool>(split, string.IsNullOrEmpty(lotStatus.LotSerialNbr)));
                    item.Transactions.Add(tran.LineNbr.Value, intran);
                }

                records.Add(artran, item);
            }
            else
            {
                if (tran.LineNbr != null)
                {
                    INTransaction intran = null;
                    if (!item.Transactions.TryGetValue(tran.LineNbr.Value, out intran))
                    {
                        intran = new INTransaction(tran);
                        item.Transactions.Add(tran.LineNbr.Value, intran);
                    }

                    intran.Splits.Add(new Tuple <INTranSplit, bool>(split, string.IsNullOrEmpty(lotStatus.LotSerialNbr)));
                }
            }
        }