Пример #1
0
        public LaborVM(WorkOrderDetailVM workOrderDetailVM, MaximoLabTrans labTrans = null)
        {
            WorkOrderDetailVM = workOrderDetailVM;
            CancelCommand     = new Command.CancelCommand <LaborVM>(this);
            SaveCommand       = new Command.SaveCommand <LaborVM>(this);
            LabTrans          = labTrans;


            List <string> craftrate;

            if (((App)Application.Current).AppType == "PM")
            {
                craftrate = new string[] { "SSWR", "SSLR", "SSWL" }.ToList();
            }
            else
            {
                craftrate = new string[] { "SSWR", "SSLR", "SSWL", "SCRW", "CNRW" }.ToList();
            }

            var labors = MaximoServiceLibrary.AppContext.laborRepository.findAll().Where(labor => labor.laborcraftrate.Where(laborcraftrate => craftrate.Contains(laborcraftrate.craft)).Count() > 0);

            LaborList = new List <MaximoPerson>();
            foreach (var labor in labors)
            {
                LaborList.AddRange(labor.person.Where(per => per.status == "ACTIVE").ToList());
            }

            if (LabTrans != null)
            {
                StartDate   = LabTrans.startdateentered + LabTrans.starttimeentered.TimeOfDay;
                Duration    = new DateTime(1900, 1, 1) + (LabTrans.finishdateentered + LabTrans.finishtimeentered.TimeOfDay - LabTrans.startdateentered - LabTrans.starttimeentered.TimeOfDay);
                IsDriver    = LabTrans.dcw_truckdriver;
                IsSecondMan = LabTrans.dcw_trucksecond;
                IsLeadMan   = LabTrans.dcw_trucklead;
                Labor       = LabTrans.laborcode;
                Type        = LabTrans.transtype;
            }
            else
            {
                StartDate = DateTime.Now;
                Type      = "WORK";
                Labor     = MaximoServiceLibrary.AppContext.synchronizationService.mxuser.userPreferences?.setting?.leadMan;
            }
        }
        public ToolVM(WorkOrderDetailVM workOrderDetailVM, MaximoToolTrans toolTrans = null)
        {
            WorkOrderDetailVM = workOrderDetailVM;
            CancelCommand     = new Command.CancelCommand <ToolVM>(this);
            SaveCommand       = new Command.SaveCommand <ToolVM>(this);
            ToolTrans         = toolTrans;

            ToolList = MaximoServiceLibrary.AppContext.inventoryRepository.findAll().ToList();
            if (ToolTrans != null)
            {
                Quantity = ToolTrans.toolqty.ToString();
                Duration = new DateTime(1900, 1, 1).AddHours(ToolTrans.toolhrs);
                Tool     = ToolTrans.itemnum;
            }
            else
            {
                Quantity = "1";
                Tool     = MaximoServiceLibrary.AppContext.synchronizationService.mxuser?.userPreferences?.setting?.vehiclenum;
            }
        }
Пример #3
0
        public AssetDetailVM(WorkOrderDetailVM _workOrderDetailVM)
        {
            PropertyChanged  += AssetDetailVM_PropertyChanged;
            WorkOrderDetailVM = _workOrderDetailVM;


            TypeList                   = MaximoServiceLibrary.AppContext.domainRepository.findOne("CB_SUBT").alndomain;
            TopMaterialList            = MaximoServiceLibrary.AppContext.domainRepository.findOne("CBTOPMATRL").alndomain;
            TopThicknessList           = MaximoServiceLibrary.AppContext.domainRepository.findOne("CBTOPTHICK").numericdomain;
            GrateTypeList              = MaximoServiceLibrary.AppContext.domainRepository.findOne("CBGRATETYPE").alndomain;
            OwnerList                  = MaximoServiceLibrary.AppContext.domainRepository.findOne("OWNER").alndomain;
            CleaningResponsibilityList = MaximoServiceLibrary.AppContext.domainRepository.findOne("CLNRESP").alndomain;

            FlowRestrictorTypeList = new List <StaticDomain>();
            FlowRestrictorTypeList.Add(new StaticDomain("ORIFICE", "Orifice"));
            FlowRestrictorTypeList.Add(new StaticDomain("BAFFLE", "Baffle"));
            FlowRestrictorTypeList.Add(new StaticDomain("WEIR", "Weir"));
            FlowRestrictorTypeList.Add(new StaticDomain("OTHER", "Other"));

            SaveCommand   = new Command.SaveCommand <AssetDetailVM>(this);
            CancelCommand = new Command.CancelCommand <AssetDetailVM>(this);
        }
Пример #4
0
        public SettingsVM(MapVM mapVM)
        {
            MapVM = mapVM;

            CancelCommand = new Command.CancelCommand <SettingsVM>(this);
            SaveCommand   = new Command.SaveCommand <SettingsVM>(this);
            UpdateReferenceDataCommand = new Command.UpdateReferenceDataCommand();
            DriverList = new List <MaximoPerson>();


            if (AppType == "PM")
            {
                secondManIsVisible = true;
            }
            else
            {
                secondManIsVisible = false;
            }

            VehicleList = MaximoServiceLibrary.AppContext.inventoryRepository.findAll().ToList();
            List <string> craftrate;

            if (AppType == "PM")
            {
                craftrate = new string[] { "SSWR", "SSLR", "SSWL" }.ToList();
            }
            else
            {
                craftrate = new string[] { "SSWR", "SSLR", "SSWL", "SCRW", "CNRW" }.ToList();
            }

            var labors = MaximoServiceLibrary.AppContext.laborRepository.findAll().Where(labor => labor.laborcraftrate.Where(laborcraftrate => craftrate.Contains(laborcraftrate.craft)).Count() > 0);

            LaborList = new List <MaximoPerson>();
            foreach (var labor in labors)
            {
                LaborList.AddRange(labor.person.Where(per => per.status == "ACTIVE").ToList());
            }
            MaximoPersonGroup = MaximoServiceLibrary.AppContext.synchronizationService.mxuser?.userPreferences?.setting;
            // find leadMan
            var leadList = LaborList.Where(person => person.personid == MaximoPersonGroup.leadMan).ToList();

            if (leadList.Count > 0)
            {
                DriverList.Add(leadList[0]);
            }

            if (AppType == "PM")
            {
                var secondList = LaborList.Where(person => person.personid == MaximoPersonGroup.secondMan).ToList();
                if (secondList.Count > 0)
                {
                    DriverList.Add(secondList[0]);
                }
            }



            Crew    = MaximoPersonGroup.persongroup;
            LeadMan = MaximoPersonGroup.leadMan;
            if (AppType == "PM")
            {
                SecondMan = MaximoPersonGroup.secondMan;
            }

            DriverMan = MaximoPersonGroup.driverMan;
            Vehicle   = MaximoPersonGroup.vehiclenum;



            if (LeadMan.ToUpper() == MaximoServiceLibrary.AppContext.synchronizationService.mxuser.personId.ToUpper())
            {
                LeadManIsEnabled   = false;
                SecondManIsEnabled = true;
            }
            else if (SecondMan?.ToUpper() == MaximoServiceLibrary.AppContext.synchronizationService.mxuser.personId.ToUpper())
            {
                LeadManIsEnabled   = true;
                SecondManIsEnabled = false;
            }
            else
            {
                LeadManIsEnabled   = false;
                SecondManIsEnabled = false;
            }


            PropertyChanged += SettingsVM_PropertyChanged;
        }