public int CopyStrandsFromTemplate( RecProductionCast record )
        {
            var rec = new RecProductionFormStrandStd
                          { Factory = record.Factory, Project = record.Project, Name = record.Form };
            var svc = new ProjectManager();
            var list = svc.LoadProductionFormStrandStd( rec );
            if (list == null || list.Count == 0)
            {
                return 0;
            }
            list = (from o in list where o.IsUsed select o).ToList();

            foreach (var std in list)
            {
                var strand = new RecProductionCastStrand
                                 {
                                     Factory = record.Factory,
                                     Project = record.Project,
                                     CastId = record.CastId,
                                     StrandPos = std.StrandPos,
                                     StrandX = std.StrandX,
                                     StrandY = std.StrandY,
                                     StrandQuality = std.StrandQuality,
                                     StrandDimension = std.StrandDimension,
                                     StrandPrestressing = std.StrandPrestressing
                                 };

                this.InsertProductionCastStrand( strand, null, null );
            }

            return list.Count;
        }
示例#2
0
		/// <summary>
		/// Saves the transport into the database
		/// </summary>
		private void SaveTransportVehicle( RecTransport transport, int seq )
		{
			ProjectManager svc = new ProjectManager();
			RecTransportVehicleStd newRec = svc.InsertTransportVehicle( transport, TransportVehicleStdObject, seq );
			// Use the new veh id
			TransportVehicleStdObject.VehicleId = newRec.VehicleId;
		}
        /// <summary>
        /// Load Slab Style
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="project"></param>
        /// <returns></returns>
		private IEnumerable<RecSectionStyleStd> GetSlabStyles(  string factory, string project  )
		{
			// Load Slab Style
			var slabStyleSvc = new ProjectManager();
			var slabStyles = slabStyleSvc.LoadSlabStyleStd( factory, project );
			var styles = new List<RecSectionStyleStd>();
			foreach( var ss in slabStyles )
			{
 			    var rec = new RecSectionStyleStd
				    {
				        Factory = ss.Factory,
				        Project = ss.Project,
				        ElementType = ss.ElementType,
				        Name = ss.Name,
                        DirectionArrowJustify = ss.DirectionArrowJustify,
				        SectionType = "",
				        Description = ss.Description,
				        StrandSpacing = ss.StrandSpacing,
				        StrandEdgeDistance = ss.StrandEdgeDistance,
				        Strandpatterns = new List<Strandpattern>(),
				    };

			    //int numOfStrands = 0
                //if( rec
                //rec.Strandpatterns.Add( new Strandpattern( "", rec.NumOfStrands ) );
				styles.Add( rec );

			}
			return styles;
		}
示例#4
0
		/// <summary>
		/// Saves the transport into the database
		/// </summary>
		private void SaveTransportVehicleStack( RecTransport transport, RecTransportVehicleStd recVeh, int seq )
		{
			// Prepare data
			TransportVehicleStackStdObject.Factory = transport.Factory;
			TransportVehicleStackStdObject.Project = transport.Project;
			TransportVehicleStackStdObject.TransportId = transport.TransportId;
			TransportVehicleStackStdObject.VehicleId = recVeh.VehicleId;

			// Save Stack object
			ProjectManager svc = new ProjectManager();
			// Use the new stack id
			TransportVehicleStackStdObject.StackId = svc.InsertTransportVehicleStack( TransportVehicleStackStdObject );
		}
示例#5
0
 /// <summary>
 /// Load standard strands into strand list
 /// </summary>
 /// <param name="record"></param>
 /// <returns></returns>
 public List<RecProductionCastStrand> LoadStandardStrands( RecProductionFormStrandStd record )
 {
     var strands = new List<RecProductionCastStrand>();
     var svc = new ProjectManager();
     var list = svc.LoadProductionFormStrandStd( record );
     list = ( from o in list where o.IsUsed select o ).ToList();
     foreach( var std in list )
     {
         var strand = new RecProductionCastStrand()
             {
                 Factory = record.Factory,
                 Project = record.Project,
                 StrandPos = std.StrandPos,
                 CastId = 0, // Since it is not created yet
             };
         strands.Add( strand );
     }
     return strands;
 }
        /// <summary>
        /// Load Wall Style
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="project"></param>
        /// <returns></returns>
		private IEnumerable<RecSectionStyleStd> GetWallStyles( string factory, string project )
		{
			// Load Wall Style
            var wallStyleSvc = new ProjectManager();
			var wallStyles = wallStyleSvc.LoadWallStyleStd( factory, project );
			var styles = new List<RecSectionStyleStd>();
			foreach( var ss in wallStyles )
			{
				var rec = new RecSectionStyleStd
				{
 					Factory = ss.Factory,
					Project = ss.Project,

 					ElementType = ss.ElementType,
					Name = ss.Name,

 					SectionType = "",
					Description = ss.Description,
				};
				styles.Add( rec );

			}
			return styles;
		}
	    /// <summary>
	    /// Load Positioned Element Data
	    /// </summary>
	    /// <param name="forms"></param>
	    /// <param name="bedfilter"></param>
	    /// <param name="isUserPositionedElement"> </param>
	    /// <returns></returns>
	    public int LoadPositionedElementData( List<RecProductionFormStd> forms, BedFilter bedfilter, bool isUserPositionedElement = false )
        {
            this.filter = bedfilter;
            if( forms == null || forms.Count == 0 )
            {
                string msg = string.Format( "No forms defined!" );
                throw new FaultException<BusinessFaultContract>( new BusinessFaultContract() { Argument = msg }, "Cannot manage form!" );
            }

            foreach( var form in forms )
            {
                this.CastUnits.Add( new ProductionBed( form, bedfilter ) );
            }

            // Load existing elements
            var mgr = new ProjectManager();
            var castData = mgr.LoadBedPlanning( bedfilter, isUserPositionedElement? forms[0] : null );
            var casts = castData.CastList;
            foreach( var bed in this.CastUnits )
            {
                bed.AssignProductionCast( casts );
            }
            return 0;
        }
		/// <summary>
		/// Delete of Transport Vehicle Standard items
		/// </summary>
		/// <param name="vehicle"></param>
		/// <returns></returns>
		public int DeleteTransportVehicleStd( RecTransportVehicleStd record )
		{
			if( record == null )
			{
				throw new ArgumentNullException( "TransportVehicleStd" );
			}
			// Delete underlying std stacks
			ProjectManager svc = new ProjectManager();
			RecTransportVehicleStackStd stack = new RecTransportVehicleStackStd()
			{ 
				Factory = record.Factory,
				Project = record.Project,
				Name = record.Name, 
			};
			svc.DeleteTransportVehicleStackStd( stack );
 
			// Now delete the std veh
			var delete = new ImpactDelete( ImpTransportVehicleStd.Instance )
			{
				Where = 
				{
					{ ImpTransportVehicleStd.Factory.Equal( record.Factory )},
					{ ImpTransportVehicleStd.Project.Equal( record.Factory )},//for Std use Factory, Factory
					{ ImpTransportVehicleStd.Name.Equal( record.Name )},
				}
			};

			string statement = delete.ToString();

			int result;

			using( ImpactDatabase database = new ImpactDatabase() )
			{
				result = database.ExecuteNonQuery( statement );
			}

			return result;
		}
