Exemplo n.º 1
0
        public order saveOrder(orderSaveParameters orderSaveParameters)
        {
            Order           p = new Order();
            orderSaveResult orderSaveResult = (orderSaveResult)PackageHelper.GetResult(orderSaveParameters, p.saveOrder, p.find);

            switch (orderSaveParameters.order.orderType)
            {
            case orderType.CO:
                throw new Exception("Order type CO not supported");

            case orderType.CO3PL:
                orderSaveResult orderSignalResult = (orderSaveResult)PackageHelper.GetResult(orderSaveParameters, p.SignalProcess, p.find);
                break;

            case orderType.PO:
                break;

            default:
                throw new Exception("Unknown order type");
            }

            // reload it
            orderSearchParameters orderSearchParameters = new orderSearchParameters();

            orderSearchParameters.clientId      = orderSaveParameters.clientId;
            orderSearchParameters.returnDetails = true;
            orderSearchParameters.orderType     = orderSaveParameters.order.orderType;

            switch (orderSaveParameters.order.orderType)
            {
            case orderType.CO:
                throw new Exception("Order type CO not supported");

            case orderType.CO3PL:
                orderSearchParameters.orderNo = orderSaveParameters.order.coNo;
                break;

            case orderType.PO:
                orderSearchParameters.orderNo = orderSaveParameters.order.poid;
                break;

            default:
                throw new Exception("Unknown order type");
            }

            orderSearchResult orderSearchResult = (orderSearchResult)PackageHelper.GetResult(orderSearchParameters, p.getOrderDetails, p.find);

            if (orderSearchResult.list.GetLength(0) != 1)
            {
                return(null);
            }
            else
            {
                return(orderSearchResult.list[0]);
            }
        }
Exemplo n.º 2
0
        public order getOrderDetails(orderSearchParameters orderSearchParameters)
        {
            Order             p = new Order();
            orderSearchResult orderSearchResult = (orderSearchResult)PackageHelper.GetResult(orderSearchParameters, p.getOrderDetails, p.find);

            if (orderSearchResult.list.GetLength(0) != 1)
            {
                return(null);
            }
            else
            {
                return(orderSearchResult.list[0]);
            }
        }
Exemplo n.º 3
0
        public ISyncWSResult getOrderDetails(Database database, ISyncWSParameter dataParameter)
        {
            orderSearchParameters orderSearchParameters = (orderSearchParameters)dataParameter;

            WebServices3pl pkg = new WebServices3pl(database);

            orderSearchResult res = pkg.getOrderDetails(dataParameter,
                                                        orderSearchParameters.orderType,
                                                        orderSearchParameters.clientId,
                                                        orderSearchParameters.orderNo,
                                                        boolToYesNo(orderSearchParameters.ordersFromHistory),
                                                        boolToYesNo(orderSearchParameters.ordersFromProduction));

            Details(dataParameter, orderSearchParameters, res, pkg);

            return((searchResult)res);
        }
Exemplo n.º 4
0
        public orderSearchResult getOpenOrders(orderSearchParameters orderSearchParameters)
        {
            Order p = new Order();

            return((orderSearchResult)PackageHelper.GetResult(orderSearchParameters, p.getOpenOrders, p.find));
        }
Exemplo n.º 5
0
        private void Details(ISyncWSParameter dataParameter, orderSearchParameters orderSearchParameters, orderSearchResult res, WebServices3pl pkg)
        {
            if (dataParameter.GetReturnDetails())
            {
                foreach (order item in res.list)
                {
                    orderSearchParameters subParams = new orderSearchParameters();
                    subParams.firstResult = null;
                    subParams.maxResult   = null;

                    switch (orderSearchParameters.orderType)
                    {
                    case orderType.CO:
                        throw new Exception("ordertype CO not supported");

                    case orderType.CO3PL:

                        if (!String.IsNullOrEmpty(item.customer))
                        {
                            address[] address = pkg.getAddresses(
                                subParams,
                                orderSearchParameters.clientId,
                                item.customer);

                            if (address.GetLength(0) == 1)
                            {
                                item.shippingAddress            = new shippingAddress();
                                item.shippingAddress.shipCustNo = item.customer;
                                item.shippingAddress.shiptoNo   = "0";
                                item.shippingAddress.address    = address[0];
                            }
                        }

                        break;

                    case orderType.PO:
                    {
                        address[] address = pkg.Getpartyaddress(
                            subParams,
                            item.shipFromPartyid,
                            item.shipFromPartyQualifier,
                            orderSearchParameters.clientId);

                        if (address.GetLength(0) == 1)
                        {
                            item.orderShipFrom = new orderShipFrom();
                            item.orderShipFrom.shipFromPartyid                 = item.shipFromPartyid;
                            item.orderShipFrom.shipFromPartyQualifier          = ConvertPartyType(item.shipFromPartyQualifier);
                            item.orderShipFrom.shipFromPartyQualifierSpecified = true;
                            item.orderShipFrom.address = address[0];
                        }
                    }
                    break;

                    default:
                        throw new Exception("unknown ordertype");
                    }

                    item.orderLines = pkg.GetOrderLines(subParams,
                                                        orderSearchParameters.orderType,
                                                        orderSearchParameters.clientId,
                                                        item.coNo,
                                                        item.poid,
                                                        item.poSeq,
                                                        boolToYesNo(orderSearchParameters.ordersFromHistory),
                                                        boolToYesNo(orderSearchParameters.ordersFromProduction));
                }
            }
        }