예제 #1
0
 public TrackingStoreItem(TrackingDataset.CartonDetailForStoreTableRow carton)
 {
     //Constructor
     if (carton != null)
     {
         this.mStore        = !carton.IsSNull() ? carton.S.ToString() : "";
         this.mTL           = !carton.IsTLNull() ? carton.TL.Trim() : "";
         this.mCartonCount  = !carton.IsCartonCountNull() ? carton.CartonCount : 0;
         this.mCBOL         = !carton.IsCBOLNull() ? carton.CBOL.Trim() : "";
         this.mOFD1         = !carton.IsOFD1Null() ? carton.OFD1 : DateTime.MinValue;
         this.mTerminal     = !carton.IsSrtLocNull() ? carton.SrtLoc.Trim() : "";
         this.mCartonNumber = (!carton.IsCtnNull() && carton.Ctn.Trim().Length > 0) ? carton.Ctn.Trim() : "No Carton Number";
         this.mLabelNumber  = !carton.IsLblNull() ? carton.Lbl : 0;
         this.mPickupDate   = !carton.IsPuDNull() ? DateTime.Parse(carton.PuD) : DateTime.MinValue;
         this.mWeight       = !carton.IsWtNull() ? carton.Wt : 0;;
         this.mShipperName  = !carton.IsVNmNull() ? carton.VNm.Trim() : "";
         this.mShipperCity  = !carton.IsVCtNull() ? carton.VCt.Trim() : "";
         this.mShipperState = !carton.IsVStNull() ? carton.VSt.Trim() : "";
         this.mShipperZip   = !carton.IsVZNull() ? carton.VZ.ToString() : "";
         this.mCartonStatus = !carton.IsOMNull() ? carton.OM.Trim() : "";
         this.mScanStatus   = ""; // !carton.IsScnStsNull() ? carton.ScnSts.Trim() : "";
         this.mPODDate      = !carton.IsScDNull() ? DateTime.Parse(carton.ScD) : DateTime.MinValue;
         this.mPODTime      = !carton.IsScTmNull() ? DateTime.Parse(carton.ScTm) : DateTime.MinValue;
         this.mAgentNumber  = !carton.IsAgNull() ? carton.Ag.Trim() : "";
         this.mAgentName    = !carton.IsAgNmNull() ? carton.AgNm.Trim() : "";
         this.mTransfer     = ""; // !carton.IsTrfNull() ? carton.Trf.Trim() : "";
     }
 }
예제 #2
0
        public TrackingStoreItems TrackCartonsForStoreSummary(string clientNumber, string storeNumber, DateTime fromDate, DateTime toDate, string vendorNumber, string by)
        {
            //
            TrackingStoreItems items = new TrackingStoreItems();

            try {
                TrackingDataset cartons = new TrackingDataset();
                DataSet         ds      = null;
                if (by.ToLower() == "pickup")
                {
                    ds = new EnterpriseRGateway().GetCartonsForStoreByPickupDate2(clientNumber, storeNumber, fromDate, toDate, vendorNumber);
                }
                else
                {
                    ds = new EnterpriseRGateway().GetCartonsForStoreByDeliveryDate2(clientNumber, storeNumber, fromDate, toDate, vendorNumber);
                }
                if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    cartons.Merge(ds, true, MissingSchemaAction.Ignore);
                }

                //Build a summary by TL; start with a dataset of unique
                TrackingDataset tls = new TrackingDataset();
                tls.Merge(cartons.CartonDetailForStoreTable.DefaultView.ToTable(true, new string[] { "TL" }));
                foreach (TrackingDataset.CartonDetailForStoreTableRow tl in tls.CartonDetailForStoreTable.Rows)
                {
                    //Get one of the cartons from this TL group
                    TrackingDataset.CartonDetailForStoreTableRow tlCarton0 = (TrackingDataset.CartonDetailForStoreTableRow)(cartons.CartonDetailForStoreTable.Select("TL='" + tl.TL + "'", "TL ASC"))[0];

                    tl.S           = tlCarton0.S;
                    tl.CartonCount = cartons.CartonDetailForStoreTable.Select("TL='" + tl.TL + "'").Length;
                    tl.Wt          = int.Parse(cartons.CartonDetailForStoreTable.Compute("Sum(Wt)", "TL='" + tl.TL + "'").ToString());
                    tl.CBOL        = tlCarton0.IsCBOLNull() ? "" : tlCarton0.CBOL;
                    object minDate = cartons.CartonDetailForStoreTable.Compute("Min(ScD)", "TL='" + tl.TL + "' AND (IsNull(ScD,#01/01/1900#) <> #01/01/1900#)");
                    if (minDate != System.DBNull.Value)
                    {
                        tl.ScD = minDate.ToString();
                        object minTime = cartons.CartonDetailForStoreTable.Compute("Min(ScTm)", "TL='" + tl.TL + "' AND ScD='" + minDate + "'");
                        tl.ScTm = minTime.ToString();
                    }
                    tl.ActSDD = !tlCarton0.IsActSDDNull() ? tlCarton0.ActSDD : "01/01/0001";
                    tl.OFD1   = !tlCarton0.IsOFD1Null() ? tlCarton0.OFD1 : DateTime.MinValue;
                    tl.Ag     = !tlCarton0.IsAgNull() ? tlCarton0.Ag : "";
                    tl.AgNm   = tlCarton0.AgNm;
                    tl.AcceptChanges();

                    TrackingStoreItem item = new TrackingStoreItem(tl);
                    items.Add(item);
                }
            }
            catch (Exception ex) { throw new FaultException <TrackingFault>(new TrackingFault(ex.Message), "Service Error"); }
            return(items);
        }
