示例#1
0
 public void AddCtlNode(CtlNodeBaseModel ctlNode)
 {
     if (ctlNode != null)
     {
         monitorNodeList.Add(ctlNode);
     }
 }
        private FlowPathModel FindFirstValidPath(string palletID, ref string reStr)
        {
            List <FlowPathModel> validPathList = new List <FlowPathModel>();

            foreach (FlowPathModel path in flowPathList)
            {
                if (path.IsPathConnected(palletID, ref reStr))
                {
                    validPathList.Add(path);
                }
            }
            if (validPathList.Count() == 0)
            {
                reStr = "没有可用分流路径";
                return(null);
            }
            //排序
            FlowPathModel rePath = validPathList[0];

            if (validPathList.Count() > 1)
            {
                for (int i = 1; i < validPathList.Count(); i++)
                {
                    FlowPathModel    path  = validPathList[i];
                    CtlNodeBaseModel node1 = rePath.NodeList[0];
                    CtlNodeBaseModel node2 = path.NodeList[0];
                    if (node2.PathValidWeight(palletID, ref reStr) > node1.PathValidWeight(palletID, ref reStr))
                    {
                        rePath = path;
                    }
                }
            }
            return(rePath);
        }
示例#3
0
        public string GetNodeName(string nodeID)
        {
            CtlNodeBaseModel node = GetNodeByID(nodeID);

            if (node == null)
            {
                return(string.Empty);
            }
            return(node.NodeName);
        }
示例#4
0
        public bool DevReset(string nodeName, ref string reStr)
        {
            CtlNodeBaseModel node = GetNodeByName(nodeName);

            if (node == null)
            {
                reStr = "不存在:" + reStr;
                return(false);
            }
            return(node.DevReset(ref reStr));
        }
示例#5
0
        public void SimSetBarcode(string nodeName, string barcode)
        {
            CtlNodeBaseModel node = GetMonitorNode(nodeName);

            if (node == null)
            {
                Console.WriteLine("工位:" + nodeName + " 不存在");
                return;
            }
            node.SimBarcode = barcode;
        }
示例#6
0
        //   public CtlManage.CommDevManage DevCommManager { get; set; }
        public bool CtlInit(XElement CtlnodeRoot, ref string reStr)
        {
            monitorNodeList = new List <CtlNodeBaseModel>();
            if (CtlnodeRoot == null)
            {
                reStr = "系统配置文件错误,不存在CtlNodes节点";
                return(false);
            }
            try
            {
                IEnumerable <XElement> nodeXEList =
                    from el in CtlnodeRoot.Elements()
                    where el.Name == "Node"
                    select el;
                foreach (XElement el in nodeXEList)
                {
                    string           className = (string)el.Attribute("className");
                    CtlNodeBaseModel ctlNode   = null;
                    switch (className)
                    {
                    case "TransDevModel.NodeTransStation":
                    {
                        ctlNode = new TransDevModel.NodeTransStation();
                        break;
                    }

                    case "TransDevModel.NodeRGV":
                    {
                        ctlNode = new TransDevModel.NodeRGV();
                        break;
                    }

                    default:
                        break;
                    }
                    if (ctlNode != null)
                    {
                        if (!ctlNode.BuildCfg(el, ref reStr))
                        {
                            return(false);
                        }

                        this.monitorNodeList.Add(ctlNode);
                    }
                }
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }

            return(true);
        }
示例#7
0
        public void SimSetAirlossCheckRe(string nodeName, string re)
        {
            if (nodeName != "气密检查1" && nodeName != "气密检查2" && nodeName != "气密检查3")
            {
                return;
            }
            CtlNodeBaseModel node        = GetNode(nodeName);
            NodeAirlossCheck airlossNode = node as NodeAirlossCheck;

            (airlossNode.AirDetectRW as AirDetectRWSim).DetectRe = re;
        }
示例#8
0
        public bool SimSetDB2(string nodeName, int dbItemID, int val)
        {
            CtlNodeBaseModel node = GetMonitorNode(nodeName);

            if (node == null)
            {
                Console.WriteLine("工位:" + nodeName + " 不存在");
                return(false);
            }
            node.DicCommuDataDB2[dbItemID].Val = val;
            return(true);
        }
示例#9
0
        public bool GetDevRunningInfo(string nodeName, ref DataTable db1Dt, ref DataTable db2Dt, ref string taskDetail)
        {
            CtlNodeBaseModel node = GetMonitorNode(nodeName);

            if (node == null)
            {
                return(false);
            }
            //任务
            db1Dt      = node.GetDB1DataDetail();
            db2Dt      = node.GetDB2DataDetail();
            taskDetail = node.GetRunningTaskDetail();
            return(true);
        }
