yangle
2024-11-29 1d9f82659dbfdfd6ac0ddbb33f1fd5af1164d939
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs
@@ -6,6 +6,8 @@
using NPOI.XSSF.UserModel; // 对于.xlsx文件  
using NPOI.HSSF.UserModel; // 对于.xls文件  
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Drawing;
namespace WFormReadData_SMR
{
@@ -30,8 +32,12 @@
            //路径只读
            this.txtLj.ReadOnly = true;
            this.txtPcm.ReadOnly = true;
            //制单编码只读
            this.txtHMakerNumber.ReadOnly = true;
            //制单人提示
            this.txtHMaker.ForeColor = Color.LightGray;
            this.txtHMaker.Text = "请输入用户编码!";
            SelectHProList();
        }
        private void btnLj_Click(object sender, EventArgs e)
@@ -43,7 +49,6 @@
                MessageBox.Show("流转卡没有扫描!");
            }
            else {
                //路径赋值给文本
                using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
                {
@@ -115,8 +120,8 @@
                }
            }
            //显示数据
            ShowData(ds);
            //显示数据  CMR-L-066 轮廓仪
            ShowData(ds, "CMR-L-066");
        }
        //根据文件路径找到对应文件 并获取对应的数据
@@ -254,8 +259,8 @@
                    }
                }
            }
            //显示数据
            ShowData(ds);
            //显示数据 CMR-L-067 三坐标
            ShowData(ds, "CMR-L-067");
        }
        //根据文件路径找到对应文件 并获取对应的数据
@@ -322,7 +327,7 @@
        }
        //把数据显示在页面上
        public void ShowData(DataSet ds) {
        public void ShowData(DataSet ds,string HNumber) {
            //清空网格内容
            ListData.Items.Clear();
            //清空表格内容
@@ -336,14 +341,16 @@
            dataTable.Columns.Add("Actual");
            dataTable.Columns.Add("HUpLimit");
            dataTable.Columns.Add("HDownLimit");
            dataTable.Columns.Add("HInspectInstruMentID");
            for (int i = 0; i < ds.Tables.Count; i++)
            {
                //修改是在哪个设备上进行的数据采集 b.HInspectInstruMentID=1  三坐标1    轮廓仪2
                DataSet dataSet = oCN.RunProcReturn(@"select a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal
                DataSet dataSet = oCN.RunProcReturn(@"select b.HInspectInstruMentID,a.HInterID HQCSchemeID,b.HQCCheckItemID, ch.HNumber HQCCheckItemNumber,m.HNumber,HUpLimit,HDownLimit,HTargetVal
from Sc_ProcessExchangeBillMain pr with(nolock)
inner join Gy_QCCheckProjectMain a with(nolock) on pr.HMaterID=a.HMaterID
inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID and  b.HInspectInstruMentID=2
inner join Gy_QCCheckProjectSub b with(nolock) on a.HInterID=b.HInterID
inner join Gy_InspectInstruMent men  with(nolock) on b.HInspectInstruMentID=men.HItemID   and men.HNumber='"+ HNumber + @"'
left join Gy_Material m with(nolock) on a.HMaterID=m.HItemID
left join Gy_QCCheckItem ch with(nolock) on b.HQCCheckItemID=ch.HItemID  
where pr.HBillNo='" + this.txtLzk.Text + "'", "Gy_QCCheckProjectMain");
@@ -368,6 +375,7 @@
                                dr["Actual"] = ds.Tables[i].Rows[k]["Actual"].ToString();
                                dr["HUpLimit"] = dataSet.Tables[0].Rows[j]["HUpLimit"].ToString();
                                dr["HDownLimit"] = dataSet.Tables[0].Rows[j]["HDownLimit"].ToString();
                                dr["HInspectInstruMentID"] = dataSet.Tables[0].Rows[j]["HInspectInstruMentID"].ToString();
                                ListData.Items.Add("检验项目:" + ds.Tables[i].Rows[k]["Characteristic"].ToString() + ",实测值:" + ds.Tables[i].Rows[k]["Actual"].ToString() + ",上公差:" + dataSet.Tables[0].Rows[j]["HUpLimit"].ToString() + ",下公差:" + dataSet.Tables[0].Rows[j]["HDownLimit"].ToString());
                                break;
                            }
@@ -431,6 +439,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7505";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -440,7 +449,7 @@
staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID
from Sc_ProcessExchangeBillMain a with(nolock)
inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID  
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain");
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID="+ HProcID, "Sc_ProcessExchangeBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
@@ -490,9 +499,17 @@
                        ",getdate(),0,''," + HProcExchInterID +
                        "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0" +
                        "," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','"+ dataTable.Rows[i]["HQCStd"].ToString() + "','" + HLastResult + "'" +
                        ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'1',0,'"+ HLastResult + "'" + ") ");
                        ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" +
                        ") ");
                    }
                    DataSet SetData = oCN.RunProcReturn("select  HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain");
                    string HMakeDate = "";
                    if (SetData.Tables[0].Rows.Count > 0)
                    {
                        HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString();
                    }
                    //主表
                    oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " +
                        "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
@@ -500,13 +517,15 @@
                        ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                        ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" +
                        ") " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                        ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID" +
                        ",HBatchNo) " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'"+ HMakeDate + "','" + this.txtHMaker.Text + "',getdate()" +
                        "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                        "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'"+this.labHMakerID.Text + "', " + HLastResults +
                        "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" +
                        ") ");
                        "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'," + HProcID + "" +
                        ",'" + this.txtPcm.Text + "') ");
                    oCN.Commit();
