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_ProcPlanMultilevelSortBill : Form { public Sc_ProcPlanMultilevelSortBill() { InitializeComponent(); } //¶¨ÒåÁÐ public const Int16 FixCols = 20; //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 HWorkShopLevCol = 17; //³µ¼ä´ÎÐò public const Int16 HWorkQtyRateCol = 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; public const Int16 HReadyMaterCol = 40; public const Int16 HBatchNoCol = 41; //ÈÎÎñµ¥ÅúºÅ public const Int16 HKTQCol = 42; public const Int16 HReadyQtyCol = 43; //¿â´æÆëÌ× public const Int16 HReadyQtyOnLoadCol = 44; //ÔÚ;ÆëÌ× public const Int16 HSortCol = 45;//ÅÅÐòÁÐ public const Int16 HWorkShopIDCol = 46; //³µ¼äÄÚÂë public const Int16 HWorkShopCol = 47; //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; public const Int16 HSecInterIDCol = 18; public const Int16 HSecSortCol = 19;//ÅÅÐòÁÐ //grdProcBill public const Int16 HProICMOBillNoCol = 1; public const Int16 HProProcNoCol = 2; public const Int16 HProProcNameCol = 3; public const Int16 HProMaterNumberCol = 4; public const Int16 HProMaterNameCol = 5; public const Int16 HProMaterModelCol = 6; public const Int16 HProUnitNumberCol = 7; public const Int16 HProUnitNameCol = 8; public const Int16 HProPlanQtyCol = 9; public const Int16 HProRelationQtyCol = 10; public const Int16 HProSourceIDCol = 11; public const Int16 HProSourceNameCol = 12; public const Int16 HSplitQtyCol = 13; public const Int16 HProWorkQtyCol = 14; //²úÄÜ public const Int16 HProSourceNumberCol = 15; public const Int16 HProSourceID2Col = 16; public const Int16 HProSourceName2Col = 17; public const Int16 HSplitQty2Col = 18; public const Int16 HProWorkQty2Col = 19; //²úÄÜ public const Int16 HProSourceNumber2Col = 20; public const Int16 HProSourceID3Col = 21; public const Int16 HProSourceName3Col = 22; public const Int16 HSplitQty3Col = 23; public const Int16 HProWorkQty3Col = 24; //²úÄÜ public const Int16 HProSourceNumber3Col = 25; public const Int16 HProSourceID4Col = 26; public const Int16 HProSourceName4Col = 27; public const Int16 HSplitQty4Col = 28; public const Int16 HProWorkQty4Col = 29; //²úÄÜ public const Int16 HProSourceNumber4Col = 30; public const Int16 HProSourceID5Col = 31; public const Int16 HProSourceName5Col = 32; public const Int16 HSplitQty5Col = 33; public const Int16 HProWorkQty5Col = 34; //²úÄÜ public const Int16 HProSourceNumber5Col = 35; public const Int16 HProSourceID6Col = 36; public const Int16 HProSourceName6Col = 37; public const Int16 HSplitQty6Col = 38; public const Int16 HProWorkQty6Col = 39; //²úÄÜ public const Int16 HProSourceNumber6Col = 40; public const Int16 HProSourceID7Col = 41; public const Int16 HProSourceName7Col = 42; public const Int16 HSplitQty7Col = 43; public const Int16 HProWorkQty7Col = 44; //²úÄÜ public const Int16 HProSourceNumber7Col = 45; public const Int16 HProSourceID8Col = 46; public const Int16 HProSourceName8Col = 47; public const Int16 HSplitQty8Col = 48; public const Int16 HProWorkQty8Col = 49; //²úÄÜ public const Int16 HProSourceNumber8Col = 50; public const Int16 HProSourceID9Col = 51; public const Int16 HProSourceName9Col = 52; public const Int16 HSplitQty9Col = 53; public const Int16 HProWorkQty9Col = 54; //²úÄÜ public const Int16 HProSourceNumber9Col = 55; public const Int16 HProSourceID10Col = 56; public const Int16 HProSourceName10Col = 57; public const Int16 HSplitQty10Col = 58; public const Int16 HProWorkQty10Col = 59; //²úÄÜ public const Int16 HProInterIDCol = 60; public const Int16 HProProdTimesCol = 61; //Éú²úÖÜÆÚ= ´Ó¹¤ÒÕ·Ïß »ñÈ¡£¬ ¿ª¹¤µ½ Èë¿â ʱ¼ä public const Int16 HProWorkTimesCol =62; public const Int16 HProYXCol = 63; public const Int16 HProOrderLevCol = 64; public const Int16 HProKTQCol = 65; public const Int16 HProReadyQtyCol = 66; //¿ª¹¤ÓàÁ¿ public const Int16 HProPlanBeginDateCol = 67; //¼Æ»®¿ª¹¤ public const Int16 HProPlanEndDateCol = 68; //¼Æ»®Í깤 public const Int16 HProLastBeginDateCol = 69; //×î³Ù¿ª¹¤=×î³ÙÍ깤-Éú²úÖÜÆÚ£¨×î¶ÌÖÜÆÚ£© public const Int16 HProLastEndDateCol = 70; //×î³ÙÍ깤=¶©µ¥½»»õÆÚ-ÌáǰÆÚ public const Int16 HProOrderNeedQtyCol = 71; //¶©µ¥ÐèÇóÊý public const Int16 HProCusNameCol = 72; // ¿Í»§ public const Int16 HProSeOrderBillNoCol =73; //¶©µ¥ºÅ public const Int16 HProOrderCommitDateCol = 74; //¶©µ¥½»»õÆÚ=ÓëÔ¤²âµ¥³åÏúµÄ¶©µ¥×îÔç½»»õÆÚ¡£ public const Int16 HProRemarkCol =75; public const Int16 HProProcIDCol = 76; public const Int16 HProMaterIDCol = 77; public const Int16 HProSourceInterIDCol = 78; public const Int16 HProSourceEntryIDCol = 79; public const Int16 HProSourceBillTypeCol = 70; public const Int16 HProICMOInterIDCol = 81; public const Int16 HProSeOrderInterIDCol = 82; public const Int16 HProSeOrderEntryIDCol = 83; public const Int16 HProSourceBillNoCol = 84; public const Int16 HProLockedCol = 85; public const Int16 HProProcPlanInterIDCol = 86; public const Int16 HProProcPlanEntryIDCol = 87; public const Int16 HProBeginDayQtyCol = 88; //¿ª¹¤ÓàÁ¿£¨ÊýÁ¿£© public const Int16 HProBeginFixQtyCol = 89; //¿ª¹¤ÓàÁ¿£¨ÌìÊý£© public const Int16 HProUnitIDCol = 90; public const Int16 HProCenterIDCol = 91; public const Int16 HProDayWorkQtyCol = 92; public const Int16 HProHReadyTimeCol = 93; //×¼±¸Ê±¼ä public const Int16 HProWorkShopIDCol = 94; public const Int16 HProWorkShopCol = 95; // 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_ProcPlanMultilevelSortBillDlg oDlg = new Sc_ProcPlanMultilevelSortBillDlg(); BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar(); // bool bEdit = false; //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return false; //return BLL.Sc_ProcPlanMultilevelSortBillFun.IsSelectCell(grdSourceBill, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow,int iCol) { return false; //return BLL.Sc_ProcPlanMultilevelSortBillFun.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 = 48; //×ÜÁÐÊý DBUtility.Xt_BaseBillFun.initGridFst(grdSourceBill, this.Name); grdSourceBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect; grdSourceBill.RowCount = 0; grdSourceBill.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //= grdSourceBill.Columns[HReadyQtyOnLoadCol].HeaderText = "ÔÚ;ÆëÌ×"; grdSourceBill.Columns[HSortCol].HeaderText = "ÅÅÐòÁÐ"; grdSourceBill.Columns[HWorkQtyRateCol].HeaderText = "²úÄܱÈ"; grdSourceBill.Columns[HWorkShopLevCol].HeaderText = "³µ¼ä´ÎÐò"; 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[HOrderNeedQtyCol].HeaderText = "¿â´æÊýÁ¿"; grdSourceBill.Columns[HRemarkCol].HeaderText = "±¸×¢"; grdSourceBill.Columns[HOrderCommitDateCol].HeaderText = "¶©µ¥½»»õÆÚ"; grdSourceBill.Columns[HSourceBillNoCol].HeaderText = "Ô´µ¥ºÅ"; grdSourceBill.Columns[HSourceBillTypeCol].HeaderText = "Ô´µ¥ÀàÐÍ"; grdSourceBill.Columns[HLockedCol].HeaderText = "Ëø¶¨±ê¼Ç"; grdSourceBill.Columns[HHangUpCol].HeaderText = "¹ÒÆð±ê¼Ç"; grdSourceBill.Columns[HReadyMaterCol].HeaderText = "ÆëÁϱê¼Ç"; grdSourceBill.Columns[HBatchNoCol].HeaderText = "Åú´Î"; grdSourceBill.Columns[HWorkShopCol].HeaderText = "³µ¼ä"; ////Òþ²ØÁÐ grdSourceBill.Columns[0].Visible = false; grdSourceBill.Columns[HMaterIDCol].Visible = false; grdSourceBill.Columns[HWorkShopIDCol].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.Columns[HHangUpCol].Visible = false; grdSourceBill.Columns[HWorkQtyCol].Visible = false; grdSourceBill.Columns[HProdTimesCol].Visible = false; grdSourceBill.Columns[HWorkTimesCol].Visible = false; grdSourceBill.Columns[HBeginDayQtyCol].Visible = false; grdSourceBill.Columns[HBeginFixQtyCol].Visible = false; grdSourceBill.Columns[HLastBeginDateCol].Visible = false; grdSourceBill.Columns[HLastEndDateCol].Visible = false; grdSourceBill.Columns[HCusNameCol].Visible = false; grdSourceBill.Columns[HSourceNameCol].Visible = false; grdSourceBill.Columns[HSourceBillTypeCol].Visible = false; grdSourceBill.Columns[HSourceBillNoCol].Visible = false; grdSourceBill.Columns[HReadyMaterCol].Visible = false; grdSourceBill.Columns[HBatchNoCol].Visible = false; grdSourceBill.Columns[HReadyQtyOnLoadCol].Visible = false; grdSourceBill.Columns[HReadyQtyCol].Visible = false; // //// grdSourceBill.ReadOnly = false; /////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[HSecSortCol].HeaderText = "´ÎÐòÁÐ"; // grdMain.Columns[0].Visible = false; grdMain.Columns[HSecInterIDCol].Visible = false; grdMain.Columns[HSecICMOInterIDCol].Visible = false; grdMain.Columns[HSecSourceIDCol].Visible = false; grdMain.Columns[HSecMaterIDCol].Visible = false; grdMain.Columns[HSecProcNoCol].Visible = false; grdMain.Columns[HSecProcNumberCol].Visible = false; grdMain.ReadOnly = false; for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; //ÁÐ ÅÅÐòģʽ } // /////grdProcBill grdProcBill.ColumnCount = 96; //×ÜÁÐÊý 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[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[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[HProHReadyTimeCol].HeaderText = "×¼±¸Ê±¼ä"; grdProcBill.Columns[HProWorkShopCol].HeaderText = "³µ¼ä"; //grdProcBill.Columns[HProOrderLevCol].HeaderText = "³µ¼ä"; ////Òþ²ØÁÐ grdProcBill.Columns[0].Visible = false; grdProcBill.Columns[HProMaterIDCol].Visible = false; grdProcBill.Columns[HProWorkShopIDCol].Visible = false; grdProcBill.Columns[HProUnitIDCol].Visible = false; grdProcBill.Columns[HProKTQCol].Visible = false; grdProcBill.Columns[HProICMOInterIDCol].Visible = false;// grdProcBill.Columns[HProProcIDCol].Visible = false; grdProcBill.Columns[HProUnitNumberCol].Visible = false; grdProcBill.Columns[HProSourceInterIDCol].Visible = false; grdProcBill.Columns[HProSourceEntryIDCol].Visible = false; grdProcBill.Columns[HProSourceBillTypeCol].Visible = false; grdProcBill.Columns[HProSeOrderEntryIDCol].Visible = false; grdProcBill.Columns[HProSeOrderInterIDCol].Visible = false; grdProcBill.Columns[HProLastEndDateCol].Visible = false; grdProcBill.Columns[HProLastBeginDateCol].Visible = false; grdProcBill.Columns[HProCenterIDCol].Visible = false; grdProcBill.Columns[HProDayWorkQtyCol].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; grdProcBill.Columns[HProReadyQtyCol].Visible = false; /////////////////////////////// grdProcBill.Columns[HProProcNoCol].Visible = false; grdProcBill.Columns[HSplitQtyCol].Visible = false; //grdProcBill.Columns[HProProdTimesCol].Visible = false; grdProcBill.Columns[HProSourceBillNoCol].Visible = false; grdProcBill.Columns[HProSourceBillTypeCol].Visible = false; grdProcBill.Columns[HProProcPlanInterIDCol].Visible = false; grdProcBill.Columns[HProProcPlanEntryIDCol].Visible = false; grdProcBill.Columns[HProSourceBillTypeCol].Visible = false; grdProcBill.Columns[HProHReadyTimeCol].Visible = false; grdProcBill.Columns[HProBeginDayQtyCol].Visible = false; grdProcBill.Columns[HProBeginFixQtyCol].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[HProSourceNumberCol].Visible = false; grdProcBill.Columns[HProSourceNumber2Col].Visible = false; grdProcBill.Columns[HProSourceNumber3Col].Visible = false; grdProcBill.Columns[HProSourceNumber4Col].Visible = false; grdProcBill.Columns[HProSourceNumber5Col].Visible = false; grdProcBill.Columns[HProSourceNumber6Col].Visible = false; grdProcBill.Columns[HProSourceNumber7Col].Visible = false; grdProcBill.Columns[HProSourceNumber8Col].Visible = false; grdProcBill.Columns[HProSourceNumber9Col].Visible = false; grdProcBill.Columns[HProInterIDCol].Visible = false; //grdProcBill.Columns[HProSourceNameCol].Visible = false; grdProcBill.Columns[HProSourceName2Col].Visible = false; grdProcBill.Columns[HProSourceName3Col].Visible = false; grdProcBill.Columns[HProSourceName4Col].Visible = false; grdProcBill.Columns[HProSourceName5Col].Visible = false; grdProcBill.Columns[HProSourceName6Col].Visible = false; grdProcBill.Columns[HProSourceName7Col].Visible = false; grdProcBill.Columns[HProSourceName8Col].Visible = false; grdProcBill.Columns[HProSourceName9Col].Visible = false; grdProcBill.Columns[HProSourceName10Col].Visible = false; //ÔÝʱÒþ²Ø ×ÊÔ´6 7,8,9£¬10 grdProcBill.Columns[HProSourceName2Col].Visible = false; grdProcBill.Columns[HProWorkQty2Col].Visible = false; grdProcBill.Columns[HSplitQty2Col].Visible = false; grdProcBill.Columns[HProSourceName3Col].Visible = false; grdProcBill.Columns[HProWorkQty3Col].Visible = false; grdProcBill.Columns[HSplitQty3Col].Visible = false; grdProcBill.Columns[HProSourceName4Col].Visible = false; grdProcBill.Columns[HProWorkQty4Col].Visible = false; grdProcBill.Columns[HSplitQty4Col].Visible = false; grdProcBill.Columns[HProSourceName5Col].Visible = false; grdProcBill.Columns[HProWorkQty5Col].Visible = false; grdProcBill.Columns[HSplitQty5Col].Visible = false; grdProcBill.Columns[HProSourceName6Col].Visible = false; grdProcBill.Columns[HProWorkQty6Col].Visible = false; grdProcBill.Columns[HSplitQty6Col].Visible = false; grdProcBill.Columns[HProSourceName7Col].Visible = false; grdProcBill.Columns[HProWorkQty7Col].Visible = false; grdProcBill.Columns[HSplitQty7Col].Visible = false; grdProcBill.Columns[HProSourceName8Col].Visible = false; grdProcBill.Columns[HProWorkQty8Col].Visible = false; grdProcBill.Columns[HSplitQty8Col].Visible = false; grdProcBill.Columns[HProSourceName9Col].Visible = false; grdProcBill.Columns[HProWorkQty9Col].Visible = false; grdProcBill.Columns[HSplitQty9Col].Visible = false; grdProcBill.Columns[HProSourceName10Col].Visible = false; grdProcBill.Columns[HProWorkQty10Col].Visible = false; grdProcBill.Columns[HSplitQty10Col].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(60); 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(); DAL.ClsGy_ProcMul_View oProc = new DAL.ClsGy_ProcMul_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(999); ////¸ù¾Ý²¿Ãŵõ½Ä¬ÈÏ×ÊÔ´ //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½ûֹˢР//¼ÓÔØ ÈÎÎñµ¥ÐÅÏ¢ 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; grdSourceBill.Rows[i].Cells[HWorkShopIDCol].Value = oModel.HWorkShopID; if (oDept.GetInfoByID(oModel.HWorkShopID)) { grdSourceBill.Rows[i].Cells[HWorkShopCol].Value = oDept.omodel.HName; grdSourceBill.Rows[i].Cells[HWorkShopLevCol].Value = oDept.omodel.HWorkShopLev; } //if (oModel.Horderlev == "") //{ // grdSourceBill.Rows[i].Cells[HOrderLevCol].Value = "±¸¿â"; //} grdSourceBill.Rows[i].Cells[HBatchNoCol].Value = oModel.HBatchNo; //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(); grdSourceBill.Rows[i].Cells[HOrderNeedQtyCol].Value = oModel.HOrderNeedQty.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 = ""; } i++; // } //¼ÓÔØ¹¤ÒÕ i = 0; int nm = 0; foreach (Model.ClsSc_WorkBillAutoSortBillMain oMod in oMain.Main2Coll) { if (nm >= grdProcBill.Rows.Count) { grdProcBill.RowCount = grdProcBill.Rows.Count + 1; } grdProcBill.Rows[nm].Cells[HProInterIDCol].Value = oMod.HInterID.ToString(); grdProcBill.Rows[nm].Cells[HProICMOInterIDCol].Value = oMod.HICMOInterID.ToString(); grdProcBill.Rows[nm].Cells[HProICMOBillNoCol].Value = oMod.HICMOBillNo.ToString(); grdProcBill.Rows[nm].Cells[HProMaterIDCol].Value = oMod.HMaterID.ToString(); if (oMater.GetInfoByID(oMod.HMaterID)) { grdProcBill.Rows[nm].Cells[HProMaterNumberCol].Value = oMater.omodel.HNumber; grdProcBill.Rows[nm].Cells[HProMaterNameCol].Value = oMater.omodel.HName; grdProcBill.Rows[nm].Cells[HProMaterModelCol].Value = oMater.omodel.HModel; } grdProcBill.Rows[nm].Cells[HProUnitIDCol].Value = oMod.HUnitID.ToString(); if (oUnit.GetInfoByID(oMod.HUnitID)) { grdProcBill.Rows[nm].Cells[HProUnitNumberCol].Value = oUnit.omodel.HNumber; grdProcBill.Rows[nm].Cells[HProUnitNameCol].Value = oUnit.omodel.HName; } grdProcBill.Rows[nm].Cells[HProPlanQtyCol].Value = oMod.HPlanQty.ToString(); grdProcBill.Rows[nm].Cells[HProRelationQtyCol].Value = oMod.HRelationQty.ToString(); grdProcBill.Rows[nm].Cells[HProWorkTimesCol].Value = oMod.HWorkTimes.ToString(); grdProcBill.Rows[nm].Cells[HProPlanBeginDateCol].Value = oMod.HPlanBeginDate.ToShortDateString(); grdProcBill.Rows[nm].Cells[HProPlanEndDateCol].Value = oMod.HPlanEndDate.ToShortDateString(); grdProcBill.Rows[nm].Cells[HProProdTimesCol].Value = oMod.HProdTimes.ToString(); grdProcBill.Rows[nm].Cells[HProWorkQtyCol].Value = oMod.HWorkQty.ToString(); grdProcBill.Rows[nm].Cells[HProYXCol].Value = oMod.HYX.ToString(); grdProcBill.Rows[nm].Cells[HProSourceIDCol].Value = oMod.HSourceID.ToString(); if (oSource.GetInfoByID(oMod.HSourceID)) { grdProcBill.Rows[nm].Cells[HProSourceNameCol].Value = oSource.omodel.HNumber; grdProcBill.Rows[nm].Cells[HProSourceNumberCol].Value = oSource.omodel.HName; } grdProcBill.Rows[nm].Cells[HProWorkShopIDCol].Value = oMod.HWorkShopID.ToString(); if (oDept.GetInfoByID(oMod.HWorkShopID)) { grdProcBill.Rows[nm].Cells[HProWorkShopCol].Value = oDept.omodel.HName; //grdProcBill.Rows[i].Cells[HProWorkShopLevCol].Value = oDept.omodel.HWorkShopLev; } grdProcBill.Rows[nm].Cells[HProProcIDCol].Value = oMod.HProcID.ToString(); grdProcBill.Rows[nm].Cells[HProProcPlanInterIDCol].Value =oMod.HProcPlanInterID.ToString(); grdProcBill.Rows[nm].Cells[HProProcPlanEntryIDCol].Value = oMod.HProcPlanEntryID.ToString(); grdProcBill.Rows[nm].Cells[HProProcNoCol].Value = ""; if (oProc.GetInfoByID(oMod.HProcID)) { grdProcBill.Rows[nm].Cells[HProProcNameCol].Value = oProc.omodel.HName; } grdProcBill.Rows[nm].Cells[HProSourceInterIDCol].Value =oMod.HSourceInterID.ToString(); grdProcBill.Rows[nm].Cells[HProSourceEntryIDCol].Value =oMod.HSourceEntryID.ToString(); grdProcBill.Rows[nm].Cells[HProSourceBillTypeCol].Value =oMod.HSourceBillType; grdProcBill.Rows[nm].Cells[HProSourceBillNoCol].Value =oMod.HSourceBillNo; grdProcBill.Rows[nm].Cells[HProBeginFixQtyCol].Value =""; grdProcBill.Rows[nm].Cells[HProBeginDayQtyCol].Value =""; //grdProcBill.Rows[nm].Cells[HProHReadyTimeCol].Value = ""; if (oMod.HLocked) { grdProcBill.Rows[nm].Cells[HProLockedCol].Value = "Y"; } else { grdProcBill.Rows[nm].Cells[HProLockedCol].Value = ""; } grdProcBill.Rows[nm].Cells[HProOrderLevCol].Value = oMod.Horderlev; nm++; } //¼ÓÔØÒÑÅÅ³Ì Êý¾Ý i = 0; Int64 iInterID = 0; foreach (Model.ClsSc_WorkBillAutoSortBillMain oM in oMain.Main2Coll) { if (i >= grdMain.Rows.Count) { grdMain.RowCount = grdMain.Rows.Count + 1; } grdMain.Rows[i].Cells[HSecSourceIDCol].Value = oM.HSourceID.ToString(); if (oSource.GetInfoByID(oM.HSourceID)) { grdMain.Rows[i].Cells[HSecSourceNumberCol].Value = oSource.omodel.HNumber; grdMain.Rows[i].Cells[HSecSourceNameCol].Value = oSource.omodel.HName; } if (oProc.GetInfoByID(oM.HProcID)) { grdMain.Rows[i].Cells[HSecProcNumberCol].Value = oProc.omodel.HNumber; grdMain.Rows[i].Cells[HSecProcNameCol].Value = oProc.omodel.HName; } grdMain.Rows[i].Cells[HSecMaterIDCol].Value = oM.HMaterID.ToString(); if (oMater.GetInfoByID(oM.HMaterID)) { grdMain.Rows[i].Cells[HSecMaterNumberCol].Value = oMater.omodel.HNumber; grdMain.Rows[i].Cells[HSecMaterNameCol].Value = oMater.omodel.HName; grdMain.Rows[i].Cells[HSecMaterModelCol].Value = oMater.omodel.HModel; } grdMain.Rows[i].Cells[HSecICMOBillNoCol].Value = oM.HICMOBillNo; grdMain.Rows[i].Cells[HSecICMOInterIDCol].Value = oM.HICMOInterID.ToString(); //grdMain.Rows[i].Cells[HSecProcNoCol].Value = oM.hp; grdMain.Rows[i].Cells[HSecPlanEndDateCol].Value = oM.HPlanEndDate.ToShortDateString(); grdMain.Rows[i].Cells[HSecYXCol].Value = oM.HYX.ToString(); grdMain.Rows[i].Cells[HSecPlanQtyCol].Value = oM.HPlanQty.ToString(); grdMain.Rows[i].Cells[HSecLeftQtyCol].Value = oM.HRelationQty.ToString(); grdMain.Rows[i].Cells[HSecWorkQtyCol].Value = oM.HWorkQty.ToString(); grdMain.Rows[i].Cells[HSecInterIDCol].Value = oM.HInterID.ToString(); grdMain.Rows[i].Cells[HSecSortCol].Value =oM.HSourceID.ToString() + "-" + oM.HYX.ToString(); i++; } foreach (Model.ClsSc_WorkBillAutoSortBillSub oSub in oMain.DetailColl) { //ÉèÖÃ×Ó±íÐÅÏ¢ for (int j = 0; j < grdMain.RowCount; j++) { for (int m = FixCols; m < grdMain.ColumnCount; m++) { if (DBUtility.ClsPub.isStrNull(grdMain.Columns[m].HeaderText) == oSub.HDate.ToShortDateString().Substring(5, 5) && oSub.HInterID == DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HSecInterIDCol].Value) ) { if (oSub.HQty != 0) { grdMain.Rows[j].Cells[m].Value = oSub.HQty.ToString(); } else { grdMain.Rows[j].Cells[m].Value = ""; } break; } } } } //Åų̽á¹û ÅÅÐò grdMain.Sort(grdMain.Columns[HSecSourceIDCol], ListSortDirection.Ascending); //»­Ïß GraphLine(); //½»»õÆÚ¹ýÆÚ ±äÉ« AddColor(); //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); //»Ö¸´Ë¢Ð // } //AfterEdit //¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ private bool CheckJHS(int iRow) { return true; //return BLL.Sc_ProcPlanMultilevelSortBillFun.CheckJHS(grdSourceBill, HICMoBillNoCol, HSplitPlanQtyCol, HPlanQtyCol, iRow); } //ÅųÌǰ¼ì²é private bool CheckSetupData() { if (grdSourceBill.RowCount == 0) { MessageBox.Show("ûÓÐÈκε¥¾Ý£¬²»ÔÊÐíÅų̣¡"); return false; } if (!RowCount()) { return false; } return true; } //½»»õÆÚ ³¬ÆÚʱ ±äÉ« private void AddColor() { //BLL.Sc_ProcPlanMultilevelSortBillFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { bool bResult; List oClsGridValues = new List(); oClsGridValues.Clear(); lblCaption.Focus(); // if (!AllowSave()) { MessageBox.Show("²»ÔÊÐí±£´æ£¡"); return; } //ȨÏÞÅÐ¶Ï //ɾ³ýÈ«²¿Î´Ëø¶¨µÄ±¾²¿Ãŵ¥¾Ý£¬»òÕß×÷·Ï Sub_DeleteBillUnLock(); //µÃµ½Ò»¸öÄÚÂë Int64 HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); // DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); //Ñ­»· for (int i = 0; i < grdProcBill.Rows.Count; i++) { Model.ClsSc_WorkBillAutoSortBillMain oModel = new Model.ClsSc_WorkBillAutoSortBillMain(); oMain.DetailColl = new List(); oMain.MainColl.Clear(); // oModel.HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); oModel.HBillNo = ""; oModel.HYear = 2012; oModel.HPeriod = 1; oModel.HDate = MainDate; oModel.HDeptID = 999; oModel.HMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].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.HWorkShopID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProWorkShopIDCol].Value); oModel.Horderlev = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProOrderLevCol].Value); oModel.HUnitID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProUnitIDCol].Value); oModel.HYX = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProYXCol].Value); // oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProPlanBeginDateCol].Value); oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProPlanEndDateCol].Value); oModel.HLastBeginDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value); oModel.HLastEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastEndDateCol].Value); oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].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.HProcID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value); oModel.HKTQ = DBUtility.ClsPub.isBool(grdProcBill.Rows[i].Cells[HProKTQCol].Value); oModel.HWorkQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); oModel.HReadyTimes = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProReadyQtyCol].Value); oModel.HRemark = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProRemarkCol].Value); oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); oModel.HMakeDate = MainDate.ToShortDateString(); oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProSourceInterIDCol].Value); oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProSourceEntryIDCol].Value); oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProSourceBillNoCol].Value); oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProSourceBillTypeCol].Value); oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProICMOBillNoCol].Value); oModel.HProcPlanEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanEntryIDCol].Value); oModel.HProcPlanInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanInterIDCol].Value); oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProSeOrderBillNoCol].Value); oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProSeOrderInterIDCol].Value); oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProSeOrderEntryIDCol].Value); oModel.HOrderCommitDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProOrderCommitDateCol].Value); // oMain.MainColl.Add(oModel); // Sc_ICMOSortBillFun.SaveGridSub(grdMain, grdMain, FixCols, oMain, MainDate, oModel.HWorkQty, ref i, oClsGridValues); //±£´æÍê±Ïºó´¦Àí bResult = oMain.AddBill(999, HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo); //Ìáʾ if (bResult == true) { //MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); } } ////´æÈëÉú²ú״̬±í oCn.RunProc("exec h_p_Sc_WorkAutoBillStatus_Add 999"); ////µÃµ½×îÐÂÅÅ³Ì GetPcTime(); } //±£´æµ¥ÐÐ sCol=×ÊÔ´ÄÚÂëÁÐ private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List oClsGridValues,int sCol,ref Int64 iHInterID) { 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); iHInterID = oModel.HInterID; oModel.HBillNo = ""; oModel.HYear = 2012; oModel.HPeriod = 1; oModel.HDate = MainDate; oModel.HDeptID = 999; oModel.HMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[sCol].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.HWorkShopID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProWorkShopIDCol].Value); oModel.Horderlev = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[iRow].Cells[HProOrderLevCol].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.HProcID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcIDCol].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(999, HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo); // grdMain.Rows[iRowSub].Cells[HSecInterIDCol].Value = oModel.HInterID; //Ìáʾ 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_ProcPlanMultilevelSortBillFun.AllowRow(grdSourceBill); } //ÅÅ³Ì private bool DateSetup(bool bAuto) { int iInStockDays = 0; 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; Int64 lInterID = 0; string sMaterNumber = ""; string sMaterName = ""; string sMaterModel = ""; string sProcNumber = ""; string sProcName = ""; string sMouldNumber = "";//Ä£¾ß±àºÅ string sMouldPreNumber = "";//Éϵ¥Ä£¾ß±àºÅ DateTime dEndDate = DateTime.Today; Single sProdTimes = 0; Single sPlanQty = 0; Single iLeftQty = 0; Single sWorkQty=0; double dChangeTimes = 0;//»»²ú»»Ä£Õ¼ÓÃʱ¼ä string sYX; Int64 HRelationInterID; bool bFind = false; DataSet ds; DataSet dsSub; DataSet dsPre;//ÉϵÀ¹¤ÐòÕ¼ÓÃʱ¼ä DateTime dWorkBeginTime;//¸ù¾Ý×ÊÔ´ ÉϵÀ¹¤Ðò ÉϵÀÒÆ½» ʱ¼ä »ñÈ¡ ¿É¿ªÊ¼Ê±¼ä DateTime dWorkBeginTimeByMater=DateTime.Today; //¸ù¾Ý¿â´æ»ñÈ¡¿É¿ªÊ¼Ê±¼ä DateTime dWorkEndTime; 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(); //Çå¿ÕÒÑÅų̻º´æ oClsGridValues.Clear(); //°´ÈÎÎñµ¥ÓÅÏȼ¶ Ñ­»· ¹¤Ðò¼Æ»®µ¥ for (int i = 0; i < grdProcBill.RowCount; i++) { oClsGridValues.Clear(); if (i == 7) { i = i; } //ÕÒµ½±¾ÈÎÎñµ¥ ¿ÉÓÃÉú²ú×ÊÔ´ //lInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[hpro].Value); 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); iInStockDays = DBUtility.ClsPub.isInt(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value); sWorkQty = 0; dChangeTimes = 0; sYX = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProYXCol].Value); lProcProcNo = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); //if (sYX == 0) //{ // i = i; //} //»ñÈ¡ Ê£Óà¼Æ»®ÊýÁ¿ iLeftQty = sPlanQty - DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProRelationQtyCol].Value); //Èç¹ûËø¶¨¼Æ»®£¬Ôò²»ÐèÒªÔÙÅÅ³Ì if (DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProLockedCol].Value) == "Y") { //½«Êý¾ÝÅŵ½Íø¸ñÖÐ 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[HSecSortCol].Value = lSourceID.ToString() + "-" + sYX.ToString(); grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; //¼ÓÔØÈÕÆÚ¼Æ»® // continue; } // int sCol = 0; sCol = HProSourceIDCol; // if (dEndDate < DBUtility.ClsPub.isDate("2000-01-01")) { dEndDate =Convert.ToDateTime( "2100-01-01"); } //Èô±¾ÈÎÎñµ¥ÒÑÓа²ÅÅ×ÊÔ´£¨ÉÏ´ÎÅų̻òÕßÊÖ¹¤Åų̣© Ôò²»ÔÙѰÕÒ×ÊÔ´£¬Ö±½ÓÅÅ³Ì if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol].Value) != 0 && DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[sCol + 1].Value)!="") { //»ñÈ¡ ¶ÔÓ¦ Éú²ú×ÊÔ´¡£' lSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol].Value); sWorkQty = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol+3].Value); sSourceName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[sCol+1].Value); //iLeftQty = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol + 2].Value); sSourceNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[sCol + 4].Value); } else // { //ûÓÐ×ÊÔ´Ôò ×Ô¶¯ÕÒµ½ Ö¸¶¨×ÊÔ´¼°²úÏß lSourceID = Sc_ICMOSortBillFun.GetFixWorkLineSourceByInfo(oCn, lMaterID, dEndDate, lProcPlanInterID, lProcPlanEntryID, ref sSourceName, ref sSourceNumber); if (lSourceID == 0) //ûÓпÉÒÔÅŵÄ×ÊÔ´ { //Ìøµ½ÏÂÒ»µ¥ ±¾µ¥ºìÉ«ÏÔʾ grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; continue; } else { //дÈë×ÊÔ´ grdProcBill.Rows[i].Cells[sCol].Value = lSourceID; grdProcBill.Rows[i].Cells[sCol + 1].Value = sSourceName; grdProcBill.Rows[i].Cells[sCol + 2].Value = iLeftQty; grdProcBill.Rows[i].Cells[sCol + 4].Value = sSourceNumber; } } grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.White; //¿ªÊ¼Åŵ¥ bFind = false; if (iLeftQty > 0) { if (lSourceID == 1066) { lSourceID = lSourceID; } if (lICMOInterID == 338827) { lICMOInterID = lICMOInterID; lProcPlanInterID = lProcPlanInterID; lProcPlanEntryID = lProcPlanEntryID; } //¸ù¾Ý¿â´æ »ñÈ¡ ÀíÂÛ¿É¿ª¹¤ÈÕÆÚ //dWorkBeginTimeByMater = Sc_ICMOSortBillFun.Sc_GetBeginWorkTimeByMater(oCn, lICMOInterID, lProcPlanInterID, lProcPlanEntryID); //¼ÆË㿪ʼʱ¼ä dWorkBeginTime = Sc_ICMOSortBillFun.Sc_GetBeginWorkTimeByLineSource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); if (dWorkBeginTimeByMater > DateTime.Today.AddDays(60)) {//ûÓÐ×ã¹»¿â´æ ±³¾° »ÆÉ« grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Yellow; continue; } if (dWorkBeginTime == null) ////ûÓÐÕÒµ½²úÏß ±³¾° ºìÉ« { grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Red; continue; } else { if (dWorkBeginTimeByMater > dWorkBeginTime)//Èç¹û¿â´æ³ä×ãÈÕÆÚ ´óÓÚ ×ÊÔ´¿ÕÏÐÈÕÆÚ Ôò°´ ´óµÄÈÕÆÚÖ´ÐÐ { dWorkBeginTime = dWorkBeginTimeByMater; } //½«Êý¾ÝÅŵ½Íø¸ñÖÐ 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[HSecSortCol].Value = lSourceID.ToString() + "-" + sYX.ToString(); grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ if (sWorkQty == 0) { SetSourceWorkQty(i); sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); } grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; if (sWorkQty == 0)//ûÓÐÉèÖòúÄÜ ±³¾° רɫ { grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; continue; } //¸ù¾Ý×ÊÔ´£¬Ä£¾ß±àºÅ£¬»ñÈ¡ »»Ä£Ê±¼ä sMouldPreNumber = ""; sMouldNumber = ""; dChangeTimes = 0; //--»ñÈ¡ ±¾µ¥Ä£¾ß±àºÅ£¬Éϵ¥Ä£¾ß±àºÅ Sc_ICMOSortBillFun.GetMouldNumber(ref sMouldPreNumber, ref sMouldNumber, ref dChangeTimes, lMaterID, lSourceID); //Èç¹ûÄ£¾ßÏàͬ Ôò »ñÈ¡ »»Ä£Ê±¼ä Ϊ 0 if (sMouldNumber == sMouldPreNumber) { dChangeTimes = 0; } //¼ÆËã½áÊøÊ±¼ä if (lProcPlanInterID == 6357) { lProcPlanInterID = lProcPlanInterID; } //Sc_ICMOSortBillFun.SetInfoToGridForEndDate(oCn, grdMain, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, dWorkBeginTime, lSourceID, oClsGridValues,FixCols); // Sc_ICMOSortBillFun.SetInfoToGridForEndDate_Line(iInStockDays, lProcPlanInterID, lProcPlanEntryID, oCn, grdMain, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, dWorkBeginTime, lSourceID, oClsGridValues, FixCols, dChangeTimes); } bFind = true; } // Int64 iHInterID=0; //±£´æÉú³ÉÅɹ¤µ¥ SaveSingeBill(i, grdMain.RowCount - 1, HRelationInterID, oClsGridValues, sCol,ref iHInterID); //»ØÌîInterID grdMain.Rows[grdMain.RowCount - 1].Cells[HSecInterIDCol].Value = iHInterID; grdProcBill.Rows[i].Cells[HProInterIDCol].Value = iHInterID; //Ëø¶¨Õ¼ÓÃ¿â´æ //¸üÐÂÈÎÎñµ¥¼Æ»®Èë¿âÈÕÆÚ //дÈë½ø¶ÈµÈ´ý¿ò 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 999"); //Åų̽á¹û ÅÅÐò grdMain.Sort(grdMain.Columns[HSecSortCol], ListSortDirection.Ascending); // oWait.Close(); return true; } //ɾ³ý±¾²¿ÃÅÎ´Ëø¶¨ ¼Ç¼ private void Sub_DeleteBillUnLock() { if (oMain.DeleteBillUnlock(DBUtility.ClsPub.isLong(999)) == false) { MessageBox.Show("×÷·ÏÀúÊ·µ¥¾Ýʧ°Ü£¡"); } } //¶©µ¥µÈ¼¶ ÅÅÐò private bool SortData_Lev() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; int result; //ðÅÝÅÅÐò·¨ //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; for (int i = 0; i < grdSourceBill.RowCount - 2; i++) { for (int j = 0; j < grdSourceBill.RowCount - i - 2; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(¶©µ¥µÈ¼¶) //Compare·µ»ØÒ»¸ö±íʾ±È½Ï½á¹ûµÄÕûÊýÖµ£¬Á½¸ö×Ö·ûÏàͬ£¬Ôò·µ»Ø0£»Èç¹ûµÚÒ»¸ö×Ö·û´®Ð¡ÓîµÚ¶þ¸ö×Ö·û´®£¬Ôò·µ»ØÐ¡ÓÚ0£»Èç¹ûµÚÒ»¸ö×Ö·û´®´óÓÚµÚ¶þ×Ö·û´®£¬·µ»ØÖµ´óÓÚ0£» result = string.Compare(DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[j].Cells[HOrderLevCol].Value), DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[j + 1].Cells[HOrderLevCol].Value)); if (result > 0) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, j); } } } //ɾ³ý±¸ÓÃÐÐ 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]["¶©µ¥½»»õÆÚ"]); grdSourceBill.Rows[i].Cells[HWorkShopCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["Éú²ú³µ¼ä"]); grdSourceBill.Rows[i].Cells[HWorkShopIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HWorkShopID"]); grdSourceBill.Rows[i].Cells[HWorkShopLevCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HWorkShopLev"]); //дÈë ½ø¶ÈµÈ´ý¿ò 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; //µ¯³öǰÖ÷Çģʽ´°Ì壬ÏÔʾ½ø¶È 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(); // grdProcBill.RowCount = 0; //Ñ­»·¼ÆËãÍø¸ñÖеÄÈÎÎñµ¥ for (int i = 0; i < grdSourceBill.RowCount; i++) { //дÈë ½ø¶ÈµÈ´ý¿ò Application.DoEvents(); oWait.pb1.Value = i + 1; oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); oWait.lblHMaterName.Text = ""; Application.DoEvents(); //Èç¹û¹ÒÆð Ôò²»·Ö½â if (DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HHangUpCol].Value) != "") { continue; } //Ö´ÐмÆËãÈÎÎñµ¥¹ý³Ì 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) { continue; } 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 = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[r]["Éú²úÖÜÆÚ"]); 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[HProSourceNumberCol].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[HProHReadyTimeCol].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; grdProcBill.Rows[m].Cells[HProWorkShopIDCol].Value = grdSourceBill.Rows[i].Cells[HWorkShopIDCol].Value; grdProcBill.Rows[m].Cells[HProWorkShopCol].Value = grdSourceBill.Rows[i].Cells[HWorkShopCol].Value; } } } oWait.Close(); } //µÃµ½ÐÂÈÕÆÚ 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_ProcPlanMultilevelSortBillFun.GetWorkNumber(FDate, SourceID,oCn); } //¼ÓÔØ ±¾»á¼ÆÆÚ¼ä È«²¿Î´Íê³ÉµÄÈÎÎñµ¥ private void sx_Click(object sender, EventArgs e) { DAL.Cls_S_K3_ICMOBill oK3_ICMOBill = new DAL.Cls_S_K3_ICMOBill(); string sWhere = " "; if (oK3_ICMOBill.Refresh2(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"); //дÈëÐÅÏ¢ if (Ds.Tables[0].Rows.Count == 0) { continue; } 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[HBatchNoCol].Value = oTable.Rows[0]["Åú´Î"].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 = DBUtility.ClsPub.isStrNull(oTable.Rows[0]["¶©µ¥µÈ¼¶"]); grdSourceBill.Rows[i].Cells[HWorkShopLevCol].Value = DBUtility.ClsPub.isStrNull(oTable.Rows[0]["³µ¼ä´ÎÐò"]); grdSourceBill.Rows[i].Cells[HKTQCol].Value = "1"; grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = "0"; grdSourceBill.Rows[i].Cells[HRemarkCol].Value = ""; grdSourceBill.Rows[i].Cells[HOrderNeedQtyCol].Value = DBUtility.ClsPub.isDoule(oTable.Rows[0]["¿â´æÊýÁ¿"]); //============ 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 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(); ////ÕÒµ½Ñ¡ÖÐÉú²ú×ÊÔ´ //Int64 lSourceID = 0; //if (tabControl1.SelectedIndex == 0) //{ // if (grdSourceBill.CurrentRow == null) // return; // lSourceID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HSourceIDCol].Value); //} //else if (tabControl1.SelectedIndex == 2) //{ // if (grdMain.CurrentRow == null) // return; // lSourceID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecSourceIDCol].Value); //} //oFrm.txtHSource.Tag = lSourceID; //oFrm.HSourceID = lSourceID; //// //oFrm.ShowDialog(); } private void Sc_ProcPlanMultilevelSortBill_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, HProSourceNumberCol, 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, HProSourceNumber2Col, 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, HProSourceNumber3Col, 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, HProSourceNumber4Col, 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, HProSourceNumber5Col, 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, HProSourceNumber6Col, 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, HProSourceNumber7Col, 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, HProSourceNumber8Col, 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, HProSourceNumber9Col, 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, HProSourceNumber10Col, 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.SetLineSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceIDCol, DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcIDCol].Value), HProWorkQtyCol, iRow, oMain); } //ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceRelationQty(int iRow) { //BLL.Sc_ProcPlanMultilevelSortBillFun.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]); } //for (int i = grdSourceBill.SelectedCells.Count; i >= 0; i--) //{ // grdSourceBill.Rows.Remove(grdSourceBill.Rows[grdSourceBill.SelectedCells[i].RowIndex]); //} } //ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç private void Sub_SetHandChangeFlag(int sCol, int sRow) { if (sCol < FixCols || sCol>=grdSourceBill.RowCount ) { return; } //BLL.Sc_ProcPlanMultilevelSortBillFun.Sub_SetHandChangeFlag(grdSourceBill, sCol, sRow); } //ˢл㱨ÊýÁ¿ private void GetHRelationQty() { ////grid½ûֹˢР//grdSourceBill.Redraw = VSFlex7.RedrawSettings.flexRDNone; ////¼ÓÔØ±íÍ· //for(int i=grdSourceBill.FixedRows ;i 100000) { sRate = 99999; } else { sRate = DBUtility.ClsPub.isInt(sRate ); } sShowRate="00000" + sRate.ToString(); grdSourceBill.Rows[i].Cells[HWorkQtyRateCol].Value = sShowRate.Substring(sShowRate.Length - 5,5); //½«ÅÅÐòÐÅÏ¢ ºÏ²¢µ½ Ò»ÁÐ sWorkShopNo = "00" + DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HWorkShopLevCol].Value); sWorkShopNo = sWorkShopNo.Substring(sWorkShopNo.Length - 2,2); ; sOrderLev =DBUtility.ClsPub.isStrNull( grdSourceBill.Rows[i].Cells[HOrderLevCol].Value); sDate =DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isDate( grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value).ToShortDateString()); sWorkQtyRate =DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HWorkQtyRateCol].Value); grdSourceBill.Rows[i].Cells[HSortCol].Value = sWorkShopNo + "-" + sOrderLev + "-" + sDate + "-" + sWorkQtyRate; } } //ÅÅÐò2 СÅÅÐò public static bool SortData_Proc1(DataGridView oGrd, int Col1, int Col2) { // //¸ù¾Ý¿ª¹¤ÈÕÆÚ ÅÅÐò string otime = "0"; int BRow = 0; int ERow = 0; // for (int i = 0; i < oGrd.Rows.Count; i++) { if (ERow == 0) { ERow = 1; otime = DBUtility.ClsPub.isStrNull(oGrd.Rows[i].Cells[Col1].Value); continue; } if (otime != DBUtility.ClsPub.isStrNull(oGrd.Rows[i].Cells[Col1].Value)) { otime = DBUtility.ClsPub.isStrNull(oGrd.Rows[i].Cells[Col1].Value); //ðÅÝÅÅÐò·¨ oGrd.RowCount = oGrd.RowCount + 1; for (int r = BRow; r < ERow; r++) { for (int j = BRow; j < ERow; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) if (DBUtility.ClsPub.isDate(oGrd.Rows[j].Cells[Col2].Value) > DBUtility.ClsPub.isDate(oGrd.Rows[j + 1].Cells[Col2].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(oGrd, j); } } } //ɾ³ý±¸ÓÃÐÐ oGrd.RowCount = oGrd.RowCount - 1; BRow = ERow + 1; } else { ERow = i; } if (i == oGrd.Rows.Count - 1) { //ðÅÝÅÅÐò·¨ oGrd.RowCount = oGrd.RowCount + 1; for (int r = BRow; r < ERow; r++) { for (int j = BRow; j < ERow; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) if (DBUtility.ClsPub.isDate(oGrd.Rows[j].Cells[Col2].Value) > DBUtility.ClsPub.isDate(oGrd.Rows[j + 1].Cells[Col2].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(oGrd, j); } } } //ɾ³ý±¸ÓÃÐÐ oGrd.RowCount = oGrd.RowCount - 1; } } return true; } //ÅÅÐò3 СÅÅÐò public static bool SortData_Proc2(DataGridView oGrd, int Col1, int Col2) { // //¸ù¾Ý¿ª¹¤ÈÕÆÚ ÅÅÐò DateTime otime = ClsPub.isDate("1900-01-01"); int BRow = 0; int ERow = 0; int result; // for (int i = 0; i < oGrd.Rows.Count; i++) { if (ERow == 0) { ERow = 1; otime = DBUtility.ClsPub.isDate(oGrd.Rows[i].Cells[Col1].Value); continue; } if (otime != DBUtility.ClsPub.isDate(oGrd.Rows[i].Cells[Col1].Value)) { otime = DBUtility.ClsPub.isDate(oGrd.Rows[i].Cells[Col1].Value); //ðÅÝÅÅÐò·¨ oGrd.RowCount = oGrd.RowCount + 1; for (int r = BRow; r < ERow; r++) { for (int j = BRow; j < ERow; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) if (DBUtility.ClsPub.isDoule(oGrd.Rows[j].Cells[Col2].Value) > DBUtility.ClsPub.isDoule(oGrd.Rows[j + 1].Cells[Col2].Value)) { //Compare·µ»ØÒ»¸ö±íʾ±È½Ï½á¹ûµÄÕûÊýÖµ£¬Á½¸ö×Ö·ûÏàͬ£¬Ôò·µ»Ø0£»Èç¹ûµÚÒ»¸ö×Ö·û´®Ð¡ÓîµÚ¶þ¸ö×Ö·û´®£¬Ôò·µ»ØÐ¡ÓÚ0£»Èç¹ûµÚÒ»¸ö×Ö·û´®´óÓÚµÚ¶þ×Ö·û´®£¬·µ»ØÖµ´óÓÚ0£» result = string.Compare(DBUtility.ClsPub.isStrNull(oGrd.Rows[j].Cells[HOrderLevCol].Value), DBUtility.ClsPub.isStrNull(oGrd.Rows[j + 1].Cells[HOrderLevCol].Value)); if (result >= 0) { Sc_ICMOSortBillFun.ChangeGridItem(oGrd, j); } } } } //ɾ³ý±¸ÓÃÐÐ oGrd.RowCount = oGrd.RowCount - 1; BRow = ERow + 1; } else { ERow = i; } if (i == oGrd.Rows.Count - 1) { //ðÅÝÅÅÐò·¨ oGrd.RowCount = oGrd.RowCount + 1; for (int r = BRow; r < ERow; r++) { for (int j = BRow; j < ERow; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) °´×î´óÅúÁ¿ÓÅÏÈ if (DBUtility.ClsPub.isDoule(oGrd.Rows[j].Cells[Col2].Value) < DBUtility.ClsPub.isDoule(oGrd.Rows[j + 1].Cells[Col2].Value)) { //Compare·µ»ØÒ»¸ö±íʾ±È½Ï½á¹ûµÄÕûÊýÖµ£¬Á½¸ö×Ö·ûÏàͬ£¬Ôò·µ»Ø0£»Èç¹ûµÚÒ»¸ö×Ö·û´®Ð¡ÓîµÚ¶þ¸ö×Ö·û´®£¬Ôò·µ»ØÐ¡ÓÚ0£»Èç¹ûµÚÒ»¸ö×Ö·û´®´óÓÚµÚ¶þ×Ö·û´®£¬·µ»ØÖµ´óÓÚ0£» result = string.Compare(DBUtility.ClsPub.isStrNull(oGrd.Rows[j].Cells[HOrderLevCol].Value), DBUtility.ClsPub.isStrNull(oGrd.Rows[j + 1].Cells[HOrderLevCol].Value)); if (result >= 0) { Sc_ICMOSortBillFun.ChangeGridItem(oGrd, j); } } } } //ɾ³ý±¸ÓÃÐÐ oGrd.RowCount = oGrd.RowCount - 1; } } return true; } private void sx_Click_1(object sender, EventArgs e) { initGrid(); Display(); } //ÈÎÎñµ¥¹ØÁªÐÅÏ¢ private void SetBillRelationInfo() { //if (AllowRow()==false) //{ // return; //} //if (tbc1.Visible) //{ // //ˢвúÏß // Int64 sMaterID = 0; // sMaterID = DBUtility.ClsPub.isLong(grdSourceBill.get_TextMatrix(grdSourceBill.Row, HMaterIDCol)); // BLL.Sc_ProcPlanMultilevelSortBillFun.GetSourceByMater(oCn,grdSource,sMaterID); // //ÏÔʾÈÎÎñµ¥ÐÅÏ¢ // Int64 sICMOInterID = 0; // sICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.get_TextMatrix(grdSourceBill.Row, HICMOInterIDCol)); // BLL.Sc_ProcPlanMultilevelSortBillFun.GetICMOInfoByID(oCn, grdICMO, sICMOInterID); // // // DBUtility.ClsPub.GetGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); // DBUtility.ClsPub.GetGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); //} } //µÃµ½ËùÐèÒª¹¤Ê± private void GetWorkTime() { //BLL.Sc_ProcPlanMultilevelSortBillFun.GetWorkTimeByID(oCn, lblWorkTime, grdSourceBill, HMaterIDCol, HSourceIDCol, FixCols); } //»ñÈ¡¹¤×÷ÖÐÐÄ£¬²úÄÜ private bool SetCenterWorkQty() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; for (int i = 0; i < grdProcBill.RowCount; i++) { //µÃµ½²úÄÜ ds = oCn.RunProcReturn("select * from h_v_Gy_RoutingBillList where hmaterid=" + ClsPub.isLong(grdProcBill.Rows[i].Cells[HProMaterIDCol].Value) + " and hprocid=" + ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value), "h_v_Gy_RoutingBillList"); if (ds == null || ds.Tables[0].Rows.Count == 0) { return false; } grdProcBill.Rows[i].Cells[HProCenterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HCenterID"]); grdProcBill.Rows[i].Cells[HProDayWorkQtyCol].Value = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[0]["HDayWorkQty"]); } return true; } //ÅÅÐò2 private bool SortData_Proc() { long HCenterID = 0; double HDayWorkQty = 0; DateTime oDatetime; oDatetime = DateTime.Today; for (int i = 0; i <= grdProcBill.RowCount - 1; i++) { if (HCenterID != DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProCenterIDCol].Value)) { HCenterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProCenterIDCol].Value); HDayWorkQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProDayWorkQtyCol].Value); //ÈÎÎñÊýÁ¿>±¾ÈÕ×ܲúÄÜ if (DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value) > HDayWorkQty) { oDatetime = DateTime.Today.AddDays(1); grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value = oDatetime; } else { oDatetime = DateTime.Today; grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value = oDatetime; } // HDayWorkQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProDayWorkQtyCol].Value) - DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); //±¾ÈÕ×ܲúÄÜ ¿Û³ý ÈÎÎñµ¥ÊýÁ¿ for (int j = i; j <= grdProcBill.Rows.Count - 1; j++) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProCenterIDCol].Value) == HCenterID) { grdProcBill.Rows[j].Cells[HProDayWorkQtyCol].Value = HDayWorkQty; } } } else { //ÈÎÎñÊýÁ¿>±¾ÈÕ×ܲúÄÜ if (DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value) > HDayWorkQty) { oDatetime = DateTime.Today.AddDays(1); grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value = oDatetime; } else { oDatetime = DateTime.Today; grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value = oDatetime; } // HDayWorkQty = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProDayWorkQtyCol].Value) - DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); //±¾ÈÕ×ܲúÄÜ ¿Û³ý ÈÎÎñµ¥ÊýÁ¿ for (int j = i; j <= grdProcBill.Rows.Count - 1; j++) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProCenterIDCol].Value) == HCenterID) { grdProcBill.Rows[j].Cells[HProDayWorkQtyCol].Value = HDayWorkQty; } } } } return true; } //ÅÅÐò °´¿ª¹¤ÈÕÆÚÅÅÐò private bool SortData_ProcByDate() { //ðÅÝÅÅÐò·¨ //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdProcBill.RowCount = grdProcBill.RowCount + 1; for (int i = 0; i < grdProcBill.RowCount - 2; i++) { for (int j = 0; j < grdProcBill.RowCount - i - 2; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ) if (DBUtility.ClsPub.isDate(grdProcBill.Rows[j].Cells[HProLastBeginDateCol].Value) > DBUtility.ClsPub.isDate(grdProcBill.Rows[j + 1].Cells[HProLastBeginDateCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdProcBill, j); } } } //ɾ³ý±¸ÓÃÐÐ grdProcBill.RowCount = grdProcBill.RowCount - 1; return true; } //ÅÅÐò °´Ð¡ÅúÁ¿ÅÅÐò private bool SortData_ProcByQty(int BRow, int ERow) { //ðÅÝÅÅÐò·¨ grdProcBill.RowCount = grdProcBill.RowCount + 1; for (int i = BRow; i < ERow; i++) { for (int j = BRow; j < ERow; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) if (DBUtility.ClsPub.isDoule(grdProcBill.Rows[j].Cells[HProPlanQtyCol].Value) > DBUtility.ClsPub.isDoule(grdProcBill.Rows[j + 1].Cells[HProPlanQtyCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdProcBill, j); } } } //ɾ³ý±¸ÓÃÐÐ grdProcBill.RowCount = grdProcBill.RowCount - 1; return true; } private void SaveProcBill() { Int64 lngBillKey = 0; //if (grdSourceBill.SelectedRows == null) // return; DAL.ClsSc_ICMOBill_K3 oBill = new DAL.ClsSc_ICMOBill_K3(); for (int i = 0; i <= grdSourceBill.Rows.Count - 1; i++) { Thread.Sleep(100); Application.DoEvents(); lngBillKey = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value); if (lngBillKey == 0) continue; if (!oBill.ProcessPlanBill_Add(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { //MessageBox.Show("ÏÂÍÆÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); continue; } Application.DoEvents(); } } //ÉèÖÃÓÅÏÈ private bool SetYXNum() { //ÉèÖÃÓÅÏȼ¶ ±àºÅ string sSortNo = ""; for (int i = 0; i < grdSourceBill.RowCount; i++) { sSortNo = "0000" + Convert.ToString(i + 1); grdSourceBill.Rows[i].Cells[HYXCol].Value = sSortNo.Substring(sSortNo.Length - 4, 4); } // return true; } private void sb_Click(object sender, EventArgs e) { //°´É豸·ÖÎö ¿ÕÏÐÉèÖà Sc_SourceFreeReport oSc_SourceFreeReport = new Sc_SourceFreeReport(); oSc_SourceFreeReport.ShowDialog(); } private void cp_Click(object sender, EventArgs e) { Int64 HMaterID = 0; string HMaterNumber = ""; string HMaterName = ""; string HMaterModel = ""; Int64 HICMOInterID = 0; string HICMOBillNo = ""; if (tabControl1.SelectedIndex == 0) { if (grdSourceBill.CurrentRow == null) return; HMaterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HMaterIDCol].Value); HMaterNumber = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HMaterNumberCol].Value); HMaterName = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HMaterNameCol].Value); HMaterModel = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HMaterModelCol].Value); HICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HICMOInterIDCol].Value); HICMOBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[grdSourceBill.CurrentRow.Index].Cells[HICMOBillNoCol].Value); } else if (tabControl1.SelectedIndex == 2) { if (grdMain.CurrentRow == null) return; HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecMaterIDCol].Value); HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecMaterNumberCol].Value); HMaterName = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecMaterNameCol].Value); HMaterModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecMaterModelCol].Value); HICMOInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecICMOInterIDCol].Value); HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecICMOBillNoCol].Value); } ////=================================================== //Sc_ProduceMultilevelQuery oSc_ProduceMultilevelQuery = new Sc_ProduceMultilevelQuery(); //oSc_ProduceMultilevelQuery.txtHMaterID.Tag = HMaterID; //oSc_ProduceMultilevelQuery.txtHMaterID.Text = HMaterNumber; //oSc_ProduceMultilevelQuery.txtHMaterName.Text = HMaterName; //oSc_ProduceMultilevelQuery.txtHMaterModel.Text = HMaterModel; //oSc_ProduceMultilevelQuery.txtHICMOBillNo.Tag = HICMOInterID; //oSc_ProduceMultilevelQuery.txtHICMOBillNo.Text = HICMOBillNo; //oSc_ProduceMultilevelQuery.ShowDialog(); } //Êý¾Ý·ÖÎö private void fx_Click(object sender, EventArgs e) { //½»»õÆÚ·ÖÎö ±³¾°É«ÑÕÉ«·ÖÎö£¨³¬ÆÚºìÉ«£¬ÈýÌìÄÚ»ÆÉ«£¬°²È«ÂÌÉ«£© SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet oDs = new DataSet(); DateTime dtimePai; DateTime dtimeJiao; //Ñ­»·grdMain£¬Ã¿¸öÈÎÎñµ¥£¬¸ù¾Ý×îºóÅųÌÈÕÆÚ£¬·ÖÎö½»»õÆÚÊÇ·ñ³åÍ» for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { for (int c = grdMain.ColumnCount - 1; c >= 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) { //if (grdMain.CurrentRow == null) // return; //if (grdMain.CurrentCell.ColumnIndex < FixCols) //{ // return; //} //Sc_ProcPlanMultilevelSortBill_ChangQty oChangQty = new Sc_ProcPlanMultilevelSortBill_ChangQty(); //oChangQty.HDate = DBUtility.ClsPub.isDate(grdMain.Columns[grdMain.CurrentCell.ColumnIndex].Tag); //oChangQty.HInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FixCols - 1].Value); //oChangQty.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecICMOBillNoCol].Value); //oChangQty.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value); //oChangQty.ShowDialog(); //if (oChangQty.IsOk == 1) //{ // grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value = oChangQty.sReturnQty.ToString(); //} //Sc_ProcPlanMultilevelSortBillQL oQL = new Sc_ProcPlanMultilevelSortBillQL(); //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; // SetYXNum(); } //Ͻµ 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; SetYXNum(); } 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 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 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("±¾ÈÎÎñµ¥¹ÒÆð³É¹¦£¡"); grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HHangUpCol].Value = "Y"; 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("±¾ÈÎÎñµ¥»Ö¸´³É¹¦£¡"); grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HHangUpCol].Value = ""; 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); } //ÆëÁÏÅÐ¶Ï private bool ReadyMater() { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet ds; //Ñ­»·¼ÆËãÍø¸ñÖеÄÈÎÎñµ¥ for (int i = 0; i < grdSourceBill.RowCount; i++) { //Ö´ÐмÆËãÈÎÎñµ¥¹ý³Ì Thread.Sleep(100); ds = oCn.RunProcReturn("exec h_p_K3_Sc_ICMO_ReadyMater " + grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value.ToString(), "xt_xtgnb"); if (ds == null || ds.Tables[0].Rows.Count == 0) { // } else { //·µ»ØÐÅÏ¢»ØÌîÍø¸ñ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 99) { grdSourceBill.Rows[i].Cells[HReadyMaterCol].Value = ""; // ȱÁÏ } else { grdSourceBill.Rows[i].Cells[HReadyMaterCol].Value = "Y"; } } } return true; } private void grdSourceBill_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { //ÉèÖÃÈÎÎñµ¥ ¼Æ»®¿ª¹¤ÈÕÆÚ switch (e.ColumnIndex) { case HPlanBeginDateCol: oSelectDate.sDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[e.RowIndex].Cells[HPlanBeginDateCol].Value); oSelectDate.ShowDialog(); if (oSelectDate.isSelected == true) { //¸üÐÂÊý¾Ý¿â Int64 id = DBUtility.ClsPub.isLong(grdSourceBill.Rows[e.RowIndex].Cells[HICMOInterIDCol].Value); if (id > 0) { UpdateICMOBeginDate(id, oSelectDate.MC1.SelectionStart); grdSourceBill.Rows[e.RowIndex].Cells[HPlanBeginDateCol].Value = oSelectDate.MC1.SelectionStart.ToShortDateString(); } else { MessageBox.Show("µ±Ç°ÈÎÎñµ¥ÓдíÎó£¡"); } } break; case HYXCol: break; default: e.Cancel = true; break; } } //¸üРÈÎÎñµ¥ ¼Æ»®¿ª¹¤ÈÕÆÚ private void UpdateICMOBeginDate(long HICMOInterID, DateTime oDatetime) { try { oCn.RunProc("exec h_p_K3_SetICMOSortBillEndDate " + HICMOInterID.ToString() + ",'" + oDatetime.ToShortDateString() + "'"); } catch (Exception e) { return; } } public void Fun_AutoSplitICMOQty() { //°´¹¤Ðò¼ÆËã //·µ»ØÈ«²¿¹¤Ðòµ½ÁÙʱ±í£¨*£©£¬»ñÈ¡µÚÒ»ÐÐ ¹¤Ðò Int64 HProcID = DBUtility.ClsPub.isLong(grdProcBill.Rows[0].Cells[HProProcIDCol].Value); //¸ù¾Ý¹¤ÐòÕÒµ½ ¿ÉÅÅ×ÊÔ´ δ½ûÓà ×ÊÔ´ÊýÁ¿£¬´æÈë »º´æ£¬×ÊÔ´ DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); List oValues = new List(); List oICMOValues = new List(); oICMOValues.Clear(); if (oSource.GetSourceByProc(HProcID, oValues)== false) { return; } if (oValues.Count <= 0) { return; } //»ã×ÜÈÎÎñµ¥ ¸Ã¹¤Ðò ÐèÒªÉú²ú×ܹ¤Ê± double sumTimes = 0; for (int i = 0; i < grdProcBill.RowCount; i++) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value) == HProcID) { sumTimes = sumTimes + (DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value) / DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); } } if (sumTimes == 0) { return; } //¼ÆËã ¸÷×ÊÔ´ ϰàʱ¼ä¡¢×î³Ùϰࡢ×îÔçϰ࣬´æÈë »º´æ£¬×ÊÔ´£¬ÐèÇóÉú²úʱ¼ä£¬×î³Ùϰàʱ¼ä£¬×îÔçϰàʱ¼ä double sNeedTimes = sumTimes / oValues.Count; double sMinTimes = sNeedTimes - 0.5; double sMaxTimes = sNeedTimes + 0.5; int sSourceIDCol = 0; Int64 iSourceID = 0; double sNowQty = 0; Single sWorkQty = 0; for (int i = 0; i < grdProcBill.RowCount; i++)//½«Íø¸ñÊý¾Ý дÈë »º´æ { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value) == HProcID) { for (int j = 1; j <= 10; j++) { sSourceIDCol = 0; iSourceID = 0; sNowQty = 0; sWorkQty = 0; sSourceIDCol = HProSourceIDCol + (j - 1) * 5; iSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sSourceIDCol].Value); if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sSourceIDCol].Value) != 0) { sNowQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[sSourceIDCol+2].Value); sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[sSourceIDCol+3].Value); //´Ó»º´æÖÐÕÒµ½×ÊÔ´ ²¢Ð´Èë if (sWorkQty > 0) { foreach(Model.ClsSourceValues oSub in oValues) { if (oSub.iSourceID == iSourceID && sWorkQty > 0) { oSub.HNowQty = oSub.HNowQty + sNowQty; oSub.HNowTimes = oSub.HNowTimes + sNowQty / sWorkQty; } } //дÈëÈÎÎñµ¥»º´æ Model.ClsSourceICMOValues oICMOSub = new Model.ClsSourceICMOValues(); oICMOSub.iSourceID = iSourceID; oICMOSub.iICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); oICMOSub.HWorkQty = sWorkQty; oICMOSub.HNowTimes = sNowQty / sWorkQty; oICMOSub.HNowQty = sNowQty; oICMOValues.Add(oICMOSub); } } } } } //Ñ­»·ÈÎÎñµ¥£¬²ð·Ö for (int i = 0; i < 50; i++) { //ÕÒµ½×î´ó¹¤Ê±×ÊÔ´²¢ÇÒ¹¤Ê±´óÓÚ ×î´ó£¬½øÐвð·Ö double MaxSourceQty = 0; double MaxSourceNowTimes = 0; double LeftTimes=0; Int64 MaxSourceID = Fun_FindMaxWorkTimesSource(oValues, sMaxTimes,ref MaxSourceNowTimes); Int64 NeedSourceID = 0; if (MaxSourceID > 0) { LeftTimes=MaxSourceNowTimes-sNeedTimes;//»ñÈ¡ ¶àÓàµÄ¹¤Ê± NeedSourceID = Fun_FindNeedWorkTimesSource(oValues, sMaxTimes, sMinTimes, sNeedTimes, LeftTimes);//ÕÒµ½×îºÏÊʵÄ×ÊÔ´ Int64 MaxICMO = Fun_FindMaxWorkTimesICMOSource(MaxSourceID,oICMOValues); Single MaxWorkQty = 0; if (MaxICMO > 0) { double SplitQty=0; foreach (Model.ClsSourceICMOValues oICMOSub in oICMOValues) { if (oICMOSub.iICMOInterID == MaxICMO && oICMOSub.iSourceID == MaxSourceID)//ÕÒµ½×î´ó×ÊÔ´²¢¿Û³ý { if (oICMOSub.HNowTimes > LeftTimes)//Èç¹û¹¤Ê±´óÓÚ ¶àÓàÔò ¿Û³ý { oICMOSub.HNowTimes = oICMOSub.HNowTimes - LeftTimes; MaxWorkQty = oICMOSub.HWorkQty; SplitQty=DBUtility.ClsPub.isLong( DBUtility.ClsPub.isDoule(LeftTimes*MaxWorkQty,0)); } else//Èç¹û¹¤Ê± СÓÚ ¶àÓà Ôò ɾ³ý { oICMOSub.HNowTimes = 0; MaxWorkQty = oICMOSub.HWorkQty; SplitQty=DBUtility.ClsPub.isLong( DBUtility.ClsPub.isDoule(LeftTimes*MaxWorkQty,0)); } //´¦Àí ½çÃæÉ쵀 Êý¾Ý,¿Û³ý×î´ó×ÊÔ´ Fun_FindGridICMO(MaxSourceID, MaxICMO, SplitQty, HProcID); } } Model.ClsSourceICMOValues oICMOSub2 = new Model.ClsSourceICMOValues(); oICMOSub2.iSourceID = NeedSourceID; oICMOSub2.iICMOInterID = MaxICMO; oICMOSub2.HWorkQty = MaxWorkQty; oICMOSub2.HNowTimes = LeftTimes; oICMOSub2.HNowQty =DBUtility.ClsPub.isLong( DBUtility.ClsPub.isDoule(LeftTimes*MaxWorkQty,0)); oICMOValues.Add(oICMOSub2); //´¦Àí ½çÃæÉ쵀 Êý¾Ý£¬Ìí¼Ó ÊʺÏ×ÊÔ´ Fun_FindGridICMOForAdd(NeedSourceID, MaxICMO, SplitQty, MaxWorkQty, HProcID); //ÕÒµ½×î´ó×ÊÔ´²¢¿Û³ý foreach (Model.ClsSourceValues oSub in oValues) { if (oSub.iSourceID == MaxSourceID) { oSub.HNowTimes = oSub.HNowTimes - LeftTimes; } //ÕÒµ½ºÏÊÊ×ÊÔ´²¢Ôö¼Ó if (oSub.iSourceID == NeedSourceID) { oSub.HNowTimes = oSub.HNowTimes + LeftTimes; } } } } else { break; } } //============================== } //ÕÒµ½½çÃæÉϵÄÈÎÎñµ¥ºÍ×ÊÔ´ ²¢½øÐÐÔö¼Ó public void Fun_FindGridICMOForAdd(Int64 iSourceID, Int64 iICMOInterID, double SplitQty, double dWorkQty, Int64 HProcID) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); for (int i = 0; i < grdProcBill.RowCount; i++) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value) == HProcID) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value) == iICMOInterID) { for (int j = 1; j <= 10; j++)//ÕÒµ½¿Õ°×µÄ²ð·Ö×ÊÔ´ { int sSourceIDCol = HProSourceIDCol + (j - 1) * 5; if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sSourceIDCol].Value) == 0) { grdProcBill.Rows[i].Cells[sSourceIDCol].Value = iSourceID; if (oSource.GetInfoByID(iSourceID)) { grdProcBill.Rows[i].Cells[sSourceIDCol + 1].Value = oSource.omodel.HName; grdProcBill.Rows[i].Cells[sSourceIDCol + 4].Value = oSource.omodel.HNumber; } grdProcBill.Rows[i].Cells[sSourceIDCol + 2].Value = SplitQty; grdProcBill.Rows[i].Cells[sSourceIDCol + 3].Value = dWorkQty; return ; } } } } } } //ÕÒµ½½çÃæÉϵÄÈÎÎñµ¥ºÍ×ÊÔ´ ²¢½øÐп۳ý public void Fun_FindGridICMO(Int64 iSourceID, Int64 iICMOInterID, double SplitQty, Int64 HProcID) { for (int i = 0; i < grdProcBill.RowCount; i++) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcIDCol].Value) == HProcID) { if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value) == iICMOInterID) { for (int j = 1; j <= 10; j++) { int sSourceIDCol = HProSourceIDCol + (j - 1) * 5; double sNowQty=0; double sWorkQty = 0; if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sSourceIDCol].Value) == iSourceID) { sNowQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[sSourceIDCol + 2].Value); sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[sSourceIDCol + 3].Value); if (SplitQty >= sNowQty) { grdProcBill.Rows[i].Cells[sSourceIDCol].Value = 0; grdProcBill.Rows[i].Cells[sSourceIDCol + 1].Value = ""; grdProcBill.Rows[i].Cells[sSourceIDCol + 2].Value = ""; grdProcBill.Rows[i].Cells[sSourceIDCol + 3].Value = ""; } else { grdProcBill.Rows[i].Cells[sSourceIDCol + 2].Value =sNowQty - SplitQty; } } } } } } } //ÕÒµ½×ÊÔ´ÖÐ×î´óµÄÈÎÎñµ¥ public Int64 Fun_FindMaxWorkTimesICMOSource(Int64 sSourceID,List oValues) { Int64 iMaxICMOID = 0; double iMaxWorkTimes = 0; foreach (Model.ClsSourceICMOValues oSub in oValues) { if (sSourceID == oSub.iSourceID) { if (oSub.HNowTimes > iMaxWorkTimes) { iMaxICMOID = oSub.iICMOInterID; iMaxWorkTimes = oSub.HNowTimes; } } } return iMaxICMOID; } //ÕÒµ½¹¤Ê±×î´óµÄ×ÊÔ´ public Int64 Fun_FindMaxWorkTimesSource(List oValues, double sMaxTimes,ref double MaxSourceNowTimes) { Int64 iMaxSourceID = 0; double iMaxWorkTimes = 0; foreach (Model.ClsSourceValues oSub in oValues) { if (oSub.HNowTimes > iMaxWorkTimes && oSub.HNowTimes > sMaxTimes) { iMaxSourceID = oSub.iSourceID; iMaxWorkTimes = oSub.HNowTimes; MaxSourceNowTimes = oSub.HNowTimes; } } return iMaxSourceID; } //ÕÒµ½×îºÏÊʵÄ×ÊÔ´ public Int64 Fun_FindNeedWorkTimesSource(List oValues, double sMaxTimes,double sMinTimes, double sNeedTimes,double LeftWorkTimes) { Int64 iNeedSourceID = 0; double DiffTimes = 0; foreach (Model.ClsSourceValues oSub in oValues) { //¼ÓÉ϶àÓ๤ʱ£¬ÕýºÃÊÇÔÊÐíϰàʱ¼äÄÚ,²¢ÇÒ²îÒì×îСµÄ×ÊÔ´ if (oSub.HNowTimes + LeftWorkTimes < sMaxTimes && oSub.HNowTimes + LeftWorkTimes > sMinTimes) { double sDiff = 0; if (oSub.HNowTimes + LeftWorkTimes - sNeedTimes < 0) { sDiff = -(oSub.HNowTimes + LeftWorkTimes - sNeedTimes); } else { sDiff = oSub.HNowTimes + LeftWorkTimes - sNeedTimes; } if (sDiff < DiffTimes) { DiffTimes = sDiff; iNeedSourceID = oSub.iSourceID; } } } //Èç¹ûûÕÒµ½ÕýºÃµÄ£¬Ôò ÕÒµ½×îСµÄ double iMinWorkTimes = 0; if (iNeedSourceID == 0) { foreach (Model.ClsSourceValues oSub in oValues) { if (iMinWorkTimes == 0) { iMinWorkTimes = oSub.HNowTimes; } if (oSub.HNowTimes < iMinWorkTimes) { iNeedSourceID = oSub.iSourceID; iMinWorkTimes = oSub.HNowTimes; } } } return iNeedSourceID; } private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (grdMain.CurrentCell == null) { e.Cancel = true; } int i = grdMain.CurrentCell.ColumnIndex; if (i < FixCols) { e.Cancel = true; } } private void gy_Click(object sender, EventArgs e) { long HMaterID = 0; if (tabControl1.SelectedIndex == 0) { if (grdSourceBill.CurrentRow == null) return; HMaterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HMaterIDCol].Value); } else if (tabControl1.SelectedIndex == 2) { if (grdMain.CurrentRow == null) return; HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HSecMaterIDCol].Value); } ////=================================================== SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet oDs = new DataSet(); long lngBillKey = 0; oDs = oCn.RunProcReturn("select top 1 * from Gy_RoutingBillMain where hmaterid=" + HMaterID.ToString() + " and hdeleteman=''", "Gy_RoutingBillMain"); if (oDs == null || oDs.Tables[0].Rows.Count == 0) { return; } lngBillKey = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HInterID"]); // Sub_ShowRoutingBill(lngBillKey); } private void Sub_ShowRoutingBill(long lngBillKey) { if (lngBillKey == 0) return; DAL.ClsGy_RoutingBill oBill = new DAL.ClsGy_RoutingBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { PlanM.Gy_RoutingBill oFrm = new PlanM.Gy_RoutingBill(); oFrm.ModCaption = "¹¤ÒÕ·Ïß"; oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View; oFrm.BillOld = oBill; oFrm.ShowDialog(); } else { MessageBox.Show("¹¤ÒÕ·ÏßδÕÒµ½", "Ìáʾ"); } oBill = null; } private void jd_Click(object sender, EventArgs e) { long lngBillKey = 0; if (tabControl1.SelectedIndex == 0) { if (grdSourceBill.CurrentRow == null) return; lngBillKey = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); } else if (tabControl1.SelectedIndex == 2) { if (grdMain.CurrentRow == null) return; lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HSecICMOInterIDCol].Value); } // Sc_ICMOProcessPlanReport oSc_ICMOProcessPlanReport = new Sc_ICMOProcessPlanReport(); oSc_ICMOProcessPlanReport.HICMOInterID = lngBillKey; oSc_ICMOProcessPlanReport.Show(); } private void tlfx_Click(object sender, EventArgs e) { long lngBillKey = 0; if (tabControl1.SelectedIndex == 0) { if (grdSourceBill.CurrentRow == null) return; lngBillKey = DBUtility.ClsPub.isLong(grdSourceBill.Rows[grdSourceBill.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); } else if (tabControl1.SelectedIndex == 2) { if (grdMain.CurrentRow == null) return; lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HSecICMOInterIDCol].Value); } // Sc_PPBOMInStockList oSc_PPBOMInStockList = new Sc_PPBOMInStockList(); oSc_PPBOMInStockList.HICMOInterID = lngBillKey; oSc_PPBOMInStockList.Show(); } private void pax_Click(object sender, EventArgs e) { //µ¥¾ÝÅÅÐò(×Ô´ø¹¦ÄÜÅÅÐò) grdSourceBill.Sort(grdSourceBill.Columns[HYXCol], ListSortDirection.Ascending); } } }