示例#10
0
        //private bool ParseCtlnodes(XElement CtlnodeRoot, ref string reStr)
        //{
        //    if (CtlnodeRoot == null)
        //    {
        //        reStr = "系统配置文件错误,不存在CtlNodes节点";
        //        return false;
        //    }
        //    try
        //    {
        //        PLNodesBll plNodeBll = new PLNodesBll();
        //        IEnumerable<XElement> nodeXEList =
        //        from el in CtlnodeRoot.Elements()
        //        where el.Name == "Node"
        //        select el;
        //        foreach (XElement el in nodeXEList)
        //        {
        //            string className = (string)el.Attribute("className");
        //            CtlNodeBaseModel ctlNode = null;
        //            switch (className)
        //            {
        //                case "LineNodes.ProductInput":
        //                    {
        //                        ctlNode = new NodeProductInput();
        //                        break;
        //                    }
        //                case "LineNodes.NodeCheckGongneng":
        //                    {
        //                        ctlNode = new NodeCheckGongneng();
        //                        break;
        //                    }
        //                //case "LineNodes.NodeCheckXingneng":
        //                //    {
        //                //        ctlNode = new NodeCheckXingneng();
        //                //        break;
        //                //    }
        //                case "LineNodes.NodeCheckAngui":
        //                    {
        //                        ctlNode = new NodeCheckAngui();
        //                        break;
        //                    }

        //                case "LineNodes.NodeFaceCheck":
        //                    {
        //                        ctlNode = new NodeFaceCheck();
        //                        break;
        //                    }
        //                case "LineNodes.NodeRepairSwitch":
        //                    {
        //                        ctlNode = new NodeRepairSwitch();
        //                        break;
        //                    }
        //                case "LineNodes.NodeShenhe":
        //                    {
        //                        ctlNode = new NodeShenhe();
        //                        break;
        //                    }
        //                case "LineNodes.NodePack":
        //                    {
        //                        ctlNode = new NodePack();
        //                        break;
        //                    }
        //                case "LineNodes.NodeRobotPallet":
        //                    {
        //                        ctlNode = new NodeRobotPallet();
        //                        break;
        //                    }
        //                default:
        //                    break;
        //            }
        //            if (ctlNode != null)
        //            {
        //                if (!ctlNode.BuildCfg(el, ref reStr))
        //                {
        //                    return false;
        //                }
        //                //Console.WriteLine(ctlNode.NodeName + ",ID:" + ctlNode.NodeID + "创建成功!");
        //                ctlNode.PlcRW = GetPlcByID(ctlNode.PlcID); // this.plcRWs[2];
        //                if (ctlNode.RfidID > 0)
        //                {
        //                    ctlNode.RfidRW = GetRfidByID(ctlNode.RfidID);
        //                }
        //               // if (!SysCfgModel.SimMode)
        //               // {
        //                    ctlNode.RfidRW = GetRfidByID((byte)ctlNode.RfidID);
        //                    ctlNode.BarcodeRW = GetBarcoderRWByID(ctlNode.BarcodeID);
        //              //  }

        //                //Console.WriteLine(ctlNode.NodeName + ",ID:" + ctlNode.NodeID + "创建成功!");
        //                if (className == "LineNodes.NodeCheckAngui")
        //                {
        //                    NodeCheckAngui anguiNode = ctlNode as NodeCheckAngui;
        //                    anguiNode.AinuoObj = GetAinuoRWByID(anguiNode.ainuoMachineID);

        //                }
        //                if (className == "LineNodes.NodeCheckGongneng")
        //                {
        //                    NodeCheckGongneng gongNengNode = ctlNode as NodeCheckGongneng;
        //                    gongNengNode.AipuObj = GetAipuRWByID(gongNengNode.aipuMachineID);
        //                }
        //                ctlNode.plNodeModel = plNodeBll.GetModel(ctlNode.NodeID);
        //                this.nodeList.Add(ctlNode);
        //            }

        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        reStr = ex.ToString();
        //        return false;
        //    }

        //    return true;
        //}
        private bool ParseTheadNodes(XElement ThreadnodeRoot, ref string reStr)
        {
            if (ThreadnodeRoot == null)
            {
                reStr = "系统配置文件错误,不存在ThreadAlloc节点";
                return(false);
            }
            try
            {
                IEnumerable <XElement> nodeXEList =
                    from el in ThreadnodeRoot.Elements()
                    where el.Name == "Thread"
                    select el;
                foreach (XElement el in nodeXEList)
                {
                    string         threadName   = el.Attribute("name").Value;
                    int            threadID     = int.Parse(el.Attribute("id").Value);
                    int            loopInterval = int.Parse(el.Attribute("loopInterval").Value);
                    ThreadRunModel threadObj    = new ThreadRunModel(threadID, threadName);
                    //  ThreadBaseModel threadObj = new ThreadBaseModel(threadID, threadName);
                    threadObj.TaskInit(ref reStr);
                    threadObj.LoopInterval = loopInterval;
                    XElement nodeContainer = el.Element("NodeContainer");

                    IEnumerable <XElement> nodeListAlloc =
                        from nodeEL in nodeContainer.Elements()
                        where nodeEL.Name == "NodeID"
                        select nodeEL;
                    foreach (XElement nodeEL in nodeListAlloc)
                    {
                        string           nodeID = nodeEL.Value;
                        CtlNodeBaseModel node   = FindNode(nodeID);
                        //threadObj.SetThreadRoutine(node.NodeLoop);
                        // break;
                        if (node != null)
                        {
                            threadObj.AddNode(node);
                        }
                    }
                    this.threadList.Add(threadObj);
                }
                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }
        }
示例#11
0
        public void SimSetRFID(string nodeName, string strUID)
        {
            //if(rfidID<1 || rfidID>rfidRWs.Count())
            //{
            //    Console.WriteLine("RFID ID错误");
            //    return;
            //}
            CtlNodeBaseModel node = GetMonitorNode(nodeName);

            if (node == null)
            {
                Console.WriteLine("工位:" + nodeName + " 不存在");
                return;
            }
            node.SimRfidUID = strUID;
        }
示例#12
0
        public bool GetDevRunningInfo(string nodeName, ref DataTable db1Dt, ref DataTable db2Dt, ref string taskDetail, ref bool mesStop)
        {
            mesStop = true;
            CtlNodeBaseModel node = GetNode(nodeName);

            if (node == null)
            {
                return(false);
            }
            mesStop = node.MesStopstat;
            //任务
            db1Dt      = node.GetDB1DataDetail();
            db2Dt      = node.GetDB2DataDetail();
            taskDetail = node.GetRunningTaskDetail();
            return(true);
        }
示例#13
0
        private CtlNodeBaseModel FindNode(string nodeID)
        {
            CtlNodeBaseModel nodeFnd = null;

            if (this.nodeList == null)
            {
                return(null);
            }
            foreach (CtlNodeBaseModel node in this.nodeList)
            {
                if (node != null && node.NodeID == nodeID)
                {
                    nodeFnd = node;
                }
            }
            return(nodeFnd);
        }
示例#14
0
 public void BuildNodePath()
 {
     foreach (CtlNodeBaseModel node in monitorNodeList)
     {
         foreach (string nextNodeID in node.NextNodeids)
         {
             CtlNodeBaseModel nextNode = GetNodeByID(nextNodeID);
             if (nextNode != null)
             {
                 node.NextNodes.Add(nextNode);
             }
         }
     }
     foreach (CtlNodeBaseModel node in monitorNodeList)
     {
         node.BuildPathList();
     }
 }
