コード例 #1
0
        public void SaveProfileData(string profileName, float sampleStart, float sampleDistance,
                                    string Error1, string Error2, string Error3, string Error4, string Error5,
                                    float H1Par, float H2Par, float H3Par, float H4Par, float H5Par, float H6Par, float H7Par,
                                    string HAC1, string HAC2, string HAC3, string HAC4, string HAC5, string HAC6, string HAC7,
                                    float F1Par, float F2Par, float F3Par, float F4Par, float F5Par, float F6Par, float F7Par,
                                    string FAC1, string FAC2, string FAC3, string FAC4, string FAC5, string FAC6, string FAC7,
                                    float SP1, float SP2, float SP3, float SP4, float SP5, float SP6, float SP7,
                                    string byWho, out string resCode, out string resDesc)
        {
            try
            {
                Log.AppendText("กำลังบันทึกข้อมูล Profile {" + profileName + ", " + sampleStart.ToString() + ", " + sampleDistance.ToString() + ", " +
                               Error1 + ", " + Error2 + ", " + Error3 + ", " + Error4 + ", " + Error5 + ", " +
                               H1Par.ToString() + ", " + H2Par.ToString() + ", " + H3Par.ToString() + ", " + H4Par.ToString() + ", " + H5Par.ToString() + ", " + H6Par.ToString() + ", " + H7Par.ToString() + ", " +
                               HAC1 + ", " + HAC2 + ", " + HAC3 + ", " + HAC4 + ", " + HAC5 + ", " + HAC6 + ", " + HAC7 + ", " +
                               F1Par.ToString() + ", " + F2Par.ToString() + ", " + F3Par.ToString() + ", " + F4Par.ToString() + ", " + F5Par.ToString() + ", " + F6Par.ToString() + ", " + F7Par.ToString() + ", " +
                               FAC1 + ", " + FAC2 + ", " + FAC3 + ", " + FAC4 + ", " + FAC5 + ", " + FAC6 + ", " + FAC7 + ", " +
                               SP1.ToString() + ", " + SP2.ToString() + ", " + SP3.ToString() + ", " + SP4.ToString() + ", " + SP5.ToString() + ", " + SP6.ToString() + ", " + SP7.ToString() +
                               "} by " + byWho);

                ManageBiz ms = new ManageBiz();
                DataTable dtUser;
                dtUser = ms.GetProfileBy(profileName);
                if (dtUser.Rows.Count == 0)
                {
                    Log.AppendText("ตรวจสอบ ProfileName เรียบร้อย");
                    ms.AddNewProfile(profileName, sampleStart, sampleDistance,
                                     Error1, Error2, Error3, Error4, Error5,
                                     H1Par, H2Par, H3Par, H4Par, H5Par, H6Par, H7Par,
                                     HAC1, HAC2, HAC3, HAC4, HAC5, HAC6, HAC7,
                                     F1Par, F2Par, F3Par, F4Par, F5Par, F6Par, F7Par,
                                     FAC1, FAC2, FAC3, FAC4, FAC5, FAC6, FAC7,
                                     SP1, SP2, SP3, SP4, SP5, SP6, SP7);
                    resCode = "00";
                    resDesc = "";
                }
                else
                {
                    Log.AppendText("WARNING! : ProfileName ซ้ำ");
                    Log.AppendText("เริ่มต้น Update Profile...");
                    ms.UpdateProfileData(profileName, sampleStart, sampleDistance,
                                         Error1, Error2, Error3, Error4, Error5,
                                         H1Par, H2Par, H3Par, H4Par, H5Par, H6Par, H7Par,
                                         HAC1, HAC2, HAC3, HAC4, HAC5, HAC6, HAC7,
                                         F1Par, F2Par, F3Par, F4Par, F5Par, F6Par, F7Par,
                                         FAC1, FAC2, FAC3, FAC4, FAC5, FAC6, FAC7,
                                         SP1, SP2, SP3, SP4, SP5, SP6, SP7);
                    resCode = "01";
                    resDesc = "";
                }
            }
            catch (Exception ex)
            {
                resCode = "EX";
                resDesc = ex.Message;
                Log.AppendText(ex.Message);
            }
        }
