예제 #1
0
        /// <summary>
        /// 绘制各个工位
        /// </summary>
        /// <param name="addflow"></param>
        public List <Node> DrawStation(AddFlow addflow)
        {
            List <Node> list = new List <Node>();
            Node        node = null;
            DataTable   dt   = AsmStation_BLL.GetAllStation();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                node           = new Node(10 + (60 * i), 580, 50, 85, dt.Rows[i]["STATION_NAME"].ToString(), addflow);
                node.Text      = dt.Rows[i]["STATION_NAME"].ToString();
                node.FillColor = Color.White;
                list.Add(node);
            }
            return(list);
        }
예제 #2
0
 public void StationRefish()
 {
     stationDt1        = null;
     stationDt1        = AsmStation_BLL.GetAllStation();
     CB_ST1.DataSource = stationDt1;
     //CB_ST1.DisplayMember = "STATION_NAME";
     CB_ST1.ValueMember   = "STATION_NAME";
     CB_ST1.SelectedIndex = 0;
     stationDt2           = null;
     stationDt2           = AsmStation_BLL.GetAllStation();
     CB_ST2.DataSource    = stationDt2;
     // CB_ST2.DisplayMember = "STATION_NAME";
     CB_ST2.ValueMember   = "STATION_NAME";
     CB_ST2.SelectedIndex = 0;
 }
예제 #3
0
 public void ProductionAndStationRefish()
 {
     productionDt        = null;
     productionDt        = AsmProduction_BLL.GetAllAsmProduction();
     CB_RP.DataSource    = productionDt;
     CB_RP.DisplayMember = "PRODUCTION_NAME";
     CB_RP.ValueMember   = "PRODUCTION_ID";
     CB_RP.SelectedItem  = null;
     stationDt           = null;
     stationDt           = AsmStation_BLL.GetAllStation();
     CB_S.DataSource     = stationDt;
     CB_S.DisplayMember  = "STATION_NAME";
     CB_S.ValueMember    = "STATION_ID";
     CB_S.SelectedItem   = null;
 }
예제 #4
0
 public void ProductionAndStationRefish()
 {
     productionDt                = null;
     productionDt                = AsmProduction_BLL.GetAllAsmProduction();
     CB_Production.DataSource    = productionDt;
     CB_Production.DisplayMember = "PRODUCTION_VR";
     CB_Production.ValueMember   = "PRODUCTION_ID";
     if (CB_Production.Items.Count > 0)
     {
         CB_Production.SelectedIndex = 0;
     }
     stationDt                = null;
     stationDt                = AsmStation_BLL.GetAllStation();
     CB_Station.DataSource    = stationDt;
     CB_Station.DisplayMember = "STATION_NAME";
     CB_Station.ValueMember   = "STATION_ID";
     CB_Station.SelectedIndex = 0;
 }
예제 #5
0
        /// <summary>
        /// 设置显示的坐标
        /// </summary>
        public List <PointF> SetPointF()
        {
            List <PointF> list = new List <PointF>();
            DataTable     dt   = AsmStation_BLL.GetAllStation();
            PointF        pf;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i < 5)
                {
                    pf = new PointF(130 * i, 80);    list.Add(pf);
                }
                if (i >= 5 && i < 10)
                {
                    pf = new PointF(130 * (i), 180);   list.Add(pf);
                }
                else
                {
                    pf = new PointF(130 * (i), 280); list.Add(pf);
                }
            }
            return(list);
        }
예제 #6
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)
            {
            }
        }