public InventoryItem[] getSupplierInventory(GetSupplierInventoryRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For<SupllierLocationView>();


        if (request.supplierCode != null && request.supplierCode != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Code", request.supplierCode));
        }

        if (request.company != null && request.company != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.company));
        }

        IList<SupllierLocationView> supplierLocationList = TheCriteriaMgr.FindAll<SupllierLocationView>(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);
        List<InventoryItem> iItemList = new List<InventoryItem>();

        foreach (SupllierLocationView supplierLocation in supplierLocationList)
        {

            //set region					
            com.Sconit.Entity.Svp.Party party = new com.Sconit.Entity.Svp.Party();
            party.code = supplierLocation.PartyTo.Code;
            party.id = supplierLocation.PartyTo.Code;
            party.description = supplierLocation.PartyTo.Name;
            party.type = supplierLocation.PartyTo.Type;

            //set supplier
            com.Sconit.Entity.Svp.Party supplier = new com.Sconit.Entity.Svp.Party();
            supplier.id = supplierLocation.PartyFrom.Code;
            supplier.code = supplierLocation.PartyFrom.Code;
            supplier.description = supplierLocation.PartyFrom.Name;
            supplier.type = supplierLocation.PartyFrom.Type;

            //set unit of messure
            UOM uom = new UOM();
            uom.id = supplierLocation.Item.Code;
            uom.abbreviation = supplierLocation.Item.Code;
            uom.description = supplierLocation.Item.Description;

            //set supplier Item
            string refItemCode = TheItemReferenceMgr.GetItemReferenceByItem(supplierLocation.Item.Code, supplierLocation.PartyFrom.Code, supplierLocation.PartyTo.Code);
            Material suppItem = new Material();
            suppItem.id = refItemCode;
            suppItem.no = refItemCode;
            suppItem.description = refItemCode;
            suppItem.quantityUOM = uom;

            //set Item
            Material material = new Material();
            material.id = supplierLocation.Item.Code;
            material.no = supplierLocation.Item.Code;
            material.name = supplierLocation.Item.Description;
            material.description = supplierLocation.Item.Description;
            suppItem.quantityUOM = uom;

            //set supplier material
            string2MaterialMapEntry[] suppItemMap = new string2MaterialMapEntry[1];
            suppItemMap[0] = new string2MaterialMapEntry();
            suppItemMap[0].key = supplier.code;
            suppItemMap[0].value = suppItem;
            material.supplierMaterials = suppItemMap;

            //set location
            com.Sconit.Entity.Svp.Location location = new com.Sconit.Entity.Svp.Location();
            location.id = supplierLocation.Location.Code;
            location.name = supplierLocation.Location.Name;

            //set inventory
            InventoryItem iItem = new InventoryItem();
            iItem.ownerParty = party;
            iItem.supplier = supplier;
            iItem.material = material;
            iItem.location = location;
            iItem.quantityOnHand = Convert.ToDouble(supplierLocation.Qty);
            iItem.quantityOnHandSpecified = true;
            iItem.unitCount = Convert.ToDouble(supplierLocation.Item.UnitCount);
            iItem.unitCountSpecified = true;

            iItemList.Add(iItem);
        }

        return iItemList.ToArray();

    }
    private RequisitionOrderItem fillOrderDetail(OrderDetail orderDetail)
    {

        RequisitionOrderItem item = new RequisitionOrderItem();

        
        item.id = orderDetail.Id.ToString();
        item.sequenceNo = orderDetail.Sequence;
        item.sequenceNoSpecified = true;
        item.memo = string.Empty;
        item.requiredQuantity = Convert.ToDouble(orderDetail.OrderedQty);
        item.requiredQuantitySpecified = true;
        item.deliveredQuantity = 0;
        if (orderDetail.ShippedQty != null)
        {
            item.deliveredQuantity = Convert.ToDouble(orderDetail.ShippedQty);
        }
        item.deliveredQuantitySpecified = true;
        item.receivedQuantity = 0;
        if (orderDetail.ReceivedQty != null)
        {
            item.receivedQuantity = Convert.ToDouble(orderDetail.ReceivedQty);
        }
        item.receivedQuantitySpecified = true;
        item.unitCount = Convert.ToDouble(orderDetail.UnitCount);
        item.unitCountSpecified = true;

        UOM u = new UOM();
        u.abbreviation = orderDetail.Uom.Code;
        u.description = orderDetail.Uom.Description;

        Material m = new Material();
        m.quantityUOM = u;
        m.id = orderDetail.Item.Code;
        m.no = orderDetail.Item.Code;
        m.name = orderDetail.Item.Description;
        m.description = orderDetail.Item.Description;

        Material supM = new Material();
        supM.quantityUOM = u;
        supM.id = orderDetail.ReferenceItemCode;
        supM.no = orderDetail.ReferenceItemCode;
        supM.name = orderDetail.ReferenceItemCode;
        supM.description = orderDetail.ReferenceItemCode;

        string2MaterialMapEntry[] mapEntry = new string2MaterialMapEntry[1];
        mapEntry[0] = new string2MaterialMapEntry();
        mapEntry[0].key = string.Empty;
        mapEntry[0].value = supM;
        m.supplierMaterials = mapEntry;

        item.material = m;

        return item;
    }