コード例 #2
0
        //
        // ---------------------------------------------------------
        // Constructor
        // ---------------------------------------------------------
        public ConnectorInfo(string connectorType, float x, float y, float angle, string comments, float fixtureThickness, float boardThickness)
        {
            // Preseting
            ToolType    = "";
            ProfileName = "";
            //
            NumberOfPins     = 0;
            CONBaseThickness = 0; CONUnseatedTop = 0; CONHeight = 0; CONSeatedHeight = 0;
            //
            GraphFPerPin = 0; GraphDistance = 0;
            //
            MinFPerPin = 0; MaxFPerPin = 0; UserFPerPin = 0; OtherForce = 0;
            //
            PARSPercent = 0; PARSStartHeight = 0; PARSDistance = 0;
            //
            FGradDegrees = 0;
            CONComments  = "";
            //
            ToolClearance = 0; ToolHeight = 0; ToolWidth = 0; ToolLength = 0;
            //
            ToolBarcode = ""; ToolComments = "";
            //
            PARSSamplingStartHeight = 0; PARSSamplingDistance = 0;
            //
            Error1 = ""; Error2 = ""; Error3 = ""; Error4 = ""; Error5 = "";
            //
            H1Par = 0; H2Par = 0; H3Par = 0; H4Par = 0; H5Par = 0; H6Par = 0; H7Par = 0;
            //
            HAC1 = ""; HAC2 = ""; HAC3 = ""; HAC4 = ""; HAC5 = ""; HAC6 = ""; HAC7 = "";
            //
            F1Par = 0; F2Par = 0; F3Par = 0; F4Par = 0; F5Par = 0; F6Par = 0; F7Par = 0;
            //
            FAC1 = ""; FAC2 = ""; FAC3 = ""; FAC4 = ""; FAC5 = ""; FAC6 = ""; FAC7 = "";
            //
            SP1 = 0; SP2 = 0; SP3 = 0; SP4 = 0; SP5 = 0; SP6 = 0; SP7 = 0;
            //
            // Assigning
            this.ConnectorType = connectorType;
            //
            this.X        = x;
            this.Y        = y;
            this.Angle    = angle;
            this.Comments = comments;
            //
            this.FixtureThickness = fixtureThickness;
            this.BoardThickness   = boardThickness;
            //
            this.Location = new PointF(x, y);
            //
            // Connector type database
            ManageBiz ms = new ManageBiz();
            DataTable dtCON;

            dtCON = ms.GetConnectorBy(connectorType);
            if (dtCON != null)
            {
                if (dtCON.Rows.Count > 0)
                {
                    ToolType    = dtCON.Rows[0]["ToolType"].ToString();
                    ProfileName = dtCON.Rows[0]["ProfileName"].ToString();
                    //
                    NumberOfPins     = int.Parse(dtCON.Rows[0]["NumberOfPins"].ToString());
                    CONBaseThickness = float.Parse(dtCON.Rows[0]["BaseThickness"].ToString());
                    CONUnseatedTop   = float.Parse(dtCON.Rows[0]["UnseatedTop"].ToString());
                    CONHeight        = float.Parse(dtCON.Rows[0]["Height"].ToString());
                    CONSeatedHeight  = float.Parse(dtCON.Rows[0]["SeatedHeight"].ToString());
                    //
                    GraphFPerPin  = float.Parse(dtCON.Rows[0]["GraphFPerPin"].ToString());
                    GraphDistance = float.Parse(dtCON.Rows[0]["GraphDistance"].ToString());
                    //
                    MinFPerPin  = float.Parse(dtCON.Rows[0]["MinFPerPin"].ToString());
                    MaxFPerPin  = float.Parse(dtCON.Rows[0]["MaxFPerPin"].ToString());
                    UserFPerPin = float.Parse(dtCON.Rows[0]["UserFPerPin"].ToString());
                    OtherForce  = float.Parse(dtCON.Rows[0]["OtherForce"].ToString());
                    //
                    PARSPercent     = float.Parse(dtCON.Rows[0]["PARSPercent"].ToString());
                    PARSStartHeight = float.Parse(dtCON.Rows[0]["PARSStartHeight"].ToString());
                    PARSDistance    = float.Parse(dtCON.Rows[0]["PARSDistance"].ToString());
                    //
                    FGradDegrees = float.Parse(dtCON.Rows[0]["FGradDegrees"].ToString());
                    //
                    CONComments = dtCON.Rows[0]["Comments"].ToString();
                }
            }
            dtCON.Dispose();
            dtCON = null;
            //
            // Tool type database
            DataTable dtTOOL;

            dtTOOL = ms.GetToolBy(ToolType);
            if (dtTOOL != null)
            {
                if (dtTOOL.Rows.Count > 0)
                {
                    ToolClearance = float.Parse(dtTOOL.Rows[0]["Clearance"].ToString());
                    ToolHeight    = float.Parse(dtTOOL.Rows[0]["Height"].ToString());
                    ToolWidth     = float.Parse(dtTOOL.Rows[0]["Width"].ToString());
                    ToolLength    = float.Parse(dtTOOL.Rows[0]["Length"].ToString());
                    //
                    ToolBarcode  = dtTOOL.Rows[0]["Barcode"].ToString();
                    ToolComments = dtTOOL.Rows[0]["Comments"].ToString();
                }
            }
            dtTOOL.Dispose();
            dtTOOL = null;
            //
            // Profile database
            DataTable dtPF;

            dtPF = ms.GetProfileBy(ProfileName);
            if (dtPF != null)
            {
                if (dtPF.Rows.Count > 0)
                {
                    PARSSamplingStartHeight = float.Parse(dtPF.Rows[0]["StartHeight"].ToString());
                    PARSSamplingDistance    = float.Parse(dtPF.Rows[0]["Distance"].ToString());
                    //
                    Error1 = dtPF.Rows[0]["Error1"].ToString();
                    Error2 = dtPF.Rows[0]["Error2"].ToString();
                    Error3 = dtPF.Rows[0]["Error3"].ToString();
                    Error4 = dtPF.Rows[0]["Error4"].ToString();
                    Error5 = dtPF.Rows[0]["Error5"].ToString();
                    //
                    H1Par = float.Parse(dtPF.Rows[0]["H1Par"].ToString());
                    H2Par = float.Parse(dtPF.Rows[0]["H2Par"].ToString());
                    H3Par = float.Parse(dtPF.Rows[0]["H3Par"].ToString());
                    H4Par = float.Parse(dtPF.Rows[0]["H4Par"].ToString());
                    H5Par = float.Parse(dtPF.Rows[0]["H5Par"].ToString());
                    H6Par = float.Parse(dtPF.Rows[0]["H6Par"].ToString());
                    H7Par = float.Parse(dtPF.Rows[0]["H7Par"].ToString());
                    //
                    HAC1 = dtPF.Rows[0]["HAC1"].ToString();
                    HAC2 = dtPF.Rows[0]["HAC2"].ToString();
                    HAC3 = dtPF.Rows[0]["HAC3"].ToString();
                    HAC4 = dtPF.Rows[0]["HAC4"].ToString();
                    HAC5 = dtPF.Rows[0]["HAC5"].ToString();
                    HAC6 = dtPF.Rows[0]["HAC6"].ToString();
                    HAC7 = dtPF.Rows[0]["HAC7"].ToString();
                    //
                    F1Par = float.Parse(dtPF.Rows[0]["F1Par"].ToString());
                    F2Par = float.Parse(dtPF.Rows[0]["F2Par"].ToString());
                    F3Par = float.Parse(dtPF.Rows[0]["F3Par"].ToString());
                    F4Par = float.Parse(dtPF.Rows[0]["F4Par"].ToString());
                    F5Par = float.Parse(dtPF.Rows[0]["F5Par"].ToString());
                    F6Par = float.Parse(dtPF.Rows[0]["F6Par"].ToString());
                    F7Par = float.Parse(dtPF.Rows[0]["F7Par"].ToString());
                    //
                    FAC1 = dtPF.Rows[0]["FAC1"].ToString();
                    FAC2 = dtPF.Rows[0]["FAC2"].ToString();
                    FAC3 = dtPF.Rows[0]["FAC3"].ToString();
                    FAC4 = dtPF.Rows[0]["FAC4"].ToString();
                    FAC5 = dtPF.Rows[0]["FAC5"].ToString();
                    FAC6 = dtPF.Rows[0]["FAC6"].ToString();
                    FAC7 = dtPF.Rows[0]["FAC7"].ToString();
                    //
                    SP1 = float.Parse(dtPF.Rows[0]["SP1"].ToString());
                    SP2 = float.Parse(dtPF.Rows[0]["SP2"].ToString());
                    SP3 = float.Parse(dtPF.Rows[0]["SP3"].ToString());
                    SP4 = float.Parse(dtPF.Rows[0]["SP4"].ToString());
                    SP5 = float.Parse(dtPF.Rows[0]["SP5"].ToString());
                    SP6 = float.Parse(dtPF.Rows[0]["SP6"].ToString());
                    SP7 = float.Parse(dtPF.Rows[0]["SP7"].ToString());
                }
            }
            dtPF.Dispose();
            dtPF = null;
            //
            // Compute tool parameters
            this.ToolSize = new SizeF(this.ToolWidth, this.ToolLength);
            if (this.ToolSize.Width <= 0)
            {
                this.ToolSize.Width = 1;
            }
            if (this.ToolSize.Height <= 0)
            {
                this.ToolSize.Height = 1;
            }
            //
            //

            /* -----------------------------------------------------------------------------------------
            * ชุดคำสั่ง ต่อไปนี้ ถูกออกแบบตามความต้องการ เข้าถึงข้อมูลจากฐานข้อมูล
            * เช่น ระยะสั่งให้เลื่อนแท่นกด เป็นต้น
            * ----------------------------------------------------------------------------------------*/
            /* ----------------------------------------------
             * Graph scaling
             * ----------------------------------------------*/
            GraphHorizontalFrom = CONUnseatedTop - CONHeight;
            GraphHorizontalTo   = GraphHorizontalFrom - GraphDistance;
            //
            GraphVerticalFrom = 0;
            GraphVerticalTo   = GraphFPerPin;
            //
            GraphForceLimit  = MaxFPerPin / 2 + MinFPerPin / 2;
            GraphHeightLimit = 0;
            //

            /* ----------------------------------------------
             * Height parameters
             * ----------------------------------------------*/
            GotoZeroSpeed = Properties.Settings.Default.GotoZeroSpeed; // mm per sec
            ZeroClearance = Properties.Settings.Default.ZeroClearance; //mm
            ZeroHeight    = Properties.Settings.Default.ZeroHeight;    // mm
            //

            /* ----------------------------------------------
             * Distance parameters
             * ----------------------------------------------*/
            UnseatedToolTop          = FixtureThickness + BoardThickness + CONUnseatedTop - CONHeight + CONBaseThickness + ToolHeight;
            Distance_UnseatedToolTop = ZeroHeight - UnseatedToolTop;
            AboveBoardBaseHeight     = CONUnseatedTop - CONHeight;
            Distance_Seated          = AboveBoardBaseHeight - CONSeatedHeight;
            //

            /* ----------------------------------------------
             * Profiled distance parameters
             * เครื่องหมาย (-) ให้กำหนดระยะ Jog แบบทิศขึ้นเป็น (-)
             * ----------------------------------------------*/
            PF_Row0_Distance = Distance_UnseatedToolTop - Properties.Settings.Default.OffsetTopDistance;
            PF_Row1_Distance = Properties.Settings.Default.OffsetTopDistance - H1Par;
            PF_Row2_Distance = Distance_Seated - H2Par + H1Par;
            PF_Row3_Distance = Distance_Seated - H3Par + H1Par;
            PF_Row4_Distance = Distance_Seated - H4Par + H1Par;
            PF_Row5_Distance = Distance_Seated - H5Par + H1Par;
            PF_Row6_Distance = Distance_Seated - H6Par + H1Par;
            PF_Row7_Distance = Distance_Seated - H7Par + H1Par;
            //

            /* ----------------------------------------------
             * Profiled distance parameters
             * ----------------------------------------------*/
            PF_Row1_Force = F1Par;
            PF_Row2_Force = MinFPerPin * NumberOfPins + F2Par;
            PF_Row3_Force = MaxFPerPin * NumberOfPins + F3Par;
            PF_Row4_PARS  = F4Par;
            PF_Row5_Force = F5Par;
            PF_Row6_Force = MaxFPerPin * NumberOfPins + F6Par;
            PF_Row7_Grad  = F7Par;
            //
        }
