Exemple #1
0
        public int GetPassCondition(string stationID, string lineID)
        {
            string  format = string.Empty;
            int     num    = 0;
            DataSet set    = null;

            try
            {
                format = "select passcondition from device_list where devicetype='串口' and stationid='{0}' and lineid='{1}'";
                format = string.Format(format, stationID, lineID);
                set    = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if ((set.Tables[0].Rows.Count > 0) && (set.Tables[0].Rows[0]["passcondition"].ToString() != string.Empty))
                {
                    num = Convert.ToInt32(set.Tables[0].Rows[0]["passcondition"]);
                }
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
            return(num);
        }
Exemple #2
0
        public List <PlinePlanMDL> GetPlanInfos(DateTime datetime)
        {
            List <PlinePlanMDL> list = null;

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_product_plan WHERE PLANID LIKE '{0}%'";

                strSql = string.Format(strSql, datetime.ToString("yyyyMMdd"));


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }

                list = new List <PlinePlanMDL>();

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    list.Add(PlinePlanMDL.PraseDataRow(row));
                }


                return(list);
            }
            catch
            {
                throw;
            }
        }
Exemple #3
0
        public DataTable GetProductTable(string lineID)
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_product WHERE PLID='{0}' ORDER BY CREATE_TIME ASC";
                strSql = string.Format(strSql, lineID);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
Exemple #4
0
        public DataTable GetProductPage(int startOffset, int endOffset, string lineID)
        {
            try
            {
                DataSet dataSet = null;


                //string strSql = "SELECT tp.PLID,tp.CODE,tp.PN,tp.EMS,tp.CT,tp.OP FROM tlb_product tp  WHERE tp.PLID='{0}' ORDER BY CREATE_TIME ASC  LIMIT {1},{2};";
                string strSql = "SELECT tp.PLID,tp.CODE,tp.PN,tp.EMS,tp.CT,tp.OP FROM tlb_product tp  WHERE tp.PLID='{0}' ORDER BY EMS ASC  LIMIT {1},{2};";

                strSql = string.Format(strSql, lineID, startOffset, endOffset);

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null)
                {
                    return(null);
                }

                return(dataSet.Tables[0]);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
Exemple #5
0
        /// <summary>
        /// 获取产品计划通过产品ID和时间
        /// </summary>
        /// <param name="planid"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public DataTable GetProductionPalnByDateTime(string planid, DateTime startTime, DateTime endTime)
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select * from production_plan where plan_id='{0}' and create_time between '{1}' and '{2}'  order by start_time desc";

                strSql = string.Format(strSql, planid, startTime.ToString("yyyy-MM-dd HH:mm:ss"), endTime.ToString("yyyy-MM-dd HH:mm:ss"));


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
Exemple #6
0
        public List <ExtTimeMDL> GetExtimes()
        {
            List <ExtTimeMDL> list = null;

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_ext_time ";


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }


                list = new List <ExtTimeMDL>();

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    list.Add(ExtTimeMDL.PraseDataRow(row));
                }

                return(list);
            }
            catch
            {
                throw;
            }
        }