示例#9
0
        /// <summary>
        /// Returns CastData which contains the following info
        /// (1) List<RecProductionFormStd>: a set of beds, each with one production cast ONLY.
        /// The production cast object can contain elements.
        /// (2) ProductionFormStdData: Production Forms Standard Data
        /// </summary>
        /// <param name="filter">BedFilter</param>
        /// <param name="form">RecProductionFormStd</param>
        /// <returns></returns>
        public CastData LoadBedPlanning( BedFilter filter, RecProductionFormStd form )
        {
            if( null == filter || 
                string.IsNullOrEmpty( filter.Factory ) || 
                string.IsNullOrEmpty( filter.Project ) )
            {
                return null;
            }

            ImpactQuery query = new ImpactQuery()
            {
                Select =
				{
					ImpProductionCast.CastId,
					ImpProductionCast.Description,
					ImpProductionCast.StartDate,
					ImpProductionCast.EndDate,
					ImpProductionCast.Tolerance,
					ImpProductionCast.ElementType,
                    ImpProductionCast.Style,
					ImpProductionCast.Strandptn,
                    ImpProductionCast.CastType,
					ImpProductionCast.CastStatus,
                    ImpProductionCast.Form,
					ImpProductionCast.Shift,
					Aggregate.Count( ImpProductionCastStrand.StrandPos ),

					ImpProductionFormStd.Name,
					ImpProductionFormStd.MaxLength,
					ImpProductionFormStd.MaxWidth,
					ImpProductionFormStd.MaxHeight,
                    ImpProductionFormStd.ElementType,
                    ImpProductionFormStd.Style,
					ImpProductionFormStd.Strandptn,
                    ImpProductionFormStd.StrandType,
                    ImpProductionFormStd.FormType,

					ImpModelPlanning.ElementId,
					ImpModelGeometry.ElementMark,
					ImpModelPlanning.ErectionSequenceNo,
					ImpModelPlanning.TransportId,

					ImpModelPlanning.BedSequenceNo,
					ImpModelPlanning.BedX,
					ImpModelPlanning.BedY,
					ImpModelPlanning.BedZ,
					ImpModelPlanning.BedRotation,
                    ImpModelPlanning.ElementIdStatus,
                    ImpModelPlanning.ProductionDate,
                    ImpModelPlanning.PlannedProductionDate,

					ImpElement.ElementLength,
					ImpElement.ElementWidth,
					ImpElement.ElementHeight,
					ImpElement.ElementType,
					ImpElement.GrossArea,
					ImpElement.Product,
					ImpElement.Project,
					ImpElement.AngleLeftSide,
					ImpElement.AngleRightSide,

					ImpElement.Style,
					ImpElement.Strandptn,
					ImpElement.NbrOfStrands,
                    ImpElement.Volume,
                },

                From = { ImpProductionFormStd.As( "FRM" ) },

                Join =
				{
					Join.Left( ImpProductionCast.As( "CST" ),	
						ImpProductionCast.Factory.Equal( ImpProductionFormStd.Factory ),
						ImpProductionCast.Project.Equal( ImpProductionFormStd.Project ),//Factory, Factory
						ImpProductionCast.Form.Equal( ImpProductionFormStd.Name ) ),

					Join.Left( ImpProductionCastStrand.As( "STA" ),	
						ImpProductionCast.Factory.Equal( ImpProductionCastStrand.Factory ),
						ImpProductionCast.Project.Equal( ImpProductionCastStrand.Project ),// Factory, Factory for productionCast & ProductionCastStrand
						ImpProductionCast.CastId.Equal( ImpProductionCastStrand.CastId ) ),


					Join.Left( ImpModelPlanning.As( "MPL" ),	
						ImpProductionCast.Factory.Equal( ImpModelPlanning.Factory ),
						ImpProductionCast.Project.Equal( ImpModelPlanning.Factory ),// Factory, Factory for productionCast & ProductionCastStrand
						ImpProductionCast.CastId.Equal( ImpModelPlanning.CastId ) ),


					Join.Left( ImpModelGeometry.As( "MGO" ),	
						ImpModelPlanning.Factory.Equal( ImpModelGeometry.Factory ),
						ImpModelPlanning.Project.Equal( ImpModelGeometry.Project ),
						ImpModelPlanning.ElementId.Equal( ImpModelGeometry.ElementId ) ),

					Join.Left( ImpElement.As( "ELM" ),	
						ImpModelGeometry.Factory.Equal( ImpElement.Factory ),
						ImpModelGeometry.Project.Equal( ImpElement.Project ),
						ImpModelGeometry.ElementMark.Equal( ImpElement.ElementMark ) ),
				},

                Where = {
							ImpProductionCast.Factory.Equal( filter.Factory ), 
							ImpProductionCast.Project.Equal( filter.Factory ), // Factory, Factory for productionCast & ProductionCastStrand
							ImpProductionCast.StartDate.Equal( filter.StartDateFrom ), 
                            ImpProductionCast.Shift.Equal( filter.Shift ), 
						   // ImpModelPlanning.CastId.GreaterThan( 0 ),      // Get even the casts without elements!
						},

                GroupBy = 
                {
					ImpProductionCast.CastId,
					ImpProductionCast.Description,
					ImpProductionCast.StartDate,
					ImpProductionCast.EndDate,
					ImpProductionCast.Tolerance,
					ImpProductionCast.ElementType,
                    ImpProductionCast.Style,
					ImpProductionCast.Strandptn,
                    ImpProductionCast.CastType,
					ImpProductionCast.CastStatus,
					ImpProductionCast.Form,
					ImpProductionCast.Shift,

					ImpProductionFormStd.Name,
					ImpProductionFormStd.MaxLength,
					ImpProductionFormStd.MaxWidth,
					ImpProductionFormStd.MaxHeight,
                    ImpProductionFormStd.ElementType,
                    ImpProductionFormStd.Style,
					ImpProductionFormStd.Strandptn,
                    ImpProductionFormStd.StrandType,
                    ImpProductionFormStd.FormType,

					ImpModelPlanning.ElementId,
					ImpModelGeometry.ElementMark,
					ImpModelPlanning.ErectionSequenceNo,
					ImpModelPlanning.TransportId,

					ImpModelPlanning.BedSequenceNo,
					ImpModelPlanning.BedX,
					ImpModelPlanning.BedY,
					ImpModelPlanning.BedZ,
					ImpModelPlanning.BedRotation,
                    ImpModelPlanning.ElementIdStatus,
                    ImpModelPlanning.ProductionDate,
                    ImpModelPlanning.PlannedProductionDate,

					ImpElement.ElementLength,
					ImpElement.ElementWidth,
					ImpElement.ElementHeight,
					ImpElement.ElementType,
					ImpElement.GrossArea,
					ImpElement.Product,
					ImpElement.Project,
					ImpElement.AngleLeftSide,
					ImpElement.AngleRightSide,

					ImpElement.Style,
					ImpElement.Strandptn,
					ImpElement.NbrOfStrands,
                    ImpElement.Volume,
                },

                OrderBy = 
				{ 
					{ ImpElement.Project },
					{ ImpProductionFormStd.Name },
					{ ImpProductionCast.CastId },
					{ ImpModelPlanning.BedSequenceNo, OrderBy.Ascending }
				},
            };

            if( filter.FormType != FormType.All )
            {
                query.Where.Add( ImpProductionCast.CastType.Equal( filter.FormType ) );
            }

            if( !string.IsNullOrWhiteSpace( filter.Location ) && !filter.Location.Equals( Filter.All ) )
            {
                query.Where.Add( ImpProductionFormStd.Location.Equal( filter.Location ) );
            }
            if( !filter.Bed.Equals( Filter.All ) )
            {
                query.Where.Add( ImpProductionCast.Form.Equal( filter.Bed ) );
            }

            // used when sorting elements on bed
            if( form != null && !string.IsNullOrWhiteSpace( form.Name ) )
            {
                query.Where.Add( ImpProductionFormStd.Name.Equal( form.Name ) );
            }

            var statement = query.ToString();

            var tmList = new List<RecProductionFormStd>();
            var parser = new FormParser( tmList );

            using( var database = new ImpactDatabase() )
            {
                var list = database.GetAll( statement, ParseCast );

                foreach( var item in list )
                {
                    item.Form.Factory = filter.Factory;
                    item.Cast.Factory = filter.Factory;

                    item.Form.Project = filter.Project; // What does that really mean!
                    item.Cast.Project = filter.Project; // What does that really mean!

                    if( null != item.Element )
                    {
                        item.Element.Factory = filter.Factory;
                        // Never set element.project to curFilter.project
                        // since we retrieve elmenets from different projects!
                    }

                    parser.Parse( item.Form, item.Cast, item.Element );
                }
            }

            var formSvc = new ProjectManager();
            var filter2 = new BedFilter( filter ) { Location = "" };
            var productionFormStdData = formSvc.LoadProductionFormStd( filter2 );

            // Load strands
            LoadCastStrands( tmList, filter );
            LoadFormStrands( productionFormStdData.Forms, filter );

            return new CastData( tmList, productionFormStdData );
        }
