public void editFulfillment(List<ItemFulfillmentLine> fulfillmentLines)
        {
            ItemFulfillment updatedFulfillment = new ItemFulfillment();
            updatedFulfillment.itemFulfillment = new com.netsuite.webservices.ItemFulfillment();
            updatedFulfillment.itemFulfillment.internalId = this.itemFulfillment.internalId;
            updatedFulfillment.itemFulfillment.itemList = new ItemFulfillmentItemList();
            // updatedFulfillment.itemFulfillment.itemList.item = new ItemFulfillmentItem[this.itemFulfillment.itemList.item.Length];

            //bool flag = false;
            //bool contains = false;
            //bool contains1 = false;

            foreach (var line in fulfillmentLines)
            {
                foreach (var itemObject in this.itemFulfillment.itemList.item)
                {
                    //if (itemObject.item.name.Contains(line.item.ItemName))
                    if (itemObject.item.name.Contains(line.item.ItemName) && (line.delete == true))
                    {
                        this.itemFulfillment.itemList.item = this.itemFulfillment.itemList.item.Where(val => !val.item.name.Contains(line.item.ItemName)).ToArray();
                        //ItemFulfillmentItem ifi = new ItemFulfillmentItem();
                        //ifi.orderLine = itemObject.orderLine;
                    }
                    if (itemObject.item.name.Contains(line.item.ItemName) && (line.delete == false))
                    {
                        itemObject.quantity = line.QuantityRequested;
                    }
                    if (!itemObject.item.name.Contains(line.item.ItemName) && (line.delete == false))
                    {
                    }
                    if (!itemObject.item.name.Contains(line.item.ItemName) && (line.delete == true))
                    {
                    }
                }
            }

            updatedFulfillment.itemFulfillment.itemList = this.itemFulfillment.itemList;
            //updatedFulfillment.itemFulfillment.itemList.item = this.itemFulfillment.itemList.item;

            NetSuiteService service = new NetSuiteService();
            service.CookieContainer = new CookieContainer();
            NetsuiteUser user = new NetsuiteUser("3451682", "*****@*****.**", "1026", "tridenT168");
            Passport passport = user.prepare(user);
            Status status = service.login(passport).status;

            WriteResponse writeResponse = service.update(updatedFulfillment.itemFulfillment);
            if (writeResponse.status.isSuccess == true)
            {
                Console.WriteLine("Update Item Fulfillment success");
            }
            if (writeResponse.status.isSuccess == false)
            {
                Console.WriteLine(writeResponse.status.statusDetail[0].message);
            }
        }
        public string markAsShipped()
        {
            ItemFulfillmentShipStatus shipped = ItemFulfillmentShipStatus._shipped;

            ItemFulfillment updatedOrder = new ItemFulfillment();
            updatedOrder.itemFulfillment = new com.netsuite.webservices.ItemFulfillment();
            updatedOrder.itemFulfillment.internalId = this.itemFulfillment.internalId;
            updatedOrder.itemFulfillment.shipStatus = shipped;
            updatedOrder.itemFulfillment.shipStatusSpecified = true;

            NetSuiteService service = new NetSuiteService();
            service.CookieContainer = new CookieContainer();
            NetsuiteUser user = new NetsuiteUser("3451682", "*****@*****.**", "1026", "tridenT168");
            Passport passport = user.prepare(user);
            Status status = service.login(passport).status;

            WriteResponse writeResponse = service.update(updatedOrder.itemFulfillment);
            if (writeResponse.status.isSuccess == true)
            {
                Console.WriteLine("Item Fulfillment " + this.itemFulfillment.tranId + " marked as shipped.");
            }
            if (writeResponse.status.isSuccess == false)
            {
                Console.WriteLine(writeResponse.status.statusDetail[0].message);
            }

            return this.itemFulfillment.tranId;
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            /********************** Create new Bins/Delete Bin
            BinManagement binCreation = new BinManagement();

            List<InventoryBin> listOfBins = new List<InventoryBin>();
            listOfBins = binCreation.GetBinsFromExcel(args[0]);

            InventoryBin ingramMalaysia = new InventoryBin("Consignment","IngramMalaysia");

            foreach (var bin in listOfBins)
            {
               binCreation.createNewBin(ingramMalaysia);
            }

            //InventoryBin testBin = new InventoryBin("Amazon - US","TestBin");
            //binCreation.DeleteBin(testBin);

             */

            /**********************  Add bins to items
            ItemBinUpdate itemBinUpdate = new ItemBinUpdate();
            List<InventoryBin> listOfItemBins = new List<InventoryBin>();
            listOfItemBins = itemBinUpdate.GetItemBinsFromExcel(args[0]);

            foreach (var itemBin in listOfItemBins)
            {
                itemBinUpdate.addBin(itemBin);
            }
            */

            //********************** Create new Sales Order
            /*
            bool noDelete = false;
            SalesOrderInfo salesInfo = new SalesOrderInfo("test address", "test address2", "test order", "FOB");

            SalesOrder testOrder = new SalesOrder(salesInfo);

            List<SalesOrderLine> orderItems = new List<SalesOrderLine>();
            orderItems.Add(new SalesOrderLine("AG-3GS-BK",1,15,noDelete));
            orderItems.Add(new SalesOrderLine("AG-3GS-BL", 1, 12,noDelete));
            orderItems.Add(new SalesOrderLine("AG-3GS-PK", 1, 10,noDelete));

            testOrder.addItemList(orderItems);
            testOrder.setCustomer("Test Celigo Company");
            testOrder.placeSalesOrder();
            */

            SalesOrder findOrder = new SalesOrder();
            findOrder.salesOrderSearch("S39853");
            /*
            foreach (var field in findOrder.salesOrder.customFieldList)
            {
                string intID = field.internalId;
                if(intID == "148")
                {
                    Console.WriteLine(((com.netsuite.webservices.SelectCustomFieldRef)field).value.name);
                }
            }
            */

            //string test = findOrder.approveOrder();

            /*********************** Edit Sales Order

            //bool delete = true;
            bool noDelete = false;
            List<SalesOrderLine> editList = new List<SalesOrderLine>();
            editList.Add(new SalesOrderLine("AG-ALOTC7-TG000", 1, 15, noDelete));

            findOrder.editOrder(editList);
            */

            //****************** Create new Invoice
            //Invoice testInvoice = new Invoice(findOrder);
            //testInvoice.createInvoice();

            //***************** Create new Item Fulfillment
            ItemFulfillment testIF = new ItemFulfillment(findOrder);
            testIF.createItemFulfillment();

            //*
            //ItemFulfillment findFulfillment = new ItemFulfillment();
            //findFulfillment.itemFulfillmentSearch("18011");

               // bool delete = false;
            //List<ItemFulfillmentLine> editLines = new List<ItemFulfillmentLine>();
            //editLines.Add(new ItemFulfillmentLine("AG-3GS-BK", 3,delete));

            //findFulfillment.editFulfillment(editLines);
            //*/

            //testOrder.deleteOrder();

            //Item testItem = new Item("AG-3GS-BK");
               // testItem.addItemRecord();

            //string test = findFulfillment.markAsShipped();

               //Console.WriteLine(test);

            Console.Read();
        }