예제 #1
0
        public static string EditPMLiftTime(string ToolId, string Typeid, string PmLT)
        {
            string DBMsg = null;

            string _ToolId = "NULL";
            string _Typeid = "NULL";
            string _tName  = "NULL";

            if (!string.IsNullOrEmpty(ToolId) && ToolId != "0")
            {
                _ToolId = "'" + ToolId + "'";
            }

            if (!string.IsNullOrEmpty(Typeid) && Typeid != "0")
            {
                _Typeid = Typeid;
                _tName  = ListModel.GettName(_Typeid);
            }

            try
            {
                DBConnector.executeSQL("Intouch", "EXEC [dbo].[uSP_Change_PMLifeTime] @action=1,@toolID=" + _ToolId + ",@tid=" + _Typeid + ",@pmLT=" + PmLT);

                if (!string.IsNullOrEmpty(ToolId))
                {
                    DBMsg += "設定 " + ToolId + " LiftTime " + PmLT + " 成功";
                }
                else
                {
                    DBMsg += "設定 " + _tName + "  LiftTime " + PmLT + " 成功";
                }
            }
            catch (Exception)
            {
                if (!string.IsNullOrEmpty(ToolId))
                {
                    DBMsg += "設定 " + ToolId + " LiftTime 失敗";
                }
                else
                {
                    DBMsg += "設定 " + _tName + "  LiftTime 失敗";
                }
            }

            return(DBMsg);
        }
예제 #2
0
        public static List <MachineStatusModel> GetMachineStatusdt(string vName)
        {
            short vid = ListModel.GetVid(vName);

            DataSet ds = DBConnector.executeQuery("Intouch", "exec uSP_Select_EQ_StatusCount  @vid = " + vid + ",@sid = null,@gFlag = NULL ");

            List <MachineStatusModel> tempList = null;

            if (ds.Tables.Count > 0)
            {
                tempList = (from dept in ds.Tables[0].AsEnumerable()
                            select new MachineStatusModel
                {
                    GroupName = dept.IsNull("gname") ? string.Empty : dept.Field <string>("gname"),
                    MachineCount = dept.Field <int>("eqCount"),
                    NormlCount = dept.Field <int>("normalCount"),
                    AlarmCount = dept.Field <int>("troubleCount"),
                    PMCount = dept.Field <int>("pmCount"),
                    OtherCount = dept.Field <int>("otherCount")
                }).ToList();
            }

            return(tempList);
        }
예제 #3
0
        public static IEnumerable <ListModel> GetToolidByType(string vName, string tName)
        {
            DataSet ds = DBConnector.executeQuery("Intouch", "exec [uSP_Select_EQ_Type] " + ListModel.GetVid(vName) + ", NULL ," + ListModel.Gettid(tName));

            IEnumerable <ListModel> tempList = null;

            if (ds.Tables.Count > 0)
            {
                tempList = (from dept in ds.Tables[0].AsEnumerable()
                            orderby dept.Field <string>("toolid")
                            select new ListModel
                {
                    Text = dept.Field <string>("toolid"),
                    Value = dept.Field <string>("toolid"),
                }).ToList();
            }

            return(tempList);
        }
예제 #4
0
        public static IEnumerable <ListModel> GetTypeByVname2Id(string vName, string gName)
        {
            if (string.IsNullOrEmpty(gName))
            {
                gName = "NULL";
            }
            DataSet ds = DBConnector.executeQuery("Intouch", "exec [uSP_Select_EQ_Type] " + ListModel.GetVid(vName) + "," + gName);

            IEnumerable <ListModel> tempList = null;

            if (ds.Tables.Count > 0)
            {
                tempList = (from dept in ds.Tables[0].AsEnumerable()
                            orderby dept.Field <string>("tName")
                            select new ListModel
                {
                    Text = dept.Field <string>("tName"),
                    Value = dept.Field <Int16>("typeid").ToString(),
                }).ToList();
            }

            return(tempList);
        }