Exemple #7
0
        /// <summary>
        /// 获取产品计划通过序号ID
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public ProductionPlanMDL GetProductionPalnByID(int tid)
        {
            try
            {
                ProductionPlanMDL mdl = new ProductionPlanMDL();


                DataSet dataSet = null;

                string strSql = "select * from production_plan where tid='{0}' ";

                strSql = string.Format(strSql, tid);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);


                if (dataSet != null)
                {
                    DataRow row = dataSet.Tables[0].Rows[0];

                    mdl.Prase(row);

                    return(mdl);
                }
                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
Exemple #8
0
        /// <summary>
        /// 通过计划ID获取产线计划
        /// </summary>
        /// <param name="planid"></param>
        /// <returns></returns>
        public DataTable GetProductionPalnByPlanID2(string planid)
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "select * from production_plan where planid='{0}' ";

                strSql = string.Format(strSql, planid);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
        public bool ExistParam(string lineid, string productid, string stationID)
        {
            bool    flag   = false;
            string  format = string.Empty;
            DataSet set    = null;

            try
            {
                format = "select count(*) as num from process_parameter where lineid='{0}' and productid='{1}' and substring(processs,1,5)='{2}'";
                format = string.Format(format, lineid, productid, stationID.Substring(0, 5));
                set    = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if ((set.Tables[0].Rows.Count > 0) && (set.Tables[0].Rows[0]["num"].ToString() != "0"))
                {
                    flag = true;
                }
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
            return(flag);
        }
Exemple #10
0
        public PrintCountMDL GetDataByKeyName(string keyName)
        {
            string        format = string.Empty;
            PrintCountMDL tmdl   = null;
            DataSet       set    = null;

            try
            {
                format = "select tid, keyname, keycount, updatetime, remark from print_count where keyname='{0}'";
                format = string.Format(format, keyName);
                set    = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if (set.Tables[0].Rows.Count > 0)
                {
                    tmdl             = new PrintCountMDL();
                    tmdl.TID         = Convert.ToInt32(set.Tables[0].Rows[0]["tid"]);
                    tmdl.KeyName     = keyName;
                    tmdl.KeyCount    = Convert.ToInt32(set.Tables[0].Rows[0]["keycount"]);
                    tmdl.UpdapteTime = Convert.ToDateTime(set.Tables[0].Rows[0]["updatetime"]);
                    tmdl.Remark      = set.Tables[0].Rows[0]["remark"].ToString();
                }
            }
            catch (Exception exception)
            {
                tmdl = null;
                CLog.WriteErrLogInTrace(exception.Message);
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
            return(tmdl);
        }
Exemple #11
0
        public int GetChangeTimeByUnit(string lineID, string unitid)
        {
            int ct = 0;

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND UNITID='{1}' ";

                strSql = string.Format(strSql, lineID, unitid);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(0);
                }

                ///获取换型时间秒为单位
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    ct += ChangeTimeMDL.ParseDataRow(row).TIME_MIG;
                }

                return(ct);
            }
            catch
            {
                throw;
            }
        }
Exemple #12
0
        /// <summary>
        /// 获取记录
        /// </summary>
        /// <param name="lineID"></param>
        /// <param name="range"></param>
        /// <returns>minutes</returns>
        public PlinePlanMDL GetPlanInfo(string lineID)
        {
            PlinePlanMDL mdl = null;

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_product_plan WHERE PLANID='{0}'";

                strSql = string.Format(strSql, lineID);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }

                mdl = PlinePlanMDL.PraseDataRow(dataSet.Tables[0].Rows[0]);

                return(mdl);
            }
            catch
            {
                throw;
            }
        }
Exemple #13
0
        //}

        public Hashtable GetProductCTTable2()
        {
            Hashtable ctTable = new Hashtable();

            try
            {
                DataSet dataSet = null;

                //string strSql = "SELECT * FROM tlb_product ORDER BY CREATE_TIME ASC";

                string strSql = "SELECT * FROM tlb_product ";

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null)
                {
                    foreach (DataRow row in dataSet.Tables[0].Rows)
                    {
                        ProductionMDL mdl  = ProductionMDL.ParseDataRow(row);
                        CTUnitMDL     unit = new CTUnitMDL();
                        unit.PN  = mdl.PN;
                        unit.CT  = mdl.CT;
                        unit.EMS = mdl.EMS;
                        unit.OP  = mdl.OP;
                        ctTable.Add(mdl.PN, unit);
                    }
                }

                return(ctTable);
            }
            catch
            {
                throw;
            }
        }
