Beispiel #1
0
        public static AsmStationObject GetStationByCondition(string sql)
        {
            AsmStationObject aso = null;
            string           sl  = "SELECT STATION_ID,STATION_INDEX,STATION_NAME,STATION_PROCESSOK,STATION_DATAOK,STATION_TYPE,STATION_RECIPEORNOT,STATION_AGVORNOT,STATION_REQUSTOUTLINE,STATION_LIGHTORNOT,STATION_REQUSTIN,STATION_REVIEWORNOT,STATION_PRINTORNOT,STATION_UPLOADMES,STATION_ENDORNOT,STATION_GUNORNOT,STATION_TIME,STATION_AUTOORNOT FROM dbo.C_ASM_STATION_T WHERE " + sql;
            DataTable        dt  = new DataTable();

            dt = ClsCommon.dbSql.ExecuteDataTable(sl);
            if (dt.Rows.Count > 0)
            {
                aso                       = new AsmStationObject();
                aso.STATION_ID            = Convert.ToInt32(dt.Rows[0]["STATION_ID"].ToString());
                aso.STATION_INDEX         = dt.Rows[0]["STATION_INDEX"].ToString();
                aso.STATION_NAME          = dt.Rows[0]["STATION_NAME"].ToString();
                aso.STATION_PROCESSOK     = dt.Rows[0]["STATION_PROCESSOK"].ToString();
                aso.STATION_DATAOK        = dt.Rows[0]["STATION_DATAOK"].ToString();
                aso.STATION_TYPE          = dt.Rows[0]["STATION_TYPE"].ToString();
                aso.STATION_RECIPEORNOT   = dt.Rows[0]["STATION_RECIPEORNOT"].ToString();
                aso.STATION_AGVORNOT      = dt.Rows[0]["STATION_AGVORNOT"].ToString();
                aso.STATION_REQUSTOUTLINE = dt.Rows[0]["STATION_REQUSTOUTLINE"].ToString();
                aso.STATION_LIGHTORNOT    = dt.Rows[0]["STATION_LIGHTORNOT"].ToString();
                aso.STATION_REQUSTIN      = dt.Rows[0]["STATION_REQUSTIN"].ToString();
                aso.STATION_REVIEWORNOT   = dt.Rows[0]["STATION_REVIEWORNOT"].ToString();
                aso.STATION_PRINTORNOT    = dt.Rows[0]["STATION_PRINTORNOT"].ToString();
                aso.STATION_UPLOADMES     = dt.Rows[0]["STATION_UPLOADMES"].ToString();
                aso.STATION_ENDORNOT      = dt.Rows[0]["STATION_ENDORNOT"].ToString();
                aso.STATION_GUNORNOT      = dt.Rows[0]["STATION_GUNORNOT"].ToString();
                aso.STATION_TIME          = Convert.ToInt32(dt.Rows[0]["STATION_TIME"].ToString());
                aso.STATION_AUTOORNOT     = dt.Rows[0]["STATION_AUTOORNOT"].ToString();
            }
            return(aso);
        }
Beispiel #2
0
 public static int AddStationByObject(AsmStationObject aso)
 {
     using (IDbConnection conn = ClsCommon.OpenConnection())  //这里访问的是Sqlite数据文件,这里OpenConnection即上边获取连接数据库对象方法
     {
         var result = conn.Insert(aso);
         return(Convert.ToInt32(result));
     }
 }
Beispiel #3
0
        public static int UpdateStationByObject(AsmStationObject aso)
        {
            var result = 0;

            using (IDbConnection conn = ClsCommon.OpenConnection())  //这里访问的是Sqlite数据文件,这里OpenConnection即上边获取连接数据库对象方法
            {
                result = conn.Update(aso);
            }
            return(Convert.ToInt32(result));
        }
Beispiel #4
0
        public static int DeleteStationByCondition(string sql)
        {
            int a = 0;
            AsmStationObject aso = GetStationByCondition(sql);

            if (aso != null)
            {
                string sl = "DELETE FROM dbo.C_ASM_STATION_T WHERE " + sql;
                a = ClsCommon.dbSql.ExecuteNonQuery(sl);
            }
            return(a);
        }