コード例 #3
0
        public void LoadProfileData(string profileName, ref TextBox _Start, ref TextBox _Distance, ref TextBox _E1, ref TextBox _E2, ref TextBox _E3, ref TextBox _E4, ref TextBox _E5, ref ListView lv)
        {
            try
            {
                Log.AppendText("กำลังเรียกข้อมูล Profile data {" + profileName + "}");

                _Start.Text    = "";
                _Distance.Text = "";
                _E1.Text       = "";
                _E2.Text       = "";
                _E3.Text       = "";
                _E4.Text       = "";
                _E5.Text       = "";

                ManageBiz ms = new ManageBiz();
                DataTable dtUser;
                dtUser = ms.GetProfileBy(profileName);
                if (dtUser.Rows.Count > 0)
                {
                    _Start.Text    = dtUser.Rows[0]["StartHeight"].ToString();
                    _Distance.Text = dtUser.Rows[0]["Distance"].ToString();

                    _E1.Text = dtUser.Rows[0]["Error1"].ToString();
                    _E2.Text = dtUser.Rows[0]["Error2"].ToString();
                    _E3.Text = dtUser.Rows[0]["Error3"].ToString();
                    _E4.Text = dtUser.Rows[0]["Error4"].ToString();
                    _E5.Text = dtUser.Rows[0]["Error5"].ToString();

                    lv.Items[0].SubItems[2].Text = dtUser.Rows[0]["H1Par"].ToString();
                    lv.Items[0].SubItems[3].Text = dtUser.Rows[0]["HAC1"].ToString();
                    lv.Items[0].SubItems[5].Text = dtUser.Rows[0]["F1Par"].ToString();
                    lv.Items[0].SubItems[6].Text = dtUser.Rows[0]["FAC1"].ToString();
                    lv.Items[0].SubItems[7].Text = dtUser.Rows[0]["SP1"].ToString();

                    lv.Items[1].SubItems[2].Text = dtUser.Rows[0]["H2Par"].ToString();
                    lv.Items[1].SubItems[3].Text = dtUser.Rows[0]["HAC2"].ToString();
                    lv.Items[1].SubItems[5].Text = dtUser.Rows[0]["F2Par"].ToString();
                    lv.Items[1].SubItems[6].Text = dtUser.Rows[0]["FAC2"].ToString();
                    lv.Items[1].SubItems[7].Text = dtUser.Rows[0]["SP2"].ToString();

                    lv.Items[2].SubItems[2].Text = dtUser.Rows[0]["H3Par"].ToString();
                    lv.Items[2].SubItems[3].Text = dtUser.Rows[0]["HAC3"].ToString();
                    lv.Items[2].SubItems[5].Text = dtUser.Rows[0]["F3Par"].ToString();
                    lv.Items[2].SubItems[6].Text = dtUser.Rows[0]["FAC3"].ToString();
                    lv.Items[2].SubItems[7].Text = dtUser.Rows[0]["SP3"].ToString();

                    lv.Items[3].SubItems[2].Text = dtUser.Rows[0]["H4Par"].ToString();
                    lv.Items[3].SubItems[3].Text = dtUser.Rows[0]["HAC4"].ToString();
                    lv.Items[3].SubItems[5].Text = dtUser.Rows[0]["F4Par"].ToString();
                    lv.Items[3].SubItems[6].Text = dtUser.Rows[0]["FAC4"].ToString();
                    lv.Items[3].SubItems[7].Text = dtUser.Rows[0]["SP4"].ToString();

                    lv.Items[4].SubItems[2].Text = dtUser.Rows[0]["H5Par"].ToString();
                    lv.Items[4].SubItems[3].Text = dtUser.Rows[0]["HAC5"].ToString();
                    lv.Items[4].SubItems[5].Text = dtUser.Rows[0]["F5Par"].ToString();
                    lv.Items[4].SubItems[6].Text = dtUser.Rows[0]["FAC5"].ToString();
                    lv.Items[4].SubItems[7].Text = dtUser.Rows[0]["SP5"].ToString();

                    lv.Items[5].SubItems[2].Text = dtUser.Rows[0]["H6Par"].ToString();
                    lv.Items[5].SubItems[3].Text = dtUser.Rows[0]["HAC6"].ToString();
                    lv.Items[5].SubItems[5].Text = dtUser.Rows[0]["F6Par"].ToString();
                    lv.Items[5].SubItems[6].Text = dtUser.Rows[0]["FAC6"].ToString();
                    lv.Items[5].SubItems[7].Text = dtUser.Rows[0]["SP6"].ToString();

                    lv.Items[6].SubItems[2].Text = dtUser.Rows[0]["H7Par"].ToString();
                    lv.Items[6].SubItems[3].Text = dtUser.Rows[0]["HAC7"].ToString();
                    lv.Items[6].SubItems[5].Text = dtUser.Rows[0]["F7Par"].ToString();
                    lv.Items[6].SubItems[6].Text = dtUser.Rows[0]["FAC7"].ToString();
                    lv.Items[6].SubItems[7].Text = dtUser.Rows[0]["SP7"].ToString();

                    Log.AppendText("เรียกข้อมูล Profile เรียบร้อย");
                }
                else
                {
                    Log.AppendText("ไม่พบข้อมูล Profile");
                }
            }
            catch (Exception ex)
            {
                Log.AppendText(ex.Message);
                MessageBox.Show(ex.Message);
            }
        }