public TimeSpan calculacte(JobLine jobLine) { Machine machine = jobLine.Machine; int stations = jobLine.Job.PageQuantity / 4; int quantity = jobLine.Job.Quantity; double instelMachine = machine.SetupTime + (stations * machine.SetupTimeStationFactor); double startDraai1000 = machine.RunTimeTo1000Speed + (stations * machine.RunTimeTo1000SpeedStationFactor); double doorDraai1000 = machine.RunTimeFrom1000Speed + (stations * machine.RunTimeFrom1000SpeedStationFactor); double quantityDoorDraai = quantity - 1000; double centiTime = instelMachine + startDraai1000 + (doorDraai1000 * quantityDoorDraai / 1000); int hour = 0; int minute = 0; int second = 0; if (centiTime >= 1) { hour = 1; centiTime--; } double centiMinute = centiTime % 1; minute = (int)Math.Round(centiMinute * 60); double centiSecond = (centiMinute * 60) - minute; second = (int)Math.Round(centiSecond * 60); TimeSpan planned = new TimeSpan(hour, minute, second); return(planned); }
public IActionResult Update(JobLine jobLine) { Job job = jobLine.Job; _context.Entry(job).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Entry(jobLine).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("ToDo")); }
public IActionResult JobReady(int jobId, bool yes) { JobLine jobLine = new JobLine(); jobLine = _context.JobLines.Include(j => j.Job).Where(j => j.Id == jobId).FirstOrDefault(); jobLine.Completed = yes; _context.Entry(jobLine).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Todo")); }
public JavaScriptResult SaveJobLog(int JobID, int LogID, string LogTime, string StartTime, string EndTime, string TotalTime, int EmployeeID, int ItemID, string Description) { DateTime LT = new DateTime(); DateTime ST = new DateTime(); DateTime ET = new DateTime(); decimal TT = 0; string result = @" alert('Log successfully saved'); "; if (LogID > 0) { result = @" alert('Log successfully Updated'); "; } try { LT = Convert.ToDateTime(LogTime); } catch { LT = DateTime.Now; } try { ST = Convert.ToDateTime(StartTime); } catch { result = @" alert('Enter a valid start time'); "; return(JavaScript(result)); } try { ET = Convert.ToDateTime(EndTime); } catch { result = @" alert('Enter a valid end time'); "; return(JavaScript(result)); } try { TT = Convert.ToDecimal(TotalTime); } catch { result = @" alert('Enter total time'); "; return(JavaScript(result)); } try { JobLine J = new JobLine { Description = Description, EmployeeID = EmployeeID, JobID = JobID, ServiceItemID = ItemID, TimeIn = ST, TimeOut = ET, TotalTime = TT, JobLineID = LogID }; if (!(M.SaveJobLine(J))) { result = @" alert('Log Save Failed!'); "; return(JavaScript(result)); } } catch { result = @" alert('Log Save Failed!'); "; return(JavaScript(result)); } return(JavaScript(result)); }
private bool IsActiveJob(JobLine job, DateTime currentDate) { if (job.DateOpen <= currentDate) { if (job.DateClose == null) { return(true); } else if (job.DateClose >= currentDate) { return(true); } } return(false); }
public TimeSpan calculacte(JobLine jobLine) { return(new TimeSpan(0, 30, 0)); }
public IActionResult Import(MachineTypes machineType, IFormFile files) { var uploads = Path.Combine(_environment.ContentRootPath, "uploads"); using (var fileStream = new FileStream(Path.Combine(uploads, files.FileName), FileMode.Create)) { files.CopyToAsync(fileStream); } Job job; string currentLine; string[] splitArray; JobLine jobLine; List <string> lines = new List <string>(); using (StreamReader reader = new StreamReader(new FileStream(Path.Combine(uploads, files.FileName), FileMode.Open))) { currentLine = reader.ReadLine(); while (!reader.EndOfStream) { currentLine = reader.ReadLine(); lines.Add(currentLine); } } foreach (string line in lines) { splitArray = line.Split(';'); //Check if job exists with current job number job = _context.Jobs.FirstOrDefault(z => z.JobNumber == splitArray[1]); //Create Job & JobLine if (job == null) { //Create Job job = new Job(); job.DeliveryDate = DateTime.ParseExact(splitArray[4], "dd/MM/yyyy", null); job.JobNumber = splitArray[1]; double aantal = double.Parse(splitArray[2]); job.Quantity = Convert.ToInt16(aantal); job.PaperBw = splitArray[8]; job.Cover = 0; job.PaperCover = "no cover"; job.Heigth = 297; job.Width = 210; //job.PageQuantity = int.Parse(splitArray[6]); _context.Jobs.Add(job); } //Create JobLine jobLine = new JobLine(); jobLine.JobId = job.Id; jobLine.Job = job; jobLine.Sequence = 1; jobLine.MachineType = machineType; jobLine.Completed = false; _context.JobLines.Add(jobLine); } _context.SaveChanges(); return(RedirectToAction("Todo")); }