@@ -517,6 +536,8 @@
            catch (Exception e)
            {
                oCN.RollBack();
                //保存按钮灰掉
                this.btnSave.Enabled = true;
                MessageBox.Show("保存失败!" + e.Message);
            }
        }
@@ -526,6 +547,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7520";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -535,7 +557,7 @@
staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID
from Sc_ProcessExchangeBillMain a with(nolock)
inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID  
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain");
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=" + HProcID, "Sc_ProcessExchangeBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
@@ -585,7 +607,13 @@
                        + HInterID + ",'" + HBillNo + "'," + (i + 1) + ",''" +
                        ",getdate(),0,''," + HProcExchInterID +
                        "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','"+ dataTable.Rows[i]["HQCStd"].ToString() + "','" + HLastResult + "'" +
                        ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'1',0,'"+ HLastResult + "'" + ") ");
                        ",'" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "',''" + ",0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() + "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" + ") ");
                    }
                    DataSet SetData = oCN.RunProcReturn("select  HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain");
                    string HMakeDate = "";
                    if (SetData.Tables[0].Rows.Count > 0)
                    {
                        HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString();
                    }
                    //主表
@@ -595,13 +623,13 @@
                        ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                        ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" +
                        ") " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                        ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID,HBatchNo) " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'"+ HMakeDate + "','"+this.txtHMaker.Text + "',getdate()" +
                        "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                        "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'" + this.labHMakerID.Text + "', " + HLastResults +
                        "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" +
                        ") ");
                        "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ",'" + this.txtPcm.Text + "') ");
                    oCN.Commit();
@@ -620,6 +648,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7507";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -629,7 +658,7 @@
staus.HSourceEntryID HProcExchEntryID,a.HBillNo HProcExchBillNo,a.HQty,a.HMaterID,staus.HProcID
from Sc_ProcessExchangeBillMain a with(nolock)
inner join Sc_ICMOBillStatus_Tmp staus with(nolock) on a.HInterID=staus.HSourceInterID   
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=186 ", "Sc_ProcessExchangeBillMain");
where a.HBillNo='" + this.txtLzk.Text + "' and staus.HProcID=" + HProcID, "Sc_ProcessExchangeBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
@@ -646,7 +675,7 @@
                    string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
                    string HQty = ds.Tables[0].Rows[0]["HQty"].ToString();
                    string HMaterID = ds.Tables[0].Rows[0]["HMaterID"].ToString();
                    string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
                    HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString();
                    string HQCSchemeID = dataTable.Rows[0]["HQCSchemeID"].ToString();
                    int HLastResults = 1;
