コード例 #1
0
ファイル: BCModels.cs プロジェクト: 0000duck/wis_web
        public ED03 GetED03(BCInfo BC, EQP eqp)
        {
            ED03 result = new ED03();

            OracleDB dbObj = new OracleDB("Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =" + BC.BCIP + ")(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME =ORCL)));User Id=innolux;Password=innoluxabc123;");

            string sqlString = @"select node.hostsubeqid,
                                       evt.funckey,
                                       substr(to_char(substr(plc.outputdata,
                                                             to_number(evt.startadr, 'xxxxxxx') * 4 + 1,
                                                             evt.datalen * 4)),
                                              4,
                                              1) reportType,
                                       substr(to_char(substr(plc.outputdata,
                                                             to_number(evt.startadr, 'xxxxxxx') * 4 + 1,
                                                             evt.datalen * 4)),
                                              evt.datalen * 4 - 3,
                                              4) evtindex,
                                       node.recipesplit,
                                       substr(to_char(substr(plc.outputdata,
                                                             to_number(evt.startadr, 'xxxxxxx') * 4 + 1,
                                                             evt.datalen * 4)),
                                              17,
                                              800) itemdata
                                  from main_bc_line t, io_event evt, main_bc_node node, plcdata plc
                                 where t.hostlineid = '" + BC.BCName + @"'
                                   and node.hostsubeqid = '" + eqp.EQPName + @"'
                                   and t.bcno = evt.bcno
                                   and t.bclineno = evt.bclineno
                                   and t.fabtype = evt.fabtype
                                   and t.bcno = node.bcno
                                   and t.bclineno = node.bclineno
                                   and t.fabtype = node.fabtype
                                   and t.bcno = plc.bcno
                                   and t.bclineno = plc.bclineno
                                   and t.fabtype = plc.fabtype
                                   and plc.devicetype = '2'
                                   and evt.nodeno = node.nodeno
                                   and evt.funckey = 'ED03'
                                   and evt.subfunckey = '01'";

            DataTable Dt = dbObj.SelectSQL(sqlString);

            foreach (DataRow eachRow in Dt.Rows)
            {
                result.ReportType = eachRow["reportType"].ToString();
                result.DataItem   = eachRow["itemdata"].ToString();
                result.Index      = eachRow["evtindex"].ToString();
            }


            return(result);
        }
コード例 #2
0
ファイル: BCModels.cs プロジェクト: 0000duck/wis_web
        public List <RecipeBodyParseData> GetRecipeBodyParseData(BCInfo BC, EQP eqp, ED03 ed03)
        {
            List <RecipeBodyParseData> result = new List <RecipeBodyParseData>();

            foreach (RecipePaserSetting eachSetting in GetRecipeBodySetting(BC, eqp))
            {
                string itemHexString           = ed03.DataItem.Substring(eachSetting.ItemOffset * 4 - 4, eachSetting.ItemLength * 4);
                RecipeBodyParseData eachResult = new RecipeBodyParseData();
                switch (eachSetting.ItemFormat)
                {
                case "A":
                    string tmpAsciiString     = "";
                    string reverseAsciiString = "";
                    for (int i = 0; i < itemHexString.Length; i += 4)
                    {
                        string tmpAscii = itemHexString.Substring(i, 4);
                        for (int j = 0; j < tmpAscii.Length; j += 2)
                        {
                            tmpAsciiString = tmpAscii.Substring(j, 2) + tmpAsciiString;
                        }
                        reverseAsciiString = reverseAsciiString + tmpAsciiString;
                    }

                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < reverseAsciiString.Length; i += 2)
                    {
                        string hs = reverseAsciiString.Substring(i, 2);
                        sb.Append(Convert.ToChar(Convert.ToUInt32(hs, 16)));
                    }
                    eachResult.Name  = eachSetting.ItemName;
                    eachResult.Value = sb.ToString().Substring(0, eachSetting.ItemEfflen);
                    eachResult.Unit  = eachSetting.ItemUnit;
                    result.Add(eachResult);

                    break;

                case "N":
                case "D":
                    string reverseItemString = "";

                    for (int i = 0; i < itemHexString.Length; i += 4)
                    {
                        reverseItemString = itemHexString.Substring(i, 4) + reverseItemString;
                    }

                    double dbValue = 0;

                    if (eachSetting.ItemSigned.Equals("1"))
                    {
                        dbValue = Convert.ToDouble(int.Parse(reverseItemString, System.Globalization.NumberStyles.HexNumber));
                    }
                    else
                    {
                        dbValue = Convert.ToDouble(uint.Parse(reverseItemString, System.Globalization.NumberStyles.HexNumber));
                    }


                    dbValue = dbValue * eachSetting.ItemRate;

                    eachResult.Name  = eachSetting.ItemName;
                    eachResult.Value = dbValue.ToString("0.000000");
                    eachResult.Unit  = eachSetting.ItemUnit;
                    result.Add(eachResult);

                    break;

                case "H":
                    eachResult.Name  = eachSetting.ItemName;
                    eachResult.Value = itemHexString;
                    eachResult.Unit  = eachSetting.ItemUnit;
                    result.Add(eachResult);
                    break;

                case "B":
                    eachResult.Name  = eachSetting.ItemName;
                    eachResult.Value = Convert.ToString(Convert.ToInt32(itemHexString, 16), 2).PadLeft(itemHexString.Length * 4, '0');
                    eachResult.Unit  = eachSetting.ItemUnit;
                    result.Add(eachResult);
                    break;
                }
            }

            return(result);
        }