Example #1
0
        public bool CarrierSlotMapStatusChange(SanwaCarrier carrier, E87_CSMS slotMapStatus)
        {
            bool Return = true;

            switch (carrier.SlotMapStatus)
            {
            case E87_CSMS.CARRIER:
                break;

            case E87_CSMS.SLOT_MAP_NOT_READ:
                if (!(slotMapStatus == E87_CSMS.CARRIER ||
                      slotMapStatus == E87_CSMS.SLOT_MAP_VERIFICATION_OK ||
                      slotMapStatus == E87_CSMS.WAITING_FOR_HOST
                      ))
                {
                    Return = false;
                }
                break;

            case E87_CSMS.WAITING_FOR_HOST:
                if (!(slotMapStatus == E87_CSMS.SLOT_MAP_NOT_READ ||
                      slotMapStatus == E87_CSMS.SLOT_MAP_VERIFICATION_OK ||
                      slotMapStatus == E87_CSMS.SLOT_MAP_VERIFICATION_FAIL
                      ))
                {
                    Return = false;
                }
                break;

            case E87_CSMS.SLOT_MAP_VERIFICATION_OK:
                if (slotMapStatus != E87_CSMS.SLOT_MAP_NOT_READ)
                {
                    Return = false;
                }
                break;

            case E87_CSMS.SLOT_MAP_VERIFICATION_FAIL:
                if (slotMapStatus != E87_CSMS.WAITING_FOR_HOST)
                {
                    Return = false;
                }
                break;
            }


            if (Return)
            {
                carrier.preSlotMapStatus = carrier.SlotMapStatus;
                carrier.SlotMapStatus    = slotMapStatus;
            }


            return(Return);
        }
Example #2
0
        public bool CarrierIDStatusChange(SanwaCarrier carrier, E87_CIDS IDStatus)
        {
            bool Return = true;

            switch (carrier.CarrierIDStatus)
            {
            case E87_CIDS.CARRIER:
                break;

            case E87_CIDS.ID_NOT_READ:
                if (!(E87_CIDS.CARRIER == IDStatus ||
                      E87_CIDS.ID_VERIFICATION_OK == IDStatus ||
                      E87_CIDS.WAITING_FOR_HOST == IDStatus))
                {
                    Return = false;
                }
                break;

            case E87_CIDS.ID_VERIFICATION_OK:
                if (E87_CIDS.CARRIER != IDStatus)
                {
                    Return = false;
                }
                break;

            case E87_CIDS.ID_VERIFICATION_FAILED:
                if (E87_CIDS.CARRIER != IDStatus)
                {
                    Return = false;
                }
                break;

            case E87_CIDS.WAITING_FOR_HOST:
                if (!(E87_CIDS.CARRIER == IDStatus ||
                      E87_CIDS.ID_VERIFICATION_FAILED == IDStatus ||
                      E87_CIDS.ID_VERIFICATION_OK == IDStatus))
                {
                    Return = false;
                }
                break;
            }

            if (Return)
            {
                carrier.preCarrierIDStatus = carrier.CarrierIDStatus;
                carrier.CarrierIDStatus    = IDStatus;
            }


            return(Return);
        }
Example #3
0
        public bool CarrierAccessingStatus(SanwaCarrier carrier, E87_CAS AccessingStatus)
        {
            bool Return = true;

            switch (carrier.CarrierAccessingStatus)
            {
            case E87_CAS.CARRIER:
                break;

            case E87_CAS.NOT_ACCESSED:
                if (!(E87_CAS.CARRIER == AccessingStatus ||
                      E87_CAS.IN_ACCESSED == AccessingStatus))
                {
                    Return = false;
                }
                break;

            case E87_CAS.IN_ACCESSED:
                if (!(E87_CAS.CARRIER == AccessingStatus ||
                      E87_CAS.CARRIER_COMPLETE == AccessingStatus ||
                      E87_CAS.CARRIER_STOPPED == AccessingStatus))
                {
                    Return = false;
                }
                break;

            case E87_CAS.CARRIER_COMPLETE:
                if (E87_CAS.CARRIER != AccessingStatus)
                {
                    Return = false;
                }
                break;

            case E87_CAS.CARRIER_STOPPED:
                if (E87_CAS.CARRIER != AccessingStatus)
                {
                    Return = false;
                }
                break;
            }

            if (Return)
            {
                carrier.preCarrierAccessingStatus = carrier.CarrierAccessingStatus;
                carrier.CarrierAccessingStatus    = AccessingStatus;
            }


            return(Return);
        }