@@ -681,8 +710,15 @@
                        ",getdate(),0,''," + HProcExchInterID +
                        "," + HProcExchEntryID + ",'" + HProcExchBillNo + "','',0,0,0," + dataTable.Rows[i]["CharacteristicID"].ToString() + ",'" + dataTable.Rows[i]["HQCStd"].ToString() + "','','" + HLastResult + "'" +
                        ",0,'',0,0,0,0,0,0,'',0,'" + dataTable.Rows[i]["Actual"].ToString() + "','" + dataTable.Rows[i]["HQCStd"].ToString() + "','" + dataTable.Rows[i]["HUpLimit"].ToString() + "','" + dataTable.Rows[i]["HDownLimit"].ToString() +
                                "','','',0,'',0,'"+ HLastResult + "'" +
                                "','','',0,'2'," + dataTable.Rows[i]["HInspectInstruMentID"].ToString() + ",'" + HLastResult + "'" +
                                ",'"+ dataTable.Rows[i]["HQCStd"].ToString() + "') ");
                    }
                    DataSet SetData = oCN.RunProcReturn("select  HMakeDate from QC_TakeSampleCheckBillMain where HInterID =" + this.HTakeSampleCheckBillID.Text, "QC_TakeSampleCheckBillMain");
                    string HMakeDate = "";
                    if (SetData.Tables[0].Rows.Count > 0)
                    {
                        HMakeDate = SetData.Tables[0].Rows[0]["HMakeDate"].ToString();
                    }
                    //主表
@@ -695,15 +731,18 @@
                    ",HBarCode,HLBatchNo,HCusID,HSortBillNo,HContrctBatchNo" +
                    ",HProdAreaID,HProdTypeID,HProdStoveNo,HRecipeID,HDiameter1" +
                    ",HDiameter2,HRoutingInterID,HDrawingDireID,HPackTypeID" +
",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty,HProcExchQty,HShiftsID,HErrTreatment" +
                    ") " +
                    " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                    ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty" +
                    ",HProcExchQty,HShiftsID,HErrTreatment" +
                    ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo" +
                    ",HBatchNo,HCheckerResult) " +
                    " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,'"+ HMakeDate + "','" + this.txtHMaker.Text + "',getdate()" +
                    "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                    "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "'" +
                    "," + HMaterID + "," + HProcID + "," + HSourceID + ",0,0,0,0,0,0,'" + HLastResults + "'" +
                    "," + HMaterID + "," + HProcID + "," + HSourceID + ",0,0,0,0,0," + this.labHMakerID.Text + ",'" + HLastResults + "'" +
                    ",'','',0,'',''" +
                    ",0,0,'',0,0,0,0,'',0," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + HPlanQty + "," + HQty + ",0,''" +
                    ") ");
                    "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "'" +
                    ",'" + this.txtPcm.Text + "','"+ HLastResults + "') ");
                    oCN.Commit();
@@ -723,7 +762,14 @@
        {
            if (e.KeyCode == Keys.Enter)
            {
                SelectHBardCode(this.txtLzk.Text);
                if (this.txtHMakerNumber.Text == "")
                {
                    MessageBox.Show("请输入制单人信息!");
                }
                else {
                    SelectHBardCode(this.txtLzk.Text);
                }
            }
        }
