示例#1
0
    private Dictionary <string, PartData> partsTable;    // parts, hashed by part name

    // Start is called before the first frame update
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Debug.Log(string.Format("Instance of PartsTable already exists! Deleting PartsTable script in %s.", gameObject.name));
            Destroy(this);
        }
        partsTable = new Dictionary <string, PartData>();

        DontDestroyOnLoad(this);

        InitPartsList();
    }
示例#2
0
        public bool InitTable()
        {
            KeyIdentifier = KEY_IDENTIFIER;

            string sTableName = PartsTable.GetPartNumberTable(KeyValue, Version);

            TableName = sTableName;

            if (string.IsNullOrEmpty(sTableName))
            {
                return(false);
            }

            // ja - for vfp the connection string has to be set after the table name is known
            ConnectionString = GetPMConnString();

            return(InitializeDatabase());
        }
        // ja - This function was added specifically to get information from the parts table to
        //      populate RMA data from a different part
        public RmaOverrides GetRMADataFromPartsInfo(string sPartNumber, string sVersion)
        {
            RmaOverrides rma = new RmaOverrides();

            try
            {
                PartsTable pt = new PartsTable(sPartNumber, sVersion);

                rma.InputSpecs  = pt.GetValue("Inspecs");
                rma.OutputSpecs = pt.GetValue("Outspecs");
                rma.RevLetter   = pt.GetValue("Revision");
            }
            catch (Exception)
            {
                throw;
            }

            return(rma);
        }
示例#4
0
        private void FillLabelData()
        {
            _wcLabelData = new LabelDataStruct();

            Workcode wc = new Workcode(WorkCode);

            if (wc.KeyFound())
            {
                string sPartNumber = wc.GetValue(wc.MODELLCODE).Trim();
                _wcLabelData.PartNumber = sPartNumber;
                _wcLabelData.ROHS       = Convert.ToBoolean(wc.GetValue("Rohasyorn"));

                string sVersion = wc.GetValue(wc.AMPVERSION);
                _wcLabelData.nQty = Convert.ToInt32(wc.GetValue("Quantity"));

                // ja - separate the 0. from the 00
                string[] sStrippedVersion = sVersion.Split('.');
                if (sStrippedVersion.Count() > 1)
                {
                    _wcLabelData.nVersion = Convert.ToInt32(sStrippedVersion[1]);
                }

                PartsTable pt = new PartsTable(sPartNumber, sVersion);

                if (pt.KeyFound())
                {
                    _wcLabelData.EtherCat    = Convert.ToBoolean(pt.GetValue("Ethercat"));
                    _wcLabelData.UL          = Convert.ToBoolean(pt.GetValue("UL"));
                    _wcLabelData.InputSpecs  = pt.GetValue("Inspecs").Trim();
                    _wcLabelData.OutputSpecs = pt.GetValue("Outspecs").Trim();
                    _wcLabelData.RevLetter   = pt.GetValue("Revision").Trim();
                    _wcLabelData.CE          = Convert.ToBoolean(pt.GetValue("Emc"));
                    _wcLabelData.ProtoType   = Convert.ToBoolean(pt.TableName == "Proto");

                    // ja - internal use
                    _wcLabelData.BaseModel   = pt.GetValue("BaseModel").Trim();
                    _wcLabelData.Extension   = pt.GetValue("Extension").Trim();
                    _wcLabelData.sLabelsCode = pt.GetValue("Labelscode");
                }
            }
        }