private void BtnSubmit_Click(object sender, EventArgs e)
 {
     //提交到线束库时,不同接口之间不能有相同的针脚
     if (this.radGridViewCable.Rows.Count < 1)
     {
         return;
     }
     foreach (var rowInfo in this.radGridViewCable.Rows)
     {
         var interNo = rowInfo.Cells[1].Value.ToString();
         InterfaceInfoLibrary plugLibraryDetail = new InterfaceInfoLibrary();
         if (!interLibraryDetailList.Contains(plugLibraryDetail))
         {
             plugLibraryDetail.InterfaceNo = interNo;
             InterfaceInfoLibraryManager libraryManager = new InterfaceInfoLibraryManager();
             var libraryData = libraryManager.GetDataSetByFieldsAndWhere("DISTINCT MeasureMethod", $"where InterfaceNo='{interNo}'").Tables[0];
             if (libraryData.Rows.Count > 0)
             {
                 plugLibraryDetail.MeasureMethod = libraryData.Rows[0][0].ToString();
                 interLibraryDetailList.Add(plugLibraryDetail);
             }
         }
     }
     if (IsExistStitchRepeat())
     {
         return;
     }
     this.Close();
     this.DialogResult = DialogResult.OK;
 }
        public static InterfaceInfoLibrary QueryInterfaceLibInfo(string priID)
        {
            InterfaceInfoLibrary        interfaceInfo      = new InterfaceInfoLibrary();
            InterfaceInfoLibraryManager infoLibraryManager = new InterfaceInfoLibraryManager();
            var data = infoLibraryManager.GetDataSetByWhere($"where ID='{priID}'").Tables[0];

            if (data.Rows.Count > 0)
            {
                interfaceInfo.ID                  = int.Parse(data.Rows[0]["ID"].ToString());
                interfaceInfo.InterfaceNo         = data.Rows[0]["InterfaceNo"].ToString();
                interfaceInfo.ContactPointName    = data.Rows[0]["ContactPointName"].ToString();
                interfaceInfo.SwitchStandStitchNo = data.Rows[0]["SwitchStandStitchNo"].ToString();
                interfaceInfo.ContactPoint        = data.Rows[0]["ContactPoint"].ToString();
                interfaceInfo.MeasureMethod       = data.Rows[0]["MeasureMethod"].ToString();
                interfaceInfo.ConnectorName       = data.Rows[0]["ConnectorName"].ToString();
                interfaceInfo.Operator            = data.Rows[0]["Operator"].ToString();
                interfaceInfo.Remark              = data.Rows[0]["Remark"].ToString();
                interfaceInfo.UpdateDate          = data.Rows[0]["UpdateDate"].ToString();
            }
            return(interfaceInfo);
        }
Пример #3
0
        private void RadGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {
            var cIndex = this.radGridView1.CurrentRow.Index;

            if (cIndex < 0)
            {
                return;
            }
            var interPointName    = this.radGridView1.CurrentRow.Cells[2].Value.ToString();
            var switchStandStitch = this.radGridView1.CurrentRow.Cells[4].Value.ToString();
            var interName         = this.radGridView1.CurrentRow.Cells[1].Value.ToString();
            var rmark             = this.radGridView1.CurrentRow.Cells[6].Value.ToString();
            var id     = this.radGridView1.CurrentRow.Cells[8].Value.ToString();
            var curObj = InterfaceBasicInfo.QueryInterfaceLibInfo(id);
            var obj1   = interfaceLibaryInfos.Find(obj => obj.ID == curObj.ID);

            if (obj1 == null)
            {
                this.infoLibrary = curObj;
                interfaceLibaryInfos.Add(this.infoLibrary);
            }
        }