@@ -732,16 +778,61 @@
        {
            try
            {
                DataSet ds = oCN.RunProcReturn("select  * from Sc_ProcessExchangeBillMain where HBillNo='" + HBillNo + "' ", "Sc_ProcessExchangeBillMain");
                string cmbPro = this.cmbPro.SelectedValue.ToString();
               DataSet ds = oCN.RunProcReturn("select  * from h_v_QC_TakeSampleCheckBillList where 单据号='" + HBillNo + "' and  HProcID='" + cmbPro + "'", "h_v_QC_TakeSampleCheckBillList");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("查无数据!");
                    MessageBox.Show("当前工序对应的取样单据,查无数据!");
                }
                else
                {
                    string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString();
                    this.txtPcm.Text = HProjectNum.Split('-')[0];
                    this.txtLzk.Text = ds.Tables[0].Rows[0]["工序流转卡号"].ToString();
                    this.HTakeSampleCheckBillID.Text = ds.Tables[0].Rows[0]["hmainid"].ToString();
                    this.HTakeSampleCheckBillNo.Text = ds.Tables[0].Rows[0]["单据号"].ToString();
                    this.txtLzk.ReadOnly = true;
                    this.label2.Text = "流转卡:";
                }
                //DataSet ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillQuerySub where 单据号='" + HBillNo + "' and  HProcID='"+ cmbPro + "'", "h_v_Sc_ProcessExchangeBillQuerySub");
                //if (ds.Tables[0].Rows.Count == 0)
                //{
                //}
                //else
                //{
                //    string HProjectNum = ds.Tables[0].Rows[0]["HProjectNum"].ToString();
                //    this.txtPcm.Text = HProjectNum.Split('-')[0];
                //    this.HTakeSampleCheckBillID.Text = "0";
                //    this.HTakeSampleCheckBillNo.Text = "";
                //    this.txtLzk.ReadOnly = true;
                //}
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, "提示");
            }
        }
        //查询工序
        public void SelectHProList()
        {
            try
            {
                DataSet ds = oCN.RunProcReturn("select  * from Gy_Process ", "Sc_ProcessExchangeBillMain");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("工序查无数据!");
                }
                else
                {
                    this.cmbPro.DataSource = ds.Tables[0];
                    this.cmbPro.DisplayMember = "HName";
                    this.cmbPro.ValueMember = "HItemID";
                    this.cmbPro.SelectedIndex = 0;
                    this.cmbPro.DropDownStyle = ComboBoxStyle.DropDownList;
                }
            }
            catch (Exception e)
@@ -752,8 +843,8 @@
        private void ReadCoordinateExcelFrom_Activated(object sender, EventArgs e)
        { 
            //光标选中流转卡
            this.txtLzk.Focus();
            //光标选中制单人
            this.txtHMaker.Focus();
        }
        private void ReadCoordinateExcelFrom_FormClosing(object sender, FormClosingEventArgs e)
@@ -763,5 +854,58 @@
                e.Cancel = true;
            }
        }
        private void txtHMaker_Leave(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtHMaker.Text))
            {
                this.txtHMaker.ForeColor = Color.LightGray;
                txtHMaker.Text = "请输入用户编码!";
            }
        }
        private void txtHMaker_Enter(object sender, EventArgs e)
        {
            if (txtHMaker.Text.Trim() == "请输入用户编码!")
            {
                txtHMaker.Text = "";
                this.txtHMaker.ForeColor = Color.Black;
            }
        }
        private void txtHMaker_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SelectHMaker(this.txtHMaker.Text);
            }
        }
        //查询职员信息
        public void SelectHMaker(string txtHMaker) {
            try
            {
                DataSet ds = oCN.RunProcReturn("select  HItemID,HName,HNumber from Gy_Employee where HNumber='" + txtHMaker + "' or HName ='" + txtHMaker + "'", "Gy_Employee");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string HName = ds.Tables[0].Rows[0]["HName"].ToString();
                    string HMakerID = ds.Tables[0].Rows[0]["HItemID"].ToString();
                    string HNumber = ds.Tables[0].Rows[0]["HNumber"].ToString();
                    this.txtHMaker.Text = HName;
                    this.txtHMakerNumber.Text = HNumber;
                    this.labHMakerID.Text = HMakerID;
                    this.txtHMaker.ReadOnly = true;
                }
                else
                {
                    MessageBox.Show(this, txtHMaker + ",查无数据,可能是输入编码有误!", "提示");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, "提示");
            }
        }
    }
}