protected virtual void _(Events.RowSelected <SOShipment> e, PXRowSelected baseHandler) { baseHandler?.Invoke(e.Cache, e.Args); SOShipment row = (SOShipment)e.Row; if (row == null) { return; } e.Cache.AllowUpdate = true; PXUIFieldAttribute.SetEnabled <SOShipmentExt.usrCarrierPluginID>(e.Cache, null, true); PXUIFieldAttribute.SetEnabled <SOShipmentExt.usrWaybill>(e.Cache, null, true); }
protected virtual IEnumerable LumGenerate3PLUKFile(PXAdapter adapter) { try { SOShipment soShipment = adapter.Get <SOShipment>()?.FirstOrDefault(); // Get Csv String Builder var result = CombineCSV(soShipment, "P3PL"); // Upload Graph UploadFileMaintenance upload = PXGraph.CreateInstance <UploadFileMaintenance>(); // Create SM.FileInfo var fileName = $"{result.OrderNbr}.csv"; var data = new UTF8Encoding(true).GetBytes(result.csvText.ToString()); FileInfo fi = new FileInfo(fileName, null, data); // Upload file to FTP #region 3PL UK FTP var configYusen = SelectFrom <LUM3PLUKSetup> .View.Select(Base).RowCast <LUM3PLUKSetup>().FirstOrDefault(); FTP_Config config = new FTP_Config() { FtpHost = configYusen.FtpHost, FtpUser = configYusen.FtpUser, FtpPass = configYusen.FtpPass, FtpPort = configYusen.FtpPort, FtpPath = configYusen.FtpPath }; var ftpResult = UploadFileByFTP(config, fileName, data); //var ftpResult = true; if (!ftpResult) { throw new Exception("Ftp Upload Fail!!"); } #endregion // Upload file to Attachment upload.SaveFile(fi); PXNoteAttribute.SetFileNotes(Base.Document.Cache, Base.Document.Current, fi.UID.Value); Base.Document.Current.GetExtension <SOShipmentExt>().UsrSendToWareHouse = true; Base.Document.UpdateCurrent(); Base.Save.Press(); } catch (Exception ex) { PXProcessing.SetError(ex.Message); } return(adapter.Get()); }
public virtual void ShipPackages(SOShipment shiporder, ShipPackagesDelegate baseMethod) { Carrier carrier = PXSelect <Carrier, Where <Carrier.carrierID, Equal <Required <SOShipment.shipVia> > > > .Select(Base, shiporder.ShipVia); if (carrier != null && carrier.IsExternal == true && shiporder.ShippedViaCarrier != true) { //Automatically print return label if enabled for selected ship via var ext = PXCache <Carrier> .GetExtension <CS.CarrierExt>(carrier); if (ext.ReturnLabel == true) { Base.GetReturnLabels(shiporder); } } baseMethod(shiporder); }
protected void _(Events.FieldSelecting <SOShipmentExt.usrNote> e) { SOShipment row = e.Row as SOShipment; string str = string.Empty; if (row != null) { foreach (PXResult <Note> pxResult1 in SelectFrom <Note> .InnerJoin <SOOrder> .On <SOOrder.noteID.IsEqual <Note.noteID> > .InnerJoin <SOOrderShipment> .On <SOOrderShipment.orderType.IsEqual <SOOrder.orderType> .And <SOOrderShipment.orderNbr.IsEqual <SOOrder.orderNbr> > > .Where <SOOrderShipment.shipmentNbr.IsEqual <P.AsString> > .View.ReadOnly.Select((PXGraph)this.Base, (object)row.ShipmentNbr)) { Note note = (Note)pxResult1; if (note.NoteText.Length > 0) { str += note.NoteText + "\n--------------------\n"; } } } e.ReturnValue = (object)str; }
public virtual void SetShipContactAndAddress() { SOShipment current = Base.Document.Current; if (current == null || !current.GetExtension <SOShipmentExt>().UsrShipToID.HasValue) { return; } AddressAttribute addressAttribute = new SOShipmentAddressAttribute(typeof(Select2 <Address, InnerJoin <Location, On <Location.bAccountID, Equal <Address.bAccountID>, And <Address.addressID, Equal <Location.defAddressID> > >, LeftJoin <SOShipmentAddress, On <SOShipmentAddress.customerID, Equal <Address.bAccountID>, And <SOShipmentAddress.customerAddressID, Equal <Address.addressID>, And <SOShipmentAddress.revisionID, Equal <Address.revisionID>, And <SOShipmentAddress.isDefaultAddress, Equal <True> > > > > > >, Where <Location.bAccountID, Equal <Current <SOShipment.customerID> >, And <Location.locationID, Equal <Current <SOShipmentExt.usrShipToID> > > > >)) { FieldName = "shipAddressID" }; addressAttribute.DefaultAddress <SOShipmentAddress, SOShipmentAddress.addressID>(Base.Document.Cache, current, null); ContactAttribute contactAttribute = new SOShipmentContactAttribute(typeof(Select2 <Contact, InnerJoin <Location, On <Location.bAccountID, Equal <Contact.bAccountID>, And <Contact.contactID, Equal <Location.defContactID> > >, LeftJoin <SOShipmentContact, On <SOShipmentContact.customerID, Equal <Contact.bAccountID>, And <SOShipmentContact.customerContactID, Equal <Contact.contactID>, And <SOShipmentContact.revisionID, Equal <Contact.revisionID>, And <SOShipmentContact.isDefaultContact, Equal <True> > > > > > >, Where <Location.bAccountID, Equal <Current <SOShipment.customerID> >, And <Location.locationID, Equal <Current <SOShipmentExt.usrShipToID> > > > >)) { FieldName = "shipContactID" }; contactAttribute.DefaultContact <SOShipmentContact, SOShipmentContact.contactID>(Base.Document.Cache, (object)current, (object)null); Base.Document.Cache.Update((object)current); }
public void ConfirmShipment(SOOrderEntry docgraph, SOShipment shiporder, ConfirmShipmentDelegate baseMethod) { bool packageDetailsValid = true; Base.Clear(); Base.Document.Current = Base.Document.Search <SOShipment.shipmentNbr>(shiporder.ShipmentNbr); var packagedQuantities = new Dictionary <Tuple <int?, int?, string, string>, decimal>(); //Get a summary of all the package details foreach (SOPackageDetailSplit ps in PXSelectGroupBy <SOPackageDetailSplit, Where <SOPackageDetailSplit.shipmentNbr, Equal <Current <SOShipment.shipmentNbr> > >, Aggregate < GroupBy <SOPackageDetailSplit.inventoryID, GroupBy <SOPackageDetailSplit.subItemID, GroupBy <SOPackageDetailSplit.lotSerialNbr, GroupBy <SOPackageDetailSplit.uOM, Sum <SOPackageDetailSplit.baseQty> > > > > > > .Select(Base)) { packagedQuantities.Add(new Tuple <int?, int?, string, string>(ps.InventoryID, ps.SubItemID, ps.LotSerialNbr, ps.UOM), ps.BaseQty.GetValueOrDefault()); } //We run validation only when packaging is used for the order - if left empty, we don't enforce validation if (packagedQuantities.Count > 0) { //Retrieve shipment details and deduct from packaged quantities foreach (SOShipLineSplit ls in PXSelectGroupBy <SOShipLineSplit, Where <SOShipLineSplit.shipmentNbr, Equal <Current <SOShipment.shipmentNbr> >, And <SOShipLineSplit.isStockItem, Equal <True> > >, Aggregate < GroupBy <SOShipLineSplit.inventoryID, GroupBy <SOShipLineSplit.subItemID, GroupBy <SOShipLineSplit.lotSerialNbr, GroupBy <SOShipLineSplit.uOM, Sum <SOShipLineSplit.baseQty> > > > > > > .Select(Base)) { //If item is not in dictionary, it will be automatically initialized and quantity deducted from 0 var key = new Tuple <int?, int?, string, string>(ls.InventoryID, ls.SubItemID, ls.LotSerialNbr, ls.UOM); packagedQuantities[key] -= ls.BaseQty.GetValueOrDefault(); } // Anything left with a quantity other than 0 need to be flagged as an error. foreach (var key in packagedQuantities.Keys) { if (packagedQuantities[key] != 0) { packageDetailsValid = false; break; } } } if (packageDetailsValid) { baseMethod(docgraph, shiporder); } else { throw new PXException(PX.Objects.WM.Messages.PackageDetailsMismatch); } }
public virtual IEnumerable orders() { PXUIFieldAttribute.SetDisplayName <SOShipment.shipVia_Carrier_description>(Caches[typeof(SOShipment)], Messages.CarrierDescr); PXUIFieldAttribute.SetDisplayName <SOShipment.siteID_INSite_descr>(Caches[typeof(SOShipment)], Messages.SiteDescr); PXUIFieldAttribute.SetDisplayName <SOShipment.customerID>(Caches[typeof(SOShipment)], Messages.CustomerID); SOShipmentFilter filter = Filter.Current; if (filter.Action == "<SELECT>") { yield break; } string actionID = (string)Orders.GetTargetFill(null, null, null, filter.Action, "@actionID"); if (_ActionChanged) { Orders.Cache.Clear(); } foreach (SOShipment order in Orders.Cache.Updated) { yield return(order); } PXSelectBase cmd; switch (actionID) { case "2": cmd = new PXSelectJoinGroupBy <SOShipment, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <SOShipLine, On <SOShipLine.shipmentNbr, Equal <SOShipment.shipmentNbr> >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOShipLine.origOrderType>, And <SOOrder.orderNbr, Equal <SOShipLine.origOrderNbr> > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOShipLine.origOrderType> >, InnerJoin <SOOrderTypeOperation, On <SOOrderTypeOperation.orderType, Equal <SOShipLine.origOrderType>, And <SOOrderTypeOperation.operation, Equal <SOShipment.operation> > >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, LeftJoin <ARTran, On <ARTran.sOShipmentNbr, Equal <SOShipLine.shipmentNbr>, And <ARTran.sOShipmentType, NotEqual <SOShipmentType.dropShip>, And <ARTran.sOShipmentLineNbr, Equal <SOShipLine.lineNbr> > > > > > > > > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate>, And <ARTran.refNbr, IsNull, And <Match <INSite, Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.insurance, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; case "3": cmd = new PXSelectJoinGroupBy <SOShipment, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOShipLine, On <SOShipLine.shipmentType, Equal <SOOrderShipment.shipmentType>, And <SOShipLine.shipmentNbr, Equal <SOOrderShipment.shipmentNbr>, And <SOShipLine.origOrderType, Equal <SOOrderShipment.orderType>, And <SOShipLine.origOrderNbr, Equal <SOOrderShipment.orderNbr> > > > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOShipLine.origOrderType>, And <SOOrder.orderNbr, Equal <SOShipLine.origOrderNbr> > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> > > > > > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And <SOOrderShipment.invtRefNbr, IsNull, And <SOShipLine.lineType, Equal <SOLineType.inventory>, And <SOOrderType.iNDocType, NotEqual <INTranType.noUpdate>, And <Match <INSite, Current <AccessInfo.userName> > > > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; case "6": cmd = new PXSelectJoinGroupBy <POReceipt, CrossJoin <SOOrder, InnerJoin <POReceiptLine, On <POReceiptLine.receiptNbr, Equal <POReceipt.receiptNbr> >, InnerJoin <SOLine, On <SOLine.pOType, Equal <POReceiptLine.pOType>, And <SOLine.pONbr, Equal <POReceiptLine.pONbr>, And <SOLine.pOLineNbr, Equal <POReceiptLine.pOLineNbr>, And <SOLine.orderType, Equal <SOOrder.orderType>, And <SOLine.orderNbr, Equal <SOOrder.orderNbr> > > > > >, LeftJoin <ARTran, On <ARTran.sOShipmentNbr, Equal <POReceiptLine.receiptNbr>, And <ARTran.sOShipmentType, Equal <SOShipmentType.dropShip>, And <ARTran.sOShipmentLineNbr, Equal <POReceiptLine.lineNbr>, And <ARTran.sOOrderType, Equal <SOLine.orderType>, And <ARTran.sOOrderNbr, Equal <SOLine.orderNbr>, And <ARTran.sOOrderLineNbr, Equal <SOLine.lineNbr> > > > > > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOLine.orderType> >, InnerJoin <SOOrderTypeOperation, On <SOOrderTypeOperation.orderType, Equal <SOOrder.orderType>, And <SOOrderTypeOperation.operation, Equal <SOLine.operation> > > > > > > > >, Where <POReceipt.released, Equal <boolTrue>, And2 <Where <POReceiptLine.lineType, Equal <POLineType.goodsForDropShip>, Or <POReceiptLine.lineType, Equal <POLineType.nonStockForDropShip> > >, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate>, And <ARTran.refNbr, IsNull> > > >, Aggregate <GroupBy <POReceipt.receiptNbr, GroupBy <POReceipt.createdByID, GroupBy <POReceipt.lastModifiedByID, GroupBy <POReceipt.released, GroupBy <POReceipt.ownerID, GroupBy <POReceipt.hold> > > > > > > >(this); break; case "9": cmd = new PXSelectJoinGroupBy <SOShipment, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > > > > > >, Where <SOShipment.labelsPrinted, Equal <False>, And <Match <INSite, Current <AccessInfo.userName> > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; default: cmd = new PXSelectJoinGroupBy <SOShipment, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > > > > > >, Where <Match <INSite, Current <AccessInfo.userName> > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; } if (typeof(PXSelectBase <SOShipment>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); if (filter.SiteID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.siteID, Equal <Current <SOShipmentFilter.siteID> > > >(); } if (!string.IsNullOrEmpty(filter.CarrierPluginID)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <Carrier.carrierPluginID, Equal <Current <SOShipmentFilter.carrierPluginID> > > >(); } if (!string.IsNullOrEmpty(filter.ShipVia)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipVia, Equal <Current <SOShipmentFilter.shipVia> > > >(); } if (filter.StartDate != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } if (filter.CustomerID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.customerID, Equal <Current <SOShipmentFilter.customerID> > > >(); } if (actionID == "7" && filter.ShowPrinted == false) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.labelsPrinted, Equal <False> > >(); } if (filter.PackagingType == SOShipmentFilter.Manual) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOOrder.isManualPackage, Equal <True> > >(); } else if (filter.PackagingType == SOShipmentFilter.Auto) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOOrder.isManualPackage, NotEqual <True> > >(); } int startRow = PXView.StartRow; int totalRows = 0; foreach (object res in ((PXSelectBase <SOShipment>)cmd).View.Select(null, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows)) { SOShipment order = PXResult.Unwrap <SOShipment>(res); SOOrder so = PXResult.Unwrap <SOOrder>(res); if (order.BilledOrderCntr + order.UnbilledOrderCntr + order.ReleasedOrderCntr == 1) { order.CustomerOrderNbr = so.CustomerOrderNbr; } object item; if ((item = (SOShipment)Orders.Cache.Locate(order)) == null || Orders.Cache.GetStatus(item) == PXEntryStatus.Notchanged) { yield return(order); } } PXView.StartRow = 0; } if (typeof(PXSelectBase <POReceipt>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); /* * if (filter.SiteID != null) * { * ((PXSelectBase<POReceipt>)cmd).WhereAnd<Where<POReceipt.siteID, Equal<Current<SOShipmentFilter.siteID>>>>(); * } * * if (!string.IsNullOrEmpty(filter.ShipVia)) * { * ((PXSelectBase<POReceipt>)cmd).WhereAnd<Where<POReceipt.shipVia, Equal<Current<SOShipmentFilter.shipVia>>>>(); * } */ if (filter.StartDate != null) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } foreach (PXResult <POReceipt, SOOrder> res in ((PXSelectBase <POReceipt>)cmd).Select()) { SOShipment order = res; if ((order = (SOShipment)Orders.Cache.Locate(order)) == null) { Orders.Cache.SetStatus(order = res, PXEntryStatus.Held); yield return(order); } else if (Orders.Cache.GetStatus(order) == PXEntryStatus.Notchanged || Orders.Cache.GetStatus(order) == PXEntryStatus.Held) { yield return(order); } } } Orders.Cache.IsDirty = false; }
public virtual IEnumerable orders() { PXUIFieldAttribute.SetDisplayName <SOShipment.customerID>(Caches[typeof(SOShipment)], Messages.CustomerID); SOShipmentFilter filter = Filter.Current; int?action = GetActionIDByName(filter.Action); if (action == null) { yield break; } if (_ActionChanged) { Orders.Cache.Clear(); } PXSelectBase cmd; switch (action) { case SOShipmentEntryActionsAttribute.CreateInvoice: cmd = new PXSelectJoin <SOShipment, InnerJoin <INSite, On <SOShipment.FK.Site>, InnerJoinSingleTable <Customer, On <SOShipment.customerID, Equal <Customer.bAccountID> >, LeftJoin <Carrier, On <SOShipment.FK.Carrier> > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And2 <Match <Customer, Current <AccessInfo.userName> >, And2 <Match <INSite, Current <AccessInfo.userName> >, And <Exists < Select <SOOrderShipment, Where <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.invoiceNbr, IsNull, And <SOOrderShipment.createARDoc, Equal <True> > > > > > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.PostInvoiceToIN: cmd = new PXSelectJoin <SOShipment, InnerJoin <INSite, On <SOShipment.FK.Site>, LeftJoinSingleTable <Customer, On <SOShipment.customerID, Equal <Customer.bAccountID> >, LeftJoin <Carrier, On <SOShipment.FK.Carrier> > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And2 <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > >, And2 <Match <INSite, Current <AccessInfo.userName> >, And <Exists < Select <SOOrderShipment, Where <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.invtRefNbr, IsNull, And <SOOrderShipment.createINDoc, Equal <True> > > > > > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.CreateDropshipInvoice: cmd = new PXSelectJoinGroupBy <POReceipt, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentNbr, Equal <POReceipt.receiptNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipmentType.dropShip> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> >, InnerJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > >, Where <POReceipt.released, Equal <True>, //And2<Where<POReceiptLine.lineType, Equal<POLineType.goodsForDropShip>, Or<POReceiptLine.lineType, Equal<POLineType.nonStockForDropShip>>>, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate>, And <SOOrderShipment.invoiceNbr, IsNull, And <Match <Customer, Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <POReceipt.receiptNbr, GroupBy <POReceipt.createdByID, GroupBy <POReceipt.lastModifiedByID, GroupBy <POReceipt.released, GroupBy <POReceipt.ownerID, GroupBy <POReceipt.hold> > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.CancelReturn: cmd = new PXSelectJoinGroupBy <SOShipment, InnerJoin <INSite, On <SOShipment.FK.Site>, LeftJoin <Carrier, On <SOShipment.FK.Carrier>, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, InnerJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > > >, Where <SOShipment.labelsPrinted, Equal <False>, And2 <Match <Customer, Current <AccessInfo.userName> >, And <Match <INSite, Current <AccessInfo.userName> > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; default: cmd = new PXSelectJoin <SOShipment, InnerJoin <INSite, On <SOShipment.FK.Site>, LeftJoinSingleTable <Customer, On <SOShipment.customerID, Equal <Customer.bAccountID> >, LeftJoin <Carrier, On <SOShipment.FK.Carrier> > > >, Where2 <Match <INSite, Current <AccessInfo.userName> >, And2 <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > >, And <Exists < Select <SOOrderShipment, Where <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType> > > > > > > > >(this); break; } if (typeof(PXSelectBase <SOShipment>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); if (filter.SiteID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.siteID, Equal <Current <SOShipmentFilter.siteID> > > >(); } if (!string.IsNullOrEmpty(filter.CarrierPluginID)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <Carrier.carrierPluginID, Equal <Current <SOShipmentFilter.carrierPluginID> > > >(); } if (!string.IsNullOrEmpty(filter.ShipVia)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipVia, Equal <Current <SOShipmentFilter.shipVia> > > >(); } if (filter.StartDate != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } if (filter.CustomerID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.customerID, Equal <Current <SOShipmentFilter.customerID> > > >(); } if (action == SOShipmentEntryActionsAttribute.PrintLabels && filter.ShowPrinted == false) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.labelsPrinted, Equal <False> > >(); } if (action == SOShipmentEntryActionsAttribute.PrintPickList && filter.ShowPrinted == false) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.pickListPrinted, Equal <False> > >(); } if (filter.PackagingType == SOPackageType.ForFiltering.Manual) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.isManualPackage, Equal <True> > >(); } else if (filter.PackagingType == SOPackageType.ForFiltering.Auto) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.isManualPackage, Equal <False> > >(); } int startRow = PXView.StartRow; int totalRows = 0; foreach (object res in ((PXSelectBase <SOShipment>)cmd).View.Select(null, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows)) { SOShipment shipment = PXResult.Unwrap <SOShipment>(res); SOShipment cached = (SOShipment)Orders.Cache.Locate(shipment); if (cached != null) { shipment.Selected = cached.Selected; shipment.BillSeparately = cached.BillSeparately; } yield return(shipment); } PXView.StartRow = 0; } if (typeof(PXSelectBase <POReceipt>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); if (filter.CustomerID != null) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <SOOrderShipment.customerID, Equal <Current <SOShipmentFilter.customerID> > > >(); } if (filter.ShipVia != null) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <SOOrder.shipVia, Equal <Current <SOShipmentFilter.shipVia> > > >(); } if (filter.CarrierPluginID != null) { ((PXSelectBase <POReceipt>)cmd).Join <InnerJoin <Carrier, On <Carrier.carrierID, Equal <SOOrder.shipVia> > > >(); ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <Carrier.carrierPluginID, Equal <Current <SOShipmentFilter.carrierPluginID> > > >(); } if (filter.StartDate != null) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } foreach (PXResult <POReceipt, SOOrderShipment, SOOrder> res in ((PXSelectBase <POReceipt>)cmd).Select()) { SOShipment order = res; SOShipment cached = (SOShipment)Orders.Cache.Locate(order); if (cached == null) { Orders.Cache.SetStatus(order, PXEntryStatus.Held); } else { order.Selected = cached.Selected; order.BillSeparately = cached.BillSeparately; } yield return(order); } } Orders.Cache.IsDirty = false; }
/// <summary> Combine Yusen csv Detail (ORH、ORL、ORA、FTO、FTD) </summary> public virtual (StringBuilder sb, int totalLine) CombineYusenDetail(StringBuilder sb, List <SOShipment> currtShipments, int totalLine) { for (int i = 0; i < currtShipments.Count; i++) { string line = string.Empty; SOShipment soShip = currtShipments[i]; var inventoryItems = SelectFrom <InventoryItem> .View.Select(Base).RowCast <InventoryItem>().ToList(); var shipLines = SelectFrom <SOShipLine> .Where <SOShipLine.shipmentNbr.IsEqual <P.AsString> > .OrderBy <SOShipLine.lineNbr.Asc> .View.Select(Base, soShip?.ShipmentNbr).RowCast <SOShipLine>(); SOShipmentContact shipContact = SOShipmentContact.PK.Find(Base, soShip.ShipContactID); SOShipmentAddress shipAddress = SOShipmentAddress.PK.Find(Base, soShip.ShipAddressID); if (!shipLines.Any()) { throw new Exception("Can not find ShipLine"); } #region OrderHeader - ORH line = string.Empty; line += $"{FillUpLen(10, "YS_OR_V01")}"; line += $"{FillUpLen(3, "ORH")}"; line += $"{FillUpLen(8, soShip?.ShipDate?.ToString("yyyyMMdd"))}"; line += $"{FillUpLen(8, shipLines.FirstOrDefault()?.ExpireDate?.ToString("yyyyMMdd"))}"; line += $"L"; line += $"{FillUpLen(15, shipLines.FirstOrDefault()?.OrigOrderNbr)}"; line += $"{FillUpLen(20, soShip?.CustomerOrderNbr)}"; line += $"{FillUpLen(11, " ")}"; line += $"{FillUpLen(40, soShip?.ShipmentDesc)}"; line += $"{FillUpLen(40, " ")}"; line += $"{FillUpLen(5, "DPD")}"; line += "\r\n"; sb.Append(line); totalLine++; #endregion #region Physical delivery address – ORL line = string.Empty; line += $"{FillUpLen(10, "YS_OR_V01")}"; line += $"{FillUpLen(3, "ORL")}"; line += $"{FillUpLen(10, " ")}"; line += $"{FillUpLen(40, shipContact?.FullName)}"; line += $"{FillUpLen(40, " ")}"; line += (shipAddress?.AddressLine1 + shipAddress?.AddressLine2).Length > 30 ? $"{(shipAddress?.AddressLine1 + shipAddress?.AddressLine2).Substring(0, 30)}" : $"{FillUpLen(30, (shipAddress?.AddressLine1 + shipAddress?.AddressLine2))}"; line += $"{FillUpLen(10, shipAddress?.PostalCode)}"; line += $"{FillUpLen(30, shipAddress?.City)}"; line += $"{FillUpLen(3, shipAddress?.CountryID)}"; line += $"{FillUpLen(30, shipContact?.Attention)}"; line += $"{FillUpLen(20, shipContact?.Phone1)}"; line += $"{FillUpLen(40, shipContact?.Email)}"; line += $"{FillUpLen(3, "DE")}"; line += "\r\n"; sb.Append(line); totalLine++; #endregion #region Articleline - ORA foreach (var item in shipLines) { line = string.Empty; line += $"{FillUpLen(10, "YS_OR_V01")}"; line += $"{FillUpLen(3, "ORA")}"; line += $"{FillUpLen(10, item?.LineNbr.ToString())}"; line += $"{FillUpLen(20, inventoryItems?.FirstOrDefault(x => x.InventoryID == item?.InventoryID).InventoryCD)}"; line += $"{FillUpLen(11, item?.ShippedQty?.ToString())}"; line += $"{FillUpLen(25, " ")}"; line += $"{FillUpLen(25, " ")}"; line += "\r\n"; sb.Append(line); totalLine++; } #endregion #region Free Text Orderpick - FTO line = string.Empty; line += $"{FillUpLen(10, "YS_OR_V01")}"; line += $"{FillUpLen(3, "FTO")}"; line += $"{FillUpLen(40, "")}"; line += "\r\n"; sb.Append(line); totalLine++; #endregion #region Free Text Delivery - FTD line = string.Empty; line += $"{FillUpLen(10, "YS_OR_V01")}"; line += $"{FillUpLen(3, "FTD")}"; line += $"{FillUpLen(40, " ")}"; line += "\r\n"; sb.Append(line); totalLine++; #endregion } return(sb, totalLine); }
/// <summary> Gnerate CA/UK csv data </summary> public virtual (StringBuilder csvText, string OrderNbr) CombineCSV(SOShipment soShipment, string csvType) { StringBuilder sb = new StringBuilder(); string line = string.Empty; var inventoryItems = SelectFrom <InventoryItem> .View.Select(Base).RowCast <InventoryItem>().ToList(); var shipLines = SelectFrom <SOShipLine> .Where <SOShipLine.shipmentNbr.IsEqual <P.AsString> > .OrderBy <SOShipLine.lineNbr.Asc> .View.Select(Base, soShipment?.ShipmentNbr).RowCast <SOShipLine>(); SOShipmentContact shipContact = SOShipmentContact.PK.Find(Base, soShipment.ShipContactID); SOShipmentAddress shipAddress = SOShipmentAddress.PK.Find(Base, soShipment.ShipAddressID); SOOrderShipment soOrderShipment = SelectFrom <SOOrderShipment> .Where <SOOrderShipment.shipmentNbr.IsEqual <P.AsString> > .View.Select(Base, soShipment.ShipmentNbr).RowCast <SOOrderShipment>().FirstOrDefault(); SOOrder soOrder = SelectFrom <SOOrder> .Where <SOOrder.orderType.IsEqual <P.AsString> .And <SOOrder.orderNbr.IsEqual <P.AsString> > > .View.Select(Base, soOrderShipment.OrderType, soOrderShipment.OrderNbr) .RowCast <SOOrder>().FirstOrDefault(); if (!shipLines.Any()) { throw new Exception("Can not find ShipLine"); } #region Header line += "\"CustomerCode\";\"OrderRefNo\";\"SKUCode\";\"Qty\";\"DeliveryReqDate\";\"ReceiverName\";\"ReceiverCountry\";\"ReceiverCity\";\"ReceiverPostCode\";\"ReceiverAddress\";\"ReceiverPhone\";\"BatchNumber\";\"Notes\""; if (csvType == "P3PL") { line += ";\"CarrierCode\";\"CarrierServiceCode\""; } sb.AppendLine(line); #endregion #region Row foreach (var item in shipLines) { var _cd = inventoryItems.Where(x => x.InventoryID == item.InventoryID).FirstOrDefault()?.InventoryCD; line = string.Empty; // CustomerCode line += $"\"IPEVOMAN\";"; // OrderRefNo line += $"\"{soShipment.CustomerOrderNbr}\";"; // SKUCode line += $"\"{_cd}\";"; // Qty line += $"\"{item?.ShippedQty}\";"; // DeliveryReqDate line += $"\"{DateTime.Now.ToString("yyyyMMdd")}\";"; // ReceiverName line += $"\"{shipContact.Attention}/{shipContact.FullName}\";"; // ReceiverCountry line += $"\"{shipAddress.CountryID}\";"; // ReceiverCity line += $"\"{shipAddress.City}\";"; // ReceiverPostCode line += $"\"{shipAddress.PostalCode}\";"; // ReceiverAddress line += $"\"{(shipAddress?.AddressLine1 + shipAddress?.AddressLine2).Replace(',','/')}\";"; // ReceiverPhone line += $"\"{shipContact.Phone1}\";"; // BatchNumber line += $"\"{soOrder.OrderNbr}\";"; // Notes var note = string.Empty; if (_cd == "5-883-4-01-00" || _cd == "5-884-4-01-00") { note = "VZ-R(sku#5-883-4-01-00) or VZ-X(sku#5-884-4-01-00) please scan the serial number for us."; } if (soOrderShipment?.OrderType == "FM" && !string.IsNullOrEmpty(soOrder?.OrderDesc)) { note = soOrder?.OrderDesc; } line += $"\"{note}\""; if (csvType == "P3PL") { line += $";\"{string.Empty}\";\"{string.Empty}\""; } sb.AppendLine(line); } #endregion return(sb, soOrder.OrderNbr); }
protected virtual bool UseCarrierService(SOShipment row, Carrier carrier) => carrier != null && carrier.IsExternal == true;
public virtual IEnumerable orders() { PXUIFieldAttribute.SetDisplayName <SOShipment.customerID>(Caches[typeof(SOShipment)], Messages.CustomerID); SOShipmentFilter filter = Filter.Current; if (filter.Action == "<SELECT>") { yield break; } string actionID = (string)Orders.GetTargetFill(null, null, null, filter.Action, "@actionID"); int action = 0; int.TryParse(actionID, out action); if (_ActionChanged) { Orders.Cache.Clear(); } PXSelectBase cmd; switch (action) { case SOShipmentEntryActionsAttribute.CreateInvoice: cmd = new PXSelectJoinGroupBy <SOShipment, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> >, InnerJoin <SOOrderTypeOperation, On <SOOrderTypeOperation.orderType, Equal <SOOrderShipment.orderType>, And <SOOrderTypeOperation.operation, Equal <SOOrderShipment.operation> > >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, InnerJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> >, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> > > > > > > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate>, And <SOOrderShipment.invoiceNbr, IsNull, And2 <Match <Customer, Current <AccessInfo.userName> >, And <Match <INSite, Current <AccessInfo.userName> > > > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.insurance, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.PostInvoiceToIN: cmd = new PXSelectJoinGroupBy <SOShipment, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOShipLine, On <SOShipLine.shipmentType, Equal <SOOrderShipment.shipmentType>, And <SOShipLine.shipmentNbr, Equal <SOOrderShipment.shipmentNbr>, And <SOShipLine.origOrderType, Equal <SOOrderShipment.orderType>, And <SOShipLine.origOrderNbr, Equal <SOOrderShipment.orderNbr> > > > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOShipLine.origOrderType>, And <SOOrder.orderNbr, Equal <SOShipLine.origOrderNbr> > >, LeftJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> > > > > > > > >, Where <SOShipment.confirmed, Equal <boolTrue>, And <SOOrderShipment.invtRefNbr, IsNull, And <SOShipLine.lineType, Equal <SOLineType.inventory>, And <SOOrderType.iNDocType, NotEqual <INTranType.noUpdate>, And2 <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > >, And <Match <INSite, Current <AccessInfo.userName> > > > > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.CreateDropshipInvoice: cmd = new PXSelectJoinGroupBy <POReceipt, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentNbr, Equal <POReceipt.receiptNbr>, And <SOOrderShipment.shipmentType, Equal <SOShipmentType.dropShip> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, InnerJoin <SOOrderType, On <SOOrderType.orderType, Equal <SOOrderShipment.orderType> >, InnerJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> >, InnerJoin <SOOrderTypeOperation, On <SOOrderTypeOperation.orderType, Equal <SOOrderShipment.orderType>, And <SOOrderTypeOperation.operation, Equal <SOOrderShipment.operation> > > > > > > >, Where <POReceipt.released, Equal <boolTrue>, //And2<Where<POReceiptLine.lineType, Equal<POLineType.goodsForDropShip>, Or<POReceiptLine.lineType, Equal<POLineType.nonStockForDropShip>>>, And <SOOrderType.aRDocType, NotEqual <ARDocType.noUpdate>, And <SOOrderShipment.invoiceNbr, IsNull, And <Match <Customer, Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <POReceipt.receiptNbr, GroupBy <POReceipt.createdByID, GroupBy <POReceipt.lastModifiedByID, GroupBy <POReceipt.released, GroupBy <POReceipt.ownerID, GroupBy <POReceipt.hold> > > > > > > >(this); break; case SOShipmentEntryActionsAttribute.CancelReturn: cmd = new PXSelectJoinGroupBy <SOShipment, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, InnerJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > > >, Where <SOShipment.labelsPrinted, Equal <False>, And2 <Match <Customer, Current <AccessInfo.userName> >, And <Match <INSite, Current <AccessInfo.userName> > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; default: cmd = new PXSelectJoinGroupBy <SOShipment, LeftJoin <Carrier, On <SOShipment.shipVia, Equal <Carrier.carrierID> >, InnerJoin <INSite, On <INSite.siteID, Equal <SOShipment.siteID> >, InnerJoin <SOOrderShipment, On <SOOrderShipment.shipmentType, Equal <SOShipment.shipmentType>, And <SOOrderShipment.shipmentNbr, Equal <SOShipment.shipmentNbr> > >, InnerJoin <SOOrder, On <SOOrder.orderType, Equal <SOOrderShipment.orderType>, And <SOOrder.orderNbr, Equal <SOOrderShipment.orderNbr> > >, LeftJoinSingleTable <Customer, On <SOOrder.customerID, Equal <Customer.bAccountID> > > > > > >, Where2 <Match <INSite, Current <AccessInfo.userName> >, And <Where <Customer.bAccountID, IsNull, Or <Match <Customer, Current <AccessInfo.userName> > > > > >, Aggregate <GroupBy <SOShipment.shipmentNbr, GroupBy <SOShipment.createdByID, GroupBy <SOShipment.lastModifiedByID, GroupBy <SOShipment.confirmed, GroupBy <SOShipment.ownerID, GroupBy <SOShipment.released, GroupBy <SOShipment.hold, GroupBy <SOShipment.resedential, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.groundCollect, GroupBy <SOShipment.saturdayDelivery, GroupBy <SOShipment.shippedViaCarrier, GroupBy <SOShipment.labelsPrinted> > > > > > > > > > > > > > >(this); break; } if (typeof(PXSelectBase <SOShipment>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); if (filter.SiteID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.siteID, Equal <Current <SOShipmentFilter.siteID> > > >(); } if (!string.IsNullOrEmpty(filter.CarrierPluginID)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <Carrier.carrierPluginID, Equal <Current <SOShipmentFilter.carrierPluginID> > > >(); } if (!string.IsNullOrEmpty(filter.ShipVia)) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipVia, Equal <Current <SOShipmentFilter.shipVia> > > >(); } if (filter.StartDate != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.shipDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } if (filter.CustomerID != null) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.customerID, Equal <Current <SOShipmentFilter.customerID> > > >(); } if (action == SOShipmentEntryActionsAttribute.PrintLabels && filter.ShowPrinted == false) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.labelsPrinted, Equal <False> > >(); } if (action == SOShipmentEntryActionsAttribute.PrintPickList && filter.ShowPrinted == false) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOShipment.pickListPrinted, Equal <False> > >(); } if (filter.PackagingType == SOShipmentFilter.Manual) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOOrder.isManualPackage, Equal <True> > >(); } else if (filter.PackagingType == SOShipmentFilter.Auto) { ((PXSelectBase <SOShipment>)cmd).WhereAnd <Where <SOOrder.isManualPackage, NotEqual <True> > >(); } int startRow = PXView.StartRow; int totalRows = 0; List <PXFilterRow> newFilters = new List <PXFilterRow>(); foreach (PXFilterRow f in PXView.Filters) { if (string.Compare(f.DataField, "CustomerOrderNbr", StringComparison.OrdinalIgnoreCase) == 0) { f.DataField = "SOOrder__CustomerOrderNbr"; } newFilters.Add(f); } foreach (object res in ((PXSelectBase <SOShipment>)cmd).View.Select(null, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, newFilters.ToArray(), ref startRow, PXView.MaximumRows, ref totalRows)) { SOShipment order = PXResult.Unwrap <SOShipment>(res); SOOrder so = PXResult.Unwrap <SOOrder>(res); if (order.BilledOrderCntr + order.UnbilledOrderCntr + order.ReleasedOrderCntr == 1) { order.CustomerOrderNbr = so.CustomerOrderNbr; } SOShipment cached = (SOShipment)Orders.Cache.Locate(order); if (cached != null) { order.Selected = cached.Selected; } yield return(order); } PXView.StartRow = 0; } if (typeof(PXSelectBase <POReceipt>).IsAssignableFrom(cmd.GetType())) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, LessEqual <Current <SOShipmentFilter.endDate> > > >(); /* * if (filter.SiteID != null) * { * ((PXSelectBase<POReceipt>)cmd).WhereAnd<Where<POReceipt.siteID, Equal<Current<SOShipmentFilter.siteID>>>>(); * } * * if (!string.IsNullOrEmpty(filter.ShipVia)) * { * ((PXSelectBase<POReceipt>)cmd).WhereAnd<Where<POReceipt.shipVia, Equal<Current<SOShipmentFilter.shipVia>>>>(); * } */ if (filter.StartDate != null) { ((PXSelectBase <POReceipt>)cmd).WhereAnd <Where <POReceipt.receiptDate, GreaterEqual <Current <SOShipmentFilter.startDate> > > >(); } foreach (PXResult <POReceipt, SOOrderShipment, SOOrder> res in ((PXSelectBase <POReceipt>)cmd).Select()) { SOShipment order = res; SOShipment cached = (SOShipment)Orders.Cache.Locate(order); if (cached == null) { Orders.Cache.SetStatus(order, PXEntryStatus.Held); } else { order.Selected = cached.Selected; } yield return(order); } } Orders.Cache.IsDirty = false; }