using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using BaseSet; using System.Threading; using Pub_Class; namespace APSM { public partial class Sc_ProcAutoSortBill : Form { public Sc_ProcAutoSortBill() { InitializeComponent(); } //¶¨ÒåÁÐ public const Int16 FixCols = 18; //grdSource public const Int16 HHangUpCol = 1; public const Int16 HICMOBillNoCol = 2; public const Int16 HMaterIDCol = 3; public const Int16 HMaterNumberCol = 4; public const Int16 HMaterNameCol = 5; public const Int16 HMaterModelCol = 6; public const Int16 HUnitIDCol = 7; public const Int16 HUnitNumberCol = 8; public const Int16 HUnitNameCol = 9; public const Int16 HPlanQtyCol = 10; public const Int16 HRelationQtyCol = 11; public const Int16 HWorkQtyCol = 12; //²úÄÜ public const Int16 HProdTimesCol = 13; //Éú²úÖÜÆÚ=¼Æ»®Êý/²úÄÜ £¨Ð¡Ê±£© public const Int16 HWorkTimesCol = 14; public const Int16 HYXCol = 15; public const Int16 HOrderLevCol = 16; public const Int16 HKTQCol =17; public const Int16 HReadyQtyCol = 18; //×¼±¸ÊýÁ¿ public const Int16 HBeginDayQtyCol = 19; //¿ª¹¤ÓàÁ¿£¨ÊýÁ¿£© public const Int16 HBeginFixQtyCol = 20; //¿ª¹¤ÓàÁ¿£¨ÌìÊý£© public const Int16 HPlanBeginDateCol = 21; //¼Æ»®¿ª¹¤ public const Int16 HPlanEndDateCol = 22; //¼Æ»®Í깤 public const Int16 HLastBeginDateCol = 23; //×î³Ù¿ª¹¤=×î³ÙÍ깤-Éú²úÖÜÆÚ£¨×î¶ÌÖÜÆÚ£© public const Int16 HLastEndDateCol = 24; //×î³ÙÍ깤=¶©µ¥½»»õÆÚ-ÌáǰÆÚ public const Int16 HOrderNeedQtyCol = 25; //¶©µ¥ÐèÇóÊý public const Int16 HCusNameCol = 26; // ¿Í»§ public const Int16 HSeOrderBillNoCol = 27; //¶©µ¥ºÅ public const Int16 HOrderCommitDateCol = 28; //¶©µ¥½»»õÆÚ=ÓëÔ¤²âµ¥³åÏúµÄ¶©µ¥×îÔç½»»õÆÚ¡£ public const Int16 HRemarkCol = 29; public const Int16 HSourceIDCol = 30; public const Int16 HSourceNameCol = 31; public const Int16 HSourceInterIDCol = 32; public const Int16 HSourceEntryIDCol = 33; public const Int16 HSourceBillTypeCol = 34; public const Int16 HICMOInterIDCol = 35; public const Int16 HSeOrderInterIDCol = 36; public const Int16 HSeOrderEntryIDCol = 37; public const Int16 HSourceBillNoCol = 38; public const Int16 HLockedCol = 39; //grdmain public const Int16 HSecSourceNumberCol = 1; public const Int16 HSecSourceNameCol = 2; public const Int16 HSecICMOBillNoCol = 3; public const Int16 HSecICMOInterIDCol = 4; public const Int16 HSecProcNoCol = 5; public const Int16 HSecMaterNumberCol = 6; public const Int16 HSecMaterNameCol = 7; public const Int16 HSecMaterModelCol = 8; public const Int16 HSecProcNumberCol = 9; public const Int16 HSecProcNameCol = 10; public const Int16 HSecPlanEndDateCol = 11; public const Int16 HSecYXCol = 12; public const Int16 HSecPlanQtyCol = 13; public const Int16 HSecLeftQtyCol = 14; public const Int16 HSecWorkQtyCol = 15; public const Int16 HSecMaterIDCol = 16; public const Int16 HSecSourceIDCol = 17; //grdProcBill public const Int16 HProSourceIDCol = 1; public const Int16 HProSourceNameCol = 2; public const Int16 HSplitQtyCol = 3; public const Int16 HProWorkQtyCol = 4; //²úÄÜ public const Int16 HProSourceID2Col = 5; public const Int16 HProSourceName2Col = 6; public const Int16 HSplitQty2Col = 7; public const Int16 HProWorkQty2Col = 8; //²úÄÜ public const Int16 HProSourceID3Col = 9; public const Int16 HProSourceName3Col = 10; public const Int16 HSplitQty3Col = 11; public const Int16 HProWorkQty3Col = 12; //²úÄÜ public const Int16 HProSourceID4Col = 13; public const Int16 HProSourceName4Col = 14; public const Int16 HSplitQty4Col = 15; public const Int16 HProWorkQty4Col = 16; //²úÄÜ public const Int16 HProSourceID5Col = 17; public const Int16 HProSourceName5Col = 18; public const Int16 HSplitQty5Col = 19; public const Int16 HProWorkQty5Col = 20; //²úÄÜ public const Int16 HProSourceID6Col = 21; public const Int16 HProSourceName6Col = 22; public const Int16 HSplitQty6Col = 23; public const Int16 HProWorkQty6Col = 24; //²úÄÜ public const Int16 HProSourceID7Col = 25; public const Int16 HProSourceName7Col = 26; public const Int16 HSplitQty7Col = 27; public const Int16 HProWorkQty7Col = 28; //²úÄÜ public const Int16 HProSourceID8Col = 29; public const Int16 HProSourceName8Col = 30; public const Int16 HSplitQty8Col = 31; public const Int16 HProWorkQty8Col = 32; //²úÄÜ public const Int16 HProSourceID9Col = 33; public const Int16 HProSourceName9Col = 34; public const Int16 HSplitQty9Col = 35; public const Int16 HProWorkQty9Col = 36; //²úÄÜ public const Int16 HProSourceID10Col = 37; public const Int16 HProSourceName10Col = 38; public const Int16 HSplitQty10Col = 39; public const Int16 HProWorkQty10Col = 40; //²úÄÜ public const Int16 HProICMOBillNoCol = 41; public const Int16 HProProcNoCol = 42; public const Int16 HProProcNameCol =43; public const Int16 HProMaterNumberCol = 44; public const Int16 HProMaterNameCol = 45; public const Int16 HProMaterModelCol = 46; public const Int16 HProUnitNumberCol = 47; public const Int16 HProUnitNameCol = 48; public const Int16 HProPlanQtyCol = 49; public const Int16 HProRelationQtyCol = 50; public const Int16 HProProdTimesCol = 51; //Éú²úÖÜÆÚ=¼Æ»®Êý/²úÄÜ £¨Ð¡Ê±£© public const Int16 HProWorkTimesCol = 52; public const Int16 HProYXCol = 53; public const Int16 HProOrderLevCol = 54; public const Int16 HProKTQCol = 55; public const Int16 HProReadyQtyCol = 56; //¿ª¹¤ÓàÁ¿ public const Int16 HProPlanBeginDateCol = 57; //¼Æ»®¿ª¹¤ public const Int16 HProPlanEndDateCol = 58; //¼Æ»®Í깤 public const Int16 HProLastBeginDateCol = 59; //×î³Ù¿ª¹¤=×î³ÙÍ깤-Éú²úÖÜÆÚ£¨×î¶ÌÖÜÆÚ£© public const Int16 HProLastEndDateCol = 60; //×î³ÙÍ깤=¶©µ¥½»»õÆÚ-ÌáǰÆÚ public const Int16 HProOrderNeedQtyCol = 61; //¶©µ¥ÐèÇóÊý public const Int16 HProCusNameCol = 62; // ¿Í»§ public const Int16 HProSeOrderBillNoCol = 63; //¶©µ¥ºÅ public const Int16 HProOrderCommitDateCol = 64; //¶©µ¥½»»õÆÚ=ÓëÔ¤²âµ¥³åÏúµÄ¶©µ¥×îÔç½»»õÆÚ¡£ public const Int16 HProRemarkCol = 65; public const Int16 HProProcIDCol = 66; public const Int16 HProMaterIDCol = 67; public const Int16 HProSourceInterIDCol = 68; public const Int16 HProSourceEntryIDCol = 69; public const Int16 HProSourceBillTypeCol = 70; public const Int16 HProICMOInterIDCol = 71; public const Int16 HProSeOrderInterIDCol = 72; public const Int16 HProSeOrderEntryIDCol = 73; public const Int16 HProSourceBillNoCol = 74; public const Int16 HProLockedCol = 75; public const Int16 HProProcPlanInterIDCol = 76; public const Int16 HProProcPlanEntryIDCol = 77; public const Int16 HProBeginDayQtyCol = 78; //¿ª¹¤ÓàÁ¿£¨ÊýÁ¿£© public const Int16 HProBeginFixQtyCol = 79; //¿ª¹¤ÓàÁ¿£¨ÌìÊý£© public const Int16 HProUnitIDCol = 80; // public string ModName = "3749"; public string ModCaption = "Éú²ú¼Æ»®×Ô¶¯ÅųÌ"; // public DBUtility.ClsPub.Enum_BillStatus BillStatus; public string sAllowCol; // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DAL.ClsSc_WorkBillAutoSortBill oMain = new DAL.ClsSc_WorkBillAutoSortBill(); Sc_ProcAutoSortBillDlg oDlg = new Sc_ProcAutoSortBillDlg(); BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar(); // bool bEdit = false; //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return false; //return BLL.Sc_ProcAutoSortBillFun.IsSelectCell(grdSourceBill, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow,int iCol) { return false; //return BLL.Sc_ProcAutoSortBillFun.IsAllowEdit(grdSourceBill,FixCols, iRow, iCol); } private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; //³õʼ»¯ initGrid(); oDlg.ShowDialog(); if (oDlg.IsOk == 1) { Display(); } } //MouseDown //³õʼ»¯Íø¸ñ private void initGrid() { // grdSourceBill.ColumnCount = 40; //×ÜÁÐÊý DBUtility.Xt_BaseBillFun.initGridFst(grdSourceBill, this.Name); grdSourceBill.RowCount = 0; grdSourceBill.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //= grdSourceBill.Columns[HCusNameCol].HeaderText = "¿Í»§"; grdSourceBill.Columns[HSeOrderBillNoCol].HeaderText = "ÏúÊÛ¶©µ¥"; grdSourceBill.Columns[HICMOBillNoCol].HeaderText = "Éú²úÈÎÎñµ¥"; grdSourceBill.Columns[HMaterNumberCol].HeaderText = "ÎïÁÏ´úÂë"; grdSourceBill.Columns[HMaterNameCol].HeaderText = "ÎïÁÏÃû³Æ"; grdSourceBill.Columns[HMaterModelCol].HeaderText = "¹æ¸ñÐͺÅ"; grdSourceBill.Columns[HUnitNameCol].HeaderText = "µ¥Î»Ãû³Æ"; grdSourceBill.Columns[HPlanBeginDateCol].HeaderText = "¼Æ»®¿ª¹¤"; grdSourceBill.Columns[HPlanEndDateCol].HeaderText = "¼Æ»®Í깤"; grdSourceBill.Columns[HLastBeginDateCol].HeaderText = "×î³Ù¿ª¹¤"; grdSourceBill.Columns[HLastEndDateCol].HeaderText = "×î³ÙÍ깤"; grdSourceBill.Columns[HPlanQtyCol].HeaderText = "ÈÎÎñÊý"; grdSourceBill.Columns[HProdTimesCol].HeaderText = "Éú²úÖÜÆÚ"; grdSourceBill.Columns[HRelationQtyCol].HeaderText = "Í깤Êý"; grdSourceBill.Columns[HReadyQtyCol].HeaderText = "×¼±¸Ê±¼ä"; grdSourceBill.Columns[HBeginDayQtyCol].HeaderText = "¿ª¹¤¹ÌÊý"; grdSourceBill.Columns[HBeginFixQtyCol].HeaderText = "¿ª¹¤¹ÌÌì"; grdSourceBill.Columns[HWorkQtyCol].HeaderText = "²úÄÜ"; grdSourceBill.Columns[HWorkTimesCol].HeaderText = "±ê×¼¹¤Ê±"; grdSourceBill.Columns[HSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdSourceBill.Columns[HYXCol].HeaderText = "ÓÅÏȼ¶"; grdSourceBill.Columns[HOrderLevCol].HeaderText = "¶©µ¥µÈ¼¶"; grdSourceBill.Columns[HRemarkCol].HeaderText = "±¸×¢"; grdSourceBill.Columns[HOrderNeedQtyCol].HeaderText = "¶©µ¥ÊýÁ¿"; grdSourceBill.Columns[HOrderCommitDateCol].HeaderText = "¶©µ¥½»»õÆÚ"; grdSourceBill.Columns[HSourceBillNoCol].HeaderText = "Ô´µ¥ºÅ"; grdSourceBill.Columns[HSourceBillTypeCol].HeaderText = "Ô´µ¥ÀàÐÍ"; grdSourceBill.Columns[HLockedCol].HeaderText = "Ëø¶¨±ê¼Ç"; grdSourceBill.Columns[HHangUpCol].HeaderText = "¹ÒÆð±ê¼Ç"; ////Òþ²ØÁÐ grdSourceBill.Columns[0].Visible = false; grdSourceBill.Columns[HMaterIDCol].Visible = false; grdSourceBill.Columns[HUnitIDCol].Visible = false; grdSourceBill.Columns[HKTQCol].Visible = false; grdSourceBill.Columns[HICMOInterIDCol].Visible = false; grdSourceBill.Columns[HSourceIDCol].Visible = false; grdSourceBill.Columns[HUnitNumberCol].Visible = false; grdSourceBill.Columns[HSourceInterIDCol].Visible = false; grdSourceBill.Columns[HSourceEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderInterIDCol].Visible = false; //// grdSourceBill.ReadOnly = true; /////grd2 grdMain.ColumnCount = FixCols; grdMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name); grdMain.BackgroundColor = Color.Lavender; //Íø¸ñ±³¾°É« grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.Beige; grdMain.RowCount = 0; grdMain.Columns[HSecICMOBillNoCol].HeaderText = "ÈÎÎñµ¥ºÅ"; grdMain.Columns[HSecLeftQtyCol].HeaderText = "´ýÉú²ú¼Æ»®Êý"; grdMain.Columns[HSecMaterNameCol].HeaderText = "ÎïÁÏÃû³Æ"; grdMain.Columns[HSecMaterNumberCol].HeaderText = "ÎïÁÏ´úÂë"; grdMain.Columns[HSecMaterModelCol].HeaderText = "¹æ¸ñÐͺÅ"; grdMain.Columns[HSecProcNumberCol].HeaderText = "¹¤Ðò´úÂë"; grdMain.Columns[HSecProcNameCol].HeaderText = "¹¤Ðò"; grdMain.Columns[HSecPlanQtyCol].HeaderText = "ÈÎÎñÊý"; grdMain.Columns[HSecSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdMain.Columns[HSecSourceNumberCol].HeaderText = "×ÊÔ´´úÂë"; grdMain.Columns[HSecPlanEndDateCol].HeaderText = "¼Æ»®Í깤"; grdMain.Columns[HSecProcNoCol].HeaderText = "¹¤ÐòÐòºÅ"; grdMain.Columns[HSecYXCol].HeaderText = "ÓÅÏÈ"; grdMain.Columns[HSecWorkQtyCol].HeaderText = "²úÄÜ"; // grdMain.Columns[0].Visible = false; grdMain.Columns[HSecICMOInterIDCol].Visible = false; grdMain.Columns[HSecSourceIDCol].Visible = false; grdMain.Columns[HSecMaterIDCol].Visible = false; grdMain.ReadOnly = true; for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; //ÁÐ ÅÅÐòģʽ } // /////grdProcBill grdProcBill.ColumnCount = 81; //×ÜÁÐÊý DBUtility.Xt_BaseBillFun.initGridFst(grdProcBill, this.Name); grdProcBill.RowCount = 0; grdProcBill.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //= grdProcBill.Columns[HProCusNameCol].HeaderText = "¿Í»§"; grdProcBill.Columns[HProSeOrderBillNoCol].HeaderText = "ÏúÊÛ¶©µ¥"; grdProcBill.Columns[HProProcNoCol].HeaderText = "¹¤ÐòÐòºÅ"; grdProcBill.Columns[HProICMOBillNoCol].HeaderText = "Éú²úÈÎÎñµ¥"; grdProcBill.Columns[HProMaterNumberCol].HeaderText = "ÎïÁÏ´úÂë"; grdProcBill.Columns[HProMaterNameCol].HeaderText = "ÎïÁÏÃû³Æ"; grdProcBill.Columns[HProMaterModelCol].HeaderText = "¹æ¸ñÐͺÅ"; grdProcBill.Columns[HProUnitNameCol].HeaderText = "µ¥Î»Ãû³Æ"; grdProcBill.Columns[HProPlanBeginDateCol].HeaderText = "¼Æ»®¿ª¹¤"; grdProcBill.Columns[HProPlanEndDateCol].HeaderText = "¼Æ»®Í깤"; grdProcBill.Columns[HProLastBeginDateCol].HeaderText = "×î³Ù¿ª¹¤"; grdProcBill.Columns[HProLastEndDateCol].HeaderText = "×î³ÙÍ깤"; grdProcBill.Columns[HProPlanQtyCol].HeaderText = "ÈÎÎñÊý"; grdProcBill.Columns[HProProdTimesCol].HeaderText = "Éú²úÖÜÆÚ"; grdProcBill.Columns[HProRelationQtyCol].HeaderText = "Í깤Êý"; grdProcBill.Columns[HProReadyQtyCol].HeaderText = "¿ª¹¤ÓàÁ¿"; grdProcBill.Columns[HProBeginDayQtyCol].HeaderText = "¿ª¹¤¹ÌÊý"; grdProcBill.Columns[HProBeginFixQtyCol].HeaderText = "¿ª¹¤¹ÌÌì"; grdProcBill.Columns[HProWorkQtyCol].HeaderText = "²úÄÜ"; grdProcBill.Columns[HProWorkQty2Col].HeaderText = "²úÄÜ2"; grdProcBill.Columns[HProWorkQty3Col].HeaderText = "²úÄÜ3"; grdProcBill.Columns[HProWorkQty4Col].HeaderText = "²úÄÜ4"; grdProcBill.Columns[HProWorkQty5Col].HeaderText = "²úÄÜ5"; grdProcBill.Columns[HProWorkQty6Col].HeaderText = "²úÄÜ6"; grdProcBill.Columns[HProWorkQty7Col].HeaderText = "²úÄÜ7"; grdProcBill.Columns[HProWorkQty8Col].HeaderText = "²úÄÜ8"; grdProcBill.Columns[HProWorkQty9Col].HeaderText = "²úÄÜ9"; grdProcBill.Columns[HProWorkQty10Col].HeaderText = "²úÄÜ10"; grdProcBill.Columns[HProWorkTimesCol].HeaderText = "±ê×¼¹¤Ê±"; grdProcBill.Columns[HProSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdProcBill.Columns[HProSourceName2Col].HeaderText = "Éú²ú×ÊÔ´2"; grdProcBill.Columns[HProSourceName3Col].HeaderText = "Éú²ú×ÊÔ´3"; grdProcBill.Columns[HProSourceName4Col].HeaderText = "Éú²ú×ÊÔ´4"; grdProcBill.Columns[HProSourceName5Col].HeaderText = "Éú²ú×ÊÔ´5"; grdProcBill.Columns[HProSourceName6Col].HeaderText = "Éú²ú×ÊÔ´6"; grdProcBill.Columns[HProSourceName7Col].HeaderText = "Éú²ú×ÊÔ´7"; grdProcBill.Columns[HProSourceName8Col].HeaderText = "Éú²ú×ÊÔ´8"; grdProcBill.Columns[HProSourceName9Col].HeaderText = "Éú²ú×ÊÔ´9"; grdProcBill.Columns[HProSourceName10Col].HeaderText = "Éú²ú×ÊÔ´10"; grdProcBill.Columns[HProProcNameCol].HeaderText = "¹¤Ðò"; grdProcBill.Columns[HProYXCol].HeaderText = "ÓÅÏȼ¶"; grdProcBill.Columns[HProOrderLevCol].HeaderText = "¶©µ¥µÈ¼¶"; grdProcBill.Columns[HProRemarkCol].HeaderText = "±¸×¢"; grdProcBill.Columns[HProOrderNeedQtyCol].HeaderText = "¶©µ¥ÊýÁ¿"; grdProcBill.Columns[HProOrderCommitDateCol].HeaderText = "¶©µ¥½»»õÆÚ"; grdProcBill.Columns[HProSourceBillNoCol].HeaderText = "Ô´µ¥ºÅ"; grdProcBill.Columns[HProSourceBillTypeCol].HeaderText = "Ô´µ¥ÀàÐÍ"; grdProcBill.Columns[HProLockedCol].HeaderText = "Ëø¶¨ÀàÐÍ"; grdProcBill.Columns[HProProcPlanInterIDCol].HeaderText = "¹¤Ðò¼Æ»®µ¥Ö÷ÄÚÂë"; grdProcBill.Columns[HProProcPlanEntryIDCol].HeaderText = "¹¤Ðò¼Æ»®µ¥×ÓÄÚÂë"; grdProcBill.Columns[HSplitQtyCol].HeaderText = "²ð·ÖÊýÁ¿"; grdProcBill.Columns[HSplitQty2Col].HeaderText = "²ð·ÖÊýÁ¿2"; grdProcBill.Columns[HSplitQty3Col].HeaderText = "²ð·ÖÊýÁ¿3"; grdProcBill.Columns[HSplitQty4Col].HeaderText = "²ð·ÖÊýÁ¿4"; grdProcBill.Columns[HSplitQty5Col].HeaderText = "²ð·ÖÊýÁ¿5"; grdProcBill.Columns[HSplitQty6Col].HeaderText = "²ð·ÖÊýÁ¿6"; grdProcBill.Columns[HSplitQty7Col].HeaderText = "²ð·ÖÊýÁ¿7"; grdProcBill.Columns[HSplitQty8Col].HeaderText = "²ð·ÖÊýÁ¿8"; grdProcBill.Columns[HSplitQty9Col].HeaderText = "²ð·ÖÊýÁ¿9"; grdProcBill.Columns[HSplitQty10Col].HeaderText = "²ð·ÖÊýÁ¿10"; ////Òþ²ØÁÐ grdProcBill.Columns[0].Visible = false; grdProcBill.Columns[HProMaterIDCol].Visible = false; grdProcBill.Columns[HProUnitIDCol].Visible = false; grdProcBill.Columns[HProKTQCol].Visible = false; grdProcBill.Columns[HProICMOInterIDCol].Visible = false; grdProcBill.Columns[HProSourceIDCol].Visible = false; grdProcBill.Columns[HProSourceID2Col].Visible = false; grdProcBill.Columns[HProSourceID3Col].Visible = false; grdProcBill.Columns[HProSourceID4Col].Visible = false; grdProcBill.Columns[HProSourceID5Col].Visible = false; grdProcBill.Columns[HProSourceID6Col].Visible = false; grdProcBill.Columns[HProSourceID7Col].Visible = false; grdProcBill.Columns[HProSourceID8Col].Visible = false; grdProcBill.Columns[HProSourceID9Col].Visible = false; grdProcBill.Columns[HProSourceID10Col].Visible = false; grdProcBill.Columns[HProProcIDCol].Visible = false; grdProcBill.Columns[HProUnitNumberCol].Visible = false; grdProcBill.Columns[HProSourceInterIDCol].Visible = false; grdProcBill.Columns[HProSourceEntryIDCol].Visible = false; grdProcBill.Columns[HProSeOrderEntryIDCol].Visible = false; grdProcBill.Columns[HProSeOrderInterIDCol].Visible = false; grdProcBill.Columns[HProLastEndDateCol].Visible = false; grdProcBill.Columns[HProLastBeginDateCol].Visible = false; grdProcBill.Columns[HProCusNameCol].Visible = false; grdProcBill.Columns[HProSeOrderBillNoCol].Visible = false; grdProcBill.Columns[HProOrderCommitDateCol].Visible = false; grdProcBill.Columns[HProOrderNeedQtyCol].Visible = false; grdProcBill.Columns[HProWorkTimesCol].Visible = false; //// //ÉèÖÿɱ༭ÁÐ sAllowCol = HProSourceNameCol.ToString() + "," + HProSourceName2Col.ToString() + "," + HProSourceName3Col.ToString() + "," + HProSourceName4Col.ToString() + "," + HProSourceName5Col.ToString() + "," + HProSourceName6Col.ToString() + "," + HProSourceName7Col.ToString() + "," + HProSourceName8Col.ToString() + "," + HProSourceName9Col.ToString() + "," + HProSourceName10Col.ToString() + "," + HSplitQtyCol.ToString() + "," + HSplitQty2Col.ToString() + "," + HSplitQty3Col.ToString() + "," + HSplitQty4Col.ToString() + "," + HSplitQty5Col.ToString() + "," + HSplitQty6Col.ToString() + "," + HSplitQty7Col.ToString() + "," + HSplitQty8Col.ToString() + "," + HSplitQty9Col.ToString() + "," + HSplitQty10Col.ToString() + "," + HProWorkQtyCol.ToString() + "," + HProWorkQty2Col.ToString() + "," + HProWorkQty3Col.ToString() + "," + HProWorkQty4Col.ToString() + "," + HProWorkQty5Col.ToString() + "," + HProWorkQty6Col.ToString() + "," + HProWorkQty7Col.ToString() + "," + HProWorkQty8Col.ToString() + "," + HProWorkQty9Col.ToString() + "," + HProWorkQty10Col.ToString(); //grdProcBill.ReadOnly = true; // DBUtility.ClsPub.GetGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdSourceBill, this.Name + "grdSourceBill", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdMain, this.Name + "grdMain", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdProcBill, this.Name + "grdProcBill", DBUtility.ClsPub.AppPath); LoadDateCol(30); grdMain.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;//±êÌâÐÐ×Ô¶¯»»ÐÐ } //¼ÓÔØ µ±ÔÂÈÕÆÚ private void LoadDateCol(int iDates) { Sc_ICMOSortBillFun.LoadDateCol(grdMain, FixCols, iDates); } //ÏÔʾ¼ÓÔØ ÒÑÅų̼Ǽ private void Display() { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View(); DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View(); DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); int c = 0; int i = 0; //½«¹ýÂË¿òµÄ²¿Ãź͹¤ÐòдÈë½çÃæ£¬ÈôûÓв¿ÃÅÔò Ìø³ö¹ý³Ì this.txtHDeptID.Tag = oDlg.txtHBDeptID.Tag; this.txtHDeptID.Text = oDlg.txtHBDeptID.Text; this.lblHDeptID.Text = oDlg.txtHBDeptID.Text; //this.txtHProcID.Tag = oDlg.txtHBProcID.Tag; //this.txtHProcID.Text = oDlg.txtHBProcID.Text; //this.lblHProcID.Text = oDlg.txtHBProcID.Text; if (DBUtility.ClsPub.isLong(txtHDeptID.Tag) == 0) { return; } //µÃµ½µ±Ç°HRelationInterID oMain.HRelationInterID = oMain.GetRelationInterIDByDept(DBUtility.ClsPub.isLong(txtHDeptID.Tag)); //¸ù¾Ý²¿Ãŵõ½Ä¬ÈÏ×ÊÔ´ if (oSource.GetInfoByDept(DBUtility.ClsPub.isLong(txtHDeptID.Tag))) { //HSourceID_MR = oSource.omodel.HItemID; //HSourceNumber_MR = oSource.omodel.HNumber; //HSourceName_MR = oSource.omodel.HName; } // if (oMain.ShowBillByProc(oMain.HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo) == false) { MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } //Çå¿Õ //grid½ûֹˢР////¼ÓÔØ±íÍ· //foreach (Model.ClsSc_WorkBillAutoSortBillMain oModel in oMain.MainICMOColl) //{ // if (i >= grdSourceBill.Rows.Count) // { // grdSourceBill.RowCount = grdSourceBill.Rows.Count + 1; // } // grdSourceBill.Rows[i].Cells[HSourceIDCol].Value = oModel.HSourceID.ToString(); // if (oSource.GetInfoByID(oModel.HSourceID)) // { // grdSourceBill.Rows[i].Cells[HSourceNameCol].Value = oSource.omodel.HName; // } // grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value = oModel.HSeOrderBillNo; // grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value = oModel.HSeOrderInterID.ToString(); // grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value = oModel.HSeOrderEntryID.ToString(); // grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value = oModel.HICMOInterID.ToString(); // grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oModel.HSourceBillType; // grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value = oModel.HSourceInterID.ToString(); // grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value = oModel.HSourceEntryID.ToString(); // grdSourceBill.Rows[i].Cells[HCusNameCol].Value = ""; // grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value = oModel.HICMOBillNo; // //grdMain.Rows[i].Cells[HRemarkCol].ToolTipText // grdSourceBill.Rows[i].Cells[HMaterIDCol].Value = oModel.HMaterID.ToString(); // if (oMater.GetInfoByID(oModel.HMaterID)) // { // grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber; // grdSourceBill.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName; // grdSourceBill.Rows[i].Cells[HMaterModelCol].Value = oMater.omodel.HModel; // } // grdSourceBill.Rows[i].Cells[HUnitIDCol].Value = oModel.HUnitID.ToString(); // if (oUnit.GetInfoByID(oModel.HUnitID)) // { // grdSourceBill.Rows[i].Cells[HUnitNumberCol].Value = oUnit.omodel.HNumber; // grdSourceBill.Rows[i].Cells[HUnitNameCol].Value = oUnit.omodel.HName; // } // grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value = oModel.HPlanBeginDate.ToShortDateString(); // grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value = oModel.HPlanEndDate.ToShortDateString(); // grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value = oModel.HPlanQty.ToString(); // //µÃµ½ÀÛ¼Æ »ã±¨ÊýÁ¿ ºÍ²ð·Ö»ã±¨ÊýÁ¿ // grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = oModel.HRelationQty.ToString(); // SetSourceRelationQty(i); // // // grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value = oModel.HWorkQty.ToString(); // grdSourceBill.Rows[i].Cells[HYXCol].Value = oModel.HYX.ToString(); // grdSourceBill.Rows[i].Cells[HKTQCol].Value = DBUtility.ClsPub.BoolToString(oModel.HKTQ); // grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = oModel.HReadyTimes.ToString(); // grdSourceBill.Rows[i].Cells[HRemarkCol].Value = oModel.HRemark; // i++; // // //} //¼ÓÔØ Ö÷±í£¬ÈÎÎñµ¥ÐÅÏ¢ i = 0; foreach (Model.ClsSc_WorkBillAutoSortBillMain oModel in oMain.MainColl) { if (i >= grdSourceBill.Rows.Count) { grdSourceBill.RowCount = grdSourceBill.Rows.Count + 1; } grdSourceBill.Rows[i].Cells[HSourceIDCol].Value = oModel.HSourceID.ToString(); if (oSource.GetInfoByID(oModel.HSourceID)) { grdSourceBill.Rows[i].Cells[HSourceNameCol].Value = oSource.omodel.HName; } grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value = oModel.HSeOrderBillNo; grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value = oModel.HSeOrderInterID.ToString(); grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value = oModel.HSeOrderEntryID.ToString(); grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value = oModel.HICMOInterID.ToString(); grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oModel.HSourceBillType; grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value = oModel.HSourceInterID.ToString(); grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value = oModel.HSourceEntryID.ToString(); grdSourceBill.Rows[i].Cells[HCusNameCol].Value = ""; grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value = oModel.HICMOBillNo; grdSourceBill.Rows[i].Cells[HOrderLevCol].Value = oModel.Horderlev; //grdMain.Rows[i].Cells[HRemarkCol].ToolTipText grdSourceBill.Rows[i].Cells[HMaterIDCol].Value = oModel.HMaterID.ToString(); if (oMater.GetInfoByID(oModel.HMaterID)) { grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber; grdSourceBill.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName; grdSourceBill.Rows[i].Cells[HMaterModelCol].Value = oMater.omodel.HModel; } grdSourceBill.Rows[i].Cells[HUnitIDCol].Value = oModel.HUnitID.ToString(); if (oUnit.GetInfoByID(oModel.HUnitID)) { grdSourceBill.Rows[i].Cells[HUnitNumberCol].Value = oUnit.omodel.HNumber; grdSourceBill.Rows[i].Cells[HUnitNameCol].Value = oUnit.omodel.HName; } grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value = oModel.HPlanBeginDate.ToShortDateString(); grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value = oModel.HPlanEndDate.ToShortDateString(); grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value = oModel.HPlanQty.ToString(); //µÃµ½ÀÛ¼Æ »ã±¨ÊýÁ¿ ºÍ²ð·Ö»ã±¨ÊýÁ¿ grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = oModel.HRelationQty.ToString(); SetSourceRelationQty(i); // grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value = oModel.HWorkQty.ToString(); grdSourceBill.Rows[i].Cells[HYXCol].Value = oModel.HYX.ToString(); grdSourceBill.Rows[i].Cells[HKTQCol].Value = DBUtility.ClsPub.BoolToString(oModel.HKTQ); grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = oModel.HReadyTimes.ToString(); grdSourceBill.Rows[i].Cells[HRemarkCol].Value = oModel.HRemark; if (oModel.HHangUp) { grdSourceBill.Rows[i].Cells[HHangUpCol].Value = "Y"; } else { grdSourceBill.Rows[i].Cells[HHangUpCol].Value = ""; } //¼ÓÔØ×Ó±í ÈÕÆÚÐÅÏ¢(Ö»¼ÓÔØ Ëø¶¨µÄÊý¾Ý) if (oModel.HLocked) { if (i >= grdMain.Rows.Count) { grdMain.RowCount = grdMain.Rows.Count + 1; } c = grdMain.RowCount - 1; //ÉèÖÃ×Ó±íÐÅÏ¢ //ÉèÖÃÈռƻ®ÊýÁ¿ Sc_ICMOSortBillFun.SetSubGrid(grdMain, oMain, ref c, ref i, FixCols); } i++; // } //»­Ïß GraphLine(); //½»»õÆÚ¹ýÆÚ ±äÉ« AddColor(); //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); //»Ö¸´Ë¢Ð // } //AfterEdit //¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ private bool CheckJHS(int iRow) { return true; //return BLL.Sc_ProcAutoSortBillFun.CheckJHS(grdSourceBill, HICMoBillNoCol, HSplitPlanQtyCol, HPlanQtyCol, iRow); } //ÅųÌǰ¼ì²é private bool CheckSetupData() { if (grdSourceBill.RowCount == 0) { MessageBox.Show("ûÓÐÈκε¥¾Ý£¬²»ÔÊÐíÅų̣¡"); return false; } if (!RowCount()) { return false; } //if (!BLL.Sc_ProcAutoSortBillFun.IsSelectZY(grdSourceBill, HSourceIDCol)) //{ // MessageBox.Show("ûÓÐÑ¡Ôñ×ÊÔ´£¬²»ÔÊÐíÅų̣¡"); // return false; //} return true; } //½»»õÆÚ ³¬ÆÚʱ ±äÉ« private void AddColor() { //BLL.Sc_ProcAutoSortBillFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { //bool bResult; //lblCaption.Focus(); //// //if (!AllowSave()) //{ // return; //} ////ȨÏÞÅÐ¶Ï ////ɾ³ýÈ«²¿Î´Ëø¶¨µÄ±¾²¿Ãŵ¥¾Ý£¬»òÕß×÷·Ï //// //oMain.MainColl = new List(); //DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); ////дÈëÀà //for (int i = 0; i <= grdSourceBill.Rows.Count - 1; i++) //{ // //Èç¹ûÖ÷±íËø¶¨£¬ÔòÌø¹ý // //Ö÷±í¸³Öµ // //if (grdSourceBill.get_TextMatrix(i, HProcIDCol) != null && grdSourceBill.get_TextMatrix(i, HProcIDCol) != string.Empty) // //{ // Model.ClsSc_WorkBillAutoSortBillMain oModel = new Model.ClsSc_WorkBillAutoSortBillMain(); // oMain.DetailColl = new List(); // // // // // oModel.HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); // oModel.HBillNo = ""; // oModel.HYear = 2012; // oModel.HPeriod = 1; // oModel.HDate = MainDate; // oModel.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); // oModel.HMaterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HMaterIDCol].Value); // oModel.HSourceID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceIDCol].Value); // oModel.HUnitID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HUnitIDCol].Value); // oModel.HYX = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HYXCol].Value); // oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value); // oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value); // oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value); // oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value); // oModel.HKTQ = DBUtility.ClsPub.isBool(grdSourceBill.Rows[i].Cells[HKTQCol].Value); // oModel.HWorkQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value); // oModel.HReadyTimes = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value); // oModel.HRemark = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HRemarkCol].Value); // oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); // oModel.HMakeDate = MainDate.ToShortDateString(); // oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value); // oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value); // oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceBillNoCol].Value); // oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value); // oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value); // //oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HICMoBillNoCol].Value); // oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value); // //oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSeOrderBilNoCol].Value); // oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value); // oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value); // // // oMain.MainColl.Add(oModel); // // // Sc_ICMOSortBillFun.SaveGridSub(grdSourceBill, FixCols, oMain, MainDate,oModel.HWorkQty, ref i); //} ////±£´æÍê±Ïºó´¦Àí //bResult = oMain.AddBill(DBUtility.ClsPub.isLong(txtHDeptID.Tag), ref DBUtility.ClsPub.sExeReturnInfo); ////Ìáʾ //if (bResult == true) //{ // MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); //} //else //{ // MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); //} ////µÃµ½×îÐÂÅÅ³Ì //GetPcTime(); } //±£´æµ¥ÐÐ private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List oClsGridValues) { bool bResult; lblCaption.Focus(); // if (!AllowSave()) { return; } //ȨÏÞÅÐ¶Ï oMain.MainColl = new List(); DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); //дÈëÀà Model.ClsSc_WorkBillAutoSortBillMain oModel = new Model.ClsSc_WorkBillAutoSortBillMain(); oMain.DetailColl = new List(); // oModel.HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); oModel.HBillNo = ""; oModel.HYear = 2012; oModel.HPeriod = 1; oModel.HDate = MainDate; oModel.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); oModel.HMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceIDCol].Value); oModel.HSourceID2 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID2Col].Value); oModel.HSourceID3 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID3Col].Value); oModel.HSourceID4 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID4Col].Value); oModel.HSourceID5 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID5Col].Value); oModel.HSourceID6 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID6Col].Value); oModel.HSourceID7 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID7Col].Value); oModel.HSourceID8 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID8Col].Value); oModel.HSourceID9 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID9Col].Value); oModel.HSourceID10 = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceID10Col].Value); oModel.HUnitID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProUnitIDCol].Value); oModel.HYX = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProYXCol].Value); // oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[iRow].Cells[HProPlanBeginDateCol].Value); oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[iRow].Cells[HProPlanEndDateCol].Value); oModel.HLastBeginDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[iRow].Cells[HProLastBeginDateCol].Value); oModel.HLastEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[iRow].Cells[HProLastEndDateCol].Value); oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HProPlanQtyCol].Value); oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HProRelationQtyCol].Value); oModel.HSplitQty2 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty2Col].Value); oModel.HSplitQty3 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty3Col].Value); oModel.HSplitQty4 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty4Col].Value); oModel.HSplitQty5 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty5Col].Value); oModel.HSplitQty6 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty6Col].Value); oModel.HSplitQty7 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty7Col].Value); oModel.HSplitQty8 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty8Col].Value); oModel.HSplitQty9 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty9Col].Value); oModel.HSplitQty10 = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HSplitQty10Col].Value); // oModel.HKTQ = DBUtility.ClsPub.isBool(grdProcBill.Rows[iRow].Cells[HProKTQCol].Value); oModel.HWorkQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HProWorkQtyCol].Value); oModel.HReadyTimes = DBUtility.ClsPub.isDoule(grdProcBill.Rows[iRow].Cells[HProReadyQtyCol].Value); oModel.HRemark = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProRemarkCol].Value); oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); oModel.HMakeDate = MainDate.ToShortDateString(); oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceInterIDCol].Value); oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSourceEntryIDCol].Value); oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProSourceBillNoCol].Value); oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProSourceBillTypeCol].Value); oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProICMOInterIDCol].Value); oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProICMOBillNoCol].Value); oModel.HProcPlanEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcPlanEntryIDCol].Value); oModel.HProcPlanInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcPlanInterIDCol].Value); oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProSeOrderBillNoCol].Value); oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSeOrderInterIDCol].Value); oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProSeOrderEntryIDCol].Value); oModel.HOrderCommitDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[iRow].Cells[HProOrderCommitDateCol].Value); // oMain.MainColl.Add(oModel); // Sc_ICMOSortBillFun.SaveGridSub(grdMain, grdMain_t, FixCols, oMain, MainDate, oModel.HWorkQty, ref iRowSub, oClsGridValues); //±£´æÍê±Ïºó´¦Àí bResult = oMain.AddBill(DBUtility.ClsPub.isLong(txtHDeptID.Tag), HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo); //Ìáʾ if (bResult == true) { //MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); } } //±£´æÇ° ¼ì²é private bool AllowSave() { //for (int i = grdSourceBill.FixedRows; i < grdSourceBill.Rows; i++) //{ // if (DBUtility.ClsPub.isStrNull(grdSourceBill.get_TextMatrix(i, HSourceIDCol)) == "") // { // MessageBox.Show("ÇëÏÈÑ¡ÔñºÃ×ÊÔ´£¬ÔÙ½øÐб£´æ£¡"); // return false; // } //} if (DBUtility.ClsPub.isLong(txtHDeptID.Tag) == 0) { MessageBox.Show("ÇëÏÈÑ¡ÔñºÃ²¿ÃÅ£¬ÔÙ½øÐб£´æ£¡"); return false; } return true; } //ÊÇ·ñÊǺÏÀíÐÐ private bool AllowRow() { return true; //return BLL.Sc_ProcAutoSortBillFun.AllowRow(grdSourceBill); } //ÅÅ³Ì private bool DateSetup(bool bAuto) { Single sLeftProdTimes = 0; string sSourceNumber = ""; string sSourceName = ""; string sICMOBillNo = ""; Int64 lICMOInterID = 0; Int64 lMainID = 0; Int64 lSourceID = 0; Int64 lMaterID = 0; Int64 lProcPlanInterID = 0; Int64 lProcPlanEntryID = 0; Int64 lProcProcNo = 0; string sMaterNumber = ""; string sMaterName = ""; string sMaterModel = ""; string sProcNumber = ""; string sProcName = ""; DateTime dEndDate = DateTime.Today; Single sProdTimes = 0; Single sPlanQty = 0; Single iLeftQty = 0; Single sWorkQty; Int64 sYX; Int64 HRelationInterID; bool bFind = false; DataSet ds; DataSet dsSub; DataSet dsPre;//ÉϵÀ¹¤ÐòÕ¼ÓÃʱ¼ä List oClsGridValues = new List(); //µÃµ½Ò»¸öÄÚÂë HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); if (HRelationInterID == 0) { HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); } if (HRelationInterID == 0) { MessageBox.Show("»ñÈ¡µ¥¾ÝÄÚÂëʧ°Ü!"); return false; } //µ¯³öǰÖ÷Çģʽ´°Ì壬ÏÔʾ½ø¶È DBUtility.Xt_ProcessWait oWait = new DBUtility.Xt_ProcessWait(); oWait.lblCaption.Text = "ÕýÔÚÅųÌÇëÉÔºò..."; oWait.lblHCount.Text = ""; oWait.lblHMaterName.Text = ""; oWait.pb1.Maximum = grdProcBill.RowCount; oWait.pb1.Value = 0; oWait.Show(); grdMain.RowCount = 0; //Çå¿ÕÎ´Ëø¶¨ Åų̼Ǽ Sub_DeleteBillUnLock(); //Èç¹û ÏÔʾʱ¼äÍø¸ñ //if (true == true) //{ // //¸´ÖÆ ÅųÌÍø¸ñµÄÈ«²¿ÐÅÏ¢ÖÁ // CopyGrid(); //} oClsGridValues.Clear(); //°´ÈÎÎñµ¥ÓÅÏȼ¶ Ñ­»· ¹¤Ðò¼Æ»®µ¥ for (int i = 0; i < grdProcBill.RowCount; i++) { //Èç¹ûËø¶¨¼Æ»®£¬Ôò²»ÐèÒªÔÙÅÅ³Ì if (DBUtility.ClsPub.isBool(grdProcBill.Rows[i].Cells[HProLockedCol].Value) == true) { continue; } //ÕÒµ½±¾ÈÎÎñµ¥ ¿ÉÓÃÉú²ú×ÊÔ´ lICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); lMainID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); lProcPlanInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanInterIDCol].Value); lProcPlanEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanEntryIDCol].Value); sICMOBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProICMOBillNoCol].Value); dEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastEndDateCol].Value); sProdTimes = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value); sPlanQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); lMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProMaterIDCol].Value); sProcName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNameCol].Value); sProcNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); sMaterNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNumberCol].Value); sMaterName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNameCol].Value); sMaterModel = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterModelCol].Value); sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); sYX = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProYXCol].Value); lProcProcNo = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); // if (sICMOBillNo == "WORK155356") { sICMOBillNo = sICMOBillNo; } //¸ù¾Ý¼Æ»®Êý-»ã±¨Êý ¼ÆËã Ê£ÓàÐèÇó¹¤Ê± iLeftQty = sPlanQty - DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProRelationQtyCol].Value); if (sWorkQty != 0) { sLeftProdTimes = iLeftQty / sWorkQty; } else { sLeftProdTimes = 0; } if (dEndDate < DBUtility.ClsPub.isDate("2000-01-01")) { dEndDate = DateTime.Today; } //Èô±¾ÈÎÎñµ¥ÒÑÓа²ÅÅ×ÊÔ´£¨ÉÏ´ÎÅų̻òÕßÊÖ¹¤Åų̣© Ôò²»ÔÙѰÕÒ×ÊÔ´£¬Ö±½ÓÅÅ³Ì //if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSourceIDCol].Value) != 0) //{ // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // lSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSourceIDCol].Value); // sSourceName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HSourceNameCol].Value); // sSourceNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HSourceNumberCol].Value); // // // ds = Sc_ICMOSortBillFun.GetWorkSourceByICMO(oCn, lMaterID, dEndDate, lSourceID, sLeftProdTimes); //} //else //ûÓÐ×ÊÔ´Ôò ×Ô¶¯ÕÒµ½×ÊÔ´ //{ // ds = Sc_ICMOSortBillFun.GetWorkSourceByProc(oCn, lMaterID, dEndDate, sLeftProdTimes,lProcPlanInterID,lProcPlanEntryID); //} if (ds == null || ds.Tables[0].Rows.Count == 0) //ûÓпÉÒÔÅŵÄ×ÊÔ´ { //Ìøµ½ÏÂÒ»µ¥ ±¾µ¥ºìÉ«ÏÔʾ grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; continue; } else { grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.White; //¿ªÊ¼Åŵ¥ bFind = false; //³¬½»»õÆÚ ÈÔÈ»ÅÅ³Ì for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { //ÅжÏ×ÊÔ´Ê£Ó๤ʱ£¬ÊÇ·ñ´óÓÚ Éú²úÖÜÆÚ if (DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[j]["Ê£Ó๤ʱ"]) > sLeftProdTimes) { if (iLeftQty > 0) { //ÔÚ±¾×ÊÔ´ÉÏÉú²ú //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HitemID"]); sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´Ãû³Æ"]); sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´´úÂë"]); grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; //grdProcBill.Rows[i].Cells[HProSourceNumberCol].Value = sSourceNumber; dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) { continue; } if (dsSub != null)//²»¼Ó°àÅÅ³Ì { //½«Êý¾ÝÅŵ½Íø¸ñÖÐ grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ SetSourceWorkQty(i); //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, false, oClsGridValues); } bFind = true; } } } if (!bFind) { for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { //ÅжÏ×ÊÔ´×î´óÊ£Ó๤ʱ£¬ÊÇ·ñ´óÓÚ Éú²úÖÜÆÚ if (DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[j]["×î´óÊ£Ó๤ʱ"]) > sLeftProdTimes) { if (iLeftQty > 0) { //ÔÚ±¾×ÊÔ´ÉÏÉú²ú grdMain.RowCount = grdMain.RowCount + 1; //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HitemID"]); sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´Ãû³Æ"]); sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´´úÂë"]); grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) { continue; } if (dsSub != null)//¼Ó°àÅÅ³Ì { //½«Êý¾ÝÅŵ½Íø¸ñÖÐ grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ SetSourceWorkQty(i); //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues); } } bFind = true; } } } if (!bFind) { //Èç¹ûûÓÐÕÒµ½ºÏÊÊ×ÊÔ´Ôò£¬Ö±½ÓÅÅ×îºóÒ»¸öÊ£Óà×î´óµÄ×ÊÔ´¡£ //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["HitemID"]); sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["×ÊÔ´Ãû³Æ"]); sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["×ÊÔ´´úÂë"]); grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) { continue; } if (dsSub != null)//¼Ó°àÅÅ³Ì { //½«Êý¾ÝÅŵ½Íø¸ñÖÐ grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ SetSourceWorkQty(i); //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues); } } } // //±£´æÉú³ÉÅɹ¤µ¥ SaveSingeBill(i, grdMain.RowCount - 1, HRelationInterID, oClsGridValues); //дÈë ½ø¶ÈµÈ´ý¿ò Thread.Sleep(100); Application.DoEvents(); oWait.pb1.Value = i + 1; oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); oWait.lblHMaterName.Text = ""; Application.DoEvents(); } ////´æÈëÉú²ú״̬±í oCn.RunProc("exec h_p_Sc_WorkAutoBillStatus_Add " + DBUtility.ClsPub.isLong(txtHDeptID.Tag).ToString()); // oWait.Close(); return true; } //ɾ³ý±¾²¿ÃÅÎ´Ëø¶¨ ¼Ç¼ private void Sub_DeleteBillUnLock() { if (oMain.DeleteBillUnlock(DBUtility.ClsPub.isLong(txtHDeptID.Tag)) == false) { MessageBox.Show("×÷·ÏÀúÊ·µ¥¾Ýʧ°Ü£¡"); } } //ÅÅÐò private bool SortData() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; //ðÅÝÅÅÐò·¨ //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; for (int i = 0; i < grdSourceBill.RowCount - 2; i++) { for (int j = 0; j < grdSourceBill.RowCount - i - 2; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HLastEndDateCol].Value) > DBUtility.ClsPub.isDate(grdSourceBill.Rows[j+1].Cells[HLastEndDateCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill,j); } else if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HLastEndDateCol].Value) == DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HLastEndDateCol].Value)) { if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HOrderCommitDateCol].Value) > DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HOrderCommitDateCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, j); } else if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HOrderCommitDateCol].Value) == DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HOrderCommitDateCol].Value)) { if (DBUtility.ClsPub.isDoule(grdSourceBill.Rows[j].Cells[HOrderNeedQtyCol].Value )< DBUtility.ClsPub.isDoule(grdSourceBill.Rows[j + 1].Cells[HOrderNeedQtyCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, j); } } else { // } } else { // } } } //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; return true; } //Êý¾Ý×¼±¸ ÉèÖÃÈÎÎñµ¥Ïà¹ØÐÅÏ¢ private bool ReadyData() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; //µ¯³öǰÖ÷Çģʽ´°Ì壬ÏÔʾ½ø¶È DBUtility.Xt_ProcessWait oWait = new DBUtility.Xt_ProcessWait(); oWait.lblCaption.Text = "ÕýÔÚÅųÌÊý¾Ý×¼±¸ÇëÉÔºò..."; oWait.lblHCount.Text = ""; oWait.lblHMaterName.Text = ""; oWait.pb1.Maximum = grdSourceBill.RowCount; oWait.pb1.Value = 0; oWait.Show(); //Ñ­»·¼ÆËãÍø¸ñÖеÄÈÎÎñµ¥ for (int i = 0; i < grdSourceBill.RowCount; i++) { //Ö´ÐмÆËãÈÎÎñµ¥¹ý³Ì Thread.Sleep(100); ds = oCn.RunProcReturn("exec h_p_Sc_GetInfoByICMOBillNo " + grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value.ToString(), "xt_xtgnb"); if (ds == null || ds.Tables[0].Rows.Count == 0) { //дÈë ½ø¶ÈµÈ´ý¿ò Application.DoEvents(); oWait.pb1.Value = i + 1; oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); oWait.lblHMaterName.Text = ""; Application.DoEvents(); } else { //·µ»ØÐÅÏ¢»ØÌîÍø¸ñ //grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["¹ØÁªÊýÁ¿"]); grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["²úÄÜ"]); grdSourceBill.Rows[i].Cells[HProdTimesCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["Éú²úÖÜÆÚ"]); //grdSourceBill.Rows[i].Cells[HWorkTimesCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["¹¤Ê±"]); grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["¿ª¹¤ÓàÁ¿"]); grdSourceBill.Rows[i].Cells[HLastBeginDateCol].Value = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["×î³Ù¿ª¹¤ÈÕÆÚ"]); grdSourceBill.Rows[i].Cells[HLastEndDateCol].Value = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["×î³ÙÍ깤ÈÕÆÚ"]); grdSourceBill.Rows[i].Cells[HOrderNeedQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[0]["¶©µ¥ÐèÇóÊý"]); //grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value = DBUtility.ClsPub.(ds.Tables[0].Rows[0][""]); grdSourceBill.Rows[i].Cells[HOrderCommitDateCol].Value = DBUtility.ClsPub.isDate(ds.Tables[0].Rows[0]["¶©µ¥½»»õÆÚ"]); //дÈë ½ø¶ÈµÈ´ý¿ò Application.DoEvents(); oWait.pb1.Value = i + 1; oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); oWait.lblHMaterName.Text = ""; Application.DoEvents(); } } oWait.Close(); return true; } private void LoadProcBill() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; int m; grdProcBill.RowCount = 0; //Ñ­»·¼ÆËãÍø¸ñÖеÄÈÎÎñµ¥ for (int i = 0; i < grdSourceBill.RowCount; i++) { //Ö´ÐмÆËãÈÎÎñµ¥¹ý³Ì Thread.Sleep(100); ds = oCn.RunProcReturn("select * from h_v_Sc_ProcessPlanList where hicmointerid=" + DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value).ToString() + " order by hmainid,hsubid", "xt_xtgnb"); if (ds == null || ds.Tables[0].Rows.Count == 0) { return; } else { for (int r = 0; r <= ds.Tables[0].Rows.Count - 1; r++) { //·µ»ØÐÅÏ¢»ØÌîÍø¸ñ grdProcBill.RowCount = grdProcBill.RowCount + 1; m = grdProcBill.RowCount - 1; // grdProcBill.Rows[m].Cells[HProICMOInterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hicmointerid"]); grdProcBill.Rows[m].Cells[HProICMOBillNoCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["ÈÎÎñµ¥ºÅ"]); grdProcBill.Rows[m].Cells[HProMaterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["HMaterID"]); grdProcBill.Rows[m].Cells[HProMaterNumberCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["ÎïÁÏ´úÂë"]); grdProcBill.Rows[m].Cells[HProMaterNameCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["ÎïÁÏÃû³Æ"]); grdProcBill.Rows[m].Cells[HProMaterModelCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["¹æ¸ñÐͺÅ"]); grdProcBill.Rows[m].Cells[HProUnitIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hunitid"]); grdProcBill.Rows[m].Cells[HProUnitNumberCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["¼ÆÁ¿µ¥Î»´úÂë"]); grdProcBill.Rows[m].Cells[HProUnitNameCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["¼ÆÁ¿µ¥Î»"]); grdProcBill.Rows[m].Cells[HProPlanQtyCol].Value = grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value; grdProcBill.Rows[m].Cells[HProRelationQtyCol].Value = Sc_ICMOSortBillFun.GetProcessRelationQty(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hmainid"]), DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hsubid"]),oCn,ref DBUtility.ClsPub.sExeReturnInfo); grdProcBill.Rows[m].Cells[HProWorkTimesCol].Value = grdSourceBill.Rows[i].Cells[HWorkTimesCol].Value; grdProcBill.Rows[m].Cells[HProPlanBeginDateCol].Value = grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value; grdProcBill.Rows[m].Cells[HProPlanEndDateCol].Value = grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value; grdProcBill.Rows[m].Cells[HProProdTimesCol].Value = grdSourceBill.Rows[i].Cells[HProdTimesCol].Value; grdProcBill.Rows[m].Cells[HProWorkQtyCol].Value =0;//µÃµ½²úÄÜ grdProcBill.Rows[m].Cells[HProYXCol].Value = grdSourceBill.Rows[i].Cells[HYXCol].Value; grdProcBill.Rows[m].Cells[HProSourceIDCol].Value = 0; grdProcBill.Rows[m].Cells[HProSourceNameCol].Value = ""; grdProcBill.Rows[m].Cells[HProProcIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hprocid"]); grdProcBill.Rows[m].Cells[HProProcPlanInterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hmainid"]); grdProcBill.Rows[m].Cells[HProProcPlanEntryIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["hsubid"]); grdProcBill.Rows[m].Cells[HProProcNoCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["¹¤ÐòºÅ"]); grdProcBill.Rows[m].Cells[HProProcNameCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["¹¤Ðò"]); grdProcBill.Rows[m].Cells[HProSourceInterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["Ô´µ¥Ö÷ÄÚÂë"]); grdProcBill.Rows[m].Cells[HProSourceEntryIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[r]["Ô´µ¥×ÓÄÚÂë"]); grdProcBill.Rows[m].Cells[HProSourceBillTypeCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["Ô´µ¥ÀàÐÍ"]); grdProcBill.Rows[m].Cells[HProSourceBillNoCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[r]["Ô´µ¥µ¥ºÅ"]); grdProcBill.Rows[m].Cells[HProBeginFixQtyCol].Value = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[r]["¿ª¹¤¹ÌÊý"]); grdProcBill.Rows[m].Cells[HProBeginDayQtyCol].Value = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[r]["¿ª¹¤¹ÌÌì"]); grdProcBill.Rows[m].Cells[HProLockedCol].Value = grdSourceBill.Rows[i].Cells[HLockedCol].Value; grdProcBill.Rows[m].Cells[HProOrderLevCol].Value = grdSourceBill.Rows[i].Cells[HOrderLevCol].Value; } } } } //µÃµ½ÐÂÈÕÆÚ private bool GetNewDay(long lSourceID,int iRow,int iCol) { return true; } //¼ÆËãÿÈÕ¼Ó¹¤Ê±¼ä private double CountDayHours(int iRow,int iCol) { return 0; } //»­Ïß private void GraphLine() { // } //µÃµ½µÃµ½±¾¹¤Ðò µ±ÈÕÉϰàʱ¼ä private double GetWorkNumber(string FDate,long SourceID) { return 0; //return BLL.Sc_ProcAutoSortBillFun.GetWorkNumber(FDate, SourceID,oCn); } private void cx_Click(object sender, EventArgs e) { timer1.Enabled = true; } //¼ÓÔØ ѡԴµ¥ private void sx_Click(object sender, EventArgs e) { DAL.Cls_S_K3_ICMOBill oK3_ICMOBill = new DAL.Cls_S_K3_ICMOBill(); string sWhere = " And HDeptID=" + DBUtility.ClsPub.isLong(txtHDeptID.Tag) + " "; if (oK3_ICMOBill.Refresh(sWhere)) //Ñ¡ÔñÔ­µ¥ { FillSelectData(oK3_ICMOBill.oBillSelectColl); } } //¼ÓÔØ Ô­µ¥µ½±¾µØ private void FillSelectData(List oList) { // bool sBool = false; DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); foreach (DBUtility.BillSelect oSelectRow in oList) { if (oSelectRow.BillType == "3710") { sBool = false; //µÃµ½ÐÅÏ¢ Ds = oCn.RunProcReturn("select * from h_v_K3_ICMOBillList_add where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_K3_ICMOBillList_add"); //дÈëÐÅÏ¢ for (int j = 0; j <= grdSourceBill.RowCount-1; j++) { if (DBUtility.ClsPub.isLong(grdSourceBill.Rows[j].Cells[HICMOInterIDCol].Value) == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainID"])) { sBool = true; MessageBox.Show("ÈÎÎñµ¥£º" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"] + "ÒÑ´æÔÚ´ýÅżƻ®ÖУ¬²»ÔÊÐíÌí¼Ó£¡"), "Ìáʾ"); break; } } if (sBool != true) { grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sub_WriteInForm(Ds.Tables[0], grdSourceBill.RowCount - 1); } } } } //¸ù¾ÝTABLEдÈë½çÃæ private void Sub_WriteInForm(DataTable oTable, int i) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); try { ////¼ÓÔØ±íÌå grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value = oTable.Rows[0]["ÏúÊÛ¶©µ¥ºÅ"].ToString(); grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value = oTable.Rows[0]["µ¥¾ÝºÅ"].ToString(); //grdSourceBill.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["HCusName"].ToString(); grdSourceBill.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ÎïÁÏ´úÂë"].ToString(); grdSourceBill.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ÎïÁÏÃû³Æ"].ToString(); grdSourceBill.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["¹æ¸ñÐͺÅ"].ToString(); grdSourceBill.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); //grdSourceBill.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["HUnitNumber"].ToString(); grdSourceBill.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["¼ÆÁ¿µ¥Î»"].ToString(); grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value = oTable.Rows[0]["¼Æ»®¿ª¹¤ÈÕÆÚ"].ToString(); grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value = oTable.Rows[0]["¼Æ»®Í깤ÈÕÆÚ"].ToString(); grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value = DBUtility.ClsPub.isDoule(oTable.Rows[0]["ÈÎÎñÊýÁ¿"], 2); grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = DBUtility.ClsPub.isDoule(oTable.Rows[0]["Èë¿âÊýÁ¿"], 2); grdSourceBill.Rows[i].Cells[HLastBeginDateCol].Value =""; grdSourceBill.Rows[i].Cells[HLastEndDateCol].Value = ""; grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value = "0"; grdSourceBill.Rows[i].Cells[HWorkTimesCol].Value = "8"; grdSourceBill.Rows[i].Cells[HYXCol].Value = ""; grdSourceBill.Rows[i].Cells[HOrderLevCol].Value = oTable.Rows[0]["¶©µ¥µÈ¼¶"].ToString(); grdSourceBill.Rows[i].Cells[HKTQCol].Value = "1"; grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = "0"; grdSourceBill.Rows[i].Cells[HRemarkCol].Value =""; //============ grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value = oTable.Rows[0]["HMainID"].ToString(); grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value = oTable.Rows[0]["HSeOrderInterID"].ToString(); grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value = oTable.Rows[0]["HSeOrderEntryID"].ToString(); grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value = oTable.Rows[0]["HMainID"].ToString(); grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value = oTable.Rows[0]["HSubID"].ToString(); //grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); } catch (Exception e) { MessageBox.Show(e.Message); } } //±£´æÁпí private void bclk_Click(object sender, EventArgs e) { //±£´æÁпí DBUtility.ClsPub.SaveGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdSourceBill, this.Name + "grdSourceBill", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdMain, this.Name + "grdMain", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdMain_t, this.Name + "grdMain_t", DBUtility.ClsPub.AppPath); } //ĬÈÏÁпí private void mrlk_Click(object sender, EventArgs e) { DBUtility.ClsPub.DefaultGridView(grdSource); DBUtility.ClsPub.DefaultGridView(grdICMO); DBUtility.ClsPub.DefaultGridView(grdSourceBill); DBUtility.ClsPub.DefaultGridView(grdMain); } //Í˳ö°´Å¥ private void tc_Click(object sender, EventArgs e) { this.Close(); } //Åų̰´Å¥ private void xz_Click(object sender, EventArgs e) { if (CheckSetupData() == false) { return; } if (MessageBox.Show("ÊÇ·ñÆô¶¯Åų̣¿","Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { //this.DateSetup(false); return; } else { this.DateSetup(true); } } //Çå¿Õ°´Å¥ private void toolStripButton1_Click(object sender, EventArgs e) { //this.ClearDateCol(true); } //»Ö¸´°´Å¥ private void hf_Click(object sender, EventArgs e) { //this.ClearDateCol(false); } //±£´æ°´Å¥ private void bc_Click(object sender, EventArgs e) { if (bEdit == true) { MessageBox.Show("ÅųÌÊý×ÖÒѱ»Ð޸ģ¬ÇëÖØÐÂÖ´ÐÐÔÚ±£´æ£¡"); return; } SaveBill(); } //ÄÜÁ¦°´Å¥ private void nl_Click(object sender, EventArgs e) { //ÄÜÁ¦ÉèÖà //Gy_WorkTimes oFrm = new Gy_WorkTimes(); //oFrm.ShowDialog(); } private void Sc_ProcAutoSortBill_Load(object sender, EventArgs e) { this.Text = ModCaption; this.lblCaption.Text = ModCaption; } //¹«Ê½ÖØËã private bool RowCount() { double SplitQty = 0; //²ð·ÖÊýÁ¿ double PlanQty = 0; //¼Æ»®ÊýÁ¿ //for (int i = 0; i <= grdProcBill.RowCount - 1; i++) //{ // SplitQty = ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty2Col].Value) // + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty3Col].Value) + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty4Col].Value) // + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty5Col].Value) + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty6Col].Value) // + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty7Col].Value) + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty8Col].Value) // + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty9Col].Value) + ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty10Col].Value); // PlanQty = ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); // if (SplitQty != PlanQty) // { // MessageBox.Show("µÚ" + DBUtility.ClsPub.isStrNull(i + 1) + "ÐÐ,²ð·ÖÊýÁ¿²»µÈÓڼƻ®ÊýÁ¿£¬²»ÔÊÐíÅųÌ"); // return false; // } //} return true; } //°ïÖúº¯Êý private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit) { switch (sKeyCode) { case 118: //F7 { switch (sCol) { case HProSourceNameCol: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceIDCol, 0, HProSourceNameCol); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceIDCol, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQtyCol, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceNameCol].Value); break; case HProSourceName2Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID2Col, 0, HProSourceName2Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID2Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty2Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName2Col].Value); break; case HProSourceName3Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID3Col, 0, HProSourceName3Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID3Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty3Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName3Col].Value); break; case HProSourceName4Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID4Col, 0, HProSourceName4Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID4Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty4Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName4Col].Value); break; case HProSourceName5Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID5Col, 0, HProSourceName5Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID5Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty5Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName5Col].Value); break; case HProSourceName6Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID6Col, 0, HProSourceName6Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID6Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty6Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName6Col].Value); break; case HProSourceName7Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID7Col, 0, HProSourceName7Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID7Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty7Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName7Col].Value); break; case HProSourceName8Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID8Col, 0, HProSourceName8Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID8Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty8Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName8Col].Value); break; case HProSourceName9Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID9Col, 0, HProSourceName9Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID9Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty9Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName9Col].Value); break; case HProSourceName10Col: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdProcBill, sRow, HProSourceID10Col, 0, HProSourceName10Col); Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceID10Col, DBUtility.ClsPub.isLong(grdProcBill.Rows[sRow].Cells[HProProcIDCol].Value), HProWorkQty10Col, sRow, oMain); oEdit.Text = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[sRow].Cells[HProSourceName10Col].Value); break; default: break; } break; } case 117: //F6 { switch (sCol) { default: break; } break; } default: break; } } //Ë¢ÐÂÈ«²¿×ÊÔ´ ²úÄÜ private void RefreshWorkQty() { //for (int i = 0; i < grdProcBill.RowCount; i++) //{ // if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value) != 0) // { // SetSourceWorkQty(i); // } //} } //ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceWorkQty(int iRow) { Sc_ICMOSortBillFun.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceIDCol, DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcIDCol].Value), HProWorkQtyCol, iRow, oMain); } //ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceRelationQty(int iRow) { //BLL.Sc_ProcAutoSortBillFun.SetSourceRelationQty(grdSourceBill, iRow, HICMOInterIDCol, HSourceIDCol, HRelationQtyCol, HSplitRelationQtyCol, oMain); } private void sc_Click_1(object sender, EventArgs e) { Sub_DeleteBill(); } //ɾ³ýµ¥¾Ý private void Sub_DeleteBill() { // ÅжÏÊÇ·ñÓл㱨 if (MessageBox.Show("È·¶¨ÒªÉ¾³ý´Ëµ¥¾Ý£¬±¾²Ù×÷²»¿É³·Ïú£¬Çë½÷É÷²Ù×÷£¡", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } if (grdSourceBill.SelectedRows == null) { return; } for (int i = grdSourceBill.SelectedRows.Count - 1; i >= 0; i--) { grdSourceBill.Rows.Remove(grdSourceBill.SelectedRows[i]); } } //ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç private void Sub_SetHandChangeFlag(int sCol, int sRow) { if (sCol < FixCols || sCol>=grdSourceBill.RowCount ) { return; } //BLL.Sc_ProcAutoSortBillFun.Sub_SetHandChangeFlag(grdSourceBill, sCol, sRow); } //ˢл㱨ÊýÁ¿ private void GetHRelationQty() { ////grid½ûֹˢР//grdSourceBill.Redraw = VSFlex7.RedrawSettings.flexRDNone; ////¼ÓÔØ±íÍ· //for(int i=grdSourceBill.FixedRows ;i= FixCols; c--) { //ÕÒµ½×î³Ù¼Æ»®ÈÕÆÚ if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[c].Value) != "") { dtimePai = DBUtility.ClsPub.isDate(grdMain.Columns[c].HeaderText); dtimeJiao = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HSecPlanEndDateCol].Value); if (dtimePai <= dtimeJiao) //×îºóÅųÌÈÕÆÚСÓÚµÈÓÚ½»»õ { for (int m =c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.LightGreen; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } else if (dtimeJiao.AddDays(-3) <= dtimePai && dtimePai < dtimeJiao) //×îºóÅųÌÈÕÆÚ Àë½»»õ3ÌìÄÚ { for (int m = c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.Gold; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } else if (dtimePai > dtimeJiao) //×îºóÅųÌÈÕÆÚ´óÓÚ½»»õ { for (int m = c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.Red; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } } } } //ȱÁÏ·ÖÎö //дһ¸ö¹ý³Ì£¬ÅжÏÊÇ·ñ ȱÁÏ for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { oDs = oCn.RunProcReturn("exec h_p_Sc_GetNeedMaterialQty " + txtHDeptID.Tag + "," + DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSecICMOInterIDCol].Value), "Gy_Czygl"); if (oDs == null || oDs.Tables[0].Rows.Count == 0) { for (int m = FixCols; m < grdMain.ColumnCount; m++) { grdMain.Rows[i].Cells[m].Style.ForeColor = Color.Black; } } else { for (int m = FixCols; m < grdMain.ColumnCount; m++) { grdMain.Rows[i].Cells[m].Style.ForeColor = Color.Blue; } } } } //Ëø¶¨ ½âËø ÈÎÎñµ¥ private void LockICMOBill(bool b, long HICMOInterID) { if (b) { try { oCn.RunProc("update Sc_WorkBillAutoSortBillMain set HBillStatus=10 where HICMOInterID=" + HICMOInterID.ToString()); return ; } catch (Exception e) { return ; } //ÕûÐлҵ×É« } else { try { oCn.RunProc("update Sc_WorkBillAutoSortBillMain set HBillStatus=0 where HICMOInterID=" + HICMOInterID.ToString()); return ; } catch (Exception e) { return ; } //»Ö¸´ µ×É« } } private void grdMain_DoubleClick(object sender, EventArgs e) { //Sc_ProcAutoSortBillQL oQL = new Sc_ProcAutoSortBillQL(); //if (grdMain.CurrentRow == null) // return; //oQL.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); //oQL.HICMOInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecICMOInterIDCol].Value); //oQL.ShowDialog(); } //ÉÏÉý private void up_Click(object sender, EventArgs e) { //ÅжÏÊÇ·ñÑ¡ÖÐÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow == null) return; //ÅжÏÊÇ·ñÊǵÚÒ»ÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow.Index == 0) return; //ÓëÉÏÒ»ÐжԻ» //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sc_ICMOSortBillFun.ChangeGridItemUp(grdSourceBill, grdSourceBill.CurrentRow.Index); //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; } //Ͻµ private void down_Click(object sender, EventArgs e) { //ÅжÏÊÇ·ñÑ¡ÖÐÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow == null) return; //ÅжÏÊÇ·ñÊǵÚÒ»ÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow.Index == grdSourceBill.ColumnCount - 1) return; //ÓëÉÏÒ»ÐжԻ» //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, grdSourceBill.CurrentRow.Index); //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; } private void msg_Click(object sender, EventArgs e) { BLL.OA_EmpMessageBill oEmpMessageBill; Int64 lngBillKey = 0; //ÕÒµ½ Ô´µ¥ÀàÐͺÍID oEmpMessageBill = new BLL.OA_EmpMessageBill(); oEmpMessageBill.HRelationInterID = lngBillKey; oEmpMessageBill.HRelationEntryID = lngBillKey; oEmpMessageBill.HRelationBillType = ModName; oEmpMessageBill.HRelationBillNo = ""; oEmpMessageBill.Show(); } private void sjb_Click(object sender, EventArgs e) { if (grdMain_t.Visible == false) { grdMain_t.Visible = true; // CopyGrid(); CountTimes(); UpdateAutoSortDate(); // DBUtility.ClsPub.GetGridView(grdMain_t, this.Name + "grdMain_t", DBUtility.ClsPub.AppPath); } else { grdMain_t.Visible = false; } } //¸üР¿ªÊ¼½áÊøÊ±¼ä private void UpdateAutoSortDate() { char a = Convert.ToChar("-"); string sYear = ""; string sDate = ""; DateTime sHBeginTime; DateTime sHEndTime; long HICMOInterID = 0; long HSourceID = 0; long HSubID = 0; try { for (int i = 0; i <= grdMain_t.RowCount - 1; i++) { for (int c = FixCols; c <= grdMain_t.ColumnCount - 1; c++) { sDate = DBUtility.ClsPub.isStrNull(grdMain_t.Rows[i].Cells[c].Value); if (sDate != "") { HICMOInterID = DBUtility.ClsPub.isLong(grdMain_t.Rows[i].Cells[HSecICMOInterIDCol].Value); HSourceID = DBUtility.ClsPub.isLong(grdMain_t.Rows[i].Cells[HSecSourceIDCol].Value); HSubID = c; sYear = DBUtility.ClsPub.isStrNull(grdMain.Columns[c].Tag); string[] s = sDate.Split(a); sHBeginTime = DBUtility.ClsPub.isDate(sYear + " " + s[0]); sHEndTime = DBUtility.ClsPub.isDate(sYear + " " + s[1]); oCn.RunProc("exec h_p_Sc_UpdateAutoSortDate " + HICMOInterID.ToString() + "," + HSourceID.ToString() + "," + HSubID.ToString() + ",'" + sHBeginTime.ToString() + "','" + sHEndTime.ToString() + "'"); } } } } catch (Exception e) { return; } } //¸´ÖÆÍø¸ñ private void CopyGrid() { DBUtility.Xt_BaseBillFun.initGridFst(grdMain_t, this.Name + "grdMain_t"); grdMain_t.RowCount = 0; grdMain_t.ColumnCount = 0; grdMain_t.RowCount = grdMain.RowCount; grdMain_t.ColumnCount = grdMain.ColumnCount; grdMain_t.ReadOnly = true; //¸´ÖƱêÌâ for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain_t.Columns[i].HeaderText = grdMain.Columns[i].HeaderText; grdMain_t.Columns[i].Tag = grdMain.Columns[i].Tag; grdMain_t.Columns[i].Visible = grdMain.Columns[i].Visible; grdMain_t.Columns[i].Width = grdMain.Columns[i].Width; } // for (int i = 0; i < grdMain.RowCount; i++) { for (int j = 0; j < grdMain.ColumnCount; j++) { grdMain_t.Rows[i].Cells[j].Value = grdMain.Rows[i].Cells[j].Value; } } } //¼ÆËãʱ¼ä private void CountTimes() { //µÃµ½Éϰàʱ¼ä ϰàʱ¼ä DateTime HBTime; DateTime HETime; HBTime = Convert.ToDateTime("08:00:00"); HETime = Convert.ToDateTime("16:00:00"); string HBeginTime = ""; string HEndTime = ""; int HQty = 0; double HUseTimes = 0; Single HWorkQty = 0; //µ¥Î»²úÄÜ string[] s; // for (int i = FixCols; i < grdMain_t.ColumnCount; i++) { for (int j = 0; j < grdMain_t.RowCount; j++) { if (i == Convert.ToInt32(FixCols) || j == 0 )//Èç¹ûÊǵÚÒ»ÁÐ »òÕßµÚÒ»ÐÐ { HBTime = Convert.ToDateTime("08:00:00"); } else { if (DBUtility.ClsPub.isStrNull(grdMain_t.Rows[j - 1].Cells[i].Value) == "") //ÉÏÐÐûÓÐÊý¾Ý { HBTime = Convert.ToDateTime("08:00:00"); } else { //µÃµ½ÉÏÐнáÊøÊ±¼ä s = DBUtility.ClsPub.isStrNull(grdMain_t.Rows[j-1].Cells[i].Value).Split(Convert.ToChar("-")); if (s.Length > 1) { HBTime = Convert.ToDateTime(s[1]); } else { HBTime = Convert.ToDateTime("08:00:00"); } } } HQty = DBUtility.ClsPub.isInt(grdMain_t.Rows[j].Cells[i].Value); if (HQty != 0) { HWorkQty = DBUtility.ClsPub.isSingle(grdMain_t.Rows[j].Cells[HSecWorkQtyCol].Value); //¸ù¾ÝÊýÁ¿¼ÆË㹤ʱ if (HWorkQty != 0) { HUseTimes = DBUtility.ClsPub.isDoule(HQty / HWorkQty); HETime = HBTime.AddHours(HUseTimes); HBeginTime = HBTime.ToShortTimeString(); HEndTime = HETime.ToShortTimeString(); grdMain_t.Rows[j].Cells[i].Value = HBeginTime + "-" + HEndTime; } else { grdMain_t.Rows[j].Cells[i].Value = "Òì³£"; } } else { grdMain_t.Rows[j].Cells[i].Value = ""; } } } } private void gq_Click(object sender, EventArgs e) { if (grdSourceBill.CurrentRow == null) { return; } long HInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); if (oMain.SetICMOBill_HangUp(HInterID)) { MessageBox.Show("±¾ÈÎÎñµ¥¹ÒÆð³É¹¦£¡"); return; } else { MessageBox.Show("±¾ÈÎÎñµ¥Î´Åų̣¬Çëµã»÷ɾ³ý£¡"); return; } } private void hfgq_Click(object sender, EventArgs e) { if (grdSourceBill.CurrentRow == null) { return; } long HInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); if (oMain.SetICMOBill_UnHangUp(HInterID)) { MessageBox.Show("±¾ÈÎÎñµ¥»Ö¸´³É¹¦£¡"); return; } else { MessageBox.Show("±¾ÈÎÎñµ¥Î´¹ÒÆð£¡"); return; } } private void grdProcBill_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { sAllowCol = "," + sAllowCol + ","; int i = grdProcBill.CurrentCell.ColumnIndex; string srow = "," + i.ToString() + ","; if (sAllowCol.IndexOf(srow) == -1) { e.Cancel = true; } } DataGridViewTextBoxEditingControl EditingControl; private void grdProcBill_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (this.EditingControl != null) //ÊÍ·Åʼþ { EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown); this.EditingControl = null; } } private void grdProcBill_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (grdProcBill.CurrentCell != null) { if (e.Control is DataGridViewTextBoxEditingControl) { this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control; //Ôö¼ÓίÍд¦Àí this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown); } } } private void EditingControl_KeyDown(object sender, KeyEventArgs e) { //ÒµÎñ´¦Àí Sub_GridKey(e.KeyValue, grdProcBill.CurrentRow.Index, grdProcBill.CurrentCell.ColumnIndex, EditingControl); } } }