Exemplo n.º 1
0
        public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode)
        {
            decimal hiddenRepairOrderID = 0;
            object  filter_value        = getEqualsFilterValue(filterNode, "HiddenRepairOrderID", true);

            if (null != filter_value)
            {
                hiddenRepairOrderID = Convert.ToDecimal(filter_value);
            }
            IList <IReportRow> reportRows = new List <IReportRow>();

            if (hiddenRepairOrderID <= 0)
            {
                string logMessage = "Provide a valid EBS Repair Order ID to search for Repair Logistics. Ignoring repair_order_id "
                                    + hiddenRepairOrderID;
                string logNote = null;
                ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
                return(reportRows);
            }
            RepairLogistics[] items = RepairLogistics.LookupRepairLogisticsList(hiddenRepairOrderID);

            foreach (RepairLogistics item in items)
            {
                ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count);
                if (item != null)
                {
                    addItem(ref columns, ref reportDataRow, ref reportRows, item);
                }
            }
            return(reportRows);
        }
Exemplo n.º 2
0
        public RepairLogisticsVirtualTable(EBSVirtualReportTablesPackage package)
            : base(package)
        {
            this.Name        = "RepairLogisticsTable";
            this.Label       = "EBS Repair Logistics Table";
            this.Description = "EBS Repair Logistics Table";
            addColumns(RepairLogistics.getRepairLogisticsListSchema());

            //add filter
            this.Columns.Add(new ReportColumn()
            {
                DataType   = ReportColumnType.Integer,
                Label      = "HiddenRepairOrderID",
                Name       = "HiddenRepairOrderID",
                CanDisplay = false,
                CanFilter  = true
            });
        }
Exemplo n.º 3
0
        public RepairLogistics[] LookupRepairLogisticsList(decimal repair_order_id)
        {
            RepairLogistics[] retvals = new RepairLogistics[0];
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(RepairLogisticsListURL) ||
                String.IsNullOrWhiteSpace(RepairLogisticsListServiceUsername) ||
                String.IsNullOrWhiteSpace(RepairLogisticsListServicePassword))
            {
                throw new Exception("Provider's InitForRepairLogisticsList not run.");
            }
            REPAIR_LOGISTICS.CSD_LOGISTICS_WEB_Service client = EBSProxyFactory.GetRepairLogisticsInstance(RepairLogisticsListURL, RepairLogisticsListServiceUsername, RepairLogisticsListServicePassword, RepairLogisticsListServiceTimeout);
            REPAIR_LOGISTICS.SOAHeader hdr = new REPAIR_LOGISTICS.SOAHeader();
            hdr.Responsibility = "DEPOT REPAIR";
            hdr.RespApplication = "CSD";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";
            hdr.Org_Id = "204";

            client.SOAHeaderValue = hdr;

            REPAIR_LOGISTICS.InputParameters ip = new REPAIR_LOGISTICS.InputParameters();
            ip.P_RECORD_LIMIT = 101;
            ip.P_RECORD_LIMITSpecified = true;
            string parameters = String.Format("GET_LOGISTICS_LINES_WEBSRVC for repair_order_id {0}",
                Convert.ToString(repair_order_id));
            if (repair_order_id <= 0)
            {
                logMessage = parameters + ". No valid parameters found. No search performed.";
                logNote = null;
                ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
                return retvals;
            }
            ip.P_REPAIR_LINE_ID = repair_order_id;
            ip.P_REPAIR_LINE_IDSpecified = true;
            ip.P_REPAIR_NUMBER = "";

            logMessage = parameters + ". Request payload.";
            logNote = serializer.Serialize(ip);
            ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            StringBuilder response = new StringBuilder("[{}");
            try
            {
                REPAIR_LOGISTICS.OutputParameters opList = client.GET_LOGISTICS_LINES_WEBSRVC(ip);
                List<RepairLogistics> items = new List<RepairLogistics>();

                foreach (REPAIR_LOGISTICS_LIST op in opList.X_PROD_TXN_TBL)
                {
                    RepairLogistics ro = new RepairLogistics(getPropertyValues(op), repair_order_id);
                    items.Add(ro);
                    response.Append(",").Append(ro.ToJSON());
                }
                retvals = items.ToArray();
            }

            catch (Exception ex)
            {
                handleEBSException(ex, parameters);
                throw;
            }

            stopwatch.Stop();
            int timeElapsed = stopwatch.Elapsed.Milliseconds;
            logMessage = new StringBuilder(parameters)
                .Append(" returned ").Append(retvals.Count()).Append(" records in ")
                .Append(timeElapsed).Append("ms")
                .ToString(); 
            logNote = response.Append(",{\"Count\":").Append("\"")
                .Append(retvals.Count()).Append("\"}]").ToString();
            ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote, timeElapsed: timeElapsed);
            return retvals;
        }