Beispiel #5
0
 /// <summary>
 /// 工位属性配置
 /// </summary>
 /// <param name="sql"></param>
 public void StationConfigure(string sql)
 {
     try
     {
         string           str_station = "";
         AsmStationObject aso         = AsmStation_BLL.GetStationByCondition(sql);
         if (aso != null)
         {
             str_station += "站名:          " + aso.STATION_NAME + "\n\n";
             str_station += "站类型:        " + aso.STATION_TYPE + "\n\n";
             str_station += "是否需要配方:  " + ((aso.STATION_RECIPEORNOT == "1") ? true : false) + "\n\n";
             str_station += "是否配备AGV:   " + ((aso.STATION_AGVORNOT == "1") ? true : false) + "\n\n";
             str_station += "是否点亮放行灯:" + ((aso.STATION_LIGHTORNOT == "1") ? true : false) + "\n\n";
             str_station += "是否配置打印机:" + ((aso.STATION_PRINTORNOT == "1") ? true : false) + "\n\n";
             str_station += "是否末站:      " + ((aso.STATION_ENDORNOT == "1") ? true : false) + "\n\n";
             str_station += "是否配备拧紧枪:" + ((aso.STATION_GUNORNOT == "1") ? true : false) + "\n\n";
             str_station += "工位节拍:      " + aso.STATION_TIME + "\n\n";
         }
         rTB_stationproperty.AppendText(str_station);
     }
     catch (Exception e)
     {
     }
 }
Beispiel #6
0
        public static AsmStationObject GetStationByCondition(string sql)
        {
            AsmStationObject aso = AsmStation_DAL.GetStationByCondition(sql);

            return(aso);
        }
Beispiel #7
0
        public static int UpdateStationByObject(AsmStationObject aso)
        {
            int a = AsmStation_DAL.UpdateStationByObject(aso);

            return(a);
        }
Beispiel #8
0
        public static int AddStationByObject(AsmStationObject aso)
        {
            int a = AsmStation_DAL.AddStationByObject(aso);

            return(a);
        }