示例#10
0
        /// <summary>
        /// Returns a set of casts with element information 
        /// </summary>
        /// <param name="filter">curFilter</param>
        /// <param name="reportFilter"> </param>
        /// <returns></returns>
        public CastScheduleData LoadCastSchedule( BedFilter filter, ReportFilter reportFilter )
        {
            if( filter == null || string.IsNullOrEmpty( filter.Factory ) || string.IsNullOrEmpty( filter.Project ) )
            {
                return null;
            }

            var query = new ImpactQuery()
            {
                Select =
				{
					ImpProductionCast.CastId,
					ImpProductionCast.Description,
					ImpProductionCast.StartDate,
					ImpProductionCast.EndDate,
					ImpProductionCast.Tolerance,
					ImpProductionCast.ElementType,
					ImpProductionCast.Style,
					ImpProductionCast.Strandptn,
					ImpProductionCast.CastStatus,
                    ImpProductionCast.CastType,
					ImpProductionCast.Form,
					ImpProductionCast.Shift,

                    Aggregate.Count( ImpProductionCastStrand.StrandPos ),

					ImpProductionFormStd.Location,
                    ImpProductionFormStd.FormType,
					ImpProductionFormStd.MaxLength,
					ImpProductionFormStd.MaxWidth,
					ImpProductionFormStd.MaxHeight,
                    ImpProductionFormStd.ElementType,

					ImpModelPlanning.ElementId,
					ImpModelGeometry.ElementMark,

                    ImpModelGeometry.Building,
                    ImpModelGeometry.FloorId,
                    ImpModelGeometry.Phase,

					ImpModelPlanning.ErectionSequenceNo,
					ImpModelPlanning.TransportId,

					ImpModelPlanning.BedSequenceNo,
					ImpModelPlanning.BedX,
					ImpModelPlanning.BedY,
					ImpModelPlanning.BedZ,
					ImpModelPlanning.BedRotation,
                    ImpModelPlanning.ElementIdStatus,

                    ImpModelPlanning.ProductionDate,
                    ImpModelPlanning.PlannedProductionDate,

                    ImpElement.ElementLength,
					ImpElement.ElementWidth,
					ImpElement.ElementHeight,
					ImpElement.ElementType,
					ImpElement.GrossArea,
					ImpElement.NetArea,
					ImpElement.Volume,
					ImpElement.Product,
					ImpElement.Project,
					ImpElement.AngleLeftSide,
					ImpElement.AngleRightSide,
                    ImpElement.Mass,

					ImpElement.Style,
					ImpElement.Strandptn,
					ImpElement.NbrOfStrands,
				},

                From = { ImpProductionCast.As( "CST" ) },

                Join =
				{
					Join.Left( ImpProductionCastStrand.As( "STA" ),	
						ImpProductionCast.Factory.Equal( ImpProductionCastStrand.Factory ),
						ImpProductionCast.Project.Equal( ImpProductionCastStrand.Project ),//Factory, Factory
						ImpProductionCast.CastId.Equal( ImpProductionCastStrand.CastId ) ),

					Join.Left( ImpProductionFormStd.As( "FRM" ),	
						ImpProductionCast.Factory.Equal( ImpProductionFormStd.Factory ),
						ImpProductionCast.Project.Equal( ImpProductionFormStd.Project ),// Factory, Factory for productionCast & ProductionCastStrand
						ImpProductionCast.Form.Equal( ImpProductionFormStd.Name ) ),

					Join.Left( ImpModelPlanning.As( "MPL" ),	
						ImpProductionCast.Factory.Equal( ImpModelPlanning.Factory ),
						ImpProductionCast.Project.Equal( ImpModelPlanning.Factory ),// Factory, Factory for productionCast & ProductionCastStrand
						ImpProductionCast.CastId.Equal( ImpModelPlanning.CastId ) ),


					Join.Left( ImpModelGeometry.As( "MGO" ),	
						ImpModelPlanning.Factory.Equal( ImpModelGeometry.Factory ),
						ImpModelPlanning.Project.Equal( ImpModelGeometry.Project ),
						ImpModelPlanning.ElementId.Equal( ImpModelGeometry.ElementId ) ),

					Join.Left( ImpElement.As( "ELM" ),	
						ImpModelGeometry.Factory.Equal( ImpElement.Factory ),
						ImpModelGeometry.Project.Equal( ImpElement.Project ),
						ImpModelGeometry.ElementMark.Equal( ImpElement.ElementMark ) ),
				},

                Where = {
							ImpProductionCast.Factory.Equal( filter.Factory ), 
							ImpProductionCast.Project.Equal( filter.Factory ), // Factory, Factory for productionCast & ProductionCastStrand
                            //ImpModelPlanning.CastId.GreaterThan( 0 ), 
						},
                GroupBy = 
                {
					ImpProductionCast.CastId,
					ImpProductionCast.Description,
					ImpProductionCast.StartDate,
					ImpProductionCast.EndDate,
					ImpProductionCast.Tolerance,
					ImpProductionCast.ElementType,
					ImpProductionCast.Style,
					ImpProductionCast.Strandptn,
					ImpProductionCast.CastStatus,
                    ImpProductionCast.CastType,
					ImpProductionCast.Form,
					ImpProductionCast.Shift,

					ImpProductionFormStd.Location,
                    ImpProductionFormStd.FormType,
					ImpProductionFormStd.MaxLength,
					ImpProductionFormStd.MaxWidth,
					ImpProductionFormStd.MaxHeight,
                    ImpProductionFormStd.ElementType,

					ImpModelPlanning.ElementId,
					ImpModelGeometry.ElementMark,

                    ImpModelGeometry.Building,
                    ImpModelGeometry.FloorId,
                    ImpModelGeometry.Phase,

					ImpModelPlanning.ErectionSequenceNo,
					ImpModelPlanning.TransportId,

					ImpModelPlanning.BedSequenceNo,
					ImpModelPlanning.BedX,
					ImpModelPlanning.BedY,
					ImpModelPlanning.BedZ,
					ImpModelPlanning.BedRotation,
                    ImpModelPlanning.ElementIdStatus,

                    ImpModelPlanning.ProductionDate,
                    ImpModelPlanning.PlannedProductionDate,

					ImpElement.ElementLength,
					ImpElement.ElementWidth,
					ImpElement.ElementHeight,
					ImpElement.ElementType,
					ImpElement.GrossArea,
					ImpElement.NetArea,
					ImpElement.Volume,
					ImpElement.Product,
					ImpElement.Project,
					ImpElement.AngleLeftSide,
					ImpElement.AngleRightSide,
                    ImpElement.Mass,

					ImpElement.Style,
					ImpElement.Strandptn,
					ImpElement.NbrOfStrands,
                },

                OrderBy = 
				{ 
					{ ImpElement.Project },
					{ ImpProductionCast.StartDate, OrderBy.Descending },
					{ ImpProductionCast.CastId },
				},
            };

            var whereStatus = WhereGroup.Or( new Where[] { } );

            if( filter.NoStatus )
            {
                whereStatus.Add( ImpProductionCast.CastStatus.Equal( CastStatus.NoStatus ) );
            }
            if( filter.Planned )
            {
                whereStatus.Add( ImpProductionCast.CastStatus.Equal( CastStatus.Planned ) );
            }
            if( filter.Produced )
            {
                whereStatus.Add( ImpProductionCast.CastStatus.Equal( CastStatus.Produced ) );
            }

            if( whereStatus.Count > 0 )
            {
               query.Where.Add( whereStatus );
            }

            if( filter.UseStartDateFrom )
            {
                query.Where.Add( ImpProductionCast.StartDate.GreaterThanOrEqual( filter.StartDateFrom ) );
            }
            if( filter.UseStartDateTo )
            {
                query.Where.Add( ImpProductionCast.StartDate.LessThanOrEqual( filter.StartDateTo ) );
            }
            if( filter.UseEndDateFrom )
            {
                query.Where.Add( ImpProductionCast.EndDate.GreaterThanOrEqual( filter.EndDateFrom ) );
            }
            if( filter.UseEndDateTo )
            {
                query.Where.Add( ImpProductionCast.EndDate.LessThanOrEqual( filter.EndDateTo ) );
            }

            if( filter.Shift != 0 )
            {
                query.Where.Add( ImpProductionCast.Shift.Equal( filter.Shift ) );
            }
            if( !string.IsNullOrEmpty(filter.Location) && !filter.Location.Equals( Filter.All ) )
            {
                query.Where.Add( ImpProductionFormStd.Location.Equal( filter.Location ) );
            }
            if( !filter.Bed.Equals( Filter.All ) )
            {
                query.Where.Add( ImpProductionCast.Form.Equal( filter.Bed ) );
            }
            if( !string.IsNullOrEmpty( filter.CastId ) )
            {
                query.Where.Add( ImpProductionCast.CastId.Like( filter.CastId ) );
            }

            if( reportFilter != null && reportFilter.Ranges.Count > 0 )
            {
                var list = new List<Where>();
                foreach( var range in reportFilter.Ranges )
                {
                    if( !string.IsNullOrEmpty( range.From ) && !string.IsNullOrEmpty( range.To ) )
                    {
                        list.Add( ImpProductionCast.CastId.Between( range.From, range.To ) );
                    }
                }

                if( list.Count > 0 )
                {
                    query.Where.Add( WhereGroup.Or( list.ToArray() ) );
                }
            }

            var statement = query.ToString();

            var tmList = new List<RecProductionCast>();
            var parser = new CastParser( tmList );

            using( var database = new ImpactDatabase() )
            {
                var list = database.GetAll( statement, ParseSchedule );

                foreach( var item in list )
                {
                    item.Form.Factory = filter.Factory;
                    item.Cast.Factory = filter.Factory;

                    item.Form.Project = filter.Project;
                    item.Cast.Project = filter.Project;

                    if( null != item.Element )
                    {
                        item.Element.Factory = filter.Factory;
                        // Never set element.project to curFilter.project
                        // since we retrieve elmenets from different projects!                    
                    }

                    parser.Parse( item.Form, item.Cast, item.Element );
                }
            }

            // Now load all the existing forms
            var formSvc = new ProjectManager();
            var productionFormStdData = formSvc.LoadProductionFormStd( new BedFilter( filter ) { Location = Filter.All } );
            return new CastScheduleData( tmList, productionFormStdData );
        }
