Example #1
0
 //<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();
                 });
             }
         }
     }
 }
Example #2
0
        //动作完成事件
        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);
        }