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; namespace APSM { public partial class Sc_ICMOAutoSortBill : Form { public Sc_ICMOAutoSortBill() { InitializeComponent(); } //¶¨ÒåÁÐ public const Int16 FixCols =16; // public const Int16 HSourceIDCol = 1; public const Int16 HSourceNameCol = 2; public const Int16 HGroupIDCol = 3; public const Int16 HGroupNameCol = 4; public const Int16 HSourceQtyCol = 5; public const Int16 HICMOBillNoCol = 6; public const Int16 HMaterIDCol = 7; public const Int16 HMaterNumberCol = 8; public const Int16 HMaterNameCol = 9; public const Int16 HMaterModelCol = 10; public const Int16 HUnitIDCol = 11; public const Int16 HUnitNumberCol = 12; public const Int16 HUnitNameCol =13; public const Int16 HPlanQtyCol = 14; public const Int16 HRelationQtyCol = 15; //ÒÑÍ깤ÊýÁ¿ public const Int16 HInStockQtyCol = 16; //Èë¿âµ¥Êý public const Int16 HWorkQtyCol = 17; //²úÄÜ public const Int16 HProdTimesCol = 18; //Éú²úÖÜÆÚ=¼Æ»®Êý/²úÄÜ £¨Ð¡Ê±£© public const Int16 HWorkTimesCol = 19; public const Int16 HYXCol = 20; public const Int16 HKTQCol =21; public const Int16 HReadyQtyCol = 22; //¿ª¹¤ÓàÁ¿ public const Int16 HPlanBeginDateCol = 23; //¼Æ»®¿ª¹¤ public const Int16 HPlanEndDateCol = 24; //¼Æ»®Í깤 public const Int16 HLastBeginDateCol = 25; //×î³Ù¿ª¹¤=×î³ÙÍ깤-Éú²úÖÜÆÚ£¨×î¶ÌÖÜÆÚ£© public const Int16 HLastEndDateCol = 26; //×î³ÙÍ깤=¶©µ¥½»»õÆÚ-ÌáǰÆÚ public const Int16 HOrderNeedQtyCol = 27; //¶©µ¥ÐèÇóÊý public const Int16 HCusNameCol = 28; // ¿Í»§ public const Int16 HSeOrderBillNoCol = 29; //¶©µ¥ºÅ public const Int16 HIsOutSellCol = 30; //ÊÇ·ñÍâó public const Int16 HOrderCommitDateCol = 31; //¶©µ¥½»»õÆÚ=ÓëÔ¤²âµ¥³åÏúµÄ¶©µ¥×îÔç½»»õÆÚ¡£ public const Int16 HRemarkCol = 32; public const Int16 HSourceInterIDCol = 33; public const Int16 HSourceEntryIDCol = 34; public const Int16 HSourceBillTypeCol = 35; public const Int16 HICMOInterIDCol = 36; public const Int16 HSeOrderInterIDCol = 37; public const Int16 HSeOrderEntryIDCol = 38; public const Int16 HSourceBillNoCol = 39; public const Int16 HLockedCol = 40; public const Int16 HSourceNumberCol = 41; //grd2 public const Int16 HSecSourceIDCol = 1; public const Int16 HSecSourceNumberCol = 2; public const Int16 HSecSourceNameCol = 3; public const Int16 HSecGroupIDCol = 4; public const Int16 HSecGroupNameCol = 5; public const Int16 HSecICMOBillNoCol = 6; public const Int16 HSecICMOInterIDCol = 7; public const Int16 HSecMaterIDCol = 8; public const Int16 HSecMaterNumberCol = 9; public const Int16 HSecMaterNameCol = 10; public const Int16 HSecMaterModelCol = 11; public const Int16 HSecPlanEndDateCol = 12; public const Int16 HSecYXCol = 13; public const Int16 HSecPlanQtyCol = 14; public const Int16 HSecLeftQtyCol = 15; // 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_ICMOAutoSortBillDlg oDlg = new Sc_ICMOAutoSortBillDlg(); BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar(); DAL.ClsSc_ICMOSortBill oMainPC = new DAL.ClsSc_ICMOSortBill(); // bool bEdit = false; //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return false; //return BLL.Sc_ICMOAutoSortBillFun.IsSelectCell(grdSourceBill, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow,int iCol) { return false; //return BLL.Sc_ICMOAutoSortBillFun.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[HIsOutSellCol].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[HWorkQtyCol].HeaderText = "²úÄÜ"; grdSourceBill.Columns[HWorkTimesCol].HeaderText = "±ê×¼¹¤Ê±"; grdSourceBill.Columns[HSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdSourceBill.Columns[HSourceNumberCol].HeaderText = "×ÊÔ´´úÂë"; grdSourceBill.Columns[HGroupNameCol].HeaderText = "Éú²ú°à×é"; grdSourceBill.Columns[HSourceQtyCol].HeaderText = "×ÊÔ´Êý"; grdSourceBill.Columns[HInStockQtyCol].HeaderText = "ÒÑÈë¿âÊýÁ¿"; grdSourceBill.Columns[HYXCol].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[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[HGroupIDCol].Visible = false; grdSourceBill.Columns[HUnitNumberCol].Visible = false; grdSourceBill.Columns[HSourceInterIDCol].Visible = false; grdSourceBill.Columns[HSourceEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderEntryIDCol].Visible = false; grdSourceBill.Columns[HSeOrderInterIDCol].Visible = false; //// //grdSourceBill.ReadOnly = true; //ÉèÖÿɱ༭ÁÐ sAllowCol = HGroupNameCol.ToString() + "," + HSourceNameCol.ToString() + "," + HSourceQtyCol.ToString() + "," + HYXCol.ToString() + "," + HWorkQtyCol.ToString(); /////grd2 grdMain.ColumnCount = FixCols; DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name); grdMain.BackgroundColor = Color.Lavender; //Íø¸ñ±³¾°É« grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.Beige; grdMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; grdMain.ReadOnly = false; grdMain.RowCount = 0; grdMain.Columns[HSecICMOBillNoCol].HeaderText = "ÈÎÎñµ¥ºÅ"; grdMain.Columns[HSecLeftQtyCol].HeaderText = "´ýÉú²ú¼Æ»®Êý"; grdMain.Columns[HSecMaterNameCol].HeaderText = "ÎïÁÏÃû³Æ"; grdMain.Columns[HSecMaterNumberCol].HeaderText = "ÎïÁÏ´úÂë"; grdMain.Columns[HSecPlanQtyCol].HeaderText = "ÈÎÎñÊý"; grdMain.Columns[HSecSourceNameCol].HeaderText = "Éú²ú×ÊÔ´"; grdMain.Columns[HSecSourceNumberCol].HeaderText = "×ÊÔ´´úÂë"; grdMain.Columns[HSecGroupNameCol].HeaderText = "Éú²ú°à×é"; grdMain.Columns[HSecPlanEndDateCol].HeaderText = "¼Æ»®Í깤"; //grdMain.Columns[HSecICMOInterIDCol].HeaderText = "¼Æ»®Í깤"; grdMain.Columns[HSecYXCol].HeaderText = "ÓÅÏÈ"; // grdMain.Columns[0].Visible = false; grdMain.Columns[HSecICMOInterIDCol].Visible = false; grdMain.Columns[HSecSourceIDCol].Visible = false; grdMain.Columns[HSecGroupIDCol].Visible = false; grdMain.Columns[HSecMaterIDCol].Visible = false; //grdMain.ReadOnly = true; for (int i = 0; i < grdMain.ColumnCount; i++) { grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; //ÁÐ ÅÅÐòģʽ } // // DBUtility.ClsPub.GetGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdProcFlow, this.Name + "grdProcFlow", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdSourceBill, this.Name + "grdSourceBill", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.GetGridView(grdMain, this.Name + "grdMain", 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.ClsGy_Department_View oDept = new DAL.ClsGy_Department_View(); DAL.ClsGy_Material_View oMater = new DAL.ClsGy_Material_View(); DAL.ClsGy_Unit_View oUnit = new DAL.ClsGy_Unit_View(); DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View(); DAL.ClsIF_Group_View oGroup = new DAL.ClsIF_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.GetRelationInterIDByDeptUser(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; } //return; // if (oMain.ShowBill(oMain.HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo) == false) { //MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } //Çå¿Õ //¼ÓÔØ Ö÷±í£¬ÈÎÎñµ¥ÐÅÏ¢ 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[HGroupIDCol].Value = oModel.HGroupID.ToString(); if (oGroup.GetInfoByID(oModel.HGroupID)) { grdSourceBill.Rows[i].Cells[HGroupNameCol].Value = oGroup.omodel.HName; } // grdSourceBill.Rows[i].Cells[HSourceQtyCol].Value = oModel.HSourceQty.ToString(); 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(); //¸ù¾ÝÏúÊÛ¶©µ¥ID »ñÈ¡ÊÇ·ñÊÇ Íâó¶©µ¥ grdSourceBill.Rows[i].Cells[HIsOutSellCol].Value = ""; // grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value = oModel.HICMOInterID.ToString(); grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oModel.HSourceBillType; grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value = oModel.HSourceInterID.ToString(); grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value = oModel.HSourceEntryID.ToString(); grdSourceBill.Rows[i].Cells[HCusNameCol].Value = ""; grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value = oModel.HICMOBillNo; //grdMain.Rows[i].Cells[HRemarkCol].ToolTipText grdSourceBill.Rows[i].Cells[HMaterIDCol].Value = oModel.HMaterID.ToString(); if (oMater.GetInfoByID(oModel.HMaterID)) { grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber; grdSourceBill.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName; grdSourceBill.Rows[i].Cells[HMaterModelCol].Value = oMater.omodel.HModel; } grdSourceBill.Rows[i].Cells[HUnitIDCol].Value = oModel.HUnitID.ToString(); if (oUnit.GetInfoByID(oModel.HUnitID)) { grdSourceBill.Rows[i].Cells[HUnitNumberCol].Value = oUnit.omodel.HNumber; grdSourceBill.Rows[i].Cells[HUnitNameCol].Value = oUnit.omodel.HName; } grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value = oModel.HPlanBeginDate.ToShortDateString(); grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value = oModel.HPlanEndDate.ToShortDateString(); grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value = oModel.HPlanQty.ToString(); //µÃµ½ÀÛ¼Æ »ã±¨ÊýÁ¿ ºÍ²ð·Ö»ã±¨ÊýÁ¿ SetSourceWorkQty(i);//»ñÈ¡²úÄÜ 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; grdSourceBill.Rows[i].Cells[HLockedCol].Value = oModel.HLocked; //¼ÓÔØ×Ó±í ÈÕÆÚÐÅÏ¢(Ö»¼ÓÔØ Ëø¶¨µÄÊý¾Ý) 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++; // } //»ñµÃÒÑÈë¿âÊýÁ¿ GetInStockQtyByICMOInterID(); //»­Ïß GraphLine(); //½»»õÆÚ¹ýÆÚ ±äÉ« AddColor(); //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); //»Ö¸´Ë¢Ð // } //AfterEdit //¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ private bool CheckJHS(int iRow) { return true; //return BLL.Sc_ICMOAutoSortBillFun.CheckJHS(grdSourceBill, HICMoBillNoCol, HSplitPlanQtyCol, HPlanQtyCol, iRow); } //ÅųÌǰ¼ì²é private bool CheckSetupData() { if (grdSourceBill.RowCount == 0) { MessageBox.Show("ûÓÐÈκε¥¾Ý£¬²»ÔÊÐíÅų̣¡"); return false; } //if (!BLL.Sc_ICMOAutoSortBillFun.IsSelectZY(grdSourceBill, HSourceIDCol)) //{ // MessageBox.Show("ûÓÐÑ¡Ôñ×ÊÔ´£¬²»ÔÊÐíÅų̣¡"); // return false; //} return true; } //½»»õÆÚ ³¬ÆÚʱ ±äÉ« private void AddColor() { //BLL.Sc_ICMOAutoSortBillFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { bool bResult; List oClsGridValues = new List(); oClsGridValues.Clear(); lblCaption.Focus(); // if (!AllowSave()) { return; } //ȨÏÞÅÐ¶Ï //ɾ³ýÈ«²¿Î´Ëø¶¨µÄ±¾²¿Ãŵ¥¾Ý£¬»òÕß×÷·Ï Sub_DeleteBillUnLock(); //µÃµ½Ò»¸öÄÚÂë Int64 HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); // DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); //Ñ­»· for (int i = 0; i < grdSource.Rows.Count; i++) { oMain.MainColl = new List(); //дÈëÀà Model.ClsSc_WorkBillAutoSortBillMain oModel = new Model.ClsSc_WorkBillAutoSortBillMain(); oMain.DetailColl = new List(); // oModel.HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); oModel.HBillNo = ""; oModel.HYear = 2012; oModel.HPeriod = 1; oModel.HDate = MainDate; oModel.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); oModel.HMaterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceIDCol].Value); oModel.HGroupID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HGroupIDCol].Value); oModel.HUnitID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HUnitIDCol].Value); oModel.HYX = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HYXCol].Value); oModel.HSourceQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HSourceQtyCol].Value); oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value); oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value); oModel.HLastBeginDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HLastBeginDateCol].Value); oModel.HLastEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HLastEndDateCol].Value); oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value); oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value); oModel.HKTQ = DBUtility.ClsPub.isBool(grdSourceBill.Rows[i].Cells[HKTQCol].Value); oModel.HWorkQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value); oModel.HReadyTimes = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value); oModel.HRemark = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HRemarkCol].Value); oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); oModel.HMakeDate = MainDate.ToShortDateString(); oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceInterIDCol].Value); oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceEntryIDCol].Value); oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceBillNoCol].Value); oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value); oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value); oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value); oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value); oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSeOrderInterIDCol].Value); oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSeOrderEntryIDCol].Value); oModel.HOrderCommitDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HOrderCommitDateCol].Value); // oMain.MainColl.Add(oModel); // Sc_ICMOSortBillFun.SaveGridSub(grdMain, grdMain, FixCols, oMain, MainDate, oModel.HWorkQty, ref i, oClsGridValues); //±£´æÍê±Ïºó´¦Àí bResult = oMain.AddBill(DBUtility.ClsPub.isLong(txtHDeptID.Tag), HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo); //Ìáʾ if (bResult == true) { //MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); } } ////µÃµ½×îÐÂÅÅ³Ì GetPcTime(); } //±£´æµ¥ÐÐ private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List oClsGridVaules) { 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(grdSourceBill.Rows[iRow].Cells[HMaterIDCol].Value); oModel.HSourceID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HSourceIDCol].Value); oModel.HGroupID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HGroupIDCol].Value); oModel.HUnitID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HUnitIDCol].Value); oModel.HYX = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HYXCol].Value); oModel.HSourceQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[iRow].Cells[HSourceQtyCol].Value); oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[iRow].Cells[HPlanBeginDateCol].Value); oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[iRow].Cells[HPlanEndDateCol].Value); oModel.HLastBeginDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[iRow].Cells[HLastBeginDateCol].Value); oModel.HLastEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[iRow].Cells[HLastEndDateCol].Value); oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[iRow].Cells[HPlanQtyCol].Value); oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[iRow].Cells[HRelationQtyCol].Value); oModel.HKTQ = DBUtility.ClsPub.isBool(grdSourceBill.Rows[iRow].Cells[HKTQCol].Value); oModel.HWorkQty = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[iRow].Cells[HWorkQtyCol].Value); oModel.HReadyTimes = DBUtility.ClsPub.isDoule(grdSourceBill.Rows[iRow].Cells[HReadyQtyCol].Value); oModel.HRemark = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HRemarkCol].Value); oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); oModel.HMakeDate = MainDate.ToShortDateString(); oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HSourceInterIDCol].Value); oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HSourceEntryIDCol].Value); oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HSourceBillNoCol].Value); oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HSourceBillTypeCol].Value); oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HICMOInterIDCol].Value); oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HICMOBillNoCol].Value); oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[iRow].Cells[HSeOrderBillNoCol].Value); oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HSeOrderInterIDCol].Value); oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[iRow].Cells[HSeOrderEntryIDCol].Value); oModel.HOrderCommitDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[iRow].Cells[HOrderCommitDateCol].Value); // oMain.MainColl.Add(oModel); // Sc_ICMOSortBillFun.SaveGridSub(grdMain,grdMain, FixCols, oMain, MainDate, oModel.HWorkQty, ref iRowSub,oClsGridVaules); //±£´æÍê±Ïºó´¦Àí bResult = oMain.AddBill(DBUtility.ClsPub.isLong(txtHDeptID.Tag), HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo); //Ìáʾ if (bResult == true) { //MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); } } //±£´æÇ° ¼ì²é private bool AllowSave() { //for (int i = grdSourceBill.FixedRows; i < grdSourceBill.Rows; i++) //{ // if (DBUtility.ClsPub.isStrNull(grdSourceBill.get_TextMatrix(i, HSourceIDCol)) == "") // { // MessageBox.Show("ÇëÏÈÑ¡ÔñºÃ×ÊÔ´£¬ÔÙ½øÐб£´æ£¡"); // return false; // } //} if (DBUtility.ClsPub.isLong(txtHDeptID.Tag) == 0) { MessageBox.Show("ÇëÏÈÑ¡ÔñºÃ²¿ÃÅ£¬ÔÙ½øÐб£´æ£¡"); return false; } return true; } //ÊÇ·ñÊǺÏÀíÐÐ private bool AllowRow() { if (grdSourceBill.CurrentRow == null) { return false; } else { return true; } } //ÅÅ³Ì private bool DateSetup(bool bAuto) { Int64 lHGroupID = 0; string sGroupName = ""; Single sLeftProdTimes=0; string sSourceName = ""; string sSourceNumber = ""; string sICMOBillNo = ""; Int64 lMainID = 0; Int64 lSourceID = 0; Int64 lMaterID = 0; string sMaterNumber = ""; string sMaterName = ""; string sMaterModel = ""; DateTime dEndDate = DateTime.Today; Single sProdTimes = 0; Single sPlanQty = 0; Single iLeftQty = 0; DataSet dsSub; Single sWorkQty; Int64 sYX; Int64 HRelationInterID; bool bFind = false; DataSet ds; List oClsGridValues = new List(); oClsGridValues.Clear(); //µÃµ½Ò»¸öÄÚÂë HRelationInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); //µ¯³öǰÖ÷Çģʽ´°Ì壬ÏÔʾ½ø¶È 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(); grdMain.RowCount = 0; //Çå¿ÕÎ´Ëø¶¨ Åų̼Ǽ Sub_DeleteBillUnLock(); //°´ÈÎÎñµ¥ÓÅÏȼ¶ Ñ­»· for (int i = 0; i < grdSourceBill.RowCount; i++) { //Èç¹ûËø¶¨¼Æ»®£¬Ôò²»ÐèÒªÔÙÅÅ³Ì if(DBUtility.ClsPub.isBool(grdSourceBill.Rows[i].Cells[HLockedCol].Value) ==true ) { continue; } //ÕÒµ½±¾ÈÎÎñµ¥ ¿ÉÓÃÉú²ú×ÊÔ´ lMainID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value); sICMOBillNo = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value); dEndDate = DBUtility.ClsPub.isDate(grdSourceBill.Rows[i].Cells[HLastEndDateCol].Value); sProdTimes = DBUtility.ClsPub.isSingle(grdSourceBill.Rows[i].Cells[HProdTimesCol].Value); sPlanQty = DBUtility.ClsPub.isSingle(grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value); lHGroupID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HGroupIDCol].Value); sGroupName = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HGroupNameCol].Value); lMaterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HMaterIDCol].Value); sMaterNumber = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value); sMaterName = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HMaterNameCol].Value); sMaterModel = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HMaterModelCol].Value); sWorkQty = DBUtility.ClsPub.isSingle(grdSourceBill.Rows[i].Cells[HWorkQtyCol].Value); sYX = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HYXCol].Value); // if (sICMOBillNo == "WORK155356") { sICMOBillNo = sICMOBillNo; } //Ê£ÓàÐèÇó¹¤Ê± iLeftQty = sPlanQty ; if (sWorkQty <= 0) { sLeftProdTimes = 0; } else { sLeftProdTimes = iLeftQty / sWorkQty; } //Èô±¾ÈÎÎñµ¥ÒÑÓа²ÅÅ×ÊÔ´£¨ÉÏ´ÎÅų̻òÕßÊÖ¹¤Åų̣© Ôò²»ÔÙѰÕÒ×ÊÔ´£¬Ö±½ÓÅÅ³Ì if (DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceIDCol].Value) != 0 && DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceNameCol].Value) != "" ) { //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ lSourceID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceIDCol].Value); sSourceName = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceNameCol].Value); sSourceNumber = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[i].Cells[HSourceNumberCol].Value); // ds = Sc_ICMOSortBillFun.GetWorkSourceByICMO(oCn, lMaterID, dEndDate, lSourceID, sLeftProdTimes); } else //ûÓÐ×ÊÔ´Ôò ×Ô¶¯ÕÒµ½×ÊÔ´ { // ds = Sc_ICMOSortBillFun.GetWorkSourceByICMO(oCn, lMaterID, dEndDate, sLeftProdTimes); } if (ds == null || ds.Tables[0].Rows.Count ==0) //ûÓпÉÒÔÅŵÄ×ÊÔ´ { //Ìøµ½ÏÂÒ»µ¥ ±¾µ¥ºìÉ«ÏÔʾ grdSourceBill.Rows[i].DefaultCellStyle.BackColor = Color.Brown; continue; } else { grdSourceBill.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]["×ÊÔ´´úÂë"]); grdSourceBill.Rows[i].Cells[HSourceIDCol].Value = lSourceID; grdSourceBill.Rows[i].Cells[HSourceNameCol].Value = sSourceName; grdSourceBill.Rows[i].Cells[HSourceNumberCol].Value = sSourceNumber; dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource(oCn, lSourceID); 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[HSecGroupIDCol].Value = lHGroupID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName; 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; Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, 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]["×ÊÔ´´úÂë"]); grdSourceBill.Rows[i].Cells[HSourceIDCol].Value = lSourceID; grdSourceBill.Rows[i].Cells[HSourceNameCol].Value = sSourceName; grdSourceBill.Rows[i].Cells[HSourceNumberCol].Value = sSourceNumber; dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource(oCn, lSourceID); 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[HSecGroupIDCol].Value = lHGroupID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName; 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; Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, 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]["×ÊÔ´´úÂë"]); grdSourceBill.Rows[i].Cells[HSourceIDCol].Value = lSourceID; grdSourceBill.Rows[i].Cells[HSourceNameCol].Value = sSourceName; grdSourceBill.Rows[i].Cells[HSourceNumberCol].Value = sSourceNumber; //»ñÈ¡¸ÃÉú²ú×ÊÔ´µÄÊ£Ó๤ʱ½øÐÐÅų̡£ dsSub = Sc_ICMOSortBillFun.GetWorkSourceTimeBySource(oCn, lSourceID); 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[HSecGroupIDCol].Value = lHGroupID; grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName; 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; Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, 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 bool SetYXNum() { //ÉèÖÃÓÅÏȼ¶ ±àºÅ for (int i = 0; i < grdSourceBill.RowCount; i++) { grdSourceBill.Rows[i].Cells[HYXCol].Value = (i + 1)*10; } // return true; } //ÅÅÐò private void SortData() { //ðÅÝÅÅÐò·¨ //Ôö¼ÓÒ»¸ö±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount + 1; for (int i = 0; i < grdSourceBill.RowCount - 2; i++) { for (int j = 0; j < grdSourceBill.RowCount - i - 2; j++) { //ÉèÖÃÈÎÎñµ¥ÓÅÏÈÅÅÐò£¬²¢ÉèÖÃÓÅÏÈ(×î³ÙÍ깤ÈÕÆÚ+¶©µ¥½»»õÆÚ) ·â×° if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HLastEndDateCol].Value) > DBUtility.ClsPub.isDate(grdSourceBill.Rows[j+1].Cells[HLastEndDateCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill,j); } else if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HLastEndDateCol].Value) == DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HLastEndDateCol].Value)) { if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HOrderCommitDateCol].Value) > DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HOrderCommitDateCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, j); } else if (DBUtility.ClsPub.isDate(grdSourceBill.Rows[j].Cells[HOrderCommitDateCol].Value) == DBUtility.ClsPub.isDate(grdSourceBill.Rows[j + 1].Cells[HOrderCommitDateCol].Value)) { if (DBUtility.ClsPub.isDoule(grdSourceBill.Rows[j].Cells[HOrderNeedQtyCol].Value )< DBUtility.ClsPub.isDoule(grdSourceBill.Rows[j + 1].Cells[HOrderNeedQtyCol].Value)) { Sc_ICMOSortBillFun.ChangeGridItem(grdSourceBill, j); } } else { // } } else { // } } } //ɾ³ý±¸ÓÃÐÐ grdSourceBill.RowCount = grdSourceBill.RowCount - 1; } //ɾ³ý±¾²¿ÃÅÎ´Ëø¶¨ ¼Ç¼ private void Sub_DeleteBillUnLock() { if (oMain.DeleteBillUnlock(DBUtility.ClsPub.isLong(txtHDeptID.Tag))==false) { MessageBox.Show("×÷·ÏÀúÊ·µ¥¾Ýʧ°Ü£¡"); } } //Êý¾Ý×¼±¸ ÉèÖÃÈÎÎñµ¥Ïà¹ØÐÅÏ¢ 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 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_ICMOAutoSortBillFun.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_Sc_ICMOBill oK3_ICMOBill = new DAL.Cls_S_Sc_ICMOBill(); string sWhere = " And HDeptID=" + DBUtility.ClsPub.isLong(txtHDeptID.Tag) + " "; if (oK3_ICMOBill.Refresh(sWhere)) //Ñ¡ÔñÔ­µ¥ { FillSelectData(oK3_ICMOBill.oBillSelectColl); } } //¼ÓÔØ Ô­µ¥µ½±¾µØ private void FillSelectData(List oList) { // bool sBool = false; DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); foreach (DBUtility.BillSelect oSelectRow in oList) { if (oSelectRow.BillType == "3710") { sBool = false; //µÃµ½ÐÅÏ¢ Ds = oCn.RunProcReturn("select * from h_v_Sc_ICMOBillList_add where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_Sc_ICMOBillList_add"); //дÈëÐÅÏ¢ for (int j = 0; j <= grdSourceBill.RowCount-1; j++) { if (DBUtility.ClsPub.isLong(grdSourceBill.Rows[j].Cells[HICMOInterIDCol].Value) == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainID"])) { sBool = true; MessageBox.Show("ÈÎÎñµ¥£º" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"] + "ÒÑ´æÔÚ´ýÅżƻ®ÖУ¬²»ÔÊÐíÌí¼Ó£¡"), "Ìáʾ"); break; } } if (sBool != true) { grdSourceBill.RowCount = grdSourceBill.RowCount + 1; Sub_WriteInForm(Ds.Tables[0], grdSourceBill.RowCount - 1); } } } } //¸ù¾ÝTABLEдÈë½çÃæ private void Sub_WriteInForm(DataTable oTable, int i) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); try { ////¼ÓÔØ±íÌå grdSourceBill.Rows[i].Cells[HSeOrderBillNoCol].Value = oTable.Rows[0]["ÏúÊÛ¶©µ¥ºÅ"].ToString(); grdSourceBill.Rows[i].Cells[HICMOBillNoCol].Value = oTable.Rows[0]["µ¥¾ÝºÅ"].ToString(); //grdSourceBill.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["HCusName"].ToString(); grdSourceBill.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); grdSourceBill.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ÎïÁÏ´úÂë"].ToString(); grdSourceBill.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ÎïÁÏÃû³Æ"].ToString(); grdSourceBill.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["¹æ¸ñÐͺÅ"].ToString(); grdSourceBill.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); //grdSourceBill.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["HUnitNumber"].ToString(); grdSourceBill.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["¼ÆÁ¿µ¥Î»"].ToString(); grdSourceBill.Rows[i].Cells[HPlanBeginDateCol].Value = oTable.Rows[0]["¼Æ»®¿ª¹¤ÈÕÆÚ"].ToString(); grdSourceBill.Rows[i].Cells[HPlanEndDateCol].Value = oTable.Rows[0]["¼Æ»®Í깤ÈÕÆÚ"].ToString(); grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value = DBUtility.ClsPub.isDoule(oTable.Rows[0]["ÈÎÎñÊýÁ¿"], 2); grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = DBUtility.ClsPub.isDoule(oTable.Rows[0]["¹ØÁªÊýÁ¿"], 2); grdSourceBill.Rows[i].Cells[HInStockQtyCol].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[HKTQCol].Value = "1"; grdSourceBill.Rows[i].Cells[HReadyQtyCol].Value = "0"; grdSourceBill.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["¶©µ¥±¸×¢"].ToString(); //============ 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[HIsOutSellCol].Value = oTable.Rows[0]["ÊÇ·ñÍâó"].ToString(); //grdSourceBill.Rows[i].Cells[HSourceBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); } catch (Exception e) { MessageBox.Show(e.Message); } } //»ñÈ¡Èë¿âÊýÁ¿ private void GetInStockQtyByICMOInterID() { DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); long HICMOInterID = 0; for (int i = 0; i <= grdSourceBill.RowCount - 1; i++) { HICMOInterID = DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HICMOInterIDCol].Value); Ds = oCn.RunProcReturn("select * from h_v_Sc_ICMOBillList_add where hmainid=" + HICMOInterID.ToString(), "h_v_Sc_ICMOBillList_add"); //дÈëÐÅÏ¢ if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return; } grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["¹ØÁªÊýÁ¿"], 2); grdSourceBill.Rows[i].Cells[HInStockQtyCol].Value = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["Èë¿âÊýÁ¿"], 2); } } //±£´æÁпí 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(grdProcFlow, this.Name + "grdProcFlow", 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); DBUtility.ClsPub.DefaultGridView(grdProcFlow); } //Í˳ö°´Å¥ 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_ICMOAutoSortBill_Load(object sender, EventArgs e) { this.Text = ModCaption; this.lblCaption.Text = ModCaption; } //°ïÖúº¯Êý private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsIF_Group_View oGroup = new DAL.ClsIF_Group_View(); switch (sKeyCode) { case 118: //F7 { switch (sCol) { case HSourceNameCol: BLL.ClsBaseSelect_InterFace.SetGridBySource(grdSourceBill, sRow, HSourceIDCol, HSourceNumberCol, HSourceNameCol); Sc_ICMOSortBillFun.SetSourceWorkQty(grdSourceBill, HMaterIDCol, HSourceIDCol, 0, HWorkQtyCol, sRow, oMain); if (oSource.GetGroupBySourceID(DBUtility.ClsPub.isLong(grdSourceBill.Rows[sRow].Cells[HSourceIDCol].Value))) { if (oGroup.GetInfoByID(oSource.omodel.HGroupK3ID)) { grdSourceBill.Rows[sRow].Cells[HGroupIDCol].Value = oGroup.omodel.HItemID.ToString(); grdSourceBill.Rows[sRow].Cells[HGroupNameCol].Value = oGroup.omodel.HName; } } else { grdSourceBill.Rows[sRow].Cells[HGroupIDCol].Value = ""; grdSourceBill.Rows[sRow].Cells[HGroupNameCol].Value = ""; } oEdit.Text = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[sRow].Cells[HSourceNameCol].Value); break; case HGroupNameCol: BLL.ClsBaseSelect_InterFace.SetGridByGroup(grdSourceBill, sRow, HGroupIDCol, 0, HGroupNameCol); oEdit.Text = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[sRow].Cells[HGroupNameCol].Value); break; case HPlanBeginDateCol: BLL.ClsPub_BLL.Sub_SelectDate(grdSourceBill, sRow, HPlanBeginDateCol); //oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HPlanBeginDateCol].Value); oMainPC.Sub_setPlanBeginDate(DBUtility.ClsPub.isLong(grdSourceBill.Rows[sRow].Cells[HICMOInterIDCol].Value), DBUtility.ClsPub.isDate(grdSourceBill.Rows[sRow].Cells[HPlanBeginDateCol].Value), ref DBUtility.ClsPub.sExeReturnInfo); break; case HPlanEndDateCol: BLL.ClsPub_BLL.Sub_SelectDate(grdSourceBill, sRow, HPlanEndDateCol); //oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HPlanEndDateCol].Value); oMainPC.Sub_setPlanEndDate(DBUtility.ClsPub.isLong(grdSourceBill.Rows[sRow].Cells[HICMOInterIDCol].Value), DBUtility.ClsPub.isDate(grdSourceBill.Rows[sRow].Cells[HPlanEndDateCol].Value), ref DBUtility.ClsPub.sExeReturnInfo); break; default: break; } break; } case 117: //F6 { switch (sCol) { case HSourceNameCol: if (oSource.RefreshViewByRelation(DBUtility.ClsPub.isLong(grdSourceBill.Rows[sRow].Cells[HMaterIDCol].Value))) { if (oSource.GetInfoByID(oSource.oModel.HItemID)) { grdSourceBill.Rows[sRow].Cells[HSourceIDCol].Value = oSource.oModel.HItemID.ToString(); grdSourceBill.Rows[sRow].Cells[HSourceNameCol].Value = oSource.oModel.HName; grdSourceBill.Rows[sRow].Cells[HSourceNumberCol].Value = oSource.oModel.HNumber; if (oGroup.GetInfoByID(oSource.omodel.HGroupK3ID)) { grdSourceBill.Rows[sRow].Cells[HGroupIDCol].Value = oGroup.omodel.HItemID.ToString(); grdSourceBill.Rows[sRow].Cells[HGroupNameCol].Value = oGroup.omodel.HName; } } else { grdSourceBill.Rows[sRow].Cells[HSourceIDCol].Value = ""; grdSourceBill.Rows[sRow].Cells[HSourceNameCol].Value = ""; grdSourceBill.Rows[sRow].Cells[HSourceNumberCol].Value = ""; } Sc_ICMOSortBillFun.SetSourceWorkQty(grdSourceBill, HMaterIDCol, HSourceIDCol, 0, HWorkQtyCol, sRow, oMain); } else { grdSourceBill.Rows[sRow].Cells[HSourceIDCol].Value = ""; grdSourceBill.Rows[sRow].Cells[HSourceNameCol].Value = ""; grdSourceBill.Rows[sRow].Cells[HSourceNumberCol].Value = ""; } oEdit.Text = DBUtility.ClsPub.isStrNull(grdSourceBill.Rows[sRow].Cells[HSourceNameCol].Value); break; default: break; } break; } default: break; } } //Ë¢ÐÂÈ«²¿×ÊÔ´ ²úÄÜ private void RefreshWorkQty() { for (int i = 0; i < grdSourceBill.RowCount; i++) { //if (DBUtility.ClsPub.isLong(grdSourceBill.Rows[i].Cells[HSourceIDCol].Value) != 0) //{ // SetSourceWorkQty(i); //} } } //ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceWorkQty(int iRow) { Sc_ICMOSortBillFun.SetSourceWorkQty(grdSourceBill, HMaterIDCol, HSourceIDCol, DBUtility.ClsPub.isLong(txtHProcID.Tag), HWorkQtyCol, iRow, oMain); } //ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceRelationQty(int iRow) { Sc_ICMOSortBillFun.SetSourceRelationQty(grdSourceBill, iRow, HICMOInterIDCol, HSourceIDCol, HRelationQtyCol, HRelationQtyCol, oMain); } private void sc_Click_1(object sender, EventArgs e) { Sub_DeleteBill(); } //ɾ³ýµ¥¾Ý private void Sub_DeleteBill() { // ÅжÏÊÇ·ñÓл㱨 if (MessageBox.Show("È·¶¨ÒªÉ¾³ý´Ëµ¥¾Ý£¬±¾²Ù×÷²»¿É³·Ïú£¬Çë½÷É÷²Ù×÷£¡", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } if (grdSourceBill.SelectedRows == null) { return; } for (int i = grdSourceBill.SelectedRows.Count - 1; i >= 0; i--) { grdSourceBill.Rows.Remove(grdSourceBill.SelectedRows[i]); } } //ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç private void Sub_SetHandChangeFlag(int sCol, int sRow) { if (sCol < FixCols || sCol>=grdSourceBill.RowCount ) { return; } //BLL.Sc_ICMOAutoSortBillFun.Sub_SetHandChangeFlag(grdSourceBill, sCol, sRow); } //ˢл㱨ÊýÁ¿ private void GetHRelationQty() { ////grid½ûֹˢР//grdSourceBill.Redraw = VSFlex7.RedrawSettings.flexRDNone; ////¼ÓÔØ±íÍ· //for(int i=grdSourceBill.FixedRows ;i= FixCols; c--) { //ÕÒµ½×î³Ù¼Æ»®ÈÕÆÚ if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[c].Value) != "") { dtimePai = DBUtility.ClsPub.isDate(grdMain.Columns[c].HeaderText); dtimeJiao = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HSecPlanEndDateCol].Value); if (dtimePai <= dtimeJiao) //×îºóÅųÌÈÕÆÚСÓÚµÈÓÚ½»»õ { for (int m =c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.LightGreen; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } else if (dtimeJiao.AddDays(-3) <= dtimePai && dtimePai < dtimeJiao) //×îºóÅųÌÈÕÆÚ Àë½»»õ3ÌìÄÚ { for (int m = c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.Gold; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } else if (dtimePai > dtimeJiao) //×îºóÅųÌÈÕÆÚ´óÓÚ½»»õ { for (int m = c; m >= FixCols; m--) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[m].Value) != "") { grdMain.Rows[i].Cells[m].Style.BackColor = Color.Red; } else { grdMain.Rows[i].Cells[m].Style.BackColor = Color.White; } } break; } } } } //ȱÁÏ·ÖÎö //дһ¸ö¹ý³Ì£¬ÅжÏÊÇ·ñ ȱÁÏ for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { oDs = oCn.RunProcReturn("exec h_p_Sc_GetNeedMaterialQty " + txtHDeptID.Tag + "," + DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSecICMOInterIDCol].Value), "Gy_Czygl"); if (oDs == null || oDs.Tables[0].Rows.Count == 0) { for (int m = FixCols; m < grdMain.ColumnCount; m++) { grdMain.Rows[i].Cells[m].Style.ForeColor = Color.Black; } } else { for (int m = FixCols; m < grdMain.ColumnCount; m++) { grdMain.Rows[i].Cells[m].Style.ForeColor = Color.Blue; } } } } //Ë«»÷²é¿´ ȱÁÏÇé¿ö private void grdMain_DoubleClick(object sender, EventArgs e) { //Sc_ICMOAutoSortBillQL oQL = new Sc_ICMOAutoSortBillQL(); //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) { //grdMain.ReadOnly = false; //ÅжÏÊÇ·ñÑ¡ÖÐÐÐ £¬Ìø³ö 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 grdSourceBill_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { sAllowCol = "," + sAllowCol + ","; int i = grdSourceBill.CurrentCell.ColumnIndex; string srow = "," + i.ToString() + ","; if (sAllowCol.IndexOf(srow) == -1) { e.Cancel = true; } } DataGridViewTextBoxEditingControl EditingControl; private void grdSourceBill_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (this.EditingControl != null) //ÊÍ·Åʼþ { EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown); this.EditingControl = null; } } private void EditingControl_KeyDown(object sender, KeyEventArgs e) { //ÒµÎñ´¦Àí Sub_GridKey(e.KeyValue, grdSourceBill.CurrentRow.Index, grdSourceBill.CurrentCell.ColumnIndex, EditingControl); } private void grdSourceBill_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (grdSourceBill.CurrentCell != null) { if (e.Control is DataGridViewTextBoxEditingControl) { this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control; //Ôö¼ÓίÍд¦Àí this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown); } } } //ÇåÀíÒѽ᰸ÈÎÎñµ¥ private void ql_Click(object sender, EventArgs e) { if (MessageBox.Show("ÊÇ·ñÆô¶¯ÇåÀí£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { return; } else { ICMOBill_Clear(); } } private void ICMOBill_Clear() { // ÒÑÍ깤+ÒÑÈë¿â>¼Æ»®ÊýÁ¿ µÄÈÎÎñµ¥ ɾ³ýµô¡£ for (int i = grdSourceBill.Rows.Count - 1; i >= 0; i--) { if (DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HRelationQtyCol].Value) >= DBUtility.ClsPub.isDoule(grdSourceBill.Rows[i].Cells[HPlanQtyCol].Value)) { grdSourceBill.Rows.RemoveAt(i); } } } private void grdSourceBill_CellClick(object sender, DataGridViewCellEventArgs e) { SetBillRelationInfo(); } private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (grdMain.CurrentCell == null) { e.Cancel = true; } int i = grdMain.CurrentCell.ColumnIndex; if (i < FixCols) { e.Cancel = true; } } private void grdSourceBill_KeyDown(object sender, KeyEventArgs e) { Sub_GridKey(e.KeyValue, grdSourceBill.CurrentRow.Index, grdSourceBill.CurrentCell.ColumnIndex, EditingControl); } } }