示例#11
0
 /// <summary>
 /// Returns no of strands
 /// </summary>
 /// <param name="castunit"></param>
 /// <returns></returns>
 private int GetNumberOfStrands( RecProductionFormStd castunit )
 {
     var nbrOfStrands = 0;
     if( castunit == null || string.IsNullOrEmpty( castunit.Factory ) || string.IsNullOrEmpty( castunit.Project ) )
     {
         return nbrOfStrands;
     }
     var svc = new ProjectManager();
     var recStrand = new RecProductionFormStrandStd { Factory = castunit.Factory, Project = castunit.Project, Name = castunit.Name };
     var strands = svc.LoadProductionFormStrandStd( recStrand );
     if( null != strands )
     {
         nbrOfStrands = (from o in strands where o.IsUsed select o).Count();
     }
     return nbrOfStrands;
 }
        /// <summary>
        /// Sort existin elements
        /// </summary>
        /// <param name="elements"></param>
        /// <param name="form"></param>
        /// <param name="curFilter"></param>
        /// <returns></returns>
		public int Sort( List<RecTMElement> elements, RecProductionFormStd form, BedFilter curFilter )
		{
			if( null == form || null == elements || elements.Count == 0 )
			{
				var msg = string.Format( "Missing sorting input!" );
				throw new FaultException<BusinessFaultContract>( new BusinessFaultContract() { Argument = msg }, "Cannot sort form!" );
			}

			this.filter = curFilter;
            var bed = new ProductionBed( form, curFilter );

			var positionedElements = bed.FillBed( elements );
			var savedElem = bed.Save( positionedElements );

            if( savedElem < elements.Count )
            {
                // remove the delta
                var mgr = new ProjectManager();
                var planner = new ModelPlanner();
                foreach( RecTMElement elem in elements )
                {
                    if( !mgr.Find( positionedElements, elem ) )
                    {
                        planner.ResetElementProduction( elem.Factory, elem.Project, 0, elem.ElementId, false );
                    }
                }
            }

            return 0;
		}