예제 #5
0
        public static IEnumerable <ListModel> GetTagNameList(string vName, string toolID)
        {
            string  _pid  = null;
            int     _pid2 = 0;
            DataSet ds    = null;

            if (vName == "DPM")
            {
                ds = DBConnector.executeQuery("Intouch", "uSP_Select_ValueNames_DPM @pid=" + _pid2);
            }
            else
            {
                _pid = ListModel.GetPid(toolID).ToString();
                ds   = DBConnector.executeQuery("Intouch", "uSP_Select_ValueNames @pid=" + _pid);
            }
            //BackPressure
            //BPCurrent
            //BPPower
            //MPCurrent
            //MPPower
            //MPTemp
            //N2Flow
            //WaterFlow
            //ds.Tables[0].Rows.Clear();

            //DataRow tempRow = null;
            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "BackPressure";
            //tempRow["FullTagName"] =toolID+ "BackPressure";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "BPCurrent";
            //tempRow["FullTagName"] = toolID + "BPCurrent";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "BPPower";
            //tempRow["FullTagName"] = toolID + "BPPower";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "MPCurrent";
            //tempRow["FullTagName"] = toolID + "MPCurrent";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "MPPower";
            //tempRow["FullTagName"] = toolID + "MPPower";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "MPTemp";
            //tempRow["FullTagName"] = toolID + "MPTemp";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "N2Flow";
            //tempRow["FullTagName"] = toolID + "N2Flow";
            //ds.Tables[0].Rows.Add(tempRow);

            //tempRow = ds.Tables[0].NewRow();
            //tempRow["Cht_Comment"] = "WaterFlow";
            //tempRow["FullTagName"] = toolID + "WaterFlow";
            //ds.Tables[0].Rows.Add(tempRow);

            IEnumerable <ListModel> tempList = null;

            if (ds.Tables.Count > 0)
            {
                tempList = from dept in ds.Tables[0].AsEnumerable()
                           orderby dept.Field <string>("Cht_Comment")
                           select new ListModel
                {
                    Text  = dept.Field <string>("Cht_Comment"),
                    Value = dept.Field <string>("FullTagName"),
                };
            }

            return(tempList);
        }
예제 #6
0
        //[Display(Name = "解除警報音")]
        //public string AlarmAck { get; set; }

        #endregion

        public static DataTable GetAlarmListdt(string vName, string fromDate, string toDate, string Toolid, string Device, string onceadayFlag, string alarmleve)
        {
            DateTime _fromdate = Convert.ToDateTime(fromDate);
            DateTime _toDate   = Convert.ToDateTime(toDate);
            string   _toolid   = "NULL";
            string   sqlStr    = "";

            if (vName == "DPM")
            {
                sqlStr = "EXEC [dbo].[uSP_Select_AlarmHistory_DPM] N'" + _fromdate.ToString("yyyy-MM-dd HH:mm") + "',N'" + _toDate.ToString("yyyy-MM-dd HH:mm") + "'";
            }
            else
            {
                sqlStr = "EXEC [dbo].[uSP_Select_AlarmHistory] N'" + _fromdate.ToString("yyyy-MM-dd HH:mm") + "',N'" + _toDate.ToString("yyyy-MM-dd HH:mm") + "'";
            }

            if (!string.IsNullOrEmpty(Toolid) && Toolid.ToUpper() != "NULL" && Toolid.Length > 0)
            {
                _toolid = "'" + Toolid + "'";
                sqlStr  = sqlStr + "," + _toolid + "," + ListModel.GetVid(vName);
            }
            else
            {
                sqlStr = sqlStr + ",NULL," + ListModel.GetVid(vName);

                //if (!string.IsNullOrEmpty(Device) && Device.ToUpper() != "NULL" && Device.Length > 0)
                //{
                //    sqlStr = sqlStr + ",'" + Device + "'";
                //}
            }

            if (!string.IsNullOrEmpty(Device) && Device.ToUpper() != "NULL" && Device.Length > 0)
            {
                sqlStr = sqlStr + ",'" + Device + "','" + alarmleve + "'";
            }
            else
            {
                sqlStr = sqlStr + ",NULL,'" + alarmleve + "'";
            }

            //bool.TryParse(onceadayFlag, out _onceadayFlag);

            //DataSet DeptDS = DBConnector.executeQuery("Intouch", "EXEC [dbo].[uSP_Select_AlarmHistory] '" + _fromdate + "','" + _toDate + "','" + Toolid + "'," + _onceadayFlag);
            //DataSet DeptDS = DBConnector.executeQuery("Intouch", "EXEC [dbo].[uSP_Select_AlarmHistory] N'" + fromDate + "',N'" + toDate + "',NULL,0");
            DataSet DeptDS = DBConnector.executeQuery("Intouch", sqlStr);

            //var dtt = (from row in DeptDS.Tables[0].AsEnumerable() select new { row["AlarmId"],row["AlarmWeek"],row["AlarmTime_Begin"],row["Group_name"],row["toolID"],row["location"],row["Location_id"],row["vendor_name"],row["AlarmMsg"],row["AlarmLevel"]}).CopyToDataTable();

            //DataTable dt = (from row in DeptDS.Tables[0].AsEnumerable() where row.Field<string>("vendor_name") == vName select row).CopyToDataTable<DataRow>();

            //DataTable newdt = new DataTable();

            //newdt.Columns.Add("AlarmId", Type.GetType("System.Int32"));
            //newdt.Columns.Add("AlarmWeek", Type.GetType("System.String"));
            //newdt.Columns.Add("AlarmTime_Begin", Type.GetType("System.DateTime"));
            //newdt.Columns.Add("Group_name", Type.GetType("System.String"));
            //newdt.Columns.Add("toolID", Type.GetType("System.String"));
            //newdt.Columns.Add("location", Type.GetType("System.String"));
            //newdt.Columns.Add("Location_id", Type.GetType("System.String"));
            //newdt.Columns.Add("vendor_name", Type.GetType("System.String"));
            //newdt.Columns.Add("AlarmMsg", Type.GetType("System.String"));
            //newdt.Columns.Add("AlarmLevel", Type.GetType("System.Int16"));


            //foreach (DataRow row in dt.Rows)
            //{
            //    DataRow nrow = newdt.NewRow();

            //    nrow["AlarmId"] = row["AlarmId"];
            //    nrow["AlarmWeek"] = row["AlarmWeek"];
            //    nrow["AlarmTime_Begin"] = row["AlarmTime_Begin"];
            //    nrow["Group_name"] = row["Group_name"];
            //    nrow["toolID"] = row["toolID"];
            //    nrow["location"] = row["location"];
            //    nrow["Location_id"] = row["Location_id"];
            //    nrow["vendor_name"] = row["vendor_name"];
            //    nrow["AlarmMsg"] = row["AlarmMsg"];
            //    nrow["AlarmLevel"] = row["AlarmLevel"];

            //    newdt.Rows.Add(nrow);
            //}

            return(DeptDS.Tables[0]);
        }