Exemple #14
0
        /// <summary>
        /// 获取产线设置的空闲时间
        /// </summary>
        /// <param name="pline"></param>
        /// <param name="claOrder"></param>
        /// <param name="rangid"></param>
        /// <param name="rang"></param>
        /// <returns></returns>
        public List <TimeRange> GetTimeRangeByRange(string pline, int claOrder, string rangid, TimeRange rang)
        {
            List <TimeRange> rets = new List <TimeRange>();

            try
            {
                DataSet dataSet = null;



                pline = Convert.ToInt32(pline).ToString();

                // string strSql = "SELECT * FROM tlb_line_dt dt WHERE dt.START_TIME>='{0}' AND dt.END_TIME<='{1}' AND dt.PLINEID='{2}' AND dt.CLA_ORDER={3} AND dt.RANGEID='{4}' ORDER BY dt.START_TIME ASC";

                string strSql = "SELECT * FROM tlb_line_dt dt WHERE  dt.PLINEID='{0}' AND dt.CLA_ORDER={1} AND dt.RANGEID='{2}' ORDER BY dt.START_TIME ASC";

                //strSql = string.Format(strSql, rang.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), rang.EndTime.ToString("yyyy-MM-dd HH:mm:ss"), pline, claOrder, rangid);

                strSql = string.Format(strSql, pline, claOrder, rangid);

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }

                int count = 0;

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    PlineDTMDL mdl = PlineDTMDL.ParseDataRow(row);

                    string tempDate = String.Format("{0}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2}",
                                                    DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day
                                                    , mdl.START_TIME.Hour, mdl.START_TIME.Minute, mdl.START_TIME.Second);

                    DateTime StartTime = Convert.ToDateTime(tempDate);
                    tempDate = string.Empty;

                    tempDate = String.Format("{0}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2}",
                                             DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day
                                             , mdl.END_TIME.Hour, mdl.END_TIME.Minute, mdl.END_TIME.Second);

                    DateTime EndTime = Convert.ToDateTime(tempDate);

                    TimeRange rangItem = new TimeRange(StartTime, EndTime);

                    rets.Add(rangItem);
                }

                return(rets);
            }
            catch
            {
                throw;
            }
        }
Exemple #15
0
        public int MoveBrakeDataToCaliper(string brakeCode, string caliperCode)
        {
            int     num11;
            int     num    = 0;
            int     num9   = 0;
            int     num10  = 0;
            string  format = string.Empty;
            DataSet set    = new DataSet();

            MySqlParameter[] commandParameters = null;
            try
            {
                format = "select tid,st300,st320,st332,st350,st360,st361,st290,trialproduce from result_line2 where (length(calipercode)<=0 or calipercode is null) and brakecode='{0}' order by updatetime desc limit 1";
                format = string.Format(format, brakeCode);
                set    = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if (set.Tables[0].Rows.Count <= 0)
                {
                    return(0);
                }
                num = Convert.ToInt32(set.Tables[0].Rows[0]["tid"]);
                if (set.Tables[0].Rows[0]["trialproduce"].ToString() != string.Empty)
                {
                    num9 = Convert.ToInt32(set.Tables[0].Rows[0]["trialproduce"]);
                }
                commandParameters = new MySqlParameter[] { new MySqlParameter("@brakecode", brakeCode), new MySqlParameter("@st300", set.Tables[0].Rows[0]["st300"]), new MySqlParameter("@st320", set.Tables[0].Rows[0]["st320"]), new MySqlParameter("@st332", set.Tables[0].Rows[0]["st332"]), new MySqlParameter("@st350", set.Tables[0].Rows[0]["st350"]), new MySqlParameter("@st360", set.Tables[0].Rows[0]["st360"]), new MySqlParameter("@st361", set.Tables[0].Rows[0]["st361"]), new MySqlParameter("@st290", set.Tables[0].Rows[0]["st290"]), new MySqlParameter("@calipercode", caliperCode) };
                if (num9 == 1)
                {
                    format = "update result_line2 set brakecode=@brakecode,st300=@st300,st320=@st320,st332=@st332,st350=@st350,st360=@st360,st361=@st361,st290=@st290,trialproduce=1,updatetime = now() where calipercode=@calipercode";
                }
                else
                {
                    format = "update result_line2 set brakecode=@brakecode,st300=@st300,st320=@st320,st332=@st332,st350=@st350,st360=@st360,st361=@st361,st290=@st290,updatetime = now() where calipercode=@calipercode";
                }
                num10 = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, format, commandParameters);
                if (num10 > 0)
                {
                    format = "delete from result_line2 where tid={0}";
                    format = string.Format(format, num);
                }
                num11 = num10;
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                num11 = 0;
            }
            finally
            {
                set.Dispose();
            }
            return(num11);
        }