示例#13
0
		public int DeleteCascadeVehicleTransport( RecTransport transport, RecTransportVehicleStd veh )
		{
			RecTransportStack rec = new RecTransportStack();
			rec.Factory = transport.Factory;
			rec.Project = transport.Project;
			rec.TransportId = transport.TransportId;
			rec.VehicleId = veh.VehicleId;

			// Delete cascade stacks
			ProjectManager svc = new ProjectManager();
			List<RecTransportStack> stacks = svc.LoadTransportStack( rec );
			foreach( RecTransportStack stack in stacks )
			{
				this.DeleteCascadeStackTransport( transport, veh, stack );
			}

			// Now delete the vehicle
			ProjectManager vehSvc = new ProjectManager();
			List<RecTransportVehicleStd> vehicles = new List<RecTransportVehicleStd>();
			vehicles.Add( veh );
			return vehSvc.RemoveTransportVehicles( transport, vehicles );
		}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="templates"></param>
        private void LoadTemplateDetails( List<RecTransport> templates )
        {
            foreach( RecTransport tpl in templates )
            {
                ProjectManager svc = new ProjectManager();
                tpl.Vehicles = svc.LoadTransportVehicles( tpl );

                // Load vehicle stacks
                foreach( RecTransportVehicleStd veh in tpl.Vehicles )
                {
                    RecTransportVehicleStackStd recStack = new RecTransportVehicleStackStd();
                    recStack.Factory = veh.Factory;
                    recStack.Project = veh.Project;
                    recStack.Name = veh.Name;
                    veh.Stacks = new ProjectManager().LoadTransportVehicleStackStd( recStack );
                    if( veh.Stacks.Count == 0 )
                    {
                        string msg = string.Format( "There are no stacks defined for the standard vehicle \"{0}\" !", veh.Name );
                        throw new FaultException<BusinessFaultContract>( new BusinessFaultContract() { Argument = msg }, "There are no stacks defined!" );
                    }
                }
                if( tpl.Vehicles.Count == 0 )
                {
                    string msg = string.Format( "There are no standard vehicles associated with the transport template \"{0}\" !", tpl.Description );
                    throw new FaultException<BusinessFaultContract>( new BusinessFaultContract() { Argument = msg }, "The transport temmplate is missing vehicles!" );
                }
            }
        }
示例#15
0
        /// <summary>
        /// Update the transport and elements with new status
        /// </summary>
        /// <param name="transports"></param>
        /// <param name="recTransportStatus"></param>
        /// <returns></returns>
        public int UpdateStatusTransport( List<RecTransport> transports, RecTransport recTransportStatus )
        {
            if( null == transports || transports.Count == 0 )
            {
                return 0;
            }

            ProjectManager mgr = new ProjectManager();
            RecElementIdStatusStd std = new RecElementIdStatusStd { Factory = recTransportStatus.Factory, Project = recTransportStatus.Project };
            List<RecElementIdStatusStd> settings = mgr.LoadStandardSettings( std );

            foreach( RecTransport recTransport in transports )
            {
                UpdateStatus( recTransport, recTransportStatus, settings );
            }

            return 0;
        }
	    /// <summary>
		/// Insert the specified record into the database.
		/// </summary>
		/// <param name="record">The record to insert into the database.</param>
		/// <returns>The number of affected records.</returns>
        public int InsertProductionCastStrand(RecProductionCastStrand record, RecProductionFormStd form, BedFilter filter)
		{
            if (null == record)
            {
                return -1;
            }
            int castId = record.CastId;
            if (castId <= 0)
            {
                if (null == form || null == filter)
                {
                    return -1;
                }
                var cast = new RecProductionCast
                    {
                        Factory = record.Factory,
                        Project = record.Project,
                        CastType = form.FormType,
                        Description = "",
                        Shift = filter.Shift,
                        StartDate = filter.StartDateFrom,
                        EndDate = filter.StartDateFrom,
                        Form = form.Name,
                        Tolerance = form.Tolerance,
                        ElementType = form.ElementType,
                        Style = form.Style,
                        Strandptn = form.Strandptn,
                        CastStatus = 0,
                        CastDivision = ""
                    };

                var svc = new ProjectManager();
                var newCast = svc.InsertProductionCast(cast);
                castId = newCast.CastId;
            }

			var insert = new ImpactInsert( ImpProductionCastStrand.Instance )
			{
				Columns = 
				{
					{ ImpProductionCastStrand.Factory, record.Factory },
					{ ImpProductionCastStrand.Project, record.Factory },// Factory, Factory for productionCast & ProductionCastStrand
					{ ImpProductionCastStrand.CastId, castId },
					{ ImpProductionCastStrand.StrandPos, record.StrandPos },
					{ ImpProductionCastStrand.StrandX, record.StrandX },
					{ ImpProductionCastStrand.StrandY, record.StrandY },
					{ ImpProductionCastStrand.StrandQuality, record.StrandQuality },
					{ ImpProductionCastStrand.StrandDimension, record.StrandDimension },
					{ ImpProductionCastStrand.StrandPrestressing, record.StrandPrestressing },
				}
			};

			string statement = insert.ToString();

			int result;

			using( var database = new ImpactDatabase() )
			{
				result = database.ExecuteNonQuery( statement );
			}

			return result;
		}