예제 #7
0
        //PM History List
        public static IEnumerable <PMModel> PMHistoryList(string vName, string tooolId, string _StartDate, string _EndDate, string selectType, string gname)
        {
            if (string.IsNullOrEmpty(_StartDate))
            {
                _StartDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm");
            }

            if (string.IsNullOrEmpty(_EndDate))
            {
                _EndDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
            }
            else if (!string.IsNullOrEmpty(_EndDate))
            {
                DateTime tempDate = Convert.ToDateTime(_EndDate);
                if (tempDate.Hour == 0)
                {
                    tempDate = tempDate.AddDays(1);
                }
                _EndDate = tempDate.ToString("yyyy-MM-dd HH:mm");
            }

            string sqlStr = "EXEC [uSP_Select_PMHistory] @fromDate = N'" + _StartDate + "',@toDate = N'" + _EndDate + "'";

            if (!string.IsNullOrEmpty(vName))
            {
                //DataSet vds = DBConnector.executeQuery("Intouch", "SELECT department_id FROM department_info where department_name = '" + vName + "'");

                sqlStr += ",@vid = " + ListModel.GetDepartmentId(vName);
            }
            else
            {
                sqlStr += ",@vid = NULL";
            }

            if (!string.IsNullOrEmpty(tooolId))
            {
                sqlStr += ",@toolID = N'" + tooolId + "'";
            }
            else
            {
                sqlStr += ",@toolID = NULL";
            }

            string flag = string.Empty;

            if (!string.IsNullOrEmpty(selectType))
            {
                string[] arrType = null;

                arrType = selectType.Split(',');
                foreach (string i in arrType)
                {
                    flag += "@" + i + "=1,";
                }
                flag = "," + flag.Substring(0, flag.Length - 1);
            }
            //if (!string.IsNullOrEmpty(gname))
            //    sqlStr += ",@gname = N'" + gname + "'";
            //else
            //    sqlStr += ",@gname = NULL";
            sqlStr += flag;
            DataSet ds = DBConnector.executeQuery("Intouch", sqlStr);

            if (ds.Tables.Count > 0)
            {
                return(from dept in ds.Tables[0].AsEnumerable()
                       select new PMModel
                {
                    pmCycle = dept.IsNull("PM_Cycle") ? string.Empty : dept.Field <Int32>("PM_Cycle").ToString(),
                    //pmNextTime = dept.IsNull("PM_Next_Time") ? string.Empty : dept.Field<DateTime>("PM_Next_Time").ToString("yyyy-MM-dd HH:mm:ss"),
                    //PMLifeTime = dept.IsNull("PM_LifeTime") ? string.Empty : dept.Field<Int16>("PM_LifeTime").ToString(),
                    pmHistoryID = dept.IsNull("pmHistoryID") ? string.Empty : dept.Field <Int32>("pmHistoryID").ToString(),
                    plcID = dept.Field <Int16>("plc_id").ToString(),
                    ToolID = dept.Field <string>("tool_id"),
                    pmSet = dept.IsNull("pm_set") ? string.Empty : dept.Field <DateTime>("pm_set").ToString("yyyy-MM-dd HH:mm:ss"),
                    pmUnset = dept.IsNull("pm_unset") ? string.Empty : dept.Field <DateTime>("pm_unset").ToString("yyyy-MM-dd HH:mm:ss"),
                    memo = dept.IsNull("memo") ? string.Empty : dept.Field <string>("memo"),
                    _operator = dept.Field <string>("operator"),
                    pmFlag = dept.IsNull("pm_flag") ? "X" : dept.Field <bool>("pm_flag") ? "O" : "X",
                    tsFlag = dept.IsNull("ts_flag") ? "X" : dept.Field <bool>("ts_flag") ? "O" : "X",
                    backupFlag = dept.IsNull("backup_flag") ? "X" : dept.Field <bool>("backup_flag") ? "O" : "X",
                    cmsErrorFlag = dept.IsNull("cmsError_flag") ? "X" : dept.Field <bool>("cmsError_flag") ? "O" : "X",
                    PumpingDone = dept.IsNull("pumping_done") ? "X" : dept.Field <bool>("pumping_done") ? "O" : "X",
                    SEXDone = dept.IsNull("sex_done") ? "X" : dept.Field <bool>("sex_done") ? "O" : "X",
                    otherFlag = dept.IsNull("other_flag") ? "X" : dept.Field <bool>("other_flag") ? "O" : "X",
                    TemporaryPFlag = dept.IsNull("TemporaryP_flag") ? "X" : dept.Field <bool>("TemporaryP_flag") ? "O" : "X",
                    ptDone = dept.IsNull("pt_done") ? "X" : dept.Field <bool>("pt_done") ? "O" : "X",
                    UpdateDate = dept.IsNull("update_date") ? string.Empty : dept.Field <DateTime>("update_date").ToString("yyyy-MM-dd HH:mm:ss"),
                    //gName = dept.IsNull("gname") ? string.Empty : dept.Field<string>("gname"),
                    //LocationID = dept.Field<string>("lid"),
                    Location = dept.Field <string>("loc"),
                    //locSide = dept.IsNull("locSide") ? string.Empty : dept.Field<string>("locSide"),
                    tName = dept.Field <string>("tname"),
                    department_id = dept.IsNull("department_id") ? (short)1 : dept.Field <Int16>("vid"),
                    department_name = dept.Field <string>("department_name"),
                    //vendorIntouch = dept.Field<string>("vendor_Intouch"),

                    //Bellow = dept.IsNull("pumping_bellow") ? string.Empty : dept.Field<string>("pumping_bellow"),
                    //Turning = dept.IsNull("pumping_turning") ? string.Empty : dept.Field<string>("pumping_turning"),
                    //ThreeWay = dept.IsNull("pumping_threeway") ? string.Empty : dept.Field<string>("pumping_threeway"),
                    //HandValve = dept.IsNull("pumping_handvalve") ? string.Empty : dept.Field<string>("pumping_handvalve"),
                    //bsHead = dept.IsNull("pumping_bshead") ? string.Empty : dept.Field<string>("pumping_bshead"),
                    //GasValve = dept.IsNull("pumping_gasvalve") ? string.Empty : dept.Field<string>("pumping_gasvalve"),
                    //LPipe = dept.IsNull("pumping_lpipe") ? string.Empty : dept.Field<string>("pumping_lpipe"),
                    //Entry = dept.IsNull("pumping_entry") ? string.Empty : dept.Field<string>("pumping_entry"),

                    //Inlet = dept.IsNull("pm_inlet") ? string.Empty : dept.Field<string>("pm_inlet"),
                    //MixingBox = dept.IsNull("pm_mixingbox") ? string.Empty : dept.Field<string>("pm_mixingbox"),
                    //Reactor = dept.IsNull("pm_reactor") ? string.Empty : dept.Field<string>("pm_reactor"),
                    //Tank = dept.IsNull("pm_tank") ? string.Empty : dept.Field<string>("pm_tank"),
                    //Outlet = dept.IsNull("pm_outlet") ? string.Empty : dept.Field<string>("pm_outlet"),
                    //Tpipe = dept.IsNull("pm_tpipe") ? string.Empty : dept.Field<string>("pm_tpipe"),
                    //Pmlpipe = dept.IsNull("pm_lpipe") ? string.Empty : dept.Field<string>("pm_lpipe"),
                    //Upturning = dept.IsNull("pm_upturning") ? string.Empty : dept.Field<string>("pm_upturning"),
                    //ms = dept.IsNull("pm_ms") ? string.Empty : dept.Field<string>("pm_ms"),

                    //Inlet_TP = dept.IsNull("pm_inlet_TP") ? string.Empty : dept.Field<string>("pm_inlet_TP"),
                    //MixingBox_TP = dept.IsNull("pm_mixingbox_TP") ? string.Empty : dept.Field<string>("pm_mixingbox_TP"),
                    //Reactor_TP = dept.IsNull("pm_reactor_TP") ? string.Empty : dept.Field<string>("pm_reactor_TP"),
                    //Tank_TP = dept.IsNull("pm_tank_TP") ? string.Empty : dept.Field<string>("pm_tank_TP"),
                    //Outlet_TP = dept.IsNull("pm_outlet_TP") ? string.Empty : dept.Field<string>("pm_outlet_TP"),
                    //Tpipe_TP = dept.IsNull("pm_tpipe_TP") ? string.Empty : dept.Field<string>("pm_tpipe_TP"),
                    //Pmlpipe_TP = dept.IsNull("pm_lpipe_TP") ? string.Empty : dept.Field<string>("pm_lpipe_TP"),
                    //Upturning_TP = dept.IsNull("pm_upturning_TP") ? string.Empty : dept.Field<string>("pm_upturning_TP"),
                    //ms_TP = dept.IsNull("pm_ms_TP") ? string.Empty : dept.Field<string>("pm_ms_TP")
                });
            }
            else
            {
                return(new List <PMModel>());
            }
        }
