예제 #1
0
        public override bool ExeBusiness(ref string reStr)
        {
            if (!NodeStatParse(ref reStr))
            {
                return(false);
            }
            if (!checkEnable)
            {
                return(true);
            }
            switch (currentTaskPhase)
            {
            //case 0:
            //    {
            //        db1ValsToSnd[0] = db1StatCheckNoneed; //空板进入,放行
            //        if (this.currentStat.Status != EnumNodeStatus.工位有板)
            //        {
            //            logRecorder.AddDebugLog(nodeName, "空板,放行");
            //        }
            //        this.currentStat.Status = EnumNodeStatus.工位有板;
            //        this.currentStat.ProductBarcode = "";
            //        this.currentStat.StatDescribe = "空板";
            //        break;
            //    }
            case 1:
            {
                DevCmdReset();
                rfidUID = string.Empty;
                this.currentStat.Status         = EnumNodeStatus.设备空闲;
                this.currentStat.ProductBarcode = "";
                this.currentStat.StatDescribe   = "设备空闲";
                currentTaskDescribe             = "等待有产品信号";
                break;
            }

            case 2:
            {
                if (this.currentStat.Status == EnumNodeStatus.设备故障)
                {
                    break;
                }
                this.currentStat.Status         = EnumNodeStatus.设备使用中;
                this.currentStat.ProductBarcode = "";
                this.currentStat.StatDescribe   = "设备使用中";
                //读条码,做校验
                currentTaskDescribe = "开始读产品条码";
                string boxBarcode = "";
                if (SysCfgModel.SimMode)
                {
                    boxBarcode = SimBarcode;
                }
                else
                {
                    boxBarcode = barcodeRW.ReadBarcode();
                }
                if (boxBarcode == string.Empty || boxBarcode.Length < 26)
                {
                    db1ValsToSnd[0] = db1StatRfidFailed;
                    this.currentStat.StatDescribe = "无效的条码,位数不足26位!";
                    currentTaskDescribe           = "无效的条码,位数不足26位!";
                    break;
                }
                else
                {
                    db1ValsToSnd[0] = 0;
                }
                logRecorder.AddDebugLog(nodeName, "扫到纸箱条码:" + boxBarcode);
                //状态赋条码,
                BarcodeFillDB1(boxBarcode, 3);
                this.currentStat.ProductBarcode = boxBarcode;

                string productTypeCode  = boxBarcode.Substring(0, 13);
                ProductSizeCfgModel cfg = productCfgBll.GetModel(productTypeCode);
                if (cfg == null)
                {
                    db1ValsToSnd[0] = 8;
                    this.currentStat.StatDescribe = "产品尺寸配置不存在";
                    logRecorder.AddDebugLog(nodeName, "包装配置不存在," + boxBarcode);
                    currentTaskDescribe = "产品尺寸配置不存在";
                    checkEnable         = false;
                    break;
                }
                ProductPacsizeDefModel packSize = packsizeDefBll.GetModel(cfg.packageSize);
                db1ValsToSnd[1] = (short)packSize.packageSeq;
                db1ValsToSnd[2] = (short)(cfg.cataSeq % 256);
                if (db1ValsToSnd[2] == 0)
                {
                    db1ValsToSnd[2] = 1;
                }

                currentTaskPhase++;

                OutputRecord(this.currentStat.ProductBarcode);
                break;
            }

            case 3:
            {
                db1ValsToSnd[0] = db1StatCheckOK;
                this.currentStat.StatDescribe = "机器人码垛完成";
                if (LineMonitorPresenter.DebugMode)
                {
                    logRecorder.AddDebugLog(this.nodeName, "码垛完成");
                }
                currentTaskDescribe = "机器人码垛完成";
                currentTaskPhase++;
                break;
            }

            case 4:
            {
                this.currentStat.StatDescribe = "流程完成";
                currentTaskDescribe           = "流程完成";

                break;
            }

            default:
                break;
            }
            return(true);
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (opAdd)
     {
         //增加
         if (this.dicCata == "产品高度字典")
         {
             ProductHeightDefModel hgt = new ProductHeightDefModel();
             hgt.productHeight = int.Parse(this.textBox1.Text);
             hgt.heightSeq     = int.Parse(this.textBox2.Text);
             hgt.mark          = this.richTextBox1.Text;
             ProductHeightDefBll hgtBll = new ProductHeightDefBll();
             if (hgtBll.Exists(hgt.productHeight))
             {
                 MessageBox.Show("该高度定义已经存在");
             }
             else
             {
                 hgtBll.Add(hgt);
             }
         }
         else
         {
             ProductPacsizeDefModel packSize = new ProductPacsizeDefModel();
             packSize.packageSize = this.textBox1.Text;
             packSize.packageSeq  = int.Parse(this.textBox2.Text);
             packSize.mark        = this.richTextBox1.Text;
             ProductPacsizeDefBll packSizeBll = new ProductPacsizeDefBll();
             if (packSizeBll.Exists(packSize.packageSize))
             {
                 MessageBox.Show("该包装尺寸定义已经存在");
             }
             else
             {
                 packSizeBll.Add(packSize);
             }
         }
     }
     else
     {
         //修改
         if (this.dicCata == "产品高度字典")
         {
             ProductHeightDefModel hgt = new ProductHeightDefModel();
             hgt.productHeight = int.Parse(this.textBox1.Text);
             hgt.heightSeq     = int.Parse(this.textBox2.Text);
             hgt.mark          = this.richTextBox1.Text;
             ProductHeightDefBll hgtBll = new ProductHeightDefBll();
             if (hgtBll.Exists(hgt.productHeight))
             {
                 hgtBll.Update(hgt);
             }
             else
             {
                 hgtBll.Add(hgt);
             }
         }
         else
         {
             ProductPacsizeDefModel packSize = new ProductPacsizeDefModel();
             packSize.packageSize = this.textBox1.Text;
             packSize.packageSeq  = int.Parse(this.textBox2.Text);
             packSize.mark        = this.richTextBox1.Text;
             ProductPacsizeDefBll packSizeBll = new ProductPacsizeDefBll();
             if (packSizeBll.Exists(packSize.packageSize))
             {
                 packSizeBll.Update(packSize);
             }
             else
             {
                 packSizeBll.Add(packSize);
             }
         }
     }
     this.DialogResult = DialogResult.OK;
 }