  public EntityShipment SimplePullMethodWorking(EntityShipment objRequest)
        {
            var retVal = objRequest;
            if (retVal != null)
            {
                string orderStatus = "";
                string orderNum = "";

                try
                {
                    orderStatus = "Completed";
                    orderNum = objRequest.strDeliveryDocNumber;

                    if (!string.IsNullOrEmpty(objRequest.strDeliveryDocNumber)
                        && objRequest.ToolKit.ID != null
                        && objRequest.ToolKit.ID.ToLower() == "select")
                    {
                        orderDetailsResult = databaseHelper.GetOrderDetails(orderNum);
                    }
                }
                catch (Exception e) { }

                if (orderStatus != "Deleted" && orderStatus != "")
                {
                    #region ✅ SHIPPING INFO (UNCHANGED)

                    string CompName = orderDetailsResult.ORGANIZATION;
                    string ContactName = orderDetailsResult.NAME;

                    string payorTerms = "THIRDPARTY";
                    string payorAcct = "251144621";

                    retVal.objShipTo = new EntityAddress();

                    retVal.objShipTo.strCompanyName = CompName;
                    retVal.objShipTo.strContactName = ContactName;
                    retVal.objShipTo.strAddressLine1 = orderDetailsResult.LABEL_LINE_1;
                    retVal.objShipTo.strAddressLine2 = orderDetailsResult.LABEL_LINE_2;
                    retVal.objShipTo.strAddressLine3 =
                        orderDetailsResult.LABEL_LINE_3 + " " +
                        orderDetailsResult.LABEL_LINE_4 + " " +
                        orderDetailsResult.LABEL_LINE_5 + " " +
                        orderDetailsResult.LABEL_LINE_6 + " " +
                        orderDetailsResult.LABEL_LINE_7;

                    retVal.objShipTo.strCity = orderDetailsResult.CITY;
                    retVal.objShipTo.strState = orderDetailsResult.STATE;
                    retVal.objShipTo.strPostalCode = orderDetailsResult.ZIP;
                    retVal.objShipTo.strCountryCode = orderDetailsResult.COUNTRY;
                    retVal.objShipTo.strPhoneNumber = orderDetailsResult.PHONE;

                    retVal.objDetails.strPONumber = orderNum;
                    retVal.objDetails.strInvoiceNumber = orderNum;
                    retVal.strCustomerRefernceValue = orderNum;
                    retVal.strInvoiceNumber = orderNum;

                    retVal.objShipMethod = new EntityShipMethod();
                    retVal.objShipMethod.strShipViaCode = "12345";
                    retVal.objShipMethod.strPaymentTerms = payorTerms;
                    retVal.objShipMethod.strPayorAccountNumber = payorAcct;
                    retVal.objShipMethod.PaymentTermType = ePaymentTerms.ThirdParty;

                    retVal.objBillTo = new EntityAddress();
                    retVal.objBillTo.strAccountNumber = payorAcct;
                    retVal.objBillTo.strCountryCode = orderDetailsResult.COUNTRY;
                    retVal.objBillTo.strPostalCode = orderDetailsResult.ZIP;

                    #endregion

                    #region ✅✅✅ FINAL LINE ITEM DISPLAY FIX (MATCHES YOUR REAL CLASSES)

                    // Add the line items
                    List<OrderItemResult> orderItemResult =
                        databaseHelper.GetOrderItems(objRequest.strDeliveryDocNumber);

                    int maxRecords = 50;

                    EntityPackageGroup EPG = new EntityPackageGroup();
                    EPG.lstLineItem = new List<EntityLineItem>();

                    foreach (var line in orderItemResult.Take(maxRecords))
                    {
                        int qty = string.IsNullOrEmpty(line.Quantity)
                            ? 1
                            : Convert.ToInt32(line.Quantity);

                        EntityLineItem lineItem = new EntityLineItem();

                        // ✅ UI REQUIRED FIELDS
                        lineItem.strItemNumber = string.IsNullOrWhiteSpace(line.order_address_id)
                            ? "ITEM-001"
                            : line.order_address_id;

                        lineItem.strItemDescription =
                            (line.BookTitle ?? "BOOK") + " " + (line.ISBN ?? "");

                        // ✅ UI DISPLAY DEPENDS ON THESE FOUR
                        lineItem.intOrderedQuantity = qty;
                        lineItem.intTotalItemQuantity = qty;
                        lineItem.intItemQuantityPerPackage = qty;
                        lineItem.intBalanceQuantity = qty;

                        // ✅ UI SAFE DEFAULTS
                        lineItem.dblPieceWeight = 2;
                        lineItem.dblPieceValue = 100;
                        lineItem.DistributionType = 0;
                        lineItem.blnHazardousMaterial = false;

                        EPG.lstLineItem.Add(lineItem);
                    }

                    // ✅✅✅ PACKAGE GROUP TOTALS (UI WILL NOT RENDER WITHOUT THESE)
                    EPG.intTotalQuantity =
                        EPG.lstLineItem.Sum(x => x.intTotalItemQuantity);

                    EPG.intTotalPerPackageItemQuantity =
                        Convert.ToInt32(EPG.lstLineItem.Sum(x => x.intItemQuantityPerPackage));

                    EPG.intTotalNumberOfPackages = 1;

                    EPG.dblTotalWeight =
                        EPG.lstLineItem.Sum(x => x.dblPieceWeight);

                    // ✅✅✅ CONTAINER TOTALS
                    EntityContainer EC = new EntityContainer();
                    EC.lstPackageGroup = new List<EntityPackageGroup>();
                    EC.lstPackageGroup.Add(EPG);   // ✅ Grey color is NOT a problem

                    EC.objPackageWeight = new PackageWeight();
                    EC.strAlternatePackageID = "9876";
                    EC.intHandlingUnitID = 1;   // ✅ REQUIRED FOR UI BINDING

                    // ✅ THESE THREE CONTROL UI VISIBILITY
                    EC.intTotalQuantity = EPG.intTotalQuantity;
                    EC.intTotalPackages = 1;
                    EC.dblTotalWeight = EPG.dblTotalWeight;

                    retVal.lstContainer = new List<EntityContainer>();
                    retVal.lstContainer.Add(EC);  // ✅ Grey color is NOT a problem

                    #endregion


                }
            }

            string jsonRequest = System.Text.Json.JsonSerializer.Serialize(
                retVal,
                new JsonSerializerOptions
                {
                    WriteIndented = true,
                    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
                });

            LogRequestMessage("✅ FINAL JSON PAYLOAD");
            LogRequestMessage(jsonRequest);

            return retVal;
        }