예제 #8
0
        public static DataTable GetNowMachineValue(string vName, string gname, string pid, string ValueStyle)
        {
            short _vid; string _gname = "NULL"; string _pid = "NULL";

            _vid = ListModel.GetVid(vName);

            if (gname.Length > 0)
            {
                _gname = "'" + gname + "'";
            }
            if (pid.Length > 0)
            {
                if (vName == "DPM")
                {
                    _pid = ListModel.GetDPMPid(pid).ToString();
                }
                else
                {
                    _pid = ListModel.GetPid(pid).ToString();
                }
            }
            if (_pid == "0")
            {
                _pid = "NULL";
            }

            DataSet DeptDS = null;

            if (vName == "DPM")
            {
                DeptDS = DBConnector.executeQuery("Intouch", "EXEC uSP_Select_ValueNow_DPM  @vid=" + _vid + " , @gname  = " + _gname + ",@pid=" + _pid);
            }
            else
            {
                DeptDS = DBConnector.executeQuery("Intouch", "EXEC uSP_Select_ValueNow  @vid=" + _vid + " , @gname  = " + _gname + ",@pid=" + _pid);
            }

            if (DeptDS != null && DeptDS.Tables.Count > 0 && DeptDS.Tables[0].Rows.Count > 0)
            {
                if (_pid == "NULL")
                {
                    if (ValueStyle != string.Empty)
                    {
                        //刪除右(左)側欄位
                        //for (int i = DeptDS.Tables[0].Columns.Count - 1; i >= 0; i--)
                        //{
                        //    if (ValueStyle == "L" && (DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("右側") > 0 || DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("側)") == 0))
                        //    {
                        //        DeptDS.Tables[0].Columns.RemoveAt(i);
                        //    }
                        //    else if (ValueStyle == "R" && (DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("左側") > 0 || DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("側)") == 0))
                        //    {
                        //        DeptDS.Tables[0].Columns.RemoveAt(i);
                        //    }
                        //}

                        //刪除右(左)側記錄
                        //for (int i = DeptDS.Tables[0].Rows.Count - 1; i >= 0; i--)
                        //{

                        //    if (ValueStyle == "L" && DeptDS.Tables[0].Rows[i][4].ToString().IndexOf('R') >= 0)
                        //    {
                        //        DeptDS.Tables[0].Rows.Remove(DeptDS.Tables[0].Rows[i]);
                        //    }
                        //    else if (ValueStyle == "R" && DeptDS.Tables[0].Rows[i][4].ToString().IndexOf("L") >= 0)
                        //    {
                        //        DeptDS.Tables[0].Rows.Remove(DeptDS.Tables[0].Rows[i]);
                        //    }
                        //}
                    }

                    //取得防火回欄位的Index
                    //string FireList = string.Empty;
                    //for (int i = 0; i <= DeptDS.Tables[0].Columns.Count - 1; i++)
                    //{
                    //    if (DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("防回火") == 0)
                    //    {
                    //        FireList += i.ToString() + ",";
                    //    }
                    //}

                    //if (FireList != string.Empty)
                    //{
                    //    FireList = FireList.Substring(0, FireList.Length - 1);
                    //    string[] FireArray;
                    //    FireArray = FireList.Split(',');
                    //    int templength = 0;
                    //    if (FireArray.Length < 4)
                    //    {
                    //        templength = FireArray.Length;
                    //    }
                    //    else
                    //    {
                    //        templength = 4;
                    //    }

                    //    if (string.IsNullOrEmpty(pid))
                    //    {
                    //        for (int i = 0; i <= DeptDS.Tables[0].Rows.Count - 1; i++)
                    //        {
                    //            //暫存單筆所有防回火欄位數據
                    //            int j = 0;
                    //            string[] isNotNullArray = new string[4];
                    //            for (int k = 0; k <= FireArray.Length - 1; k++)
                    //            {
                    //                if (!DeptDS.Tables[0].Rows[i].IsNull(int.Parse(FireArray[k].ToString())))
                    //                {
                    //                    isNotNullArray[j] = DeptDS.Tables[0].Rows[i][int.Parse(FireArray[k].ToString())].ToString();
                    //                    j += 1;
                    //                }
                    //            }



                    //            //回寫4個防回火數據到DataSet
                    //            for (int k = 0; k <= templength - 1; k++)
                    //            {

                    //                if (!string.IsNullOrEmpty(isNotNullArray[k]))
                    //                {
                    //                    DeptDS.Tables[0].Rows[i][int.Parse(FireArray[k + FireArray.Length - templength].ToString())] = double.Parse(isNotNullArray[k]);
                    //                }
                    //                else
                    //                {
                    //                    DeptDS.Tables[0].Rows[i][int.Parse(FireArray[k + FireArray.Length - templength].ToString())] = System.DBNull.Value;
                    //                }
                    //            }
                    //        }

                    //        //保留4個防回火欄位重新命名,其他刪除
                    //        int intFire = templength;
                    //        for (int i = DeptDS.Tables[0].Columns.Count - 1; i >= 0; i--)
                    //        {
                    //            if (DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("防回火") == 0)
                    //            {

                    //                if (intFire > 0)
                    //                {
                    //                    DeptDS.Tables[0].Columns[i].ColumnName = "防回火" + intFire;
                    //                }
                    //                else
                    //                {
                    //                    DeptDS.Tables[0].Columns.RemoveAt(i);
                    //                }
                    //                intFire -= 1;
                    //            }
                    //        }
                    //    }
                    //}

                    //更改抬頭名稱
                    //int indexStr = 0;

                    //for (int i = DeptDS.Tables[0].Columns.Count - 1; i >= 0; i--)
                    //{
                    //    if (ValueStyle == "R")
                    //    {
                    //        indexStr = DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("(右側)");
                    //    }
                    //    else if (ValueStyle == "L")
                    //    {
                    //        indexStr = DeptDS.Tables[0].Columns[i].ColumnName.IndexOf("(左側)");
                    //    }

                    //    if (indexStr > 0)
                    //    {
                    //        DeptDS.Tables[0].Columns[i].ColumnName = DeptDS.Tables[0].Columns[i].ColumnName.Substring(0, indexStr);
                    //    }
                    //}
                }
                //DeptDS.Tables[0].Columns.Remove("location_side");
                DeptDS.Tables[0].Columns.Remove("toolID1");
                DeptDS.Tables[0].Columns.Remove("DataTime");
                return(DeptDS.Tables[0]);
            }
            else
            {
                return(null);
            }
        }