Example #4
0
        public void LoadPortCarrierAssociated(LoadPort lpObj, SanwaCarrier carrierObj, E87_ASSOCIATED associated)
        {
            if (associated == E87_ASSOCIATED.ASSOCIATION)
            {
                lpObj.Carrier          = carrierObj;
                carrierObj.LoadPortObj = lpObj;
            }
            else
            {
                lpObj.Carrier          = null;
                carrierObj.LoadPortObj = null;
            }


            lpObj.Associated      = associated;
            carrierObj.Associated = associated;

            //AssociatedFinishEvent?.Invoke(this, lpObj);
        }
Example #5
0
        private void SetCarrierAttribute(Item CattrList, ref SanwaCarrier carrierObj)
        {
            for (int i = 0; i < CattrList.Count; i++)
            {
                Item Cattr         = CattrList.Items[i];
                Item CATTRIDItem   = Cattr.Items[0];
                Item CATTRDATAItem = Cattr.Items[1];

                switch (CATTRIDItem.GetString().ToUpper())
                {
                case "CAPACITY":
                    carrierObj.Capacity = CATTRDATAItem.GetValue <byte>();
                    break;

                case "CONTENTMAP":

                    if (carrierObj.ContentMap.Count > 0)
                    {
                        carrierObj.ContentMap.Clear();
                    }

                    for (int j = 0; j < CATTRDATAItem.Count; j++)
                    {
                        Item ContentMapList = CATTRDATAItem.Items[j];

                        Item LotID      = ContentMapList.Items[0];
                        Item SubstLotID = ContentMapList.Items[1];

                        sContentMap cmObj = new sContentMap
                        {
                            LotID       = LotID.GetString(),
                            SubstrateID = SubstLotID.GetString()
                        };

                        carrierObj.ContentMap.Add(cmObj.SubstrateID, cmObj);
                    }

                    break;

                case "SLOTMAP":
                    if (carrierObj.SlotMap.Count > 0)
                    {
                        carrierObj.SlotMap.Clear();
                    }

                    for (int j = 0; j < CATTRDATAItem.Count; j++)
                    {
                        Item ContentMapList = CATTRDATAItem.Items[j];
                        carrierObj.SlotMap.Add((eSlotMap)ContentMapList.GetValue <byte>());
                    }

                    break;

                case "SUBSTATECOUNT":
                    carrierObj.SubstrateCount = CATTRDATAItem.GetValue <byte>();
                    break;

                case "USAGE":
                    carrierObj.Usage = CATTRDATAItem.GetString();
                    break;
                }
            }
        }
