private static VLogger _log = VLogger.GetVLogger(typeof(MPackage).FullName); //Arpit public static MPackage Create(MInOut shipment, MShipper shipper, DateTime?shipDate, Trx trxName) { MPackage retValue = new MPackage(shipment, shipper); if (shipDate != null) { retValue.SetShipDate(shipDate); } //Edited : Arpit Rai, 13 Sept,2017 DateTime?moveDate = Convert.ToDateTime(shipment.GetMovementDate()); String documentNo = shipment.GetDocumentNo(); retValue.SetDateAcct(DateTime.Now.Date); retValue.SetAD_Client_ID(shipment.GetAD_Client_ID()); retValue.SetAD_Org_ID(shipment.GetAD_Org_ID()); if (!retValue.Save(trxName)) { trxName.Rollback(); _log.Log(Level.SEVERE, "Error While Generating Package"); } //Arpit // Lines MInOutLine[] lines = shipment.GetLines(false); for (int i = 0; i < lines.Length; i++) { MInOutLine sLine = lines[i]; MPackageLine pLine = new MPackageLine(retValue); //Arpit //pLine.SetInOutLine(sLine); //Changes in Below Method to create Lines and their values from Shipment/MR Lines to Package Lines pLine.SetInOutLine(sLine, moveDate, documentNo, retValue.GetAD_Client_ID(), retValue.GetAD_Org_ID()); if (!pLine.Save(trxName)) { trxName.Rollback(); _log.Log(Level.SEVERE, "Error While Generating Package Lines"); } //Arpit } // lines return(retValue); }
/// <summary> /// Create one Package for Shipment /// </summary> /// <param name="shipment">shipment</param> /// <param name="shipper">shipper</param> /// <param name="shipDate">null for today</param> /// <returns>package</returns> public static MPackage Create(MInOut shipment, MShipper shipper, DateTime?shipDate) { MPackage retValue = new MPackage(shipment, shipper); if (shipDate != null) { retValue.SetShipDate(shipDate); } retValue.Save(); // Lines MInOutLine[] lines = shipment.GetLines(false); for (int i = 0; i < lines.Length; i++) { MInOutLine sLine = lines[i]; MPackageLine pLine = new MPackageLine(retValue); pLine.SetInOutLine(sLine); pLine.Save(); } // lines return(retValue); }