コード例 #1
0
 public IEnumerable<SequencingStation> SequencingStationsBySequencingLocationId(int id)
 {
     PlasticSeqDatabase dbPlastic = new PlasticSeqDatabase();
     return dbPlastic.GetSequencingStationsBySequencingLocationId(id);
 }
コード例 #2
0
        public IEnumerable<PlasticSeqSchedule> GetPlasticScheduleHistoryDetailByLocationId(int locationId, int scheduleNum)
        {
            PlasticScheduleFactory factory = new PlasticScheduleFactory();
            PlasticSeqDatabase db = new PlasticSeqDatabase();

            List<PlasticSeqSchedule> listPlasticHistory = new List<PlasticSeqSchedule>();

            var seqStations = db.GetSequencingStationsBySequencingLocationId(locationId);

            foreach (var station in seqStations)
            {
                var schedule = factory.GetPlasticSeqScheduleHistoryDetail(station, scheduleNum);
                listPlasticHistory.Add(schedule);
            }

            return listPlasticHistory;
        }
コード例 #3
0
        public async Task<int> CompletePlasticSeqByLocationId(int id, int employeeId)
        {
            #region Complete Plastic Seq By Location Id
            try
            {
                PartSequencingDataContext dbSeq = new PartSequencingDataContext();
                EmployeeDatabase dbEmp = new EmployeeDatabase();
                PlasticSeqDatabase db = new PlasticSeqDatabase();

                int scheduleNum = 0;

                var seqStations = db.GetSequencingStationsBySequencingLocationId(id);

                if (seqStations.Count() > 0)
                {
                    var first = seqStations.FirstOrDefault();
                    if (first != null)
                        scheduleNum = first.NextBox.ScheduleNum;
                }

                Log.Logging.Info("Global Complete|Schedule #{0}|Location Id: {1}", scheduleNum, id);

                await Task.Run(() => Parallel.ForEach(seqStations, station =>
                {
                    Log.Logging.Info("Attempt Complete Schedule|Station: {0} Seq Id: {1}", station.SequencingLocation.Description, station.Id);
                    CompletePlasticSeqByStation(station);
                    Log.Logging.Info("Complete Schedule Done|Seq Id: {1}", id);
                }));

                var employee = dbEmp.GetEmployeeInfo(employeeId);

                var scheduleHist = new SequencingStationScheduleHistory
                {
                    EmployeeId = employeeId,
                    EmployeeName = employee == null ? "Unknown Employee" : employee.Name.Trim(),
                    ScheduleNum = scheduleNum,
                    SequencingLocationId = id,
                    DateCompleted = DateTime.Now,
                };

                dbSeq.SequencingStationScheduleHistories.InsertOnSubmit(scheduleHist);
                dbSeq.SubmitChanges();
                Log.Logging.Info("Insert|SequencingStationScheduleHistory|Schedule #{0}, {1}, {2}, {3}", scheduleNum, scheduleHist.SequencingLocationId, scheduleHist.EmployeeName, scheduleHist.DateCompleted);
                return 1;
            }
            catch (Exception ex)
            {
                Log.Logging.Fatal("FATAL|CompleteSequencingByAisleId(SeqId={0}, EmployeeId={1})", id, employeeId);
                Log.Logging.Fatal("FATAL|Error: {0}", ex.Message);
            }
            return 0;
            #endregion
        }