示例#15
0
        public void InitNodeMonitorview(List <CtlNodeBaseModel> nodeList)
        {
            userCtlNodes   = new Dictionary <string, UserControlCtlNode>();
            nodeStatusList = new List <CtlNodeStatus>();
            this.flowLayoutPanel1.Controls.Clear();
            int  nodeCount = nodeList.Count();
            Size boxSize   = new Size(0, 0);

            boxSize.Width  = this.flowLayoutPanel1.Width / (nodeCount + 1);
            boxSize.Height = (int)(this.flowLayoutPanel1.Height);
            //foreach(CtlNodeBaseModel node in nodeList)
            for (int i = 0; i < nodeList.Count(); i++)
            {
                CtlNodeBaseModel   node        = nodeList[i];
                UserControlCtlNode monitorNode = new UserControlCtlNode();
                monitorNode.Size = boxSize;
                //监控控件属性赋值
                monitorNode.Title     = node.NodeName;
                monitorNode.TimerInfo = "40";

                monitorNode.RefreshDisp();
                this.flowLayoutPanel1.Controls.Add(monitorNode);
                userCtlNodes[node.NodeName] = monitorNode;

                nodeStatusList.Add(new CtlNodeStatus(node.NodeName)
                {
                    ProductBarcode = node.CurrentStat.ProductBarcode
                });
            }
            //配色方案

            //设备状态图例颜色
            nodeColorMap = new Dictionary <EnumNodeStatus, Color>();
            nodeColorMap[EnumNodeStatus.设备故障]  = Color.Red;
            nodeColorMap[EnumNodeStatus.设备空闲]  = Color.Green;
            nodeColorMap[EnumNodeStatus.设备使用中] = Color.Yellow;
            nodeColorMap[EnumNodeStatus.工位有板]  = Color.LightSeaGreen;
            nodeColorMap[EnumNodeStatus.无法识别]  = Color.PaleVioletRed;
            this.pictureBox1.BackColor         = nodeColorMap[EnumNodeStatus.设备故障];
            this.pictureBox2.BackColor         = nodeColorMap[EnumNodeStatus.设备空闲];
            this.pictureBox3.BackColor         = nodeColorMap[EnumNodeStatus.设备使用中];
            this.pictureBox4.BackColor         = nodeColorMap[EnumNodeStatus.工位有板];
            this.pictureBox5.BackColor         = nodeColorMap[EnumNodeStatus.无法识别];
        }
示例#16
0
        public int GetRunningDetectdevs()
        {
            int counter = 0;

            string[] detectDevSum = new string[]
            { "气密检查1", "气密检查2", "气密检查3", "零秒点火", "一次试火:1", "一次试火:2", "一次试火:3", "一次试火:4", "二次试火:1", "二次试火:2", "外观检测" };
            for (int i = 0; i < nodeList.Count; i++)
            {
                CtlNodeBaseModel node = nodeList[i];
                if (detectDevSum.Contains(node.NodeName))
                {
                    if (node.CurrentStat.Status != EnumNodeStatus.设备空闲 && (node.CurrentStat.Status != EnumNodeStatus.工位有板))
                    {
                        counter++;
                    }
                }
            }
            return(counter);
        }