示例#17
0
		/// <summary>
		/// Insert the specified record into the database.
		/// </summary>
		/// <param name="record">The record to insert into the database.</param>
		/// <returns>The number of affected records.</returns>
		public RecProductionCast InsertProductionCast( RecProductionCast record )
		{
            // Get new sequence
			ProjectManager ng = new ProjectManager();
			string company = ProjectManager.GetCompany( record.Factory );
			int castId = ng.GetNextNumber( company, company, RecNumberGenerator.CMP_NG_CAST_ID );

			var insert = new ImpactInsert( ImpProductionCast.Instance )
			{
				Columns = 
				{
					{ ImpProductionCast.Factory, record.Factory },
					{ ImpProductionCast.Project, record.Factory }, // Factory, Factory for productionCast
					{ ImpProductionCast.CastId, castId }, //Sequence
					{ ImpProductionCast.CastType, record.CastType },
					{ ImpProductionCast.Description, record.Description },
					{ ImpProductionCast.Shift, record.Shift },
					{ ImpProductionCast.StartDate, record.StartDate },
					{ ImpProductionCast.EndDate, record.EndDate },
					{ ImpProductionCast.Form, record.Form },
					{ ImpProductionCast.Tolerance, record.Tolerance },
					{ ImpProductionCast.ElementType, record.ElementType },
					{ ImpProductionCast.Style, record.Style },
					{ ImpProductionCast.Strandptn, record.Strandptn },
					{ ImpProductionCast.CastStatus, record.CastStatus },
					{ ImpProductionCast.CastDivision, record.CastDivision },
				}
			};

			string statement = insert.ToString();

			int result;

			using( ImpactDatabase database = new ImpactDatabase() )
			{
				result = database.ExecuteNonQuery( statement );
			}

            // Copy strands from template (form)
            if (!string.IsNullOrWhiteSpace(record.Form))
            {
                record.CastId = castId;
                ProjectManager svc = new ProjectManager( );
                svc.CopyStrandsFromTemplate( record );
            }

			return record;
		}
示例#18
0
 public List<RecProductionCastStrand> LoadCastStrands( RecProductionCastStrand record )
 {
     var svc = new ProjectManager();
     return svc.LoadProductionCastStrand( record );
 }
示例#19
0
		/// <summary>
		/// Returns a list of the reset element ids.
		/// </summary>
		/// <param name="record">The record to delete from the database.</param>
		/// <returns>The number of affected records.</returns>
		public CastScheduleResult DeleteProductionCast( RecProductionCast record )
		{
            ProjectManager projectManagerService = new ProjectManager();   
            BedFilter filter = new BedFilter();
            filter.Factory = record.Factory;
            List<string> projectsInvolved = projectManagerService.LoadCastProjects( filter, record.CastId );
            if( null == projectsInvolved )
            {
                return null;
            }

            ProjectManager mgr = new ProjectManager();
            RecElementIdStatusStd std = new RecElementIdStatusStd { Factory = record.Factory, Project = record.Project };
            List<RecElementIdStatusStd> settings = mgr.LoadStandardSettings( std );

			ModelPlanner svc = new ModelPlanner( );
            List<int> deletedIds = svc.LoadElementIds( record.Factory, record.Project, record.CastId );

            // (1) Reset elements
            // Update Status, Note this can be optimized!
            RecProductionCast recProductionCastStatus = new RecProductionCast( record );
            recProductionCastStatus.CastStatus = (int)CastStatus.NoStatus;
            recProductionCastStatus.ElementIdStatus = RecElementIdStatusStd.GetLocalSettingFromGlobalId( settings, recProductionCastStatus.CastStatus).StatusId;
            UpdateStatus( record, recProductionCastStatus, settings );
            // Now reset
			svc.ResetElementProduction( record.Factory, record.Project, record.CastId, 0, false );

            // (2) Delete strands
            RecProductionCastStrand recStrand = new RecProductionCastStrand();
            recStrand.Factory = record.Factory;
            recStrand.Project = record.Factory; // Factory, Factory for productionCast & ProductionCastStrand
            recStrand.CastId = record.CastId;
            recStrand.StrandPos = 0;
            ProjectManager strand = new ProjectManager();
            strand.DeleteProductionCastStrand(recStrand);
            // (3) Now delete the cast Object
            int result = 0;
            // The cast object can be deleted if no elements belong to other projects other that the current one
            if( projectsInvolved.Count == 0 || (projectsInvolved.Count == 1 && projectsInvolved[0].Equals( record.Project ) )  )
            {
                var delete = new ImpactDelete( ImpProductionCast.Instance )
                {
                    Where = 
				{
					{ ImpProductionCast.Factory.Equal( record.Factory )},
					{ ImpProductionCast.Project.Equal( record.Factory )},// Factory, Factory for productionCast & ProductionCastStrand
					{ ImpProductionCast.CastId.Equal( record.CastId )},
				}
                };

                string statement = delete.ToString();

                using( ImpactDatabase database = new ImpactDatabase() )
                {
                    result = database.ExecuteNonQuery( statement );
                }
            }

			return new CastScheduleResult(deletedIds, projectsInvolved);
		}