Пример #4
0
        private int EditAddNewInterInfo()
        {
            if (this.dataSource.Rows.Count < 1)
            {
                return(0);
            }
            if (!CheckValid())
            {
                return(0);
            }
            //int beforeInsertCount = plugLibraryDetailManager.GetRowCount();
            //submit data
            int iRow = 1;
            int id   = 0;
            List <InterfaceInfoLibrary> libList = new List <InterfaceInfoLibrary>();

            foreach (DataRow rowInfo in this.dataSource.Rows)
            {
                var plugNo        = rowInfo[1].ToString();
                var pinName       = rowInfo[2].ToString();
                var testMethod    = rowInfo[3].ToString();
                var stitchNo      = rowInfo[4].ToString();
                var IsAddNewRow   = rowInfo[7].ToString();
                var remark        = "";
                var connectorName = "";
                remark        = rowInfo[6].ToString();
                connectorName = rowInfo[5].ToString();

                #region TPlugLibraryDetail
                InterfaceInfoLibrary plugLibraryDetail = new InterfaceInfoLibrary();
                plugLibraryDetail.ID               = CableTestManager.Common.TablePrimaryKey.InsertInterfaceLibPID() + id;
                plugLibraryDetail.InterfaceNo      = plugNo;
                plugLibraryDetail.ContactPointName = pinName;
                if (testMethod == TWO_WIRE_METHOD)
                {
                    plugLibraryDetail.MeasureMethod = "2";
                }
                else if (testMethod == FOUR_WIRE_METHOD)
                {
                    plugLibraryDetail.MeasureMethod = "4";
                }
                plugLibraryDetail.SwitchStandStitchNo = stitchNo;
                plugLibraryDetail.Remark        = remark;
                plugLibraryDetail.Operator      = LocalLogin.currentUserName;
                plugLibraryDetail.ConnectorName = connectorName;
                plugLibraryDetail.ContactPoint  = iRow.ToString();
                #endregion

                //新增数据
                if (IsAddNewRow != null)
                {
                    //if (IsCanInsertOrUpdate(false, -1, plugNo, pinName, stitchNo) == InterfaceExTipEnum.InterfacePoint_NotExistAndStitch_NoExist)
                    //{
                    //plugLibraryDetailManager.Insert(plugLibraryDetail);
                    libList.Add(plugLibraryDetail);
                    iRow++;
                    id++;
                    //}
                }
            }

            var resCount = plugLibraryDetailManager.Insert(libList);
            this.dataSource.Clear();
            //int afterInsertCount = plugLibraryDetailManager.GetRowCount();
            return(resCount);
        }
Пример #5
0
        private int AddNewInterInfo()
        {
            int resCount = 0;

            if (this.radGridView1.RowCount < 1)
            {
                MessageBox.Show("没有可以提交的数据!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }
            if (!CheckValid())
            {
                return(0);
            }
            int beforeInsertCount = plugLibraryDetailManager.GetRowCount();
            int excuteCount       = 0;
            //submit data
            int iRow = 1;
            int id   = 0;
            List <InterfaceInfoLibrary> libList = new List <InterfaceInfoLibrary>();

            foreach (var rowInfo in this.radGridView1.Rows)
            {
                var plugNo        = rowInfo.Cells[1].Value.ToString();
                var pinName       = rowInfo.Cells[2].Value.ToString();
                var testMethod    = rowInfo.Cells[3].Value.ToString();
                var stitchNo      = rowInfo.Cells[4].Value.ToString();
                var IsAddNewRow   = rowInfo.Cells[7].Value;
                var remark        = "";
                var connectorName = "";
                if (rowInfo.Cells[6].Value != null)
                {
                    remark = rowInfo.Cells[6].Value.ToString();
                }
                if (rowInfo.Cells[5].Value != null)
                {
                    connectorName = rowInfo.Cells[5].Value.ToString();
                }

                #region TPlugLibraryDetail
                InterfaceInfoLibrary plugLibraryDetail = new InterfaceInfoLibrary();
                plugLibraryDetail.ID               = CableTestManager.Common.TablePrimaryKey.InsertInterfaceLibPID() + id;
                plugLibraryDetail.InterfaceNo      = plugNo;
                plugLibraryDetail.ContactPointName = pinName;
                if (testMethod == TWO_WIRE_METHOD)
                {
                    plugLibraryDetail.MeasureMethod = "2";
                }
                else if (testMethod == FOUR_WIRE_METHOD)
                {
                    plugLibraryDetail.MeasureMethod = "4";
                }
                plugLibraryDetail.SwitchStandStitchNo = stitchNo;
                plugLibraryDetail.Remark        = remark;
                plugLibraryDetail.Operator      = LocalLogin.currentUserName;
                plugLibraryDetail.ConnectorName = connectorName;
                plugLibraryDetail.ContactPoint  = iRow.ToString();
                #endregion

                //新增数据
                if (IsAddNewRow != null)
                {
                    //if (IsCanInsertOrUpdate(false, -1, plugNo, pinName, stitchNo) == InterfaceExTipEnum.InterfacePoint_NotExistAndStitch_NoExist)
                    //{
                    //plugLibraryDetailManager.Insert(plugLibraryDetail);
                    libList.Add(plugLibraryDetail);
                    iRow++;
                    id++;
                    //}
                }
            }

            resCount = plugLibraryDetailManager.Insert(libList);
            return(resCount);
        }