Exemple #16
0
        public bool CheckStationResult(string keyFieldName, string barCode, string productType, string stationID, List <PLCDataMDL> testItemList)
        {
            bool    flag    = true;
            string  cmdText = string.Empty;
            DataSet set     = new DataSet();

            try
            {
                cmdText = cmdText + "select ";
                foreach (PLCDataMDL amdl in testItemList)
                {
                    cmdText = cmdText + amdl.DBFieldName;
                    cmdText = cmdText + ",";
                }
                if (testItemList.Count > 0)
                {
                    cmdText = cmdText.Substring(0, cmdText.Length - 1);
                }
                else
                {
                    return(false);
                }
                cmdText = string.Format(cmdText + " from result_line2 where {0}='{1}' order by updatetime desc limit 1", keyFieldName, barCode);
                set     = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, cmdText, null);
                if (set.Tables[0].Rows.Count <= 0)
                {
                    return(false);
                }
                for (int i = 0; i < set.Tables[0].Columns.Count; i++)
                {
                    string columnName = set.Tables[0].Columns[i].ColumnName;
                    if (set.Tables[0].Rows[0][columnName].ToString() == string.Empty)
                    {
                        return(false);
                    }
                }
                return(flag);
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                flag = false;
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
            return(flag);
        }
Exemple #17
0
        public DataTable GetDeviceList(string lineID)
        {
            string format = string.Empty;

            try
            {
                format = "select tid,deviceid,devicestate,remark from device_list where (devicetype='PLC' or devicetype='TCP/IP') and lineid='{0}'";
                format = string.Format(format, lineID);
                return(MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null).Tables[0]);
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                return(null);
            }
        }
Exemple #18
0
        /// <summary>
        /// 查询过去CTUNIT
        /// </summary>
        /// <param name="LineID"></param>
        /// <param name="ems"></param>
        /// <returns></returns>
        public CTUnitMDL GetCTUnit(string lineid, int ems)
        {
            CTUnitMDL unit = null;

            try
            {
                int id = 0;

                Int32.TryParse(lineid, out id);

                if (id <= 0)
                {
                    return(null);
                }


                string strSql = "SELECT * FROM tlb_product WHERE  PLID='{0}' AND EMS={1}";

                strSql = string.Format(strSql, id.ToString(), ems);

                DataSet dataSet = null;

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
                {
                    ProductionMDL mdl = ProductionMDL.ParseDataRow(dataSet.Tables[0].Rows[0]);
                    unit     = new CTUnitMDL();
                    unit.PN  = mdl.PN;
                    unit.CT  = mdl.CT;
                    unit.EMS = mdl.EMS;
                    unit.OP  = mdl.OP;

                    return(unit);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Exemple #19
0
        public ProductionMDL GetProductInfo(string lineID, int ems)
        {
            ProductionMDL mdl = null;

            try
            {
                string strSql = string.Empty;

                int nline = 0;
                Int32.TryParse(lineID, out nline);

                if (nline <= 0)
                {
                    return(null);
                }


                strSql = "select * from tlb_product where PLID='{0}' and EMS='{1}'";

                strSql = string.Format(strSql, nline.ToString(), ems);


                DataSet dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables.Count <= 0)
                {
                    return(null);
                }

                //解析数据
                mdl = ProductionMDL.ParseDataRow(dataSet.Tables[0].Rows[0]);

                return(mdl);
            }
            catch
            {
                throw;
            }
        }
Exemple #20
0
        //public int



        public List <ChangeTimeMDL> GetChangeTimeItems(string lineID, TimeRange range)
        {
            List <ChangeTimeMDL> ret = new List <ChangeTimeMDL>();

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND CUR_TIME BETWEEN  '{1}' AND  '{2}'";

                strSql = string.Format(strSql, lineID, range.StartTime, range.EndTime);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(null);
                }



                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    ChangeTimeMDL dml = ChangeTimeMDL.ParseDataRow(row);

                    ret.Add(dml);
                }



                return(ret);
            }
            catch
            {
                throw;
            }
        }