示例#17
0
 private void BusinessLoop()//List<CtlNodeBaseModel> myNodeList
 {
     try
     {
         IPlcRW           plc1  = GetPlcByID(1);
         IPlcRW           plc2  = GetPlcByID(2);
         IPlcRW           plc3  = GetPlcByID(3);
         CtlNodeBaseModel node1 = FindNode("OPA004");
         plc1.WriteMultiDB(node1.Db1StartAddr, node1.Db1BlockNum, node1.Db1ValsToSnd);
         CtlNodeBaseModel node2 = FindNode("OPB001");
         plc2.WriteMultiDB(node2.Db1StartAddr, node2.Db1BlockNum, node2.Db1ValsToSnd);
         //CtlNodeBaseModel node3 = FindNode("OPC003");
         //plc3.WriteMultiDB(node3.Db1StartAddr, node3.Db1BlockNum, node3.Db1ValsToSnd);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
示例#18
0
        private bool Switch4003()
        {
            string reStr = "";

            if (!MesAcc.UpdateStep(1, this.rfidUID, ref reStr))
            {
                Console.WriteLine("{0} 更新步号错误,{1}", nodeName, reStr);
                return(false);
            }
            int switchRe = 0;

            FlowPathModel switchPath = FindFirstValidPath(this.rfidUID, ref reStr);

            if (switchPath == null)
            {
                switchRe             = this.flowPathList.Count() + 2; //无可用路径,等待
                this.db1ValsToSnd[0] = 3;
                return(false);
            }
            else
            {
                //string strCata = this.rfidUID.Substring(10, 1).ToUpper();

                string strCataName = "正极材料";
                if (!RecordPalletInfo(this.rfidUID, ref strCataName, ref reStr))
                {
                    return(false);
                }

                switchRe = switchPath.PathSeq + 1;
                CtlNodeBaseModel node = switchPath.NodeList[0];
                if (node.GetType().ToString() == "AsrsControl.AsrsPortalModel")
                {
                    (node as AsrsControl.AsrsPortalModel).PushPalletID(this.rfidUID);
                }
                this.db1ValsToSnd[0] = (short)switchRe;
                logRecorder.AddDebugLog(nodeName, string.Format("{0}分流,进入{1}", this.rfidUID, switchPath.NodeList[0].NodeName));
                return(true);
            }
        }
示例#19
0
        public void InitLineMonitor(int lineSeq, CtlLineBaseModel line)
        {
            //this.flowLayoutPanel1.Controls.Clear();

            Size boxSize = new Size(0, 0);

            View.UserControlLine userControlLine = null;
            if (lineSeq == 1)
            {
                userControlLine = this.userControlLine1;
            }
            else if (lineSeq == 2)
            {
                userControlLine = this.userControlLine2;
            }
            else
            {
                userControlLine = this.userControlLine3;
            }
            userControlLine.LineName = line.LineName;
            int nodeCount = line.NodeList.Count();

            for (int i = 0; i < nodeCount; i++)
            {
                CtlNodeBaseModel   node        = line.NodeList[i];
                UserControlCtlNode monitorNode = new UserControlCtlNode();
                monitorNode.Title = node.NodeName;
                userControlLine.Add(monitorNode);
                userCtlNodes[node.NodeName] = monitorNode;
                monitorNode.TimerInfo       = "40";
                monitorNode.RefreshDisp();
                nodeStatusList.Add(new CtlNodeStatus(node.NodeName)
                {
                    ProductBarcode = node.CurrentStat.ProductBarcode
                });
            }
            userControlLine.ReLayout();
        }
示例#20
0
        public bool MesRunCommit(string nodeName, bool mesRun, ref string reStr)
        {
            CtlNodeBaseModel node = GetNode(nodeName);

            if (node == null)
            {
                reStr = "不存在:" + nodeName;
                return(false);
            }
            foreach (string mesID in node.MesIDS)
            {
                string     jsonStr = "";
                RootObject rObj    = WShelper.DevStopStatUpload(6, mesID, "RUN", ref jsonStr);
                node.LogRecorder.AddDebugLog(node.NodeName, string.Format("恢复停机,返回:{0}", rObj.RES));
            }
            if (!node.PlcRWStop.WriteDB(node.MesStopAddr, 2))
            {
                reStr = "给PLC发送恢复停机命令失败";
                return(false);
            }
            node.MesStopstat = false;
            return(true);
        }
示例#21
0
        public override bool ExeBusiness(ref string reStr)
        {
            if (!devStatusRestore)
            {
                devStatusRestore = DevStatusRestore();
            }
            if (db2Vals[0] == 1)
            {
                currentTaskPhase = 0;
                Array.Clear(this.db1ValsToSnd, 0, this.db1ValsToSnd.Count());
                rfidUID             = string.Empty;
                currentTaskDescribe = "等待新的任务";
                //return true;
            }
            //if(db1ValsToSnd[0] >1) //分流完成后
            //{
            //    return true;
            //}
            if (db2Vals[0] == 2)
            {
                if (currentTaskPhase == 0)
                {
                    currentTaskPhase = 1;
                }
            }
            switch (this.currentTaskPhase)
            {
            case 1:
            {
                currentTaskDescribe = "开始读RFID";
                this.rfidUID        = "";
                if (SysCfg.SysCfgModel.UnbindMode)
                {
                    this.rfidUID = System.Guid.NewGuid().ToString();
                }
                else
                {
                    if (SysCfg.SysCfgModel.SimMode || SysCfg.SysCfgModel.RfidSimMode)
                    {
                        this.rfidUID = this.SimRfidUID;
                    }
                    else
                    {
                        this.rfidUID = this.barcodeRW.ReadBarcode();
                    }
                }

                if (string.IsNullOrWhiteSpace(this.rfidUID))
                {
                    if (this.db1ValsToSnd[0] != barcodeFailedStat)
                    {
                        logRecorder.AddDebugLog(nodeName, "读料框条码失败");
                    }
                    this.db1ValsToSnd[0] = barcodeFailedStat;
                    break;
                }
                this.rfidUID = this.rfidUID.Trim(new char[] { '\0', '\r', '\n', '\t', ' ' });

                string palletPattern = @"^[a-z|A-Z|0-9]{4}TP[0-9]{4,}";
                if (!Regex.IsMatch(this.rfidUID, palletPattern))
                {
                    if (this.db1ValsToSnd[0] != barcodeFailedStat)
                    {
                        logRecorder.AddDebugLog(nodeName, "读料框条码不符合规则," + this.rfidUID);
                        this.currentTaskDescribe = "读料框条码不符合规则," + this.rfidUID;
                    }
                    this.db1ValsToSnd[0] = barcodeFailedStat;
                    break;
                }

                /*
                 * //检测是否跟库里有重码
                 * string[] houseNames = new string[] { AsrsModel.EnumStoreHouse.A1库房.ToString(), AsrsModel.EnumStoreHouse.A2库房.ToString(),
                 *  AsrsModel.EnumStoreHouse.B1库房.ToString(), AsrsModel.EnumStoreHouse.C1库房.ToString(),AsrsModel.EnumStoreHouse.C2库房.ToString(),AsrsModel.EnumStoreHouse.C3库房.ToString() };
                 * foreach (string houseName in houseNames)
                 * {
                 *  string cellIn = AsrsResManage.IsProductCodeInStore(houseName, this.rfidUID, ref reStr);
                 *  if (!string.IsNullOrWhiteSpace(cellIn))
                 *  {
                 *      if (this.db1ValsToSnd[0] != 3)
                 *      {
                 *          currentTaskDescribe = string.Format("条码异常,条码{0}已经在库房{1},库位{2}", this.rfidUID.Length.ToString(), houseName, cellIn);
                 *          logRecorder.AddDebugLog(nodeName, currentTaskDescribe);
                 *      }
                 *      this.db1ValsToSnd[0] = 3;
                 *      return true;
                 *  }
                 * }*/

                logRecorder.AddDebugLog(this.nodeName, "读到托盘号:" + this.rfidUID);
                this.currentTaskPhase++;
                break;
            }

            case 2:
            {
                //分流
                currentTaskDescribe = "等待分流";
                int switchRe = 0;
                int step     = 0;
                if (!MesAcc.GetStep(this.rfidUID, out step, ref reStr))
                {
                    currentTaskDescribe = "查询MES工步失败:" + reStr;
                    break;
                }
                if (this.nodeID == "4001")
                {
                    if (step == 0)
                    {
                        currentTaskDescribe = string.Format("{0} 入库分流失败,步号为0,禁止入库", this.rfidUID);
                        if (this.db1ValsToSnd[0] != 4)
                        {
                            logRecorder.AddDebugLog(nodeName, string.Format("{0} 入库分流失败,步号为0,禁止入库", this.rfidUID));
                        }
                        this.db1ValsToSnd[0] = 4;         //

                        break;
                    }
                }
                if (this.nodeID == "4004")
                {
                    step = 5;
                    if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                    {
                        currentTaskDescribe = "更新MES工步失败:" + reStr;
                        break;
                    }
                }
                if (this.nodeID == "4005")
                {
                    step = 6;
                    if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                    {
                        currentTaskDescribe = "更新MES工步失败:" + reStr;
                        break;
                    }
                }
                if (this.nodeID == "4006")
                {
                    if (step > 0)
                    {
                        if (step >= 11)
                        {
                            step = 0;
                            if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                            {
                                currentTaskDescribe = "更新MES工步失败:" + reStr;
                                break;
                            }
                        }
                        else if (step != 10)
                        {
                            step = 10;
                            if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                            {
                                currentTaskDescribe = "更新MES工步失败:" + reStr;
                                break;
                            }
                        }
                    }
                }
                FlowPathModel switchPath = FindFirstValidPath(this.rfidUID, ref reStr);
                if (switchPath == null)
                {
                    switchRe                 = 0; //无可用路径,等待
                    this.db1ValsToSnd[0]     = (short)switchRe;
                    this.currentTaskDescribe = reStr;
                    break;
                }
                else
                {
                    CtlNodeBaseModel node = switchPath.NodeList[0];

                    if (this.nodeID == "4004")
                    {
                        AsrsControl.AsrsPortalModel port = (node as AsrsControl.AsrsPortalModel);
                        if (port == null)
                        {
                            break;
                        }
                        AsrsModel.CellCoordModel       requireCell   = null;
                        AsrsControl.AsrsCtlModel       asrsCtl       = port.AsrsCtl;
                        AsrsInterface.IAsrsManageToCtl asrsResManage = port.AsrsCtl.AsrsResManage;
                        string logicArea = "通用分区";
                        if (dlgtGetLogicArea != null)
                        {
                            logicArea = dlgtGetLogicArea(this.rfidUID, asrsCtl, step);
                        }
                        if (string.IsNullOrWhiteSpace(logicArea))
                        {
                            this.currentTaskDescribe = string.Format("{0} 检索货区失败,未配置", this.rfidUID);
                            break;
                        }
                        // AsrsModel.EnumLogicArea logicArea = (AsrsModel.EnumLogicArea)Enum.Parse(typeof(AsrsModel.EnumLogicArea), SysCfg.SysCfgModel.asrsStepCfg.AsrsAreaSwitch(step));
                        if (!asrsResManage.CellRequire(asrsCtl.HouseName, logicArea, ref requireCell, ref reStr))
                        {
                            Console.WriteLine("{0}申请库位失败,{1}", nodeName, reStr);
                            break;
                        }
                        if (requireCell.Row == 1)
                        {
                            switchRe = 2;
                            asrsCtl.SetAsrsCheckinRow(requireCell.Row);
                        }
                        else if (requireCell.Row == 2)
                        {
                            switchRe = 3;
                            asrsCtl.SetAsrsCheckinRow(requireCell.Row);
                        }
                        else
                        {
                            break;
                        }
                        logRecorder.AddDebugLog(nodeName, string.Format("{0}锁定分容库位第{1}排", this.rfidUID, requireCell.Row));
                    }
                    else
                    {
                        switchRe = switchPath.PathSeq + 1;
                    }

                    this.db1ValsToSnd[0] = (short)switchRe;

                    /*
                     * if(this.nodeID=="4006") //OCV后入库分流时,把条码后4位以整形发给PLC
                     * {
                     *  this.db1ValsToSnd[1] = short.Parse(this.rfidUID.Substring(this.rfidUID.Length - 4, 4));
                     * }*/
                    if (node.GetType().ToString() == "AsrsControl.AsrsPortalModel")
                    {
                        (node as AsrsControl.AsrsPortalModel).PushPalletID(this.rfidUID);
                    }
                    string logStr = string.Format("{0}分流,进入{1}", this.rfidUID, switchPath.NodeList[0].NodeName);
                    logRecorder.AddDebugLog(nodeName, logStr);
                    AddProduceRecord(this.rfidUID, logStr);

                    if (this.nodeID == "4001")
                    {
                        if (step >= 4)
                        {
                            step = 0;
                            if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                            {
                                currentTaskDescribe = "更新MES工步失败:" + reStr;
                                break;
                            }
                        }
                    }
                }

                this.currentTaskPhase++;
                break;
            }

            case 3:
            {
                currentTaskDescribe = "分流完成";
                break;
            }

            default:
                break;
            }
            return(true);
        }
示例#22
0
        public bool ProcessInit()
        {
            // nodeList = new List<CtlNodeBaseModel>();
            monitorNodeList     = new List <CtlNodeBaseModel>();
            this.nodeStatusList = new List <CtlNodeStatus>();
            //解析配置文件
            string reStr = "";
            //string xmlCfgFile = System.AppDomain.CurrentDomain.BaseDirectory + @"data/AcCfg.xml";


            string xmlCfgFile = System.AppDomain.CurrentDomain.BaseDirectory + @"data/AcCfg.xml";

            if (!SysCfg.SysCfgModel.LoadCfg(xmlCfgFile, ref reStr))
            {
                Console.WriteLine("系统配置解析错误,{0}", reStr);
                return(false);
            }
            XElement root = XElement.Load(xmlCfgFile);

            //1 通信设备创建、初始化
            hkAccessList = new List <IHKAccess>();
            if (SysCfg.SysCfgModel.SimMode)
            {
                plcRWs = new List <IPlcRW>();
                for (int i = 0; i < 4; i++)
                {
                    IPlcRW plcRW = new PlcRWSim();
                    plcRW.PlcID = i + 1;
                    plcRWs.Add(plcRW);
                }
                rfidRWs = new List <IrfidRW>();
                for (int i = 0; i < 13; i++)
                {
                    int     rfidID = i + 1;
                    IrfidRW rfidRW = new rfidRWSim();
                    rfidRW.ReaderID = (byte)rfidID;
                    rfidRWs.Add(rfidRW);
                }
                //HKAccess hk = new HKAccess(1,"127.0.0.1", 13535);
                //hkAccessList.Add(hk);
                //hk = new HKAccess(2, "127.0.0.1", 13535);
                //hkAccessList.Add(hk);
                //if(!hk.Conn(ref reStr))
                //{
                //    Console.WriteLine(reStr);
                //}
                //string ocvDBConn = "Data Source = 192.168.100.20;Initial Catalog=SRANCH;User ID=L_Guest;Password=Guest@123;"; ; //
                //ocvAccess = new OcvAccess(ocvDBConn, 36);
            }
            else
            {
                XElement commDevXERoot = root.Element("CommDevCfg");
                if (!ParseCommDevCfg(commDevXERoot, ref reStr))
                {
                    //logRecorder.AddLog(new LogModel(objectName, "PLC初始化错误,"+reStr, EnumLoglevel.错误));
                    Console.WriteLine("通信设备错误," + reStr);
                    return(false);
                }
            }

            //2 控制节点初始化
            XElement CtlnodeRoot = root.Element("CtlNodes");

            if (!ParseCtlnodes(CtlnodeRoot, ref reStr))
            {
                logRecorder.AddLog(new LogModel(objectName, "节点初始化错误," + reStr, EnumLoglevel.错误));
                return(false);
            }
            foreach (AsrsCtlModel asrsModel in asrsCtlPresenter.AsrsCtls)
            {
                monitorNodeList.Add(asrsModel.StackDevice);
                monitorNodeList.AddRange(asrsModel.Ports.ToArray());
            }

            //3 工位控制线程初始化
            this.threadList = new List <ThreadRunModel>();
            XElement ThreadnodeRoot = root.Element("ThreadAlloc");

            if (!ParseTheadNodes(ThreadnodeRoot, ref reStr))
            {
                logRecorder.AddLog(new LogModel(objectName, "任务分配错误," + reStr, EnumLoglevel.错误));
                return(false);
            }
            // NodeSwitch switchNode = GetNodeByID("7001") as NodeSwitch;
            //List<AsrsControl.AsrsPortalModel> targetPorts = new List<AsrsPortalModel>();
            //foreach(string portID in switchNode.TargetPortIDs)
            //{
            //    AsrsPortalModel portObj = GetNodeByID(portID) as AsrsControl.AsrsPortalModel;
            //    targetPorts.Add(portObj);
            //}
            //switchNode.TargetPorts = targetPorts;

            foreach (ThreadRunModel threadObj in threadList)
            {
                threadObj.LogRecorder = logRecorder;
            }

            for (int i = 0; i < this.monitorNodeList.Count(); i++)
            {
                CtlNodeBaseModel node = this.monitorNodeList[i];
                node.LogRecorder = this.logRecorder;
                this.nodeStatusList.Add(node.CurrentStat);
            }

            //ThreadRunModel palletBindThread = new ThreadRunModel("工装板绑定");
            //palletBindThread.TaskInit();
            //CtlNodeBaseModel palletBindNode = GetNodeByID("6001");
            //if(palletBindNode != null && palletBindNode.NodeEnabled)
            //{
            //    palletBindThread.AddNode(palletBindNode);
            //}
            //this.threadList.Add(palletBindThread);

            //4 plc通信线程初始化

            //5 历史数据清理线程
            historyDataClearThread = new ThreadBaseModel("历史数据集清理");

            historyDataClearThread.SetThreadRoutine(ClearHistoryLoop);
            historyDataClearThread.LoopInterval = 60000;
            historyDataClearThread.TaskInit();


            //5 通信对象分配
            asrsCtlPresenter.PlcRWs  = this.plcRWs;
            asrsCtlPresenter.RfidRWs = this.rfidRWs;
            if (!asrsCtlPresenter.AsrsCommCfg())
            {
                return(false);
            }

            //view.InitNodeMonitorview();
            bool re = asrsCtlPresenter.DevStatusRestore();

            if (!re)
            {
                return(false);
            }
            return(true);
        }
示例#23
0
        private bool ParseCtlnodes(XElement CtlnodeRoot, ref string reStr)
        {
            if (CtlnodeRoot == null)
            {
                reStr = "系统配置文件错误,不存在CtlNodes节点";
                return(false);
            }
            try
            {
                IEnumerable <XElement> nodeXEList =
                    from el in CtlnodeRoot.Elements()
                    where el.Name == "Node"
                    select el;
                foreach (XElement el in nodeXEList)
                {
                    string           className = (string)el.Attribute("className");
                    CtlNodeBaseModel ctlNode   = null;
                    switch (className)
                    {
                    case "NbProcessCtl.NodePalletBind":
                    {
                        ctlNode = new NodePalletBind();

                        break;
                    }

                    case "NbProcessCtl.NodePalletUnBind":
                    {
                        ctlNode = new NodePalletUnBind();

                        break;
                    }

                    case "NbProcessCtl.NodeManualBind":
                    {
                        ctlNode = new NodeManualBind();

                        break;
                    }

                    case "NbProcessCtl.NodeManualPacket":
                    {
                        ctlNode = new NodeManualPacket();

                        break;
                    }

                    case "NbProcessCtl.NodeOcv":
                    {
                        ctlNode = new NodeOcv();
                        break;
                    }

                    case "NbProcessCtl.NodeGrasp":
                    {
                        ctlNode = new NodeGrasp();
                        break;
                    }

                    case "NbProcessCtl.NodeVirStation":
                    {
                        ctlNode = new NodeVirStation();
                        break;
                    }

                    //case "NbProcessCtl.NodeSwitch":
                    //    {
                    //        ctlNode = new NodeSwitch();
                    //        break;
                    //    }
                    default:
                        break;
                    }
                    if (ctlNode != null)
                    {
                        if (!ctlNode.BuildCfg(el, ref reStr))
                        {
                            return(false);
                        }
                        else if (className == "NbProcessCtl.NodeGrasp")
                        {
                            NodeGrasp graspNode = ctlNode as NodeGrasp;
                            graspNode.OcvAccess = ocvAccess;
                        }
                        ctlNode.PlcRW = GetPlcByID(ctlNode.PlcID); // this.plcRWs[2];
                        if (ctlNode.RfidID > 0)
                        {
                            ctlNode.RfidRW = GetRfidByID(ctlNode.RfidID);
                        }
                        if (!SysCfg.SysCfgModel.SimMode)
                        {
                            //ctlNode.RfidRW = GetRfidByID((byte)ctlNode.RfidID);
                            if (ctlNode.BarcodeID > 0)
                            {
                                ctlNode.BarcodeRW = GetBarcoderRWByID(ctlNode.BarcodeID);
                            }
                        }

                        //Console.WriteLine(ctlNode.NodeName + ",ID:" + ctlNode.NodeID + "创建成功!");
                        this.monitorNodeList.Add(ctlNode);
                    }
                }
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }

            return(true);
        }
示例#24
0
        public virtual bool ParseCfg(XElement xe, ref string reStr)
        {
            try
            {
                this.lineName = xe.Attribute("name").Value.ToString();
                XElement devCfgRoot = xe.Element("DevCfg");
                if (devCfgRoot != null)
                {
                    IEnumerable <XElement> devXEList = devCfgRoot.Elements("Dev");
                    foreach (XElement el in devXEList)
                    {
                        CtlDevBaseModel ctlDev = new CtlDevBaseModel();
                        if (!ctlDev.ParseCfg(el, ref reStr))
                        {
                            return(false);
                        }
                        devList.Add(ctlDev);
                    }
                }
                XElement nodeCfgRoot = xe.Element("NodeCfg");
                if (nodeCfgRoot != null)
                {
                    IEnumerable <XElement> nodeXEList = nodeCfgRoot.Elements("Node");
                    foreach (XElement el in nodeXEList)
                    {
                        string           className = (string)el.Attribute("className");
                        CtlNodeBaseModel ctlNode   = null;
                        switch (className)
                        {
                        case "LineNodes.NodePalletBind":
                        {
                            ctlNode = new NodePalletBind();
                            break;
                        }

                        case "LineNodes.NodeScrewLock":
                        {
                            ctlNode = new NodeScrewLock();
                            break;
                        }

                        case "LineNodes.NodeUV":
                        {
                            ctlNode = new NodeUV();
                            break;
                        }

                        case "LineNodes.NodeDianjiao":
                        {
                            ctlNode = new NodeDianjiao();
                            break;
                        }

                        case "LineNodes.NodeSwitchBind":
                        {
                            ctlNode = new NodeSwitchBind();
                            break;
                        }

                        case "LineNodes.NodeCCDCheck":
                        {
                            ctlNode = new NodeCCDCheck();
                            break;
                        }

                        case "LineNodes.NodeLaserClean":
                        {
                            ctlNode = new NodeLaserClean();
                            break;
                        }

                        case "LineNodes.NodeWeld":
                        {
                            ctlNode = new NodeWeld();
                            break;
                        }

                        case "LineNodes.NodePackFasten":
                        {
                            ctlNode = new NodePackFasten();
                            break;
                        }

                        case "LineNodes.NodePackLabel":
                        {
                            ctlNode = new NodePackLabel();
                            break;
                        }

                        case "LineNodes.NodePackWeld":
                        {
                            ctlNode = new NodePackWeld();
                            break;
                        }

                        case "LineNodes.NodePackOutput":
                        {
                            ctlNode = new NodePackOutput();
                            break;
                        }

                        case "LineNodes.NodeUpDownMachine":
                        {
                            ctlNode = new NodeUpDownMachine();
                            break;
                        }

                        case "LineNodes.NodeTailRobot":
                        {
                            ctlNode = new NodeTailRobot();
                            break;
                        }

                        case "LineNodes.NodeManualStation":
                        {
                            ctlNode = new  NodeManualStation();
                            break;
                        }

                        case "LineNodes.BakeStation":
                        {
                            ctlNode = new BakeStation();
                            break;
                        }

                        case "LineNodes.NodeCManualStation":
                        {
                            ctlNode = new  NodeCManualStation();
                            break;
                        }

                        default:
                            break;
                        }
                        if (ctlNode != null)
                        {
                            if (this.lineName == "A线")
                            {
                                ctlNode.LineID = 1;
                            }
                            else if (this.lineName == "B线")
                            {
                                ctlNode.LineID = 2;
                            }
                            else
                            {
                                ctlNode.LineID = 3;
                            }
                            if (!ctlNode.BuildCfg(el, ref reStr))
                            {
                                return(false);
                            }
                            this.nodeList.Add(ctlNode);
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }
        }
示例#25
0
        public bool ConfigInit(ref string reStr)
        {
            nodeList      = new List <CtlNodeBaseModel>();
            threadList    = new List <ThreadBaseModel>();
            rfidList      = new List <IrfidRW>();
            barcodeRWList = new List <IBarcodeRW>();
            airDetectList = new List <IAirlossDetectDev>();
            printerList   = new List <IPrinterInfoDev>();
            plcRWList     = new List <IPlcRW>();
            IPlcRW          plcRW      = null;
            IPrinterInfoDev prienterRW = null;

            try
            {
                if (!PLProcessModel.SysCfgModel.LoadCfg(ref reStr))
                {
                    return(false);
                }
                string xmlCfgFile = System.AppDomain.CurrentDomain.BaseDirectory + @"data/DevConfigFTzj.xml";
                if (!File.Exists(xmlCfgFile))
                {
                    reStr = "系统配置文件:" + xmlCfgFile + " 不存在!";
                    return(false);
                }
                XElement root      = XElement.Load(xmlCfgFile);
                XElement runModeXE = root.Element("sysSet").Element("RunMode");
                string   simStr    = runModeXE.Attribute("sim").Value.ToString().ToUpper();
                if (simStr == "TRUE")
                {
                    NodeFactory.SimMode = true;
                    SysCfgModel.SimMode = true;
                }
                else
                {
                    NodeFactory.SimMode = false;
                    SysCfgModel.SimMode = false;
                }
                if (runModeXE.Attribute("mesTestMode") != null)
                {
                    if (runModeXE.Attribute("mesTestMode").Value.ToString().ToUpper() == "TRUE")
                    {
                        SysCfgModel.MesTestMode = true;
                    }
                    else
                    {
                        SysCfgModel.MesTestMode = false;
                    }
                }
                //1 解析结点信息
                XElement CtlnodeRoot = root.Element("CtlNodes");
                if (!ParseCtlnodes(CtlnodeRoot, ref reStr))
                {
                    return(false);
                }
                //2 解析通信设备信息
                if (NodeFactory.SimMode)
                {
                    plcRW = new PlcRWSim();
                    plcRWList.Add(plcRW);
                    prienterRW = new PrinterRWSim(1);
                    printerList.Add(prienterRW);
                    for (int i = 0; i < 13; i++)
                    {
                        int     rfidID = 0;// i + 1;
                        IrfidRW rfidRW = new rfidRWSim();
                        rfidRW.ReaderID = (byte)rfidID;
                        rfidList.Add(rfidRW);
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        int        barcodeID  = i + 1;
                        IBarcodeRW barscanner = new BarcodeRWSim(barcodeID);
                        barcodeRWList.Add(barscanner);
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        int airDetectID = i + 1;
                        IAirlossDetectDev airDetecter = new AirDetectRWSim(airDetectID);
                        airDetectList.Add(airDetecter);
                    }
                }
                else
                {
                    XElement commDevXERoot = root.Element("CommDevCfg");
                    if (!ParseCommDevCfg(commDevXERoot, ref reStr))
                    {
                        return(false);
                    }
                    plcRW = plcRWList[0];
                }

                //3 给节点分配设备读写接口对象

                for (int i = 0; i < nodeList.Count(); i++)
                {
                    CtlNodeBaseModel node = nodeList[i];
                    node.PlcRW   = plcRW;
                    node.SimMode = NodeFactory.SimMode;
                }
                for (int i = 0; i < nodeList.Count() - 1; i++)
                {
                    CtlNodeBaseModel node = nodeList[i];
                    node.RfidRW = rfidList[i];
                }
                prienterRW             = PrinterRWList[0];
                nodeList[0].BarcodeRW  = barcodeRWList[0];
                nodeList[12].BarcodeRW = barcodeRWList[1];
                nodeList[13].BarcodeRW = barcodeRWList[2];
                (nodeList[1] as NodeAirlossCheck).AirDetectRW = airDetectList[0];
                (nodeList[2] as NodeAirlossCheck).AirDetectRW = airDetectList[1];
                (nodeList[3] as NodeAirlossCheck).AirDetectRW = airDetectList[2];
                (nodeList[11] as NodeFaceCheck).PrienterRW    = prienterRW;



                //4 线程-结点分配
                XElement ThreadnodeRoot = root.Element("ThreadAlloc");
                if (!ParseTheadNodes(ThreadnodeRoot, ref reStr))
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                reStr = "加载系统配置文件出现异常:" + ex.ToString();
                return(false);
            }


            return(true);
        }
示例#26
0
        private bool ParseCtlnodes(XElement CtlnodeRoot, ref string reStr)
        {
            if (CtlnodeRoot == null)
            {
                reStr = "系统配置文件错误,不存在CtlNodes节点";
                return(false);
            }
            try
            {
                IEnumerable <XElement> nodeXEList =
                    from el in CtlnodeRoot.Elements()
                    where el.Name == "Node"
                    select el;
                foreach (XElement el in nodeXEList)
                {
                    string           className = (string)el.Attribute("className");
                    CtlNodeBaseModel ctlNode   = null;
                    switch (className)
                    {
                    case "LineNodes.ProductInput":
                    {
                        ctlNode = new NodeProductInput();
                        break;
                    }

                    case "LineNodes.NodeAirlossCheck":
                    {
                        ctlNode = new NodeAirlossCheck();
                        break;
                    }

                    case "LineNodes.NodeFireZero":
                    {
                        ctlNode = new NodeFireZero();
                        break;
                    }

                    case "LineNodes.NodeFireTryingA":
                    {
                        ctlNode = new NodeFireTryingA();
                        break;
                    }

                    case "LineNodes.NodeFireTryingB":
                    {
                        ctlNode = new NodeFireTryingB();
                        break;
                    }

                    case "LineNodes.NodeFaceCheck":
                    {
                        ctlNode = new NodeFaceCheck();
                        break;
                    }

                    case "LineNodes.NodePack":
                    {
                        ctlNode = new NodePack();
                        break;
                    }

                    case "LineNodes.NodeRobotPallet":
                    {
                        ctlNode = new NodeRobotPallet();
                        break;
                    }

                    default:
                        break;
                    }
                    if (ctlNode != null)
                    {
                        if (!ctlNode.BuildCfg(el, ref reStr))
                        {
                            return(false);
                        }
                        //Console.WriteLine(ctlNode.NodeName + ",ID:" + ctlNode.NodeID + "创建成功!");
                        this.nodeList.Add(ctlNode);
                    }
                }
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }

            return(true);
        }
示例#27
0
        public override bool ExeBusiness(ref string reStr)
        {
            if (!devStatusRestore)
            {
                devStatusRestore = DevStatusRestore();
            }
            if (db2Vals[0] == 1)
            {
                currentTaskPhase = 0;
                Array.Clear(this.db1ValsToSnd, 0, this.db1ValsToSnd.Count());
                rfidUID             = string.Empty;
                currentTaskDescribe = "等待新的任务";
                //return true;
            }
            //if(db1ValsToSnd[0] >1) //分流完成后
            //{
            //    return true;
            //}
            if (db2Vals[0] == 2)
            {
                if (currentTaskPhase == 0)
                {
                    currentTaskPhase = 1;
                }
            }
            switch (this.currentTaskPhase)
            {
            case 1:
            {
                currentTaskDescribe = "开始读RFID";
                this.rfidUID        = "";
                if (SysCfg.SysCfgModel.UnbindMode)
                {
                    this.rfidUID = System.Guid.NewGuid().ToString();
                }
                else
                {
                    if (SysCfg.SysCfgModel.SimMode || SysCfg.SysCfgModel.RfidSimMode)
                    {
                        this.rfidUID = this.SimRfidUID;
                    }
                    else
                    {
                        this.rfidUID = this.barcodeRW.ReadBarcode();
                    }
                }
                if (string.IsNullOrWhiteSpace(this.rfidUID))
                {
                    if (this.db1ValsToSnd[0] != barcodeFailedStat)
                    {
                        logRecorder.AddDebugLog(nodeName, "读料框条码失败");
                    }
                    this.db1ValsToSnd[0] = barcodeFailedStat;
                    break;
                }

                /*
                 * //检测是否跟库里有重码
                 * string[] houseNames = new string[] { AsrsModel.EnumStoreHouse.A1库房.ToString(), AsrsModel.EnumStoreHouse.A2库房.ToString(),
                 *  AsrsModel.EnumStoreHouse.B1库房.ToString(), AsrsModel.EnumStoreHouse.C1库房.ToString(),AsrsModel.EnumStoreHouse.C2库房.ToString(),AsrsModel.EnumStoreHouse.C3库房.ToString() };
                 * foreach (string houseName in houseNames)
                 * {
                 *  string cellIn = AsrsResManage.IsProductCodeInStore(houseName, this.rfidUID, ref reStr);
                 *  if (!string.IsNullOrWhiteSpace(cellIn))
                 *  {
                 *      if (this.db1ValsToSnd[0] != 3)
                 *      {
                 *          currentTaskDescribe = string.Format("条码异常,条码{0}已经在库房{1},库位{2}", this.rfidUID.Length.ToString(), houseName, cellIn);
                 *          logRecorder.AddDebugLog(nodeName, currentTaskDescribe);
                 *      }
                 *      this.db1ValsToSnd[0] = 3;
                 *      return true;
                 *  }
                 * }*/

                logRecorder.AddDebugLog(this.nodeName, "读到托盘号:" + this.rfidUID);
                this.currentTaskPhase++;
                break;
            }

            case 2:
            {
                //分流
                currentTaskDescribe = "等待分流";
                int switchRe = 0;
                int step     = 0;
                if (!MesAcc.GetStep(this.rfidUID, out step, ref reStr))
                {
                    currentTaskDescribe = "查询MES工步失败:" + reStr;
                    break;
                }
                if (this.nodeID == "4001")
                {
                    step = 14;
                    if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                    {
                        currentTaskDescribe = "更新MES工步失败:" + reStr;
                        break;
                    }
                }
                else if (this.nodeID == "4002")
                {
                    step = 0;
                    if (!MesAcc.UpdateStep(step, this.rfidUID, ref reStr))
                    {
                        currentTaskDescribe = "更新MES工步失败:" + reStr;
                        break;
                    }
                }

                FlowPathModel switchPath = FindFirstValidPath(this.rfidUID, ref reStr);
                if (switchPath == null)
                {
                    switchRe             = 0; //无可用路径,等待
                    this.db1ValsToSnd[0] = (short)switchRe;
                    break;
                }
                else
                {
                    CtlNodeBaseModel node = switchPath.NodeList[0];
                    switchRe = switchPath.PathSeq + 1;
                    if (node.GetType().ToString() == "AsrsControl.AsrsPortalModel")
                    {
                        (node as AsrsControl.AsrsPortalModel).PushPalletID(this.rfidUID);
                    }
                    this.db1ValsToSnd[0] = (short)switchRe;
                    string logStr = string.Format("{0}分流,进入{1}", this.rfidUID, switchPath.NodeList[0].NodeName);
                    logRecorder.AddDebugLog(nodeName, logStr);
                    AddProduceRecord(this.rfidUID, logStr);
                }

                this.currentTaskPhase++;
                break;
            }

            case 3:
            {
                currentTaskDescribe = "分流完成";
                break;
            }

            default:
                break;
            }
            return(true);
        }
示例#28
0
 public RepairProcessBLineBind(CtlNodeBaseModel nodeBase)
     : base(nodeBase)
 {
     this.nodeBase.repairProcess = this;
     stepIndex = 1;
 }