Beispiel #9
0
        /// <summary>
        /// 存储数据
        /// </summary>
        public void StoreData()
        {
            try
            {
                List <Item> list_item                   = addFlow.Items;
                DataTable   dt                          = AsmStation_BLL.GetAllStation();
                AsmProductionWayRecordObject apwo       = null;
                AsmProductionWayRecordObject apwo_right = null;
                List <string> list                      = new List <string>();
                bool          judge                     = false;
                bool          judge_right               = false;
                int           j                         = 1;

                List <Item> list_link = new List <Item>();
                for (int i = 0; i < list_item.Count; i++)
                {
                    if (list_item[i].GetType().ToString().Contains("Link"))
                    {
                        list_link.Add(list_item[i]);
                    }
                }

                for (int i = 0; i < list_link.Count; i++)
                {
                    string str_left  = (list_link[i] as Link).Org.Text;
                    string str_right = (list_link[i] as Link).Dst.Text;


                    if (list.Count > 0)
                    {
                        for (int m = 0; m < list.Count; m++)
                        {
                            if (str_left.Equals(list[m]))
                            {
                                judge = false;
                            }
                            else
                            {
                                judge = true;
                            }
                        }
                    }
                    else
                    {
                        judge = true;
                    }

                    if (judge)
                    {
                        apwo         = new AsmProductionWayRecordObject();
                        apwo.ST_NAME = str_left;
                        AsmProductionObject apo = AsmProduction_BLL.GetAsmProductionByCondition("PRODUCTION_NAME='" + cB_product_name.SelectedItem.ToString() + "'");
                        if (apo != null)
                        {
                            apwo.PRODUCTION_NAME = apo.PRODUCTION_NAME;
                            apwo.PRODUCTION_ID   = apo.PRODUCTION_ID;
                        }
                        AsmStationObject aso = AsmStation_BLL.GetStationByCondition("STATION_NAME='" + apwo.ST_NAME + "'");
                        if (aso != null)
                        {
                            apwo.ST_ID = aso.STATION_ID;
                        }
                        apwo.DT        = System.DateTime.Now;
                        apwo.SERIAL_NO = j++;
                        AsmproductionWayRecord_BLL.AddRecord(apwo);
                    }

                    if (list.Count > 0)
                    {
                        for (int m = 0; m < list.Count; m++)
                        {
                            if (str_right.Equals(list[m]))
                            {
                                judge_right = false;
                            }
                            else
                            {
                                judge_right = true;
                            }
                        }
                    }
                    else
                    {
                        judge_right = true;
                    }
                    if (judge_right)
                    {
                        apwo_right         = new AsmProductionWayRecordObject();
                        apwo_right.ST_NAME = str_right;
                        AsmProductionObject apoX = AsmProduction_BLL.GetAsmProductionByCondition("PRODUCTION_NAME='" + cB_product_name.SelectedItem.ToString() + "'");
                        apwo_right.PRODUCTION_NAME = apoX.PRODUCTION_NAME;
                        apwo_right.PRODUCTION_ID   = apoX.PRODUCTION_ID;
                        AsmStationObject asoX = AsmStation_BLL.GetStationByCondition("STATION_NAME='" + apwo_right.ST_NAME + "'");
                        apwo_right.ST_ID     = asoX.STATION_ID;
                        apwo_right.DT        = System.DateTime.Now;
                        apwo_right.SERIAL_NO = j++;
                        AsmproductionWayRecord_BLL.AddRecord(apwo_right);
                    }
                }

                DataTable dt_way = AsmProductionWay_BLL.GetWayByCondition("PRODUCTION_NAME= '" + cB_product_name.SelectedItem.ToString().Trim() + "'");
                if (!(dt_way.Rows.Count > 0))
                {
                    DataTable dt_record          = AsmproductionWayRecord_BLL.GetAllRecordByCondition(cB_product_name.SelectedItem.ToString().Trim());
                    AsmProductionWayObject apwro = null;
                    for (int i = 0; i < dt_record.Rows.Count; i++)
                    {
                        apwro                 = new AsmProductionWayObject();
                        apwro.ST_NAME         = dt_record.Rows[i]["ST_NAME"].ToString();
                        apwro.DT              = Convert.ToDateTime(dt_record.Rows[i]["DT"].ToString());
                        apwro.PRODUCTION_NAME = dt_record.Rows[i]["PRODUCTION_NAME"].ToString();
                        apwro.PRODUCTION_ID   = Convert.ToInt32(dt_record.Rows[i]["PRODUCTION_ID"].ToString());
                        apwro.ST_NAME         = dt_record.Rows[i]["ST_NAME"].ToString();
                        apwro.ST_ID           = Convert.ToInt32(dt_record.Rows[i]["ST_ID"].ToString());
                        apwro.SERIAL_NO       = i + 1;
                        AsmProductionWay_BLL.AddRoutingRecord(apwro);
                    }
                }
                else
                {
                    AsmProductionWay_BLL.DeleteAllByCondition("PRODUCTION_NAME= '" + cB_product_name.SelectedItem.ToString().Trim() + "'");
                    DataTable dt_record          = AsmproductionWayRecord_BLL.GetAllRecordByCondition(cB_product_name.SelectedItem.ToString().Trim());
                    AsmProductionWayObject apwro = null;
                    for (int i = 0; i < dt_record.Rows.Count; i++)
                    {
                        apwro    = new AsmProductionWayObject();
                        apwro.DT = Convert.ToDateTime(dt_record.Rows[i]["DT"]);
                        apwro.PRODUCTION_NAME = dt_record.Rows[i]["PRODUCTION_NAME"].ToString();
                        apwro.PRODUCTION_ID   = Convert.ToInt32(dt_record.Rows[i]["PRODUCTION_ID"].ToString());
                        apwro.ST_NAME         = dt_record.Rows[i]["ST_NAME"].ToString();
                        apwro.ST_ID           = Convert.ToInt32(dt_record.Rows[i]["ST_ID"].ToString());
                        apwro.SERIAL_NO       = i + 1;
                        AsmProductionWay_BLL.AddRoutingRecord(apwro);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int         index = 0;
            string      stName;
            XmlNode     lineNode     = ClsCommon.InfoRootNode.SelectSingleNode("line[@name='" + lineName + "']");
            XmlNodeList stationNodes = lineNode.SelectNodes("station");///////DELETE

            foreach (XmlNode node in stationNodes)
            {
                if (int.Parse(node.Attributes["index"].Value) > index)
                {
                    index = int.Parse(node.Attributes["index"].Value);
                }
            }
            if (lstStation.Items.Count > 0)
            {
                index++;
            }
            stName = "Station" + index.ToString();
            XmlElement element = ClsCommon.xml.CreateElement("station");

            element.SetAttribute("index", index.ToString());
            element.SetAttribute("name", stName);
            element.SetAttribute("processOK", "0");
            element.SetAttribute("dataOK", "0");
            //element.SetAttribute("index", index.ToString());
            //element.SetAttribute("name", stName);
            //element.SetAttribute("scanValue", "");
            //element.SetAttribute("automaticStation", "0");
            element.SetAttribute("type", "0");
            element.SetAttribute("recipeOrNot", "1");
            element.SetAttribute("agvOrNot", "1");
            element.SetAttribute("requentMESoutLineOrNot", "0");
            element.SetAttribute("lightLighOrNot", "0");
            element.SetAttribute("requentMESInLineOrNot", "0");
            element.SetAttribute("reviewOrNot", "1");
            element.SetAttribute("printOrNot", "0");
            element.SetAttribute("dataUploadMESOrNot", "0");
            element.SetAttribute("endSTorNot", "0");
            element.SetAttribute("gunOrNot", "1");
            element.SetAttribute("autoOrNot", "0");
            element.SetAttribute("stationTime", "10000");
            //element.SetAttribute("keypartOK", "0");
            //element.SetAttribute("statusOK", "0");
            //element.SetAttribute("processOK", "0");
            // element.SetAttribute("dataOK", "0");
            //element.SetAttribute("snAddr", "");
            //element.SetAttribute("snTagAddr", "");
            //element.SetAttribute("okAddr", "");
            //element.SetAttribute("programAddr", "");
            //element.SetAttribute("enableAddr", "");
            //element.SetAttribute("enableTagAddr", "");

            lineNode.AppendChild(element);
            ClsCommon.saveXml();
            #region >>>>>同步新增站
            AsmStationObject aso = new AsmStationObject();
            aso.STATION_INDEX         = index.ToString();
            aso.STATION_NAME          = stName;
            aso.STATION_PROCESSOK     = "0";
            aso.STATION_DATAOK        = "0";
            aso.STATION_TYPE          = "0";
            aso.STATION_RECIPEORNOT   = "1";
            aso.STATION_AGVORNOT      = "1";
            aso.STATION_REQUSTOUTLINE = "1";
            aso.STATION_LIGHTORNOT    = "1";
            aso.STATION_REQUSTIN      = "1";
            aso.STATION_REVIEWORNOT   = "1";
            aso.STATION_PRINTORNOT    = "1";
            aso.STATION_UPLOADMES     = "1";
            aso.STATION_ENDORNOT      = "0";
            aso.STATION_GUNORNOT      = "1";
            aso.STATION_AUTOORNOT     = "0";
            aso.STATION_TIME          = 10000;
            AsmStation_BLL.AddStationByObject(aso);
            #endregion
            lstStation.Items.Add(stName);
            lstStation.SelectedIndex = lstStation.Items.Count - 1;

            if (lstStation.Items.Count > 0)
            {
                btnRemove.Enabled   = true;
                btnMovedown.Enabled = true;
                btnMoveup.Enabled   = true;
            }
        }
Beispiel #11
0
 public void Refish()
 {
     aso = AsmStation_BLL.GetStationByCondition(" STATION_NAME='" + StationName + "';");
 }