示例#20
0
        /// <summary>
        /// Saves the cast into the database
        /// </summary>
        public RecProductionCast GetCast()
        {
            // If there is a cast object with the same date (Year, Month, Day), shift then use it
            // otherwise create a new one
            var cast = this.FindCast( -1 );
            var svc = new ProjectManager();
            var pcd = svc.LoadProductionCast( this.bedFilter, cast );
            RecProductionCast newCast = null;
            if( pcd != null && pcd.Count > 0 )
            {
                newCast = pcd[0]; // Use the first one
            }
            if( newCast == null )
            {
                newCast = svc.InsertProductionCast( cast );
            }
            if( newCast == null )
            {
                throw new Exception( "Cannot create new cast object!" );
            }
            cast.CastId = newCast.CastId;

            return cast;
        }
		/// <summary>
		/// Insert of Transport Vehicle Standard items
		/// </summary>
		/// <param name="rec"></param>
		/// <param name="vehicle"></param>
		/// <param name="seq"></param>
		/// <returns></returns>
		public RecTransportVehicleStd InsertTransportVehicle( RecTransport rec, RecTransportVehicleStd vehicle, int seq )
		{
			if( rec == null || rec.Factory == null || rec.Project == null )
			{
				throw new ArgumentNullException( "Transport" );
			}
			string project = "";
			if( rec.IsTemplate == 1 )
			{
				// Templates are saved on factory level (factory, factory), 2012-04-23
				project = rec.Factory;
			}
			else
			{
				project = rec.Project;
			}
			RecTransportVehicleStd res = new RecTransportVehicleStd( vehicle );
			using( ImpactDatabase database = new ImpactDatabase() )
			{
				// 1. Instantiate a new command with a query and connection
				ProjectManager ng = new ProjectManager();
				int vehicleId = ng.GetNextNumber( rec.Factory, rec.Project, RecNumberGenerator.NG_VEHICLE_ID );

				string sql = "Insert into IMP_TRANSPORT_VEHICLE(FACTORY,PROJECT,TRANSPORT_ID,VEHICLE_ID,VEHICLE,VEHICLE_SEQUENCE_NO,TRANSPORT_TYPE)values("
										+ Conv.Sql( rec.Factory ) + ","
										+ Conv.Sql( project ) + "," //Templates are saved on factory level (factory, factory), 2012-04-23
										+ Conv.Sql( rec.TransportId ) + ","
										+ Conv.Sql( vehicleId ) + ","
										+ Conv.Sql( vehicle.Name ) + ","
										+ Conv.Sql( seq ) + ","
										+ Conv.Sql( vehicle.TransportType )
										+ ")";

				database.ExecuteNonQuery( sql );

				res.VehicleId = vehicleId;
			}
			return res;
		}
        /// <summary>
        /// Load Section Styles
        /// </summary>
        /// <param name="factory"></param>
        /// <param name="project"></param>
        /// <returns></returns>
        public List<RecSectionStyleStd> LoadSectionStyles( string factory, string project )
        {
            // Hollowcore (HD/F), Prestressed Slab (D/F)
            // (1) Load Style from IMP_SECTION_STYLE_STD
            // (2) Load Sttrandpattern and No of strands from
            // IMP_SECTION_STRANDPTN_STD.NAME, IMP_SECTION_STRANDPTN_POS_STD->Count ([STRAND_POS])
            var styleSvc = new ProjectManager();
			var styles = styleSvc.LoadSectionStyleStd( factory, project );

			// Load Slab Style
            // 3 kinds of slabs
			styles.AddRange( GetSlabStyles( factory, project ) );
			// Load Wall Style
            // 1 kind
			styles.AddRange( GetWallStyles( factory, project ) );

            return styles;
        }
 RecTransportVehicleStd GetStandardVehicle( RecTMElement rec )
 {
     ProjectManager svc = new ProjectManager();
     RecTransport recTrans = new RecTransport();
     recTrans.Factory = rec.Factory;
     recTrans.Project = rec.Project;
     recTrans.TransportId = rec.TransportId;
     List<RecTransportVehicleStd> vehList = svc.LoadTransportVehiclesEx( recTrans, rec.VehicleId );
     if( vehList != null && vehList.Count > 0 )
     {
         return vehList[0];
     }
     return null;
 }
示例#24
0
        /// <summary>
        /// LoadHollowcoreStrands
        /// </summary>
        /// <param name="form"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        private List<RecProductionFormStrandStd> LoadHollowcoreStrands( RecProductionFormStd form, Filter filter )
        {

            if( string.IsNullOrEmpty( form.Style ) || string.IsNullOrEmpty( form.Strandptn ) )
            {
                return null;
            }
            var strandSvc = new ProjectManager();
            var strands = strandSvc.LoadStrands(
                            filter.Factory,
                            filter.Project,
                            form.ElementType,
                            form.Style,
                            form.Strandptn );
            if( null != strands && strands.Count > 0 )
            {
                var list = new List<RecProductionFormStrandStd>();
                foreach( var strand in strands)
                {
                    var strandStd = new RecProductionFormStrandStd 
                    { 
                        Factory = strand.Factory, 
                        Project = strand.Project, 
                        StrandPos = strand.StrandPos, 
                        StrandX = strand.StrandX, 
                        StrandY = strand.StrandY, 
                        StrandQuality = strand.StrandQuality,
                        StrandDimension = strand.StrandDimension,
                        StrandPrestressing = strand.StrandPrestressing,
                    };

                    list.Add( strandStd );
                }

                return list;
            }

            return null;
        }
示例#25
0
		/// <summary>
		/// Delete of Transport items
		/// </summary>
		/// <param name="transport"></param>
		/// <returns></returns>
		public int DeleteCascadeTransport( RecTransport transport )
		{
			if( transport == null || transport.TransportId == 0 )
			{
				throw new ArgumentNullException( "RecTransport" );
			}
			string project = "";
			if( transport.IsTemplate == 1 )
			{
				// Templates are saved on factory level (factory, factory), 2012-04-23
				project = transport.Factory;
			}
			else
			{
				project = transport.Project;
			}
			// Delete cascade vehicles
			ProjectManager vehSvc = new ProjectManager();
			List<RecTransportVehicleStd> vehicles = vehSvc.LoadTransportVehicles( transport );
			foreach( RecTransportVehicleStd veh in vehicles )
			{
				this.DeleteCascadeVehicleTransport( transport, veh );
			}

			int ret = 0;
			// Now let's delete the transport 
			using( ImpactDatabase database = new ImpactDatabase() )
			{
				ImpactDelete delete = new ImpactDelete( ImpTransport.Instance )
				{
					Where = { ImpTransport.Factory.Equal( transport.Factory ), 
							  ImpTransport.Project.Equal( project ),// Templates are saved on factory level (factory, factory), 2012-04-23
							  ImpTransport.TransportId.Equal( transport.TransportId )},
				};
				string statement = delete.ToString();
				ret = database.ExecuteNonQuery( statement );
			}
			return ret;
		}