Exemple #21
0
        public void CheckResultState()
        {
            string  str     = string.Empty;
            string  str2    = string.Empty;
            string  str3    = string.Empty;
            string  cmdText = string.Empty;
            int     num     = 0;
            DataSet set     = new DataSet();

            try
            {
                cmdText = "select calipercode,brakecode,bracketcode from result_line2 where calipercode is not null and brakecode is not null and bracketcode is not null and result is null and (resultdesc is null or resultdesc='')";
                set     = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, cmdText, null);
                if (set.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < set.Tables[0].Columns.Count; i++)
                    {
                        str     = set.Tables[0].Rows[i]["calipercode"].ToString();
                        str2    = set.Tables[0].Rows[i]["brakecode"].ToString();
                        str3    = set.Tables[0].Rows[i]["bracketcode"].ToString();
                        cmdText = "update result_line2 set integrity=1,valid=1,result=1 where calipercode='{0}' and brakecode='{1}' and bracketcode='{2}'";
                        cmdText = string.Format(cmdText, str, str2, str3);
                        num     = MySqlDBHelper.ExecuteNonQuery(MySqlDBHelper.Conn, CommandType.Text, cmdText, null);
                    }
                }
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
        }
Exemple #22
0
        /// <summary>
        /// 获取换型时间
        /// </summary>
        /// <param name="lineID"></param>
        /// <param name="range"></param>
        /// <returns>minutes</returns>
        public int GetChangeTime(string lineID, TimeRange range, ref string ems)
        {
            int ct = 0;

            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_line_change WHERE PLID='{0}' AND CUR_TIME BETWEEN  '{1}' AND  '{2}'";

                strSql = string.Format(strSql, lineID, range.StartTime, range.EndTime);


                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(0);
                }



                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    ChangeTimeMDL dml = ChangeTimeMDL.ParseDataRow(row);
                    ct  += dml.TIME_MIG;
                    ems += dml.CUR_PN + ",";
                }



                return(ct);
            }
            catch
            {
                throw;
            }
        }
Exemple #23
0
        /// <summary>
        ///获取生产线信息
        /// </summary>
        /// <returns></returns>
        public DataTable GetProductionInfos()
        {
            try
            {
                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_product ORDER BY CREATE_TIME ASC";

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet != null)
                {
                    return(dataSet.Tables[0]);
                }

                return(null);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.Message);
                return(null);
            }
        }
Exemple #24
0
        /// <summary>
        /// 获取时间段内暂停时间数据
        /// </summary>
        /// <param name="plineID"></param>
        /// <param name="rang"></param>
        /// <returns></returns>
        public int GetDownTimeDataByTimeRange(string plineID, TimeRange rang)
        {
            try
            {
                List <PlineDTMDL> dts = new List <PlineDTMDL>();


                DataSet dataSet = null;

                string strSql = "SELECT * FROM tlb_line_dt dt WHERE dt.START_TIME>='{0}' AND dt.END_TIME<='{1}' AND dt.PLINEID='{2}'";

                strSql = string.Format(strSql, rang.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), rang.EndTime.ToString("yyyy-MM-dd HH:mm:ss"), plineID);

                dataSet = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, strSql);

                if (dataSet == null || dataSet.Tables[0].Rows.Count <= 0)
                {
                    return(0);
                }

                int count = 0;

                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    PlineDTMDL mdl = PlineDTMDL.ParseDataRow(row);

                    count += mdl.DOWNTIME;
                }

                return(count);
            }
            catch
            {
                throw;
            }
        }
