yangle
2024-08-15 0f0d1ce8057cf705bac051b7cc7108b4075659d0
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCoordinateExcelFrom.cs
@@ -30,8 +30,7 @@
            //路径只读
            this.txtLj.ReadOnly = true;
            this.txtPcm.ReadOnly = true;
            SelectHProList();
        }
        private void btnLj_Click(object sender, EventArgs e)
@@ -431,6 +430,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7505";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -440,7 +440,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,7 +490,8 @@
                        ",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,'1',0,'"+ HLastResult + "'" +
                        ") ");
                    }
                    //主表
@@ -500,13 +501,14 @@
                        ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                        ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" +
                        ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID" +
                        ") " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                        "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                        "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults +
                        "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" +
                        ") ");
                        "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ") ");
                    oCN.Commit();
@@ -517,6 +519,8 @@
            catch (Exception e)
            {
                oCN.RollBack();
                //保存按钮灰掉
                this.btnSave.Enabled = true;
                MessageBox.Show("保存失败!" + e.Message);
            }
        }
@@ -526,6 +530,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7520";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -535,7 +540,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)
                {
@@ -595,13 +600,13 @@
                        ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                        ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                        ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment" +
                        ") " +
                        ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID) " +
                        " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                        "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
                        "," + HSourceID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPlanQty + "," + HProcExchInterID + "," + HProcExchEntryID +
                        ",'" + HProcExchBillNo + "'," + HQty + "," + HMaterID + ",'', " + HLastResults +
                        "," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + ",0,''" +
                        ") ");
                        "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "',"+ HProcID + ") ");
                    oCN.Commit();
@@ -620,6 +625,7 @@
        {
            try
            {
                string HProcID = this.cmbPro.SelectedValue.ToString();
                string sExeReturnInfo = "";
                string BillType = "7507";
                long HInterID = oCN.CreateBillID_Prod(BillType, ref sExeReturnInfo);
@@ -629,7 +635,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 +652,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;
@@ -695,7 +701,9 @@
                    ",HBarCode,HLBatchNo,HCusID,HSortBillNo,HContrctBatchNo" +
                    ",HProdAreaID,HProdTypeID,HProdStoveNo,HRecipeID,HDiameter1" +
                    ",HDiameter2,HRoutingInterID,HDrawingDireID,HPackTypeID" +
",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty,HProcExchQty,HShiftsID,HErrTreatment" +
                    ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HICMOQty" +
                    ",HProcExchQty,HShiftsID,HErrTreatment" +
                    ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo" +
                    ") " +
                    " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "',1,getdate(),'',getdate()" +
                    "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",''" +
@@ -703,7 +711,7 @@
                    "," + HMaterID + "," + HProcID + "," + HSourceID + ",0,0,0,0,0,0,'" + HLastResults + "'" +
                    ",'','',0,'',''" +
                    ",0,0,'',0,0,0,0,'',0," + HProcExchInterID + "," + HProcExchEntryID + ",'" + HProcExchBillNo + "',''," + HICMOEntryID + "," + HQCSchemeID + "," + HPlanQty + "," + HQty + ",0,''" +
                    ") ");
                    "," + this.HTakeSampleCheckBillID.Text + ",'" + this.HTakeSampleCheckBillNo.Text + "') ");
                    oCN.Commit();
@@ -732,15 +740,31 @@
        {
            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_Sc_ProcessExchangeBillQuerySub where 单据号='" + HBillNo + "' and  HProcID='"+ cmbPro + "'", "h_v_Sc_ProcessExchangeBillQuerySub");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("查无数据!");
                    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("当前工序对应的单据,查无数据!");
                    }
                    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;
                    }
                }
                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;
                }
            }
@@ -750,6 +774,31 @@
            }
        }
        //查询工序
        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)
            {
                MessageBox.Show(this, e.Message, "提示");
            }
        }
        private void ReadCoordinateExcelFrom_Activated(object sender, EventArgs e)
        { 
            //光标选中流转卡