Example #6
0
        private void ReplyCarrierReCreate(PrimaryMessageWrapper e, SecsMessage receiveMsg, SecsMessage replyMsg)
        {
            //    0. < DATAID >
            //    1. < CARRIERACTION >
            //    2. < CARRIERID >
            //    3. < PTN >
            string newReplyMsg = GetMessageName(replyMsg.ToSml());

            string carrierID = e.Message.SecsItem.Items[2].GetString();
            Item   PTNItem   = e.Message.SecsItem.Items[3];

            LoadPort lpObj = _loadPortList.FirstOrDefault(x => x.Value.Number == PTNItem.GetValue <byte>()).Value;

            newReplyMsg += "< L[2]\r\n";

            _carrierList.TryGetValue(carrierID, out SanwaCarrier carrierObj);

            if (lpObj == null)
            {
                //無對應Load Port
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_LOAD_PORT_DOES_NOT_EXIST.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            //else if (lpObj.IsReserved == E87_RS.RESERVED)
            //{
            //    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
            //    newReplyMsg += "<L[2]\r\n";
            //    newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_LOAD_PORT_ALREADY_IN_USE.ToString());
            //    newReplyMsg += "<A[0]>\r\n";
            //    newReplyMsg += ">\r\n";
            //}
            else if (carrierObj == null)
            {
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_UNKNOWN_OBJECT_INSTANCE.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            else if (lpObj.CurrentState != E87_LPTS.READY_TO_UNLOAD)
            {
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_COMMAND_NOT_VALID_FOR_CURRENT_STATE.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            else
            {
                Item  CattrList        = e.Message.SecsItem.Items[4];
                ulong CheckCattrReturn = CheckCattrList(CattrList);

                if (CheckCattrReturn != SanwaACK.ERRCODE_NO_ERROR)
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                    newReplyMsg += "<L[2]\r\n";
                    newReplyMsg += GetToSMLItem(SecsFormat.U1, CheckCattrReturn.ToString());
                    newReplyMsg += "<A[0]>\r\n";
                    newReplyMsg += ">\r\n";
                }
                else
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_ACK.ToString() + ">\r\n";
                    newReplyMsg += "<L[0]\r\n>\r\n";

                    _carrierList.Remove(carrierID);

                    SanwaCarrier newCarrierObj = new SanwaCarrier
                    {
                        ObjID = carrierID
                    };

                    SetCarrierAttribute(CattrList, ref newCarrierObj);

                    _carrierList.Add(newCarrierObj.ObjID, newCarrierObj);

                    //ChangeReserviceState(lpObj, E87_RS.NOT_RESERVED);

                    //LoadPortCarrierAssociated(lpObj, newCarrierObj, E87_ASSOCIATED.NOT_ASSOCIATION);

                    ////等效於Bind
                    //if (CattrList.Count > 0)
                    //{
                    //    ChangeReserviceState(lpObj, E87_RS.RESERVED);

                    //    LoadPortCarrierAssociated(lpObj, newCarrierObj, E87_ASSOCIATED.ASSOCIATION);
                    //}


                    E87_HostCommand Obj = new E87_HostCommand
                    {
                        Name        = "CarrierReCreate",
                        MessageName = "S3F17",
                        lpObj       = lpObj,
                        carrierObj  = newCarrierObj
                    };

                    //S3F17CarrierReCreateEvent?.Invoke(this, Obj);
                    ThreadPool.QueueUserWorkItem(callback =>
                    {
                        S3F17CarrierReCreateEvent?.Invoke(this, Obj);
                    });
                }
            }

            newReplyMsg += ">\r\n";
            e.ReplyAsync(newReplyMsg.ToSecsMessage());
        }
Example #7
0
        private void ReplyCancelCarrierService(PrimaryMessageWrapper e, SecsMessage receiveMsg, SecsMessage replyMsg, bool atPort)
        {
            //    0. < DATAID >
            //    1. < CARRIERACTION >
            //    2. < CARRIERID >
            //    3. < PTN >
            string newReplyMsg = GetMessageName(replyMsg.ToSml());

            string carrierID = e.Message.SecsItem.Items[2].GetString();
            Item   PTNItem   = e.Message.SecsItem.Items[3];

            LoadPort lpObj = _loadPortList.FirstOrDefault(x => x.Value.Number == PTNItem.GetValue <byte>()).Value;

            newReplyMsg += "< L[2]\r\n";

            SanwaCarrier carrierObj = null;

            if (!atPort)
            {
                _carrierList.TryGetValue(carrierID, out carrierObj);
            }
            else
            {
                carrierObj = lpObj.Carrier;
            }

            if (lpObj == null)
            {
                //無對應Load Port
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_LOAD_PORT_DOES_NOT_EXIST.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            else if (carrierObj == null)
            {
                if (!atPort)
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                    newReplyMsg += "<L[2]\r\n";
                    newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_UNKNOWN_OBJECT_INSTANCE.ToString());
                    newReplyMsg += "<A[0]>\r\n";
                    newReplyMsg += ">\r\n";
                }
                else
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                    newReplyMsg += "<L[2]\r\n";
                    newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_MISSING_CARRIER.ToString());
                    newReplyMsg += "<A[0]>\r\n";
                    newReplyMsg += ">\r\n";
                }
            }
            else if (lpObj.Carrier.ObjID != carrierID && !atPort)
            {
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_MISSING_CARRIER.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            else
            {
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_ACK.ToString() + ">\r\n";
                newReplyMsg += "<L[0]\r\n>\r\n";

                if (!atPort)
                {
                    E87_HostCommand Obj = new E87_HostCommand
                    {
                        Name        = "CancelCarrier",
                        MessageName = "S3F17",
                        lpObj       = lpObj,
                        carrierObj  = carrierObj
                    };

                    S3F17CancelCarrierEvent.Invoke(this, Obj);
                }
                else
                {
                    E87_HostCommand Obj = new E87_HostCommand
                    {
                        Name        = "CancelCarrierAtPort",
                        MessageName = "S3F17",
                        lpObj       = lpObj,
                        carrierObj  = carrierObj
                    };

                    //S3F17CancelCarrierAtPortEvent?.Invoke(this, Obj);
                    ThreadPool.QueueUserWorkItem(callback =>
                    {
                        S3F17CancelCarrierAtPortEvent?.Invoke(this, Obj);
                    });
                }
            }

            newReplyMsg += ">\r\n";
            e.ReplyAsync(newReplyMsg.ToSecsMessage());
        }