Exemple #25
0
        public bool CheckAllResult(string keyFieldName, string barCode, string productType)
        {
            bool    flag       = true;
            int     integrity  = 1;
            int     valid      = 1;
            int     result     = 0;
            string  format     = string.Empty;
            string  resultDesc = string.Empty;
            DataSet set        = new DataSet();

            try
            {
                format = "select st115_pf,st123,st124_pf,st150_t,st160,st170,st176_pf,st177,st180,st230,st240,st250,st260,st290,st310,st320,st340_t1,st340_t2,st340_a1,st340_a2,st360_xminx1,st360_xminy1,st360_xmaxx1,st360_xmaxy1,st360_yminx1,st360_yminy1,st360_ymaxx1,st360_ymaxy1,st361,st362_t1,st362_t2,st362_a1,st362_a2,st362_p1,st362_p2,st370,st380,st390 from result_line2 where {0}='{1}' order by updatetime desc limit 1";
                format = string.Format(format, keyFieldName, barCode);
                set    = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                if (set.Tables[0].Rows.Count <= 0)
                {
                    return(false);
                }
                for (int i = 0; i < set.Tables[0].Columns.Count; i++)
                {
                    double  num5       = 0.0;
                    double  num6       = 0.0;
                    double  num7       = 0.0;
                    DataSet set2       = null;
                    string  columnName = set.Tables[0].Columns[i].ColumnName;
                    if (set.Tables[0].Rows[0][columnName].ToString() != string.Empty)
                    {
                        num5 = Convert.ToDouble(set.Tables[0].Rows[0][columnName]);
                    }
                    format = "select maxvalues,minvalues from process_parameter where lineid='2' and productid='{0}' and processs='{1}'";
                    format = string.Format(format, productType, columnName);
                    set2   = MySqlDBHelper.ExecuteDataSet(MySqlDBHelper.Conn, CommandType.Text, format, null);
                    if (set2.Tables[0].Rows.Count > 0)
                    {
                        if (set2.Tables[0].Rows[0]["maxvalues"].ToString() != string.Empty)
                        {
                            num6 = Convert.ToDouble(set2.Tables[0].Rows[0]["maxvalues"]);
                        }
                        if (set2.Tables[0].Rows[0]["minvalues"].ToString() != string.Empty)
                        {
                            num7 = Convert.ToDouble(set2.Tables[0].Rows[0]["minvalues"]);
                        }
                        if (set.Tables[0].Rows[0][columnName].ToString() == string.Empty)
                        {
                            integrity  = 0;
                            flag       = false;
                            resultDesc = resultDesc + string.Format("{0}为空;", columnName);
                            CLog.WriteStationLog("ST400", string.Format("{0}的{1}检测结果为空", barCode, columnName));
                        }
                        if ((num5 < num7) || (num5 > num6))
                        {
                            valid      = 0;
                            flag       = false;
                            resultDesc = resultDesc + string.Format("{0}不合格;", columnName);
                            CLog.WriteStationLog("ST400", string.Format("{0}的{1}检测结果{2}不合格,范围为{3}-{4}", new object[] { barCode, columnName, num5, num7, num6 }));
                        }
                    }
                    set2.Dispose();
                }
                if (flag)
                {
                    result = 1;
                }
                this.UpdateResultByKeyCode(keyFieldName, barCode, integrity, valid, result, resultDesc);
                return(flag);
            }
            catch (Exception exception)
            {
                CLog.WriteErrLogInTrace(exception.Message);
                flag = false;
            }
            finally
            {
                if (set != null)
                {
                    set.Dispose();
                }
            }
            return(flag);
        }