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_ProcPlanAutoSortBill : Form { public Sc_ProcPlanAutoSortBill() { InitializeComponent(); } //¶¨ÒåÁÐ public const Int16 FixCols = 19; //grdSource public const Int16 HHangUpCol = 1; public const Int16 HICMOBillNoCol = 2; public const Int16 HMaterIDCol = 3; public const Int16 HMaterNumberCol = 4; public const Int16 HMaterNameCol = 5; public const Int16 HMaterModelCol = 6; public const Int16 HUnitIDCol = 7; public const Int16 HUnitNumberCol = 8; public const Int16 HUnitNameCol = 9; public const Int16 HPlanQtyCol = 10; public const Int16 HRelationQtyCol = 11; public const Int16 HWorkQtyCol = 12; //²úÄÜ public const Int16 HProdTimesCol = 13; //Éú²úÖÜÆÚ=¼Æ»®Êý/²úÄÜ £¨Ð¡Ê±£© public const Int16 HWorkTimesCol = 14; public const Int16 HYXCol = 15; public const Int16 HOrderLevCol = 16; public const Int16 HKTQCol =17; public const Int16 HReadyQtyCol = 18; //×¼±¸ÊýÁ¿ public const Int16 HBeginDayQtyCol = 19; //¿ª¹¤ÓàÁ¿£¨ÊýÁ¿£© public const Int16 HBeginFixQtyCol = 20; //¿ª¹¤ÓàÁ¿£¨ÌìÊý£© public const Int16 HPlanBeginDateCol = 21; //¼Æ»®¿ª¹¤ public const Int16 HPlanEndDateCol = 22; //¼Æ»®Í깤 public const Int16 HLastBeginDateCol = 23; //×î³Ù¿ª¹¤=×î³ÙÍ깤-Éú²úÖÜÆÚ£¨×î¶ÌÖÜÆÚ£© public const Int16 HLastEndDateCol = 24; //×î³ÙÍ깤=¶©µ¥½»»õÆÚ-ÌáǰÆÚ public const Int16 HOrderNeedQtyCol = 25; //¶©µ¥ÐèÇóÊý public const Int16 HCusNameCol = 26; // ¿Í»§ public const Int16 HSeOrderBillNoCol = 27; //¶©µ¥ºÅ public const Int16 HOrderCommitDateCol = 28; //¶©µ¥½»»õÆÚ=ÓëÔ¤²âµ¥³åÏúµÄ¶©µ¥×îÔç½»»õÆÚ¡£ public const Int16 HRemarkCol = 29; public const Int16 HSourceIDCol = 30; public const Int16 HSourceNameCol = 31; public const Int16 HSourceInterIDCol = 32; public const Int16 HSourceEntryIDCol = 33; public const Int16 HSourceBillTypeCol = 34; public const Int16 HICMOInterIDCol = 35; public const Int16 HSeOrderInterIDCol = 36; public const Int16 HSeOrderEntryIDCol = 37; public const Int16 HSourceBillNoCol = 38; public const Int16 HLockedCol = 39; public const Int16 HReadyMaterCol = 40; public const Int16 HBatchNoCol = 41; //ÈÎÎñµ¥ÅúºÅ //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; //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 HProSourceNumber10Col = 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 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_ProcPlanAutoSortBillDlg oDlg = new Sc_ProcPlanAutoSortBillDlg(); BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar(); // bool bEdit = false; //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return false; //return BLL.Sc_ProcPlanAutoSortBillFun.IsSelectCell(grdSourceBill, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow,int iCol) { return false; //return BLL.Sc_ProcPlanAutoSortBillFun.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 = 42; //×ÜÁÐÊý DBUtility.Xt_BaseBillFun.initGridFst(grdSourceBill, this.Name); grdSourceBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect; grdSourceBill.RowCount = 0; grdSourceBill.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //= grdSourceBill.Columns[HCusNameCol].HeaderText = "¿Í»§"; grdSourceBill.Columns[HSeOrderBillNoCol].HeaderText = "ÏúÊÛ¶©µ¥"; grdSourceBill.Columns[HICMOBillNoCol].HeaderText = "Éú²úÈÎÎñµ¥"; grdSourceBill.Columns[HMaterNumberCol].HeaderText = "ÎïÁÏ´úÂë"; grdSourceBill.Columns[HMaterNameCol].HeaderText = "ÎïÁÏÃû³Æ"; grdSourceBill.Columns[HMaterModelCol].HeaderText = "¹æ¸ñÐͺÅ"; grdSourceBill.Columns[HUnitNameCol].HeaderText = "µ¥Î»Ãû³Æ"; grdSourceBill.Columns[HPlanBeginDateCol].HeaderText = "¼Æ»®¿ª¹¤"; grdSourceBill.Columns[HPlanEndDateCol].HeaderText = "¼Æ»®Í깤"; grdSourceBill.Columns[HLastBeginDateCol].HeaderText = "Ô¤¼Æ¿ª¹¤"; grdSourceBill.Columns[HLastEndDateCol].HeaderText = "×î³ÙÍ깤"; grdSourceBill.Columns[HPlanQtyCol].HeaderText = "ÈÎÎñÊý"; grdSourceBill.Columns[HProdTimesCol].HeaderText = "Éú²úÖÜÆÚ"; grdSourceBill.Columns[HRelationQtyCol].HeaderText = "Í깤Êý"; grdSourceBill.Columns[HReadyQtyCol].HeaderText = "×¼±¸Ê±¼ä"; grdSourceBill.Columns[HBeginDayQtyCol].HeaderText = "¿ª¹¤¹ÌÊý"; grdSourceBill.Columns[HBeginFixQtyCol].HeaderText = "¿ª¹¤¹ÌÌì"; grdSourceBill.Columns[HWorkQtyCol].HeaderText = "²úÄÜ"; grdSourceBill.Columns[HWorkTimesCol].HeaderText = "±ê×¼¹¤Ê±"; grdSourceBill.Columns[HSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdSourceBill.Columns[HYXCol].HeaderText = "ÓÅÏȼ¶"; grdSourceBill.Columns[HOrderLevCol].HeaderText = "¶©µ¥µÈ¼¶"; grdSourceBill.Columns[HRemarkCol].HeaderText = "±¸×¢"; grdSourceBill.Columns[HOrderNeedQtyCol].HeaderText = "¶©µ¥ÊýÁ¿"; grdSourceBill.Columns[HOrderCommitDateCol].HeaderText = "¶©µ¥½»»õÆÚ"; grdSourceBill.Columns[HSourceBillNoCol].HeaderText = "Ô´µ¥ºÅ"; grdSourceBill.Columns[HSourceBillTypeCol].HeaderText = "Ô´µ¥ÀàÐÍ"; grdSourceBill.Columns[HLockedCol].HeaderText = "Ëø¶¨±ê¼Ç"; grdSourceBill.Columns[HHangUpCol].HeaderText = "¹ÒÆð±ê¼Ç"; grdSourceBill.Columns[HReadyMaterCol].HeaderText = "ÆëÁϱê¼Ç"; grdSourceBill.Columns[HBatchNoCol].HeaderText = "Åú´Î"; ////Òþ²ØÁÐ grdSourceBill.Columns[0].Visible = false; grdSourceBill.Columns[HMaterIDCol].Visible = false; grdSourceBill.Columns[HUnitIDCol].Visible = false; grdSourceBill.Columns[HKTQCol].Visible = false; grdSourceBill.Columns[HICMOInterIDCol].Visible = false; grdSourceBill.Columns[HSourceIDCol].Visible = false; grdSourceBill.Columns[HUnitNumberCol].Visible = false; grdSourceBill.Columns[HSourceInterIDCol].Visible = false; grdSourceBill.Columns[HSourceEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderInterIDCol].Visible = false; // //// grdSourceBill.ReadOnly = 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[0].Visible = false; grdMain.Columns[HSecInterIDCol].Visible = false; grdMain.Columns[HSecICMOInterIDCol].Visible = false; grdMain.Columns[HSecSourceIDCol].Visible = false; grdMain.Columns[HSecMaterIDCol].Visible = false; grdMain.ReadOnly = true; for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; //ÁÐ ÅÅÐòģʽ } // /////grdProcBill grdProcBill.ColumnCount = 94; //×ÜÁÐÊý 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[0].Visible = false; grdProcBill.Columns[HProMaterIDCol].Visible = false; grdProcBill.Columns[HProUnitIDCol].Visible = false; grdProcBill.Columns[HProKTQCol].Visible = false; grdProcBill.Columns[HProICMOInterIDCol].Visible = false;// grdProcBill.Columns[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[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[HProSourceNumber10Col].Visible = false; //ÔÝʱÒþ²Ø ×ÊÔ´6 7,8,9£¬10 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(30); grdMain.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;//±êÌâÐÐ×Ô¶¯»»ÐÐ } //¼ÓÔØ µ±ÔÂÈÕÆÚ private void LoadDateCol(int iDates) { Sc_ICMOSortBillFun.LoadDateCol(grdMain, FixCols, iDates); } //ÏÔʾ¼ÓÔØ ÒÑÅų̼Ǽ private void Display() { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View(); DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View(); DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); int c = 0; int i = 0; //½«¹ýÂË¿òµÄ²¿Ãź͹¤ÐòдÈë½çÃæ£¬ÈôûÓв¿ÃÅÔò Ìø³ö¹ý³Ì this.txtHDeptID.Tag = oDlg.txtHBDeptID.Tag; this.txtHDeptID.Text = oDlg.txtHBDeptID.Text; this.lblHDeptID.Text = oDlg.txtHBDeptID.Text; //this.txtHProcID.Tag = oDlg.txtHBProcID.Tag; //this.txtHProcID.Text = oDlg.txtHBProcID.Text; //this.lblHProcID.Text = oDlg.txtHBProcID.Text; if (DBUtility.ClsPub.isLong(txtHDeptID.Tag) == 0) { return; } //µÃµ½µ±Ç°HRelationInterID oMain.HRelationInterID = oMain.GetRelationInterIDByDept(DBUtility.ClsPub.isLong(txtHDeptID.Tag)); //¸ù¾Ý²¿Ãŵõ½Ä¬ÈÏ×ÊÔ´ if (oSource.GetInfoByDept(DBUtility.ClsPub.isLong(txtHDeptID.Tag))) { //HSourceID_MR = oSource.omodel.HItemID; //HSourceNumber_MR = oSource.omodel.HNumber; //HSourceName_MR = oSource.omodel.HName; } // if (oMain.ShowBillByProc(oMain.HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo) == false) { MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } //Çå¿Õ //grid½ûֹˢР//¼ÓÔØ Ö÷±í£¬ÈÎÎñµ¥ÐÅÏ¢ 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[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(); SetSourceRelationQty(i); // grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value = oModel.HWorkQty.ToString(); grdSourceBill.Rows[i].Cells[HYXCol].Value = oModel.HYX.ToString(); grdSourceBill.Rows[i].Cells[HKTQCol].Value = DBUtility.ClsPub.BoolToString(oModel.HKTQ); grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = oModel.HReadyTimes.ToString(); grdSourceBill.Rows[i].Cells[HRemarkCol].Value = oModel.HRemark; if (oModel.HHangUp) { grdSourceBill.Rows[i].Cells[HHangUpCol].Value = "Y"; } else { grdSourceBill.Rows[i].Cells[HHangUpCol].Value = ""; } //¼ÓÔØ×Ó±í ÈÕÆÚÐÅÏ¢(Ö»¼ÓÔØ Ëø¶¨µÄÊý¾Ý) if (oModel.HLocked) { if (i >= grdMain.Rows.Count) { grdMain.RowCount = grdMain.Rows.Count + 1; } c = grdMain.RowCount - 1; //ÉèÖÃ×Ó±íÐÅÏ¢ //ÉèÖÃÈռƻ®ÊýÁ¿ Sc_ICMOSortBillFun.SetSubGrid(grdMain, oMain, ref c, ref i, FixCols); } i++; // } //»­Ïß GraphLine(); //½»»õÆÚ¹ýÆÚ ±äÉ« AddColor(); //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); //»Ö¸´Ë¢Ð // } //AfterEdit //¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ private bool CheckJHS(int iRow) { return true; //return BLL.Sc_ProcPlanAutoSortBillFun.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_ProcPlanAutoSortBillFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { } //±£´æµ¥ÐÐ sCol=×ÊÔ´ÄÚÂëÁÐ private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List oClsGridValues,int sCol) { bool bResult; lblCaption.Focus(); // if (!AllowSave()) { return; } //ȨÏÞÅÐ¶Ï oMain.MainColl = new List(); DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); //дÈëÀà Model.ClsSc_WorkBillAutoSortBillMain oModel = new Model.ClsSc_WorkBillAutoSortBillMain(); oMain.DetailColl = new List(); // oModel.HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); oModel.HBillNo = ""; oModel.HYear = 2012; oModel.HPeriod = 1; oModel.HDate = MainDate; oModel.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); oModel.HMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[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.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(DBUtility.ClsPub.isLong(txtHDeptID.Tag), 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_ProcPlanAutoSortBillFun.AllowRow(grdSourceBill); } //ÅÅ³Ì private bool DateSetup(bool bAuto) { Single sLeftProdTimes = 0; string sSourceNumber = ""; string sSourceName = ""; string sICMOBillNo = ""; Int64 lICMOInterID = 0; Int64 lMainID = 0; Int64 lSourceID = 0; Int64 lMaterID = 0; Int64 lProcPlanInterID = 0; Int64 lProcPlanEntryID = 0; Int64 lProcProcNo = 0; string sMaterNumber = ""; string sMaterName = ""; string sMaterModel = ""; string sProcNumber = ""; string sProcName = ""; DateTime dEndDate = DateTime.Today; Single sProdTimes = 0; Single sPlanQty = 0; Single iLeftQty = 0; Single sWorkQty=0; Int64 sYX; Int64 HRelationInterID; bool bFind = false; DataSet ds; DataSet dsSub; DataSet dsPre;//ÉϵÀ¹¤ÐòÕ¼ÓÃʱ¼ä DateTime dWorkBeginTime; 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++) { if (i == 7) { i = i; } //Èç¹ûËø¶¨¼Æ»®£¬Ôò²»ÐèÒªÔÙÅÅ³Ì if (DBUtility.ClsPub.isBool(grdProcBill.Rows[i].Cells[HProLockedCol].Value) == true) { continue; } //ÕÒµ½±¾ÈÎÎñµ¥ ¿ÉÓÃÉú²ú×ÊÔ´ lICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); lMainID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); lProcPlanInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanInterIDCol].Value); lProcPlanEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanEntryIDCol].Value); sICMOBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProICMOBillNoCol].Value); dEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastEndDateCol].Value); sProdTimes = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value); sPlanQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); lMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProMaterIDCol].Value); sProcName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNameCol].Value); sProcNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); sMaterNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNumberCol].Value); sMaterName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNameCol].Value); sMaterModel = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterModelCol].Value); sWorkQty = 0; sYX = DBUtility.ClsPub.isLong(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); for (int sNum = 1; sNum < 10; sNum++) { int sCol = 0; sCol = HProSourceIDCol + (sNum - 1) * 5; //×ÊÔ´2Ϊ¿Õʱ Ìø¹ýÑ­»· if ((DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol].Value) == 0 || DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[sCol + 1].Value) == "" || DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[sCol + 2].Value) == 0 ) && sNum > 1) { break; } 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.GetWorkSourceByInfo(oCn, lMaterID, dEndDate, lProcPlanInterID, lProcPlanEntryID, ref sSourceName, ref sSourceNumber); if (lSourceID == 0) //ûÓпÉÒÔÅŵÄ×ÊÔ´ { //Ìøµ½ÏÂÒ»µ¥ ±¾µ¥ºìÉ«ÏÔʾ grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; sNum = 10; 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 == 51) { sNum = sNum; } //¼ÆË㿪ʼʱ¼ä dWorkBeginTime = Sc_ICMOSortBillFun.Sc_GetBeginWorkTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); if (dWorkBeginTime == null) { grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; sNum = 10; continue; } else { //½«Êý¾ÝÅŵ½Íø¸ñÖÐ grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ¡® 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; sNum = 10; continue; } //¼ÆËã½áÊøÊ±¼ä Sc_ICMOSortBillFun.SetInfoToGridForEndDate(oCn, grdMain, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, dWorkBeginTime, lSourceID, oClsGridValues,FixCols); } bFind = true; } // //±£´æÉú³ÉÅɹ¤µ¥ SaveSingeBill(i, grdMain.RowCount - 1, HRelationInterID, oClsGridValues, sCol); } //дÈë½ø¶ÈµÈ´ý¿ò Thread.Sleep(100); Application.DoEvents(); oWait.pb1.Value = i + 1; oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); oWait.lblHMaterName.Text = ""; Application.DoEvents(); } ////´æÈëÉú²ú״̬±í oCn.RunProc("exec h_p_Sc_WorkAutoBillStatus_Add " + DBUtility.ClsPub.isLong(txtHDeptID.Tag).ToString()); // oWait.Close(); return true; } ////ÅÅ³Ì //private bool DateSetup_tmp(bool bAuto) //{ // Single sLeftProdTimes = 0; // string sSourceNumber = ""; // string sSourceName = ""; // string sICMOBillNo = ""; // Int64 lICMOInterID = 0; // Int64 lMainID = 0; // Int64 lSourceID = 0; // Int64 lMaterID = 0; // Int64 lProcPlanInterID = 0; // Int64 lProcPlanEntryID = 0; // Int64 lProcProcNo = 0; // string sMaterNumber = ""; // string sMaterName = ""; // string sMaterModel = ""; // string sProcNumber = ""; // string sProcName = ""; // DateTime dEndDate = DateTime.Today; // Single sProdTimes = 0; // Single sPlanQty = 0; // Single iLeftQty = 0; // Single sWorkQty; // Int64 sYX; // Int64 HRelationInterID; // bool bFind = false; // DataSet ds; // DataSet dsSub; // DataSet dsPre;//ÉϵÀ¹¤ÐòÕ¼ÓÃʱ¼ä // List oClsGridValues = new List(); // //µÃµ½Ò»¸öÄÚÂë // HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); // if (HRelationInterID == 0) // { // HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); // } // if (HRelationInterID == 0) // { // MessageBox.Show("»ñÈ¡µ¥¾ÝÄÚÂëʧ°Ü!"); // return false; // } // //µ¯³öǰÖ÷Çģʽ´°Ì壬ÏÔʾ½ø¶È // DBUtility.Xt_ProcessWait oWait = new DBUtility.Xt_ProcessWait(); // oWait.lblCaption.Text = "ÕýÔÚÅųÌÇëÉÔºò..."; // oWait.lblHCount.Text = ""; // oWait.lblHMaterName.Text = ""; // oWait.pb1.Maximum = grdProcBill.RowCount; // oWait.pb1.Value = 0; // oWait.Show(); // grdMain.RowCount = 0; // //Çå¿ÕÎ´Ëø¶¨ Åų̼Ǽ // Sub_DeleteBillUnLock(); // //Èç¹û ÏÔʾʱ¼äÍø¸ñ // //if (true == true) // //{ // // //¸´ÖÆ ÅųÌÍø¸ñµÄÈ«²¿ÐÅÏ¢ÖÁ // // CopyGrid(); // //} // oClsGridValues.Clear(); // //°´ÈÎÎñµ¥ÓÅÏȼ¶ Ñ­»· ¹¤Ðò¼Æ»®µ¥ // for (int i = 0; i < grdProcBill.RowCount; i++) // { // //Èç¹ûËø¶¨¼Æ»®£¬Ôò²»ÐèÒªÔÙÅÅ³Ì // if (DBUtility.ClsPub.isBool(grdProcBill.Rows[i].Cells[HProLockedCol].Value) == true) // { // continue; // } // //ÕÒµ½±¾ÈÎÎñµ¥ ¿ÉÓÃÉú²ú×ÊÔ´ // lICMOInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); // lMainID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value); // lProcPlanInterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanInterIDCol].Value); // lProcPlanEntryID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcPlanEntryIDCol].Value); // sICMOBillNo = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProICMOBillNoCol].Value); // dEndDate = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastEndDateCol].Value); // sProdTimes = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value); // sPlanQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProPlanQtyCol].Value); // lMaterID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProMaterIDCol].Value); // sProcName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNameCol].Value); // sProcNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); // sMaterNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNumberCol].Value); // sMaterName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterNameCol].Value); // sMaterModel = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HProMaterModelCol].Value); // sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); // sYX = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProYXCol].Value); // lProcProcNo = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProProcNoCol].Value); // // // if (sICMOBillNo == "WORK155356") // { // sICMOBillNo = sICMOBillNo; // } // //¸ù¾Ý¼Æ»®Êý-»ã±¨Êý ¼ÆËã Ê£ÓàÐèÇó¹¤Ê± // iLeftQty = sPlanQty - DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProRelationQtyCol].Value); // if (sWorkQty != 0) // { // sLeftProdTimes = iLeftQty / sWorkQty; // } // else // { // sLeftProdTimes = 0; // } // if (dEndDate < DBUtility.ClsPub.isDate("2000-01-01")) // { // dEndDate = DateTime.Today; // } // //Èô±¾ÈÎÎñµ¥ÒÑÓа²ÅÅ×ÊÔ´£¨ÉÏ´ÎÅų̻òÕßÊÖ¹¤Åų̣© Ôò²»ÔÙѰÕÒ×ÊÔ´£¬Ö±½ÓÅÅ³Ì // //if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSourceIDCol].Value) != 0) // //{ // // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // // lSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSourceIDCol].Value); // // sSourceName = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HSourceNameCol].Value); // // sSourceNumber = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[i].Cells[HSourceNumberCol].Value); // // // // // ds = Sc_ICMOSortBillFun.GetWorkSourceByICMO(oCn, lMaterID, dEndDate, lSourceID, sLeftProdTimes); // //} // //else //ûÓÐ×ÊÔ´Ôò ×Ô¶¯ÕÒµ½×ÊÔ´ // //{ // // // ds = Sc_ICMOSortBillFun.GetWorkSourceByProc(oCn, lMaterID, dEndDate, sLeftProdTimes, lProcPlanInterID, lProcPlanEntryID); // //} // if (ds == null || ds.Tables[0].Rows.Count == 0) //ûÓпÉÒÔÅŵÄ×ÊÔ´ // { // //Ìøµ½ÏÂÒ»µ¥ ±¾µ¥ºìÉ«ÏÔʾ // grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; // continue; // } // else // { // grdProcBill.Rows[i].DefaultCellStyle.BackColor = Color.White; // //¿ªÊ¼Åŵ¥ // bFind = false; // //³¬½»»õÆÚ ÈÔÈ»ÅÅ³Ì // for (int j = 0; j < ds.Tables[0].Rows.Count; j++) // { // //ÅжÏ×ÊÔ´Ê£Ó๤ʱ£¬ÊÇ·ñ´óÓÚ Éú²úÖÜÆÚ // if (DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[j]["Ê£Ó๤ʱ"]) > sLeftProdTimes) // { // if (iLeftQty > 0) // { // //ÔÚ±¾×ÊÔ´ÉÏÉú²ú // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HitemID"]); // sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´Ãû³Æ"]); // sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´´úÂë"]); // grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; // grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; // grdProcBill.Rows[i].Cells[HProSourceNumberCol].Value = sSourceNumber; // dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); // if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) // { // continue; // } // if (dsSub != null)//²»¼Ó°àÅÅ³Ì // { // //½«Êý¾ÝÅŵ½Íø¸ñÖÐ // grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; // //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ // SetSourceWorkQty(i); // //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© // dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); // //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; // sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // // // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, false, oClsGridValues); // } // bFind = true; // } // } // } // if (!bFind) // { // for (int j = 0; j < ds.Tables[0].Rows.Count; j++) // { // //ÅжÏ×ÊÔ´×î´óÊ£Ó๤ʱ£¬ÊÇ·ñ´óÓÚ Éú²úÖÜÆÚ // if (DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[j]["×î´óÊ£Ó๤ʱ"]) > sLeftProdTimes) // { // if (iLeftQty > 0) // { // //ÔÚ±¾×ÊÔ´ÉÏÉú²ú // grdMain.RowCount = grdMain.RowCount + 1; // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HitemID"]); // sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´Ãû³Æ"]); // sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[j]["×ÊÔ´´úÂë"]); // grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; // grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; // grdProcBill.Rows[i].Cells[HProSourceNumberCol].Value = sSourceNumber; // dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); // if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) // { // continue; // } // if (dsSub != null)//¼Ó°àÅÅ³Ì // { // //½«Êý¾ÝÅŵ½Íø¸ñÖÐ // grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; // //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ // SetSourceWorkQty(i); // //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© // dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); // //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; // sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // // // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues); // } // } // bFind = true; // } // } // } // if (!bFind) // { // //Èç¹ûûÓÐÕÒµ½ºÏÊÊ×ÊÔ´Ôò£¬Ö±½ÓÅÅ×îºóÒ»¸öÊ£Óà×î´óµÄ×ÊÔ´¡£ // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // lSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["HitemID"]); // sSourceName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["×ÊÔ´Ãû³Æ"]); // sSourceNumber = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["×ÊÔ´´úÂë"]); // grdProcBill.Rows[i].Cells[HProSourceIDCol].Value = lSourceID; // grdProcBill.Rows[i].Cells[HProSourceNameCol].Value = sSourceName; // grdProcBill.Rows[i].Cells[HProSourceNumberCol].Value = sSourceNumber; // //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ // dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource_Proc(oCn, lSourceID, lProcPlanInterID, lProcPlanEntryID); // if (dsSub == null || dsSub.Tables[0].Rows.Count == 0) // { // continue; // } // if (dsSub != null)//¼Ó°àÅÅ³Ì // { // //½«Êý¾ÝÅŵ½Íø¸ñÖÐ // grdMain.RowCount = grdMain.RowCount + 1; // grdmain ÐÂÔöÒ»ÐÐ // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNumberCol].Value = sProcNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNameCol].Value = sProcName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX; // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecProcNoCol].Value = lProcProcNo; // //¸ù¾Ý×ÊÔ´ÖØÐ»ñÈ¡²úÄÜ // SetSourceWorkQty(i); // //¸ù¾Ý¿ª¹¤ÓàÁ¿ºÍÌìÊý »ñÈ¡ ÉϵÀ¹¤ÐòÒÑÕ¼ÓÃʱ¼ä£¨Ôݲ»¿¼ÂÇÒѻ㱨ÊýÁ¿£© // dsPre = Sc_ICMOSortBillFun.GetUseSourceTimeByBeginQty(oCn, lProcPlanInterID, lProcPlanEntryID); // //grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value = sWorkQty; // sWorkQty = DBUtility.ClsPub.isSingle(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value); // grdMain.Rows[grdMain.RowCount - 1].Cells[HSecWorkQtyCol].Value = sWorkQty; // // // Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, dsPre, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues); // } // } // } // //±£´æÉú³ÉÅɹ¤µ¥ // SaveSingeBill(i, grdMain.RowCount - 1, HRelationInterID, oClsGridValues); // //дÈë ½ø¶ÈµÈ´ý¿ò // Thread.Sleep(100); // Application.DoEvents(); // oWait.pb1.Value = i + 1; // oWait.lblHCount.Text = oWait.pb1.Value.ToString() + "/" + oWait.pb1.Maximum.ToString(); // oWait.lblHMaterName.Text = ""; // Application.DoEvents(); // } // ////´æÈëÉú²ú״̬±í // oCn.RunProc("exec h_p_Sc_WorkAutoBillStatus_Add " + DBUtility.ClsPub.isLong(txtHDeptID.Tag).ToString()); // // // oWait.Close(); // return true; //} //ɾ³ý±¾²¿ÃÅÎ´Ëø¶¨ ¼Ç¼ private void Sub_DeleteBillUnLock() { if (oMain.DeleteBillUnlock(DBUtility.ClsPub.isLong(txtHDeptID.Tag)) == false) { MessageBox.Show("×÷·ÏÀúÊ·µ¥¾Ýʧ°Ü£¡"); } } //¶©µ¥µÈ¼¶ ÅÅÐò private bool SortData_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]["¶©µ¥½»»õÆÚ"]); //дÈë ½ø¶ÈµÈ´ý¿ò 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 = grdSourceBill.Rows[i].Cells[HProdTimesCol].Value; grdProcBill.Rows[m].Cells[HProWorkQtyCol].Value =0;//µÃµ½²úÄÜ grdProcBill.Rows[m].Cells[HProYXCol].Value = grdSourceBill.Rows[i].Cells[HYXCol].Value; grdProcBill.Rows[m].Cells[HProSourceIDCol].Value = 0; grdProcBill.Rows[m].Cells[HProSourceNameCol].Value = ""; grdProcBill.Rows[m].Cells[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; } } } 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_ProcPlanAutoSortBillFun.GetWorkNumber(FDate, SourceID,oCn); } private void cx_Click(object sender, EventArgs e) { timer1.Enabled = true; } //¼ÓÔØ ѡԴµ¥ private void sx_Click(object sender, EventArgs e) { DAL.Cls_S_K3_ICMOBill oK3_ICMOBill = new DAL.Cls_S_K3_ICMOBill(); string sWhere = " And HDeptID=" + DBUtility.ClsPub.isLong(txtHDeptID.Tag) + " "; if (oK3_ICMOBill.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"); //дÈëÐÅÏ¢ 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 = oTable.Rows[0]["¶©µ¥µÈ¼¶"].ToString(); grdSourceBill.Rows[i].Cells[HKTQCol].Value = "1"; grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = "0"; grdSourceBill.Rows[i].Cells[HRemarkCol].Value =""; //============ grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value = oTable.Rows[0]["HMainID"].ToString(); grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value = oTable.Rows[0]["HSeOrderInterID"].ToString(); grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value = oTable.Rows[0]["HSeOrderEntryID"].ToString(); grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value = oTable.Rows[0]["HMainID"].ToString(); grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value = oTable.Rows[0]["HSubID"].ToString(); //grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); } catch (Exception e) { MessageBox.Show(e.Message); } } //±£´æÁпí private void bclk_Click(object sender, EventArgs e) { //±£´æÁпí DBUtility.ClsPub.SaveGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdSourceBill, this.Name + "grdSourceBill", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdMain, this.Name + "grdMain", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdMain_t, this.Name + "grdMain_t", DBUtility.ClsPub.AppPath); } //ĬÈÏÁпí private void mrlk_Click(object sender, EventArgs e) { DBUtility.ClsPub.DefaultGridView(grdSource); DBUtility.ClsPub.DefaultGridView(grdICMO); DBUtility.ClsPub.DefaultGridView(grdSourceBill); DBUtility.ClsPub.DefaultGridView(grdMain); } //Í˳ö°´Å¥ private void tc_Click(object sender, EventArgs e) { this.Close(); } //Åų̰´Å¥ private void xz_Click(object sender, EventArgs e) { if (CheckSetupData() == false) { return; } if (MessageBox.Show("ÊÇ·ñÆô¶¯Åų̣¿","Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { //this.DateSetup(false); return; } else { this.DateSetup(true); } } //Çå¿Õ°´Å¥ private void toolStripButton1_Click(object sender, EventArgs e) { //this.ClearDateCol(true); } //»Ö¸´°´Å¥ private void hf_Click(object sender, EventArgs e) { //this.ClearDateCol(false); } //±£´æ°´Å¥ private void bc_Click(object sender, EventArgs e) { //if (bEdit == true) //{ // MessageBox.Show("ÅųÌÊý×ÖÒѱ»Ð޸ģ¬ÇëÖØÐÂÖ´ÐÐÔÚ±£´æ£¡"); // return; //} SaveBill(); } //ÄÜÁ¦°´Å¥ private void nl_Click(object sender, EventArgs e) { //ÄÜÁ¦ÉèÖà //Gy_WorkTimes oFrm = new Gy_WorkTimes(); //oFrm.ShowDialog(); } private void Sc_ProcPlanAutoSortBill_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.SetSourceWorkQty(grdProcBill, HProMaterIDCol, HProSourceIDCol, DBUtility.ClsPub.isLong(grdProcBill.Rows[iRow].Cells[HProProcIDCol].Value), HProWorkQtyCol, iRow, oMain); } //ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceRelationQty(int iRow) { //BLL.Sc_ProcPlanAutoSortBillFun.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_ProcPlanAutoSortBillFun.Sub_SetHandChangeFlag(grdSourceBill, sCol, sRow); } //ˢл㱨ÊýÁ¿ private void GetHRelationQty() { ////grid½ûֹˢР//grdSourceBill.Redraw = VSFlex7.RedrawSettings.flexRDNone; ////¼ÓÔØ±íÍ· //for(int i=grdSourceBill.FixedRows ;i 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 glxx_Click(object sender, EventArgs e) { tbc1.Visible = !tbc1.Visible; if (tbc1.Visible == false) { spc1.SplitterDistance = spc1.Size.Height-20; } else { spc1.SplitterDistance = spc1.Size.Height-200; } } //ÈÎÎñµ¥¹ØÁªÐÅÏ¢ 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_ProcPlanAutoSortBillFun.GetSourceByMater(oCn,grdSource,sMaterID); // //ÏÔʾÈÎÎñµ¥ÐÅÏ¢ // Int64 sICMOInterID = 0; // sICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.get_TextMatrix(grdSourceBill.Row, HICMOInterIDCol)); // BLL.Sc_ProcPlanAutoSortBillFun.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_ProcPlanAutoSortBillFun.GetWorkTimeByID(oCn, lblWorkTime, grdSourceBill, HMaterIDCol, HSourceIDCol, FixCols); } //ÉèÖÃÓÅÏȼ¶ private void yxj_Click(object sender, EventArgs e) { SetYXNum(); /* //¸ù¾ÝÎïÁÏ ¹¤Ðò µÃµ½¹¤×÷ÖÐÐÄ ×ܲúÄÜ SetCenterWorkQty(); SortData_Proc(); //¸ù¾Ý¿ª¹¤ÈÕÆÚ ÅÅÐò SortData_ProcByDate(); //¸ù¾Ý¿ª¹¤ÈÕÆÚ ÅÅÐò DateTime otime = ClsPub.isDate("1900-01-01"); int BRow = 0; int ERow = 0; // for (int i = 0; i < grdProcBill.Rows.Count; i++) { if (ERow == 0) { ERow = 1; otime = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value); continue; } if (otime != DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value)) { otime = DBUtility.ClsPub.isDate(grdProcBill.Rows[i].Cells[HProLastBeginDateCol].Value); SortData_ProcByQty(BRow, ERow); break; BRow = i; ERow = i; } else { ERow = i; } if (i == grdProcBill.Rows.Count - 1) { SortData_ProcByQty(BRow, ERow); } } */ } //»ñÈ¡¹¤×÷ÖÐÐÄ£¬²úÄÜ 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() { //ÉèÖÃÓÅÏȼ¶ ±àºÅ for (int i = 0; i < grdSourceBill.RowCount; i++) { grdSourceBill.Rows[i].Cells[HYXCol].Value = i + 1; } // return true; } private void sb_Click(object sender, EventArgs e) { //°´É豸·ÖÎö Sc_WorkBillSortSumBySource oSc_WorkBillSortSumBySource = new Sc_WorkBillSortSumBySource(); oSc_WorkBillSortSumBySource.txtHBDeptID.Tag = txtHDeptID.Tag; oSc_WorkBillSortSumBySource.ShowDialog(); } private void cp_Click(object sender, EventArgs e) { //°´²úÆ··ÖÎö Sc_WorkBillSortSumByMaterial oSc_WorkBillSortSumByMaterial = new Sc_WorkBillSortSumByMaterial(); oSc_WorkBillSortSumByMaterial.txtHBDeptID.Tag = txtHDeptID.Tag; oSc_WorkBillSortSumByMaterial.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_ProcPlanAutoSortBill_ChangQty oChangQty = new Sc_ProcPlanAutoSortBill_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_ProcPlanAutoSortBillQL oQL = new Sc_ProcPlanAutoSortBillQL(); //if (grdMain.CurrentRow == null) // return; //oQL.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); //oQL.HICMOInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[HSecICMOInterIDCol].Value); //oQL.ShowDialog(); } //ÉÏÉý private void up_Click(object sender, EventArgs e) { //ÅжÏÊÇ·ñÑ¡ÖÐÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow == null) return; //ÅжÏÊÇ·ñÊǵÚÒ»ÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow.Index == 0) return; //ÓëÉÏÒ»ÐжԻ» //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sc_ICMOSortBillFun.ChangeGridItemUp(grdSourceBill, grdSourceBill.CurrentRow.Index); //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; } //Ͻµ private void down_Click(object sender, EventArgs e) { //ÅжÏÊÇ·ñÑ¡ÖÐÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow == null) return; //ÅжÏÊÇ·ñÊǵÚÒ»ÐÐ £¬Ìø³ö if (grdSourceBill.CurrentRow.Index == grdSourceBill.ColumnCount - 1) return; //ÓëÉÏÒ»ÐжԻ» //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, grdSourceBill.CurrentRow.Index); //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; } private void msg_Click(object sender, EventArgs e) { BLL.OA_EmpMessageBill oEmpMessageBill; Int64 lngBillKey = 0; //ÕÒµ½ Ô´µ¥ÀàÐͺÍID oEmpMessageBill = new BLL.OA_EmpMessageBill(); oEmpMessageBill.HRelationInterID = lngBillKey; oEmpMessageBill.HRelationEntryID = lngBillKey; oEmpMessageBill.HRelationBillType = ModName; oEmpMessageBill.HRelationBillNo = ""; oEmpMessageBill.Show(); } private void sjb_Click(object sender, EventArgs e) { if (grdMain_t.Visible == false) { grdMain_t.Visible = true; // CopyGrid(); CountTimes(); //UpdateAutoSortDate(); // DBUtility.ClsPub.GetGridView(grdMain_t, this.Name + "grdMain_t", DBUtility.ClsPub.AppPath); } else { grdMain_t.Visible = false; } } //¸üР¿ªÊ¼½áÊøÊ±¼ä private void UpdateAutoSortDate() { char a = Convert.ToChar("-"); string sYear = ""; string sDate = ""; DateTime sHBeginTime; DateTime sHEndTime; long HICMOInterID = 0; long HSourceID = 0; long HSubID = 0; try { for (int i = 0; i <= grdMain_t.RowCount - 1; i++) { for (int c = FixCols; c <= grdMain_t.ColumnCount - 1; c++) { sDate = DBUtility.ClsPub.isStrNull(grdMain_t.Rows[i].Cells[c].Value); if (sDate != "") { HICMOInterID = DBUtility.ClsPub.isLong(grdMain_t.Rows[i].Cells[HSecICMOInterIDCol].Value); HSourceID = DBUtility.ClsPub.isLong(grdMain_t.Rows[i].Cells[HSecSourceIDCol].Value); HSubID = c; sYear = DBUtility.ClsPub.isStrNull(grdMain.Columns[c].Tag); string[] s = sDate.Split(a); sHBeginTime = DBUtility.ClsPub.isDate(sYear + " " + s[0]); sHEndTime = DBUtility.ClsPub.isDate(sYear + " " + s[1]); oCn.RunProc("exec h_p_Sc_UpdateAutoSortDate " + HICMOInterID.ToString() + "," + HSourceID.ToString() + "," + HSubID.ToString() + ",'" + sHBeginTime.ToString() + "','" + sHEndTime.ToString() + "'"); } } } } catch (Exception e) { return; } } //¸´ÖÆÍø¸ñ private void CopyGrid() { DBUtility.Xt_BaseBillFun.initGridFst(grdMain_t, this.Name + "grdMain_t"); grdMain_t.RowCount = 0; grdMain_t.ColumnCount = 0; grdMain_t.RowCount = grdMain.RowCount; grdMain_t.ColumnCount = grdMain.ColumnCount; grdMain_t.ReadOnly = true; //¸´ÖƱêÌâ for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain_t.Columns[i].HeaderText = grdMain.Columns[i].HeaderText; grdMain_t.Columns[i].Tag = grdMain.Columns[i].Tag; grdMain_t.Columns[i].Visible = grdMain.Columns[i].Visible; grdMain_t.Columns[i].Width = grdMain.Columns[i].Width; } // for (int i = 0; i < grdMain.RowCount; i++) { for (int j = 0; j < grdMain.ColumnCount; j++) { grdMain_t.Rows[i].Cells[j].Value = grdMain.Rows[i].Cells[j].Value; } } } //¼ÆËãʱ¼ä private void CountTimes() { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View(); DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View(); DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); int c = 0; int i = 0; //½«¹ýÂË¿òµÄ²¿Ãź͹¤ÐòдÈë½çÃæ£¬ÈôûÓв¿ÃÅÔò Ìø³ö¹ý³Ì //µÃµ½µ±Ç°HRelationInterID oMain.HRelationInterID = oMain.GetRelationInterIDByDept(DBUtility.ClsPub.isLong(txtHDeptID.Tag)); //¸ù¾Ý²¿Ãŵõ½Ä¬ÈÏ×ÊÔ´ // if (oMain.ShowBillByProc_t(oMain.HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo) == false) { MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } //Çå¿Õ //¼ÓÔØ Ö÷±í£¬ÈÎÎñµ¥ÐÅÏ¢ i = 0; //foreach (Model.ClsSc_WorkBillAutoSortBillMain oModel in oMain.MainColl) //{ //¼ÓÔØ×Ó±í ÈÕÆÚÐÅÏ¢(Ö»¼ÓÔØ Ëø¶¨µÄÊý¾Ý) if (i >= grdMain_t.Rows.Count) { grdMain_t.RowCount = grdMain_t.Rows.Count + 1; } c = grdMain_t.RowCount - 1; //ÉèÖÃ×Ó±íÐÅÏ¢ //ÉèÖÃÈռƻ®ÊýÁ¿ Sc_ICMOSortBillFun.SetSubGrid_t(grdMain_t, oMain, ref c, ref i, FixCols); i++; // //} } 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 void gy_Click(object sender, EventArgs e) { //ÏÈÉú³É¹¤Ðò¼Æ»®µ¥ SaveProcBill(); LoadProcBill();//¼ÓÔØ¹¤Ðò¼Æ»®µ¥ Éú³É¹¤Ðò¼Æ»®µ¥ } //ÆëÁÏÅÐ¶Ï 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; 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 cf_Click(object sender, EventArgs e) { Fun_AutoSplitICMOQty(); //int sQty = 2; //²ð·ÖÁÐÊý //int qty = 0; //ÐÐÊý //double times = 0; //»ã×ÜÉú²úÖÜÆÚ //double avgtimes = 0; //ƽ¾ùÉú²úÖÜÆÚ //double Dtimes = 0; //¶àÓàÉú²úÖÜÆÚ //double Ktimes = 0; //¿ÕÏÐÉú²úÖÜÆÚ //long HSourceID = 0; //×ÊÔ´ID ////µÃµ½»ã×Ü Éú²úÖÜÆÚ //for (int i = 0; i < grdProcBill.RowCount; i++) //{ // if (DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HProICMOInterIDCol].Value) != 0) // { // times = times + DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value); // qty = qty + 1; // } //} ////µÃµ½Æ½¾ù Éú²úÖÜÆÚ //avgtimes = times / qty; ////²ð·Ö Éú²úÖÜÆÚ ´óÓÚ Æ½¾ùÉú²úÖÜÆÚ µÄ¼Ç¼ //for (int i = 0; i < grdProcBill.RowCount; i++) //{ // if (DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value) > avgtimes) // { // //¶àÓàÉú²úÖÜÆÚ // sQty = 2; // Dtimes = DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProProdTimesCol].Value) - avgtimes; // for (int j = i + 1; j < grdProcBill.RowCount; j++) // { // //ÕÒµ½ Éú²úÖÜÆÚ Ð¡ÓÚ Æ½¾ùÉú²úÖÜÆÚ £¬ ·ÖÅäÊýÁ¿ // if (DBUtility.ClsPub.isDoule(grdProcBill.Rows[j].Cells[HProProdTimesCol].Value) < avgtimes) // { // //¿ÕÏÐÉú²úÖÜÆÚ // HSourceID = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // Ktimes = avgtimes - DBUtility.ClsPub.isDoule(grdProcBill.Rows[j].Cells[HProProdTimesCol].Value); // //·ÖÅä ²ð·ÖÊýÁ¿ // if (Dtimes - Ktimes >= 0) // { // if (sQty == 2) // { // grdProcBill.Rows[i].Cells[HProSourceID2Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber2Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName2Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty2Col].Value = DBUtility.ClsPub.isLong(Ktimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty2Col].Value); // } // if (sQty == 3) // { // grdProcBill.Rows[i].Cells[HProSourceID3Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber3Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName3Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty3Col].Value = DBUtility.ClsPub.isLong(Ktimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty3Col].Value); // } // if (sQty == 4) // { // grdProcBill.Rows[i].Cells[HProSourceID4Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber4Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName4Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty4Col].Value = DBUtility.ClsPub.isLong(Ktimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty4Col].Value); // } // if (sQty == 5) // { // grdProcBill.Rows[i].Cells[HProSourceID5Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber5Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName5Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty5Col].Value = DBUtility.ClsPub.isLong(Ktimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HSplitQty5Col].Value); // } // if (sQty == 6) // { // grdProcBill.Rows[i].Cells[HProSourceID6Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber6Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName6Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty6Col].Value = DBUtility.ClsPub.isLong(Ktimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty6Col].Value); // } // grdProcBill.Rows[j].Cells[HProProdTimesCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProProdTimesCol].Value) + Ktimes; // Dtimes = Dtimes - Ktimes; // sQty = sQty + 1; // } // else // { // if (sQty == 2) // { // grdProcBill.Rows[i].Cells[HProSourceID2Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber2Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName2Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty2Col].Value = DBUtility.ClsPub.isLong(Dtimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty2Col].Value); // } // if (sQty == 3) // { // grdProcBill.Rows[i].Cells[HProSourceID3Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber3Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName3Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty3Col].Value = DBUtility.ClsPub.isLong(Dtimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty3Col].Value); // } // if (sQty == 4) // { // grdProcBill.Rows[i].Cells[HProSourceID4Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber4Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName4Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty4Col].Value = DBUtility.ClsPub.isLong(Dtimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty4Col].Value); // } // if (sQty == 5) // { // grdProcBill.Rows[i].Cells[HProSourceID5Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber5Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName5Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty5Col].Value = DBUtility.ClsPub.isLong(Dtimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty5Col].Value); // } // if (sQty == 6) // { // grdProcBill.Rows[i].Cells[HProSourceID6Col].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProSourceIDCol].Value); // grdProcBill.Rows[i].Cells[HProSourceNumber6Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNumberCol].Value); // grdProcBill.Rows[i].Cells[HProSourceName6Col].Value = DBUtility.ClsPub.isStrNull(grdProcBill.Rows[j].Cells[HProSourceNameCol].Value); // grdProcBill.Rows[i].Cells[HSplitQty6Col].Value = DBUtility.ClsPub.isLong(Dtimes * DBUtility.ClsPub.isDoule(grdProcBill.Rows[i].Cells[HProWorkQtyCol].Value)); // grdProcBill.Rows[i].Cells[HSplitQtyCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQtyCol].Value) - DBUtility.ClsPub.isLong(grdProcBill.Rows[i].Cells[HSplitQty6Col].Value); // } // grdProcBill.Rows[j].Cells[HProProdTimesCol].Value = DBUtility.ClsPub.isLong(grdProcBill.Rows[j].Cells[HProProdTimesCol].Value) + Dtimes; // sQty = sQty + 1; // } // } // } // } //} } } }