using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using WorkM; namespace MES { public partial class FrmShow : Form { public FrmShow() { InitializeComponent(); } private void pictureBox5_Click(object sender, EventArgs e) { } private void pictureBox1_Click(object sender, EventArgs e) { } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { DAL.ClsSc_ProcessExchangeBill oPeb = new DAL.ClsSc_ProcessExchangeBill(); if (oPeb.GetIDByNo(DBUtility.ClsPub.isStrNull(txtHProcExchBillNo.Text), ref DBUtility.ClsPub.sExeReturnInfo) == false) { MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } long lngBillKey = oPeb.omodel.HInterID; if (checkBox1.Checked == true) { GetLastOut(lngBillKey); } else { GetLotProc(lngBillKey); } } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { txtHProcExchBillNo.Text = ""; txtHProcExchBillNo.Select(); } private void GetLotProc(long lngBillKey) { DataSet DsCheck; DataSet DsCheckIPQC; DataSet DsCheck2; DataSet Ds; DataSet DsFIFO; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //ÅжÏÉϵÀ³öÕ¾ÊÇ·ñÆ·ÖÊÈ·ÈÏ DsCheckIPQC = oCn.RunProcReturn("exec h_p_MES_CheckIPQCCheckByLot " + lngBillKey, "h_p_MES_CheckIPQCCheckByLot"); if (DsCheckIPQC.Tables[0].Rows.Count > 0) { if (DsCheckIPQC.Tables[0].Rows[0]["HBillType"].ToString() == "3791") { MessageBox.Show("³öÕ¾µ¥£º" + DsCheckIPQC.Tables[0].Rows[0]["HBillNo"].ToString() + ",δÌá½»IPQCÆ·ÖÊÈ·ÈÏ£¬²»ÔÊÐí¼ÌÐøÉ¨Ã裡", "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } else { MessageBox.Show("ίÍâ½ÓÊÕµ¥£º" + DsCheckIPQC.Tables[0].Rows[0]["HBillNo"].ToString() + ",δÌá½»IPQCÆ·ÖÊÈ·ÈÏ£¬²»ÔÊÐí¼ÌÐøÉ¨Ã裡", "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } } //ÅжÏÊÇ·ñ´æÔÚ½ÓÊÕÊýÁ¿²»µÈÓÚ·¢³öÊýÁ¿²¢ÇÒûÓÐÌá½»MRBÆÀÉ󵥵ijöÕ¾µ¥ DsCheck2 = oCn.RunProcReturn("exec h_p_MES_CheckHaveNoPassByLot " + lngBillKey, "h_p_MES_CheckHaveNoPassByLot"); if (DsCheck2.Tables[0].Rows.Count > 0) { if (DsCheck2.Tables[0].Rows[0]["HBillType"].ToString() == "3791") { MessageBox.Show("³öÕ¾µ¥£º" + DsCheck2.Tables[0].Rows[0]["HBillNo"].ToString() + ",δÌá½»MRBÆÀÉóµ¥£¬²»ÔÊÐí¼ÌÐøÉ¨Ã裡", "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } else { MessageBox.Show("ίÍâ½ÓÊÕµ¥£º" + DsCheck2.Tables[0].Rows[0]["HBillNo"].ToString() + ",δÌá½»MRBÆÀÉóµ¥£¬²»ÔÊÐí¼ÌÐøÉ¨Ã裡", "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } } //ÅжÏÊÇ·ñ´æÔÚδÉóºËMRBÆÀÉóµ¥ DsCheck = oCn.RunProcReturn("select * from QC_NoPassProdCheckBillMain where HProcExchInterID = " + lngBillKey + " and HChecker='' ", "QC_NoPassProdCheckBillMain"); if (DsCheck.Tables[0].Rows.Count > 0) { MessageBox.Show("ÉϵÀ¹¤ÐòMRBÆÀÉóµ¥Î´ÉóºË£¬²»ÔÊÐí¼ÌÐøÉ¨Ã裡", "Ìáʾ"); txtHProcExchBillNo.Text = ""; return; } //µÃµ½LOT¿¨ÐÅÏ¢ Ds = oCn.RunProcReturn("exec h_p_Sc_GetProcByLotNo " + lngBillKey, "h_p_Sc_GetProcByLotNo"); if (Ds == null) { MessageBox.Show("´íÎóÔ­Òò£º" + DBUtility.ClsPub.sErrInfo); txtHProcExchBillNo.Text = ""; return; } if (Ds.Tables[0].Rows.Count == 0) { MessageBox.Show("LOTÎÞЧ!"); txtHProcExchBillNo.Text = ""; return; } //³öÕ¾µ¥ if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInorOut"]) == "out" && DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcType"]) == "×ÔÖÆ") { DsFIFO = oCn.RunProcReturn("exec h_p_MES_LotFIFO '" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"]) + "'," + DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSubID"]) + ",'out'", "h_p_MES_LotFIFO"); if (DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) != "OK") { if (MessageBox.Show(DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) + ",ÊÇ·ñ¼ÌÐø£¿", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.OK) { } else { txtHProcExchBillNo.Text = ""; return; } } MES_StationOutBill oMES_StationOutBill = new MES_StationOutBill(); oMES_StationOutBill.lngBillKey = lngBillKey; oMES_StationOutBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationOutBill.ShowDialog(); } //ίÍâ½ÓÊÕ else if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInorOut"]) == "out" && DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcType"]) == "ίÍâ") { //if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]) == "") //{ // MessageBox.Show("ίÍâ·¢³öµ¥:" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HJZBillNo"]) + "δÉóºË£¬²»ÔÊÐí½ÓÊÕ!"); // txtHProcExchBillNo.Text = ""; // return; //} if (DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HCloseType"]) != 0) { MessageBox.Show("ίÍâ·¢³öµ¥:" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HJZBillNo"]) + "Òѹرգ¬²»ÔÊÐí½ÓÊÕ!"); txtHProcExchBillNo.Text = ""; return; } DsFIFO = oCn.RunProcReturn("exec h_p_MES_LotFIFO '" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"]) + "'," + DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSubID"]) + ",'out'", "h_p_MES_LotFIFO"); if (DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) != "OK") { if (MessageBox.Show(DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) + ",ÊÇ·ñ¼ÌÐø£¿", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.OK) { } else { txtHProcExchBillNo.Text = ""; return; } } MES_StationEntrustOutBill oMES_StationEntrustOutBill = new MES_StationEntrustOutBill(); oMES_StationEntrustOutBill.lngBillKey = lngBillKey; oMES_StationEntrustOutBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationEntrustOutBill.ShowDialog(); } //ίÍâ·¢³ö else if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInorOut"]) == "in" && DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcType"]) == "ίÍâ") { //ÏȽøÏȳö DsFIFO = oCn.RunProcReturn("exec h_p_MES_LotFIFO '" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"]) + "'," + DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSubID"]) + ",'in'", "h_p_MES_LotFIFO"); if (DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) != "OK") { if (MessageBox.Show(DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) + ",ÊÇ·ñ¼ÌÐø£¿", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.OK) { } else { txtHProcExchBillNo.Text = ""; return; } } MES_StationEntrustInBill oMES_StationEntrustInBill = new MES_StationEntrustInBill(); oMES_StationEntrustInBill.lngBillKey = lngBillKey; oMES_StationEntrustInBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationEntrustInBill.ShowDialog(); } //½øÕ¾µ¥ else { DsFIFO = oCn.RunProcReturn("exec h_p_MES_LotFIFO '" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"]) + "'," + DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSubID"]) + ",'in'", "h_p_MES_LotFIFO"); if (DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) != "OK") { if (MessageBox.Show(DBUtility.ClsPub.isStrNull(DsFIFO.Tables[0].Rows[0][0]) + ",ÊÇ·ñ¼ÌÐø£¿", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.OK) { } else { txtHProcExchBillNo.Text = ""; return; } } MES_StationInBill oMES_StationInBill = new MES_StationInBill(); oMES_StationInBill.lngBillKey = lngBillKey; oMES_StationInBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationInBill.ShowDialog(); } txtHProcExchBillNo.Text = ""; } public MES_StationOutBill oFrm; public MES_StationEntrustOutBill oFrm2; private void GetLastOut(long HLotInterID) { DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); Ds = oCn.RunProcReturn("exec h_p_Sc_GetLastOutByLotNo " + HLotInterID, "h_p_Sc_GetLastOutByLotNo"); if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 0) { MessageBox.Show("²»´æÔÚ³öÕ¾µ¥£¡"); txtHProcExchBillNo.Text = ""; return; } if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) == "×ÔÖÆ") { DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); if (oBill.ShowBill(DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]), ref DBUtility.ClsPub.sExeReturnInfo)) { oFrm = new MES_StationOutBill(); oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View; oFrm.BillOld = oBill; oFrm.ShowDialog(); } else { MessageBox.Show("µ¥¾ÝδÕÒµ½", "Ìáʾ"); } oBill = null; } else { DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); if (oBill.ShowBill(DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]), ref DBUtility.ClsPub.sExeReturnInfo)) { oFrm2 = new MES_StationEntrustOutBill(); oFrm2.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View; oFrm2.BillOld = oBill; oFrm2.ShowDialog(); } else { MessageBox.Show("µ¥¾ÝδÕÒµ½", "Ìáʾ"); } oBill = null; } txtHProcExchBillNo.Text = ""; } private void pictureBox6_Click(object sender, EventArgs e) { } private void pictureBox2_Click(object sender, EventArgs e) { MES_StationOutBill oMES_StationOutBill = new MES_StationOutBill(); oMES_StationOutBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationOutBill.ModCaption = "Éú²úÍ깤»ã±¨µ¥"; oMES_StationOutBill.ShowDialog(); } private void pictureBox3_Click(object sender, EventArgs e) { MES_StationInBill oMES_StationInBill = new MES_StationInBill(); oMES_StationInBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; oMES_StationInBill.ModCaption = "Éú²ú½øÕ¾È·Èϵ¥"; oMES_StationInBill.ShowDialog(); } private void pictureBox4_Click(object sender, EventArgs e) { } private void pictureBox7_Click(object sender, EventArgs e) { Application.Exit(); } } }