예제 #3
0
        public TrackingDataset TrackCartonsForStoreSummary(string clientID, string storeNumber, DateTime from, DateTime to, string by)
        {
            //Get TL summary
            TrackingDataset  cartons = new TrackingDataset();
            CRMServiceClient client  = null;

            try {
                client = new CRMServiceClient();
                DataSet ds = null;
                if (by.ToLower() == "delivery")
                {
                    ds = client.TrackCartonsForStoreByDeliveryDate(clientID, storeNumber, from, to, null);
                }
                else
                {
                    ds = client.TrackCartonsForStoreByPickupDate(clientID, storeNumber, from, to, null);
                }
                client.Close();

                //Snag the carton detail
                TrackingDataset detail = new TrackingDataset();
                if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    detail.Merge(ds, true, MissingSchemaAction.Ignore);
                }

                //Build a summary by TL
                TrackingDataset summary = new TrackingDataset();
                summary.Merge(detail.CartonDetailForStoreTable.DefaultView.ToTable(true, new string[] { "TL" }));
                foreach (TrackingDataset.CartonDetailForStoreTableRow row in summary.CartonDetailForStoreTable.Rows)
                {
                    row.CartonCount = detail.CartonDetailForStoreTable.Select("TL='" + row.TL + "'").Length;
                    row.Weight      = int.Parse(detail.CartonDetailForStoreTable.Compute("Sum(weight)", "TL='" + row.TL + "'").ToString());
                    object minDate = detail.CartonDetailForStoreTable.Compute("Min(PodDate)", "TL='" + row.TL + "' AND (IsNull(PodDate,#01/01/1900#) <> #01/01/1900#)");

                    TrackingDataset.CartonDetailForStoreTableRow row0 = (TrackingDataset.CartonDetailForStoreTableRow)(detail.CartonDetailForStoreTable.Select("TL='" + row.TL + "'"))[0];
                    if (minDate != System.DBNull.Value)
                    {
                        row.PodDate = DateTime.Parse(minDate.ToString());
                    }
                    else
                    {
                        if (!row0.IsOFD1Null())
                        {
                            row.OFD1 = row0.OFD1;
                        }
                    }
                    row.Store  = row0.Store;
                    row.CBOL   = row0.IsCBOLNull() ? "" : row0.CBOL;
                    row.AG     = !row0.IsAGNull() ? row0.AG : "";
                    row.AgName = row0.Trf == "N" ? row0.AgName : row0.AgName + " (Transfer)";
                    row.AcceptChanges();
                }
                cartons.Merge(summary);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(cartons);
        }