Показать сообщение отдельно
Старый 19.05.2011, 08:09    | »»» |  #6
OBerezhinskiy
Начинающий
 
Аватар для OBerezhinskiy
 
Регистрация: 19.05.2011
Сообщений: 2
OBerezhinskiy is on a distinguished road
По умолчанию

public static void Fill(DateTime date, int sn, bool isProblem)
{
XPCollection<ReportHead> c = new XPCollection<ReportHead>(Context.MainUnitOfWork);
XPCollection<QuestionableVehicles> q = new XPCollection<QuestionableVehicles>(Context.MainUni tOfWork);
rh = c.Where(t => !t.IsD && t.ReportDate.Date == date.Date && t.ShiftNo == sn).First();
DateTime s;
DateTime e;
if (rh.ShiftNo == 1)
{
s = new DateTime(rh.ReportDate.Year, rh.ReportDate.Month, rh.ReportDate.Day, 8, 0, 0);
e = new DateTime(rh.ReportDate.Year, rh.ReportDate.Month, rh.ReportDate.Day, 20, 0, 0);
}
else
{
s = new DateTime(rh.ReportDate.Year, rh.ReportDate.Month, rh.ReportDate.Day, 20, 0, 0);
e = new DateTime(rh.ReportDate.AddDays(1).Year, rh.ReportDate.AddDays(1).Month, rh.ReportDate.AddDays(1).Day, 8, 0, 0);

}


//s = new DateTime(10, 4, 26, 0, 0, 0);
//e = new DateTime(10, 4, 27, 8, 0, 0); ;

ag = new AutoGRAPHAutomationClass();
ag.EnterPassword(ProductionReporting.AutoGRAPHLoad er.Business.Properties.Settings.Default.AutoGraph) ;


List<string> log = new List<string>();

for (int i = 1; i <= ag.GroupsNum; i++)
{

ag.GroupIndex = i;
for (int i0 = 1; i0 <= ag.GroupCarsNum; i0++)
{
ag.CarIndex = i0;
var vl = rh.VehicleLine.Where(t => t.VehicleId.AutoGRAPHId == ag.CarDevice.ToString()).FirstOrDefault();
if (vl == null || ( isProblem && q.FirstOrDefault(t=>vl.VehicleId == t.VehicleId && rh == t.ReportHeadId)!=null)) continue;

//валится тут!!!!!!!!
ag.WaitForComputing(
ag.GroupFileName,
ag.CarDevice,
s.ToString("dd.MM.yy HH:mm:ss"),
e.ToString("dd.MM.yy HH:mm:ss"),
"GSM", 1);



for (int i1 = 1; i1 <= ag.TripsNum; i1++)
{

ag.TripIndex = i1;
ag.TripEntriesListTypeName = "parks"; // Тип списка записей
//ag.TripEntriesListKindName = "points"; // Вид списка записей

try
{
for (int i2 = 1; i2 <= ag.TripEntriesNum; i2++)
{


ag.EntryIndex = i2;
AGPoints p = new AGPoints();
p.Vehicle = vl;
// if (p.Vehicle == null) continue;

p.EntryEndRealTime = DateTime.Parse(ag.EntryEndRealTime);
p.EntryDistance = Convert.ToDecimal(ag.EntryDistance);
p.EntryMotor1Fuel = Convert.ToDecimal(ag.EntryMotor1Fuel);
p.EntryMotor1Hours = Convert.ToDecimal(ag.EntryMotor1Hours);
p.EntryMotor1ParkHours = Convert.ToDecimal(ag.EntryMotor1ParkHours);
p.EntryTank1EndLevel = Convert.ToDecimal(ag.EntryTank1EndLevel);
p.EntryTank1StartLevel = Convert.ToDecimal(ag.EntryTank1StartLevel);
p.Longitude = ag.EntryStartLongitude;
p.Latitude = ag.EntryStartLatitude;
p.IDP = ag.EntryStartIDP;
p.IDName = ag.EntryStartName;
p.CarDevice = ag.CarDevice;
if (p.IDP != null)
{
XPCollection<CheckPoints> cc =
new XPCollection<CheckPoints>(Context.MainUnitOfWork, new BinaryOperator("AutoGRAPHId", p.IDP, BinaryOperatorType.Equal));

p.JobName = cc.Count > 0 && cc.First().JobId != null ? cc.First().JobId.Name : null;
p.JobId = cc.Count > 0 && cc.First().JobId != null ? (int?)cc.First().JobId.IdN : null;
}

aglist.Add(p);
}
}
catch (Exception exp)
{
//EventLog.WriteEntry("PR.AutoGRAPH", exp.ToString());
if (DevExpress.XtraEditors.XtraMessageBox.Show(
string.Format(@"Смена №{0} - {1}; Техника {2};
{3}", sn, date.ToShortDateString(), ag.CarDevice, exp.ToString()),
"Ошибка",
System.Windows.Forms.MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
return;
}
}
}
}
DevExpress.XtraEditors.XtraMessageBox.Show(
string.Format(@"Загрузка данных смены №{0} - {1} завершена.
Загружено {2} записей.", sn, date.ToShortDateString(), aglist.Count),
"Собщение");
}

public static Jobs OtherJob
{
get
{
XPCollection<Jobs> job = new XPCollection<Jobs>(Context.MainUnitOfWork, new BinaryOperator("Name", "Прочее"));
return job.FirstOrDefault();
}
}

Добавлено через 42 минуты
Входные параметры в функцию WaitForComputing:
"Горнообогатительный.ini",
101448,
"15.10.10 08:00:00",
"15.10.10 20:00:00",
"GSM",
1
OBerezhinskiy вне форума   Ответить с цитированием