示例#26
0
        /// <summary>
        /// LoadStrands
        /// </summary>
        /// <param name="forms"></param>
        /// <param name="filter"></param>
        private void LoadCastStrands( IEnumerable<RecProductionFormStd> forms, Filter filter )
        {
            foreach( var recProductionFormStd in forms )
            {
                var rec = new RecProductionCastStrand()
                              {
                                  Factory = filter.Factory,
                                  Project = filter.Project,
                                  CastId = recProductionFormStd.ProductionCast.CastId
                              };
                if( null != recProductionFormStd.ProductionCast )
                {
                    if( recProductionFormStd.FormType == FormType.Bed && recProductionFormStd.StrandType == StrandType.Bed )
                    {
                        // Load cast strands
                        var svc = new ProjectManager();
                        recProductionFormStd.ProductionCast.Strands = svc.LoadProductionCastStrand( rec );
                    }
                    var et = recProductionFormStd.ProductionCast.ElementType;
                    var hasStrands = et.Equals( "HD" ) || et.Equals( "HD/F" );

                    if( hasStrands )
                    {
                        var strandSvc = new ProjectManager();
                        recProductionFormStd.ProductionCast.Strands = strandSvc.LoadStrands(
                            filter.Factory,
                            filter.Project,
                            recProductionFormStd.ProductionCast.ElementType,
                            recProductionFormStd.ProductionCast.Style,
                            recProductionFormStd.ProductionCast.Strandptn );
                    }
                }
            }
        }
示例#27
0
        /// <summary>
        /// Delete Cascade Stack
        /// </summary>
        /// <param name="transport"></param>
        /// <param name="veh"></param>
        /// <param name="stack"></param>
        /// <returns></returns>
		public int DeleteCascadeStackTransport( RecTransport transport, RecTransportVehicleStd veh, RecTransportStack stack )
		{
            ProjectManager mgr = new ProjectManager();
            RecElementIdStatusStd std = new RecElementIdStatusStd { Factory = transport.Factory, Project = transport.Project };
            List<RecElementIdStatusStd> settings = mgr.LoadStandardSettings( std );

            // Update Status, Note this can be optimized!
            RecTransport recTransportStatus = new RecTransport( transport );
            recTransportStatus.TransportStatus = (int)TransportStatus.NoStatus;
            recTransportStatus.ElementIdStatus = RecElementIdStatusStd.GetLocalSettingFromGlobalId( settings, recTransportStatus.TransportStatus).StatusId;
            UpdateStatus( transport, recTransportStatus, settings );
            // No reset
			ModelPlanner svc = new ModelPlanner();
			svc.ResetTransport( transport.Factory, transport.Project, 0, transport.TransportId, veh.VehicleId, stack.StackId );

			ProjectManager StackSvc = new ProjectManager();
			return StackSvc.DeleteTransportStack( stack );
		}
示例#28
0
        /// <summary>
        /// Update the transport and elements with new status
        /// </summary>
        /// <param name="transports"></param>
        /// <param name="recTransportStatus"></param>
        /// <returns></returns>
        public int UpdateStatusProductionCast( List<RecProductionCast> casts, RecProductionCast recProductionCastStatus )
        {
            if( null == casts || casts.Count == 0 )
            {
                return 0;
            }

            ProjectManager mgr = new ProjectManager();
            RecElementIdStatusStd std = new RecElementIdStatusStd { Factory = recProductionCastStatus.Factory, Project = recProductionCastStatus.Project };
            List<RecElementIdStatusStd> settings = mgr.LoadStandardSettings( std );

            int ret = 0;
            foreach( RecProductionCast rec in casts )
            {
                ret += UpdateStatus( rec, recProductionCastStatus, settings );
            }

            return ret;
        }
示例#29
0
		/// <summary>
		/// Insert of Transport items
		/// </summary>
		/// <param name="transport"></param>
		/// <returns></returns>
		public RecTransport InsertTransport( RecTransport record )
		{
			if( record == null )
			{
				throw new ArgumentNullException( "Transport" );
			}
			RecTransport newTransport = new RecTransport( record );
			string project = "";
			if( record.IsTemplate == 1 )
			{
				//Secure and easy solution for unique sequence id's!!!
				// Use negative value to distinguish templates from transports!
				ProjectManager ng = new ProjectManager();
				newTransport.TransportId = -ng.GetNextNumber( record.Factory, record.Project, RecNumberGenerator.NG_TRANSPORT_ID );

				// Templates are saved on factory level (factory, factory), 2012-04-23
				project = record.Factory;
			}
			else
			{
				//Now let's use the slow, unsecure and bad unique id's using max, what a mess :(
				newTransport.TransportId = GetMaxTransportId( record ) + 1;
				project = record.Project;
			}

			var insert = new ImpactInsert( ImpTransport.Instance )
			{
				Columns = 
				{
					{ ImpTransport.Factory, record.Factory },
					{ ImpTransport.Project, project },// Templates are saved on factory level (factory, factory), 2012-04-23
					{ ImpTransport.TransportId, newTransport.TransportId }, // The new Id!
					{ ImpTransport.Description, record.Description },
					{ ImpTransport.LoadDate, record.LoadDate },
					{ ImpTransport.DeliveryDate, record.DeliveryDate },
					{ ImpTransport.IsTemplate, record.IsTemplate },
					{ ImpTransport.IsVisible, record.IsVisible },
					{ ImpTransport.TemplateId, record.TemplateId },
					{ ImpTransport.TimeInterval, record.TimeInterval },
					{ ImpTransport.TransportStatus, record.TransportStatus },
					{ ImpTransport.LoadLocation, record.LoadLocation },
					{ ImpTransport.LoadDivision, record.LoadDivision },
					{ ImpTransport.DeliveryDivision, record.DeliveryDivision },
				}
			};

			string statement = insert.ToString();

			int result;

			using( ImpactDatabase database = new ImpactDatabase() )
			{
				result = database.ExecuteNonQuery( statement );
			}

			return newTransport;
		}
示例#30
0
        /// <summary>
        /// LoadFormStrands
        /// </summary>
        /// <param name="forms"></param>
        /// <param name="filter"></param>
        private void LoadFormStrands( IEnumerable<RecProductionFormStd> forms, Filter filter )
        {
            if( null == forms )
            {
                return;
            }
            foreach( var recProductionFormStd in forms )
            {
                if( recProductionFormStd.FormType == FormType.Bed && recProductionFormStd.StrandType == StrandType.Bed )
                {
                    // Load for strands
                    var stdSvc = new ProjectManager();
                    var recStrand = new RecProductionFormStrandStd { Factory = filter.Factory, Project = filter.Project, Name = recProductionFormStd.Name };
                    var strands = stdSvc.LoadProductionFormStrandStd( recStrand );
                    if( null != strands )
                    {
                        strands = (from o in strands where o.IsUsed select o).ToList();
                    }
                    recProductionFormStd.Strands = strands;
                }
                else if( recProductionFormStd.FormType == FormType.Bed && ( recProductionFormStd.ElementType.Equals( "HD/F" ) || recProductionFormStd.ElementType.Equals( "D/F" ) ) )
                {
                    recProductionFormStd.Strands = LoadHollowcoreStrands( recProductionFormStd, filter);
                }
            }

        }