//开始执行 public static void Excute(View_FormulaInfoModel model, string potCode) { DSStep = 1; WaterStep = 1; CurrentFormulaModel = model; CurrentPotCode = potCode; Golbal.CurrentPotName = potList.FirstOrDefault(s => s.PotCode == Golbal.CurrentPotCode).PotName; MaterialQueue.Clear(); decimal minus = 0; foreach (View_FormulaDetailInfoModel detailModel in model.list.OrderBy(s => s.Sort)) { DsMaterial dsmaterial = new DsMaterial(); dsmaterial.MaterialId = detailModel.MaterialId.ToString(); dsmaterial.MaterialCode = detailModel.MaterialCode; dsmaterial.MaterialName = detailModel.MaterialName; dsmaterial.MaterialQuantity = detailModel.MaterialQuantity; dsmaterial.Unit = detailModel.Unit; dsmaterial.Price = detailModel.Price.Value; MaterialQueue.Enqueue(dsmaterial); minus += dsmaterial.MaterialQuantity + IntervalWater; } CurrentCabinetWaterQuantity = model.Quantity - minus - CleanWater; formulaStatus.FormulaStart(ParamClass);//开始写入配方状态 0; }
//执行入口 public void Excute(ParamClass pc, string potCode, string matCode, decimal targetQuantity) { CurrentDsMaterial = new DsMaterial(); CurrentDsMaterial.MaterialId = Golbal.WaterModel.Id.ToString(); CurrentDsMaterial.MaterialCode = Golbal.WaterModel.Code; CurrentDsMaterial.MaterialName = Golbal.WaterModel.Name; CurrentDsMaterial.MaterialQuantity = targetQuantity; CurrentDsMaterial.Unit = Golbal.WaterModel.Unit; CurrentDsMaterial.Price = Golbal.WaterModel.Price.Value; pc.FucEndWater(potCode, matCode, targetQuantity); base.KepWriteStatus(pc, ParamClass.ParamEnum.助剂配送状态); }
//执行入口 public void Excute(ParamClass pc, string potCode, decimal targetQuantity) { CurrentDsMaterial = new DsMaterial(); CurrentDsMaterial.MaterialId = Golbal.WaterModel.Id.ToString(); CurrentDsMaterial.MaterialCode = Golbal.WaterModel.Code; CurrentDsMaterial.MaterialName = Golbal.WaterModel.Name; CurrentDsMaterial.MaterialQuantity = targetQuantity; CurrentDsMaterial.Unit = Golbal.WaterModel.Unit; CurrentDsMaterial.Price = Golbal.WaterModel.Price.Value; pc.FucWaterDS(potCode, targetQuantity); base.KepWriteStatus(pc, ParamClass.ParamEnum.机台放水状态); TargetQuantity = targetQuantity; IsPercent = false; tTimer.Start(); }
private void Start_Event(object sender, EventArgs e) { btnStart.Enabled = false; btnEnd.Enabled = true; DsMaterial dsMaterial = new DsMaterial(); dsMaterial.MaterialCode = combMaterial.SelectedValue.ToString(); dsMaterial.MaterialName = combMaterial.SelectedText; dsMaterial.MaterialQuantity = decimal.Parse(txtTarget.Text); string potCode = combPot.SelectedValue.ToString(); if (cbkEnd.Checked)//末端排放 { switch (potCode) { case "211": potCode = "200"; break; case "212": potCode = "200"; break; case "221": potCode = "200"; break; case "222": potCode = "200"; break; case "231": potCode = "200"; break; case "232": potCode = "200"; break; case "241": potCode = "200"; break; case "242": potCode = "200"; break; case "251": potCode = "200"; break; case "252": potCode = "200"; break; case "261": potCode = "200"; break; case "262": potCode = "200"; break; } } Golbal.ParamClass.OpcSyncWrite(DSMS.DSW.OPC.ParamClass.ParamEnum.助剂配送机台缸号, potCode); Golbal.ParamClass.OpcSyncWrite(DSMS.DSW.OPC.ParamClass.ParamEnum.助剂配送助剂编号, dsMaterial.MaterialCode); Golbal.ParamClass.OpcSyncWrite(DSMS.DSW.OPC.ParamClass.ParamEnum.助剂配送目标量, dsMaterial.MaterialQuantity.ToString()); Golbal.ParamClass.OpcSyncWrite(DSMS.DSW.OPC.ParamClass.ParamEnum.助剂配送状态, "1"); }
private void FrmMaterialEdit_Load(object sender, EventArgs e) { numPanel1.ValueChange += ValueChange; combMaterial.DataSource = materialDAL.GetMaterialList(); combMaterial.DisplayMember = "Name"; combMaterial.ValueMember = "Code"; combMaterial.SelectedIndex = 0; if (currentMaterial != null) { combMaterial.SelectedValue = currentMaterial.MaterialCode; txtTarget.Text = currentMaterial.MaterialQuantity.ToString(); numPanel1.Value = txtTarget.Text; } else { currentMaterial = new DsMaterial(); } }
//达到机台放水百分比后开始配送助剂 private void PercentFinishEvent(object sender, EventArgs e) { if (Golbal.CurrentWashingaModel.MaterialQuantity > 0) { DS_DSMaterialModel materialmodel = MaterialList.Find(s => s.Code == "80"); DsMaterial dsMaterial = new DsMaterial(); dsMaterial.MaterialId = materialmodel.Id.ToString(); dsMaterial.MaterialCode = materialmodel.Code; dsMaterial.MaterialName = materialmodel.Name; dsMaterial.MaterialQuantity = Golbal.CurrentWashingaModel.MaterialQuantity; dsMaterial.Unit = materialmodel.Unit; dsMaterial.Price = materialmodel.Price.Value; washingmaterialDS.Excute(Golbal.ParamClass, Golbal.WashingCurrentPotCode, dsMaterial); //配送第一种助剂 Golbal.WashingDSStep = 1; //开始配送助剂 } else { Golbal.WashingDSStep = 2;//跳过配送助剂完成 } }
private void LoadData() { Guid parnetId; if (Guid.TryParse(combStandard.SelectedValue.ToString(), out parnetId)) { List <DsMaterial> materialList = new List <DsMaterial>(); foreach (View_FormulaStandardDetailModel model in formulaStandardDAL.GetListByParnetId(parnetId)) { DsMaterial dsMaterial = new DsMaterial(); dsMaterial.MaterialId = model.MatId.ToString(); dsMaterial.MaterialName = model.MatName; dsMaterial.MaterialCode = model.MatCode; dsMaterial.MaterialQuantity = model.MatQuantity.Value; dsMaterial.Price = model.Price.Value; dsMaterial.Unit = model.Unit; materialList.Add(dsMaterial); } bindingSource.DataSource = materialList; dataView1.DataSource = bindingSource; DSW_FormulaStandardModel standardModel = standardModelList.SingleOrDefault(s => s.Id == parnetId); IsChecked = standardModel.IsManualFeed; } }
//执行入口 public void Excute(ParamClass pc, string potCode, DsMaterial dsMaterial) { CurrentDsMaterial = dsMaterial; pc.FucMaterialDS(potCode, CurrentDsMaterial.MaterialCode, CurrentDsMaterial.MaterialQuantity); base.KepWriteStatus(pc, ParamClass.ParamEnum.助剂配送状态); }
public static void RecordAdd(int dsType, string barCode, string potCode, DsRecord dsRecord, DsMaterial dsMaterial) { View_DeviceInfoModel viewModel = deviceDAL.GetDeviceInfoByPotCode(potCode); DS_RecordModel recordModel = new DS_RecordModel(); recordModel.DSType = dsType; recordModel.Action = dsRecord.ActionName; recordModel.BarCode = barCode; recordModel.MatId = new Guid(dsMaterial.MaterialId); recordModel.MatCode = dsMaterial.MaterialCode; recordModel.MatName = dsMaterial.MaterialName; recordModel.DSQuantity = dsMaterial.MaterialQuantity; recordModel.RealQuantity = dsRecord.DSQuantity; recordModel.UnitType = dsMaterial.Unit; recordModel.UnitPrice = dsMaterial.Price; recordModel.TotalPrice = recordModel.RealQuantity * recordModel.UnitPrice; recordModel.DeviceId = viewModel.DeviceId; recordModel.DeviceName = viewModel.DeviceName; recordModel.PotCode = viewModel.PotCode; recordModel.PotName = viewModel.PotName; recordModel.EntryDate = DateTime.Now; recordModel.EntryFilterYMD = DateTime.Now.ToString("yyyyMMdd"); recordDAL.Add(recordModel); }
//动作完成事件 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); }
//达到机台放水百分比后开始配送助剂 private void PercentFinishEvent(object sender, EventArgs e) { DsMaterial dsMaterial = Golbal.MaterialQueue.Dequeue(); materialDS.Excute(Golbal.ParamClass, Golbal.CurrentPotCode, dsMaterial);//配送第一种助剂 }