/// <summary> /// 循环动作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tMain_Elapsed(object sender, EventArgs e) { tMain.Stop(); if (Golbal.DSStep == 0 && Golbal.WaterStep == 0) { if (Golbal.MyQueueList.Count > 0) { lock (Golbal.MyQueueList) { if (Golbal.MyQueueList.Count > 0) { View_FormulaInfoModel model = Golbal.MyQueueList[0]; Golbal.Excute(model, model.PotCode); } //foreach (View_FormulaInfoModel model in Golbal.MyQueueList) //{ // //foreach (DS_PotModel potModel in Golbal.potList.Where(s => s.DeviceId == model.DeviceId).ToList()) // //{ // // if (Golbal.ParamClass.IsAlarming(potModel.PotCode)) // // { // Golbal.Excute(model, model.PotCode); // // } // //} //} } } } tMain.Start(); }
//<summary> //异常停止 //</summary> private void FormulaEnd() { if (Golbal.DSStep > 0 && Golbal.DSStep < 4) { FrmMessageBox frmMessageBox = new FrmMessageBox(); frmMessageBox.ShowYC("确定要停止?"); if (frmMessageBox.DialogResult == System.Windows.Forms.DialogResult.OK) { Golbal.MaterialQueue.Clear(); myPanel.SetFinishAll(); cabinetWaterDS.FormulaStop(); materialDS.FormulaStop(); endWaterDS.FormulaStop(); frmMessageBox.ShowYC("是否末端排放"); if (frmMessageBox.DialogResult == System.Windows.Forms.DialogResult.OK) { Task.Factory.StartNew(() => //线程执行任务 { endWaterDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, "99", Golbal.CleanWater); }); } else { Task.Factory.StartNew(() => //线程执行任务 { Golbal.EndExcute(); }); } } } }
//动作完成事件 private void Competed_Event(object sender, EventArgs e) { DsRecord dsRecord = new DsRecord(); dsRecord.EntryDate = DateTime.Now.ToString("HH:mm:ss"); //配送动作 if (sender is WashingMaterialDS) { Golbal.WashingDSStep = 2; //助剂配送完成 dsRecord.ActionName = "助剂配送"; dsRecord.MaterialName = washingmaterialDS.CurrentDsMaterial.MaterialName; dsRecord.DSQuantity = decimal.Parse(Golbal.ParamClass.水洗助剂配送实际); Golbal.RecordAdd(Golbal.CurrentWashingaModel.Devicetype, Golbal.CurrentWashingaModel.BarCode, Golbal.WashingCurrentPotCode, dsRecord, washingmaterialDS.CurrentDsMaterial);//添加纪录 } //机水动作 if (sender is WashingCabinetWaterDS) { Golbal.WashingWaterStep = 2;// 机台放水完成 dsRecord.ActionName = "机台放水"; dsRecord.MaterialName = "水"; dsRecord.DSQuantity = decimal.Parse(Golbal.ParamClass.水洗机台放水实际); Golbal.RecordAdd(Golbal.CurrentWashingaModel.Devicetype, Golbal.CurrentWashingaModel.BarCode, Golbal.WashingCurrentPotCode, dsRecord, washingcabinetWaterDS.CurrentDsMaterial);//添加纪录 } if (Golbal.WashingDSStep == 2 && Golbal.WashingWaterStep == 2) { Golbal.WashingEndExcute(); } RecordShow(dsRecord); }
/// <summary> /// 循环动作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tMain_Elapsed(object sender, EventArgs e) { tMain.Stop(); if (Golbal.WashingDSStep == 0 && Golbal.WashingWaterStep == 0) { if (Golbal.MyWashingList.Count > 0) { lock (Golbal.MyWashingList) { foreach (View_WashingModel washingmodel in Golbal.MyWashingList) { if (washingmodel != null) { Golbal.WashingExcute(washingmodel); break; } } } } } tMain.Start(); }
//动作完成事件 private void Competed_Event(object sender, EventArgs e) { DsRecord dsRecord = new DsRecord(); dsRecord.EntryDate = DateTime.Now.ToString("HH:mm:ss"); //配送动作 if (sender is MaterialDS) { dsRecord.ActionName = "助剂配送"; dsRecord.MaterialName = materialDS.CurrentDsMaterial.MaterialName; dsRecord.DSQuantity = decimal.Parse(Golbal.ParamClass.助剂配送实际); Golbal.RecordAdd(Golbal.CurrentFormulaModel.DeviceType, Golbal.CurrentFormulaModel.BarCode, Golbal.CurrentPotCode, dsRecord, materialDS.CurrentDsMaterial); //添加纪录 if (Golbal.DSStep == 1) //助剂配送完成 { Golbal.DSStep = 2; myPanel.SetFinishLabel(materialDS.CurrentDsMaterial.MaterialId); //设置完成标识 DsMaterial dsMaterial = new DsMaterial(); dsMaterial.MaterialId = Golbal.WaterModel.Id.ToString(); dsMaterial.MaterialCode = Golbal.WaterModel.Code; dsMaterial.MaterialName = "间隔水"; dsMaterial.MaterialQuantity = Golbal.IntervalWater; dsMaterial.Unit = Golbal.WaterModel.Unit; dsMaterial.Price = Golbal.WaterModel.Price.Value; materialDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, dsMaterial); //间隔水 } else if (Golbal.DSStep == 2)//间隔水完成 { if (Golbal.MaterialQueue.Count > 0) { Golbal.DSStep = 1; DsMaterial dsMaterial = Golbal.MaterialQueue.Dequeue(); materialDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, dsMaterial);//助剂配送 } else { Golbal.DSStep = 3; DsMaterial dsMaterial = new DsMaterial(); dsMaterial.MaterialId = Golbal.WaterModel.Id.ToString(); dsMaterial.MaterialCode = Golbal.WaterModel.Code; dsMaterial.MaterialName = "清洗水"; dsMaterial.MaterialQuantity = Golbal.CleanWater; dsMaterial.Unit = Golbal.WaterModel.Unit; dsMaterial.Price = Golbal.WaterModel.Price.Value; materialDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, dsMaterial); //管道清洗 } } else if (Golbal.DSStep == 3)//清洗水完成 { Golbal.DSStep = 4; endWaterDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, "99", Golbal.EndWater); } } //末端动作 if (sender is EndWaterDS) //末端排放完成 { Golbal.DSStep = 5; Golbal.CurrentAction = "等待机台放水中"; if (Golbal.WaterStep == 2) //当机台放水完成 { Golbal.EndExcute(); } dsRecord.ActionName = "末端排放"; dsRecord.MaterialName = "水"; dsRecord.DSQuantity = decimal.Parse(Golbal.ParamClass.助剂配送实际); Golbal.RecordAdd(Golbal.CurrentFormulaModel.DeviceType, Golbal.CurrentFormulaModel.BarCode, Golbal.CurrentPotCode, dsRecord, endWaterDS.CurrentDsMaterial);//添加纪录 } //机水动作 if (sender is CabinetWaterDS) { Golbal.WaterStep = 2; if (Golbal.DSStep == 5)//当末端排放完成 { Golbal.EndExcute(); } dsRecord.ActionName = "机台放水"; dsRecord.MaterialName = "水"; dsRecord.DSQuantity = decimal.Parse(Golbal.ParamClass.机台放水实际); Golbal.RecordAdd(Golbal.CurrentFormulaModel.DeviceType, Golbal.CurrentFormulaModel.BarCode, Golbal.CurrentPotCode, dsRecord, cabinetWaterDS.CurrentDsMaterial);//添加纪录 } RecordShow(dsRecord); }