Example #8
0
        private void ReplyCarrierNotificationService(PrimaryMessageWrapper e, SecsMessage receiveMsg, SecsMessage replyMsg)
        {
            //    0. < DATAID >
            //    1. < CARRIERACTION >
            //    2. < CARRIERID >
            //    3. < PTN >
            string newReplyMsg = GetMessageName(replyMsg.ToSml());
            string carrierID   = e.Message.SecsItem.Items[2].GetString();

            newReplyMsg += "< L[2]\r\n";

            _carrierList.TryGetValue(carrierID, out SanwaCarrier carrierObj);

            if (carrierObj != null)
            {
                newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                newReplyMsg += "<L[2]\r\n";
                newReplyMsg += GetToSMLItem(SecsFormat.U1, SanwaACK.ERRCODE_OBJECT_IDENTIFIER_IN_USE.ToString());
                newReplyMsg += "<A[0]>\r\n";
                newReplyMsg += ">\r\n";
            }
            else
            {
                Item  CattrList        = e.Message.SecsItem.Items[4];
                ulong CheckCattrReturn = CheckCattrList(CattrList);

                if (CheckCattrReturn != SanwaACK.ERRCODE_NO_ERROR)
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_CMD_PERFOEM_WITH_ERR.ToString() + ">\r\n";
                    newReplyMsg += "<L[2]\r\n";
                    newReplyMsg += GetToSMLItem(SecsFormat.U1, CheckCattrReturn.ToString());
                    newReplyMsg += "<A[0]>\r\n";
                    newReplyMsg += ">\r\n";
                }
                else
                {
                    newReplyMsg += "<U1[0] " + SanwaACK.CAACK_ACK.ToString() + ">\r\n";
                    newReplyMsg += "<L[0]\r\n>\r\n";

                    SanwaCarrier newCarrierObj = new SanwaCarrier
                    {
                        ObjID = carrierID
                    };

                    SetCarrierAttribute(CattrList, ref newCarrierObj);

                    _carrierList.Add(newCarrierObj.ObjID, newCarrierObj);

                    E87_HostCommand Obj = new E87_HostCommand
                    {
                        Name        = "CarrierNotification",
                        MessageName = "S3F17",
                        lpObj       = null,
                        carrierObj  = newCarrierObj
                    };

                    //S3F17CarrierNotificationEvent?.Invoke(this, Obj);
                    ThreadPool.QueueUserWorkItem(callback =>
                    {
                        S3F17CarrierNotificationEvent?.Invoke(this, Obj);
                    });
                }
            }
            newReplyMsg += ">\r\n";
            e.ReplyAsync(newReplyMsg.ToSecsMessage());
        }