using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using BaseSet; namespace APS { public partial class Sc_ProcPlanSortBill : Form { public Sc_ProcPlanSortBill() { InitializeComponent(); } //¶¨ÒåÁÐ public const Int16 FixCols = 46; // public const Int16 HSelectCol = 0; public const Int16 HSourceIDCol = 1; public const Int16 HSourceNumberCol = 2; public const Int16 HSourceNameCol = 3; public const Int16 HGroupIDCol = 4; public const Int16 HGroupNumberCol = 5; public const Int16 HGroupNameCol = 6; public const Int16 HWorkerIDCol = 7; public const Int16 HWorkerNumberCol = 8; public const Int16 HWorkerNameCol = 9; public const Int16 HCusNameCol = 10; public const Int16 HSeOrderBilNoCol = 11; public const Int16 HICMoBillNoCol = 12; public const Int16 HProcPlanBillNoCol = 13; public const Int16 HProcIDCol = 14; public const Int16 HProcNumberCol = 15; public const Int16 HProcNameCol = 16; public const Int16 HSplitNOCol = 17; public const Int16 HMaterIDCol = 18; public const Int16 HMaterNumberCol = 19; public const Int16 HMaterNameCol = 20; public const Int16 HMaterModelCol = 21; public const Int16 HUnitIDCol = 22; public const Int16 HUnitNumberCol = 23; public const Int16 HUnitNameCol = 24; public const Int16 HPlanBeginDateCol = 25; public const Int16 HPlanEndDateCol = 26; public const Int16 HPlanQtyCol = 27; public const Int16 HRelationQtyCol = 28; public const Int16 HSplitPlanQtyCol = 29; public const Int16 HSplitRelationQtyCol = 30; public const Int16 HWorkQtyCol = 31; //²úÄÜ public const Int16 HWorkTimesCol = 32; public const Int16 HYXCol = 33; public const Int16 HKTQCol = 34; public const Int16 HReadyTimesCol = 35; public const Int16 HRemarkCol = 36; //-------------- public const Int16 HSourceInterIDCol = 37; public const Int16 HSourceEntryIDCol = 38; public const Int16 HSourceBillTypeCol = 39; public const Int16 HICMOInterIDCol = 40; public const Int16 HProcPlanInterIDCol = 41; public const Int16 HProcPlanEntryIDCol = 42; public const Int16 HSeOrderInterIDCol = 43; public const Int16 HSeOrderEntryIDCol = 44; public const Int16 HSourceBillNoCol = 45; // public string ModName = "3713"; public string ModCaption = "¹¤Ðò¼Æ»®ÅųÌ"; // public DBUtility.ClsPub.Enum_BillStatus BillStatus; public string sAllowCol; // Int64 HSourceID_MR = 0; string HSourceNumber_MR = ""; string HSourceName_MR = ""; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DAL.ClsSc_ProcPlanSortBill oMain = new DAL.ClsSc_ProcPlanSortBill(); Sc_ProcPlanSortBillDlg oDlg = new Sc_ProcPlanSortBillDlg(); FrmSelectDate oSelectDate = new FrmSelectDate(); // bool bEdit = false; //ÉèÖÃÈÕÆÚ private void grdMain_CellButtonClick(object sender, AxVSFlex7._IVSFlexGridEvents_CellButtonClickEvent e) { //ÉèÖÃÈÎÎñµ¥ ¼Æ»®¿ª¹¤ÈÕÆÚ switch (e.col) { case HPlanBeginDateCol: oSelectDate.sDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(e.row, e.col)); oSelectDate.ShowDialog(); if (oSelectDate.isSelected == true) { //¸üÐÂÊý¾Ý¿â Int64 id = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(e.row, HICMOInterIDCol)); if (id > 0) { //oMain.Sub_setPlanBeginDate(id, oSelectDate.MC1.SelectionStart,ref DBUtility.ClsPub.sExeReturnInfo); grdMain.set_TextMatrix(e.row, e.col, oSelectDate.MC1.SelectionStart.ToShortDateString()); } else { MessageBox.Show("µ±Ç°ÈÎÎñµ¥ÓдíÎó£¡"); } } break; case HPlanEndDateCol: oSelectDate.sDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(e.row, e.col)); oSelectDate.ShowDialog(); if (oSelectDate.isSelected == true) { //¸üÐÂÊý¾Ý¿â Int64 id = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(e.row, HICMOInterIDCol)); if (id > 0) { //oMain.Sub_setPlanEndDate(id, oSelectDate.MC1.SelectionStart, ref DBUtility.ClsPub.sExeReturnInfo); grdMain.set_TextMatrix(e.row, e.col, oSelectDate.MC1.SelectionStart.ToShortDateString()); } else { MessageBox.Show("µ±Ç°ÈÎÎñµ¥ÓдíÎó£¡"); } } break; default: break; //ÉèÖà ¼Æ»®Í깤ÈÕÆÚ } } //ÖØÐ·ÖÅä²ð·Öµ¥ºÅ private void RefreshCfBillNo() { BLL.Sc_ICMOSortBillFun.RefreshCfBillNo(grdMain, HICMoBillNoCol, HSplitNOCol); } //KeyDown ¸´ÖƱí¸ñ£¬²éÕÒ£¬É¾³ý //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return BLL.Sc_ICMOSortBillFun.IsSelectCell(grdMain, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow,int iCol) { return BLL.Sc_ICMOSortBillFun.IsAllowEdit(grdMain,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() { DBUtility.Xt_BaseBillFun.initGridList(grdSource, this.Name + "grdSource",true); DBUtility.Xt_BaseBillFun.initGridList(grdICMO, this.Name + "grdICMO",true); BLL.Sc_ICMOSortBillFun.initGrid(grdMain,FixCols); grdMain.BackColorFrozen = Color.Beige; //ÉèÖñêÌâ grdMain.set_TextMatrix(0, HSelectCol, "Ñ¡Ôñ"); grdMain.set_TextMatrix(0, HSourceIDCol, ""); grdMain.set_TextMatrix(0, HProcNameCol, "¹¤Ðò"); grdMain.set_TextMatrix(0, HProcNumberCol, "¹¤Ðò´úÂë"); grdMain.set_TextMatrix(0, HSourceNumberCol, "×ÊÔ´´úÂë"); grdMain.set_TextMatrix(0, HSourceNameCol, "×ÊÔ´Ãû³Æ"); grdMain.set_TextMatrix(0, HCusNameCol, "¿Í»§Ãû³Æ"); grdMain.set_TextMatrix(0, HGroupNumberCol, "°à×é´úÂë"); grdMain.set_TextMatrix(0, HGroupNameCol, "°à×éÃû³Æ"); grdMain.set_TextMatrix(0, HWorkerNumberCol, "²Ù×÷Ô±´úÂë"); grdMain.set_TextMatrix(0, HWorkerNameCol, "²Ù×÷Ô±"); grdMain.set_TextMatrix(0, HSeOrderBilNoCol, "ÏúÊÛ¶©µ¥ºÅ"); grdMain.set_TextMatrix(0, HICMoBillNoCol, "ÈÎÎñµ¥ºÅ"); grdMain.set_TextMatrix(0, HProcPlanBillNoCol, "¹¤Ðò¼Æ»®µ¥ºÅ"); grdMain.set_TextMatrix(0, HSplitNOCol, "²ð·Öµ¥ºÅ"); grdMain.set_TextMatrix(0, HMaterIDCol, ""); grdMain.set_TextMatrix(0, HMaterNumberCol, "ÎïÁÏ´úÂë"); grdMain.set_TextMatrix(0, HMaterNameCol, "ÎïÁÏÃû³Æ"); grdMain.set_TextMatrix(0, HMaterModelCol, "¹æ¸ñÐͺÅ"); grdMain.set_TextMatrix(0, HUnitIDCol, ""); grdMain.set_TextMatrix(0, HUnitNumberCol, "µ¥Î»´úÂë"); grdMain.set_TextMatrix(0, HUnitNameCol, "µ¥Î»Ãû³Æ"); grdMain.set_TextMatrix(0, HPlanBeginDateCol, "¼Æ»®¿ª¹¤ÈÕÆÚ"); grdMain.set_TextMatrix(0, HPlanEndDateCol, "¼Æ»®Í깤ÈÕÆÚ"); grdMain.set_TextMatrix(0, HPlanQtyCol, "¼Æ»®ÊýÁ¿"); grdMain.set_TextMatrix(0, HRelationQtyCol, "Àۼƻ㱨ÊýÁ¿"); grdMain.set_TextMatrix(0, HSplitPlanQtyCol, "²ð·Ö¼Æ»®ÊýÁ¿"); grdMain.set_TextMatrix(0, HSplitRelationQtyCol, "²ð·Ö»ã±¨ÊýÁ¿"); grdMain.set_TextMatrix(0, HWorkQtyCol, "µ¥Î»²úÄÜ"); grdMain.set_TextMatrix(0, HKTQCol, "¿ÉÌáǰ"); grdMain.set_TextMatrix(0, HReadyTimesCol, "×¼±¸Ê±¼ä"); grdMain.set_TextMatrix(0, HWorkTimesCol, "¹¤Ê±"); grdMain.set_TextMatrix(0, HYXCol, "ÓÅÏȼ¶"); grdMain.set_TextMatrix(0, HRemarkCol, "±¸×¢"); //¼ÓÔØÅųÌÈÕÆÚ this.LoadDateCol(28); //Òþ²Ø grdMain.set_ColHidden(HSourceIDCol, true); grdMain.set_ColHidden(HMaterIDCol, true); grdMain.set_ColHidden(HUnitIDCol, true); grdMain.set_ColHidden(HGroupIDCol, true); grdMain.set_ColHidden(HWorkerIDCol, true); grdMain.set_ColHidden(HProcIDCol, true); grdMain.set_ColHidden(HICMOInterIDCol, true); grdMain.set_ColHidden(HSeOrderEntryIDCol, true); grdMain.set_ColHidden(HSeOrderInterIDCol, true); grdMain.set_ColHidden(HProcPlanInterIDCol, true); grdMain.set_ColHidden(HProcPlanEntryIDCol, true); grdMain.set_ColHidden(HSourceInterIDCol, true); grdMain.set_ColHidden(HSourceBillNoCol, true); grdMain.set_ColHidden(HSourceEntryIDCol, true); grdMain.set_ColHidden(HSourceBillTypeCol, true); //Íø¸ñ¸ñʽ»¯ grdMain.set_ColDataType(HSelectCol, VSFlex7.DataTypeSettings.flexDTBoolean); grdMain.set_ColDataType(HKTQCol, VSFlex7.DataTypeSettings.flexDTBoolean); grdMain.set_ColFormat(HYXCol,"###"); grdMain.set_ColComboList(HPlanBeginDateCol, "..."); grdMain.set_ColComboList(HPlanEndDateCol, "..."); sAllowCol = "," + HSourceNumberCol.ToString() + "," + HYXCol.ToString() + "," + HSelectCol.ToString() + "," + HGroupNumberCol.ToString() + "," + HWorkerNumberCol.ToString() + "," + HSplitPlanQtyCol.ToString() + "," + HRemarkCol.ToString() + "," + HPlanBeginDateCol.ToString() + "," + HPlanEndDateCol.ToString() + "," + HWorkQtyCol.ToString() + ","; // DBUtility.ClsPub.GetGrid(grdMain,this.Name,DBUtility.ClsPub.AppPath); } //¼ÓÔØ µ±ÔÂÈÕÆÚ private void LoadDateCol(int iDates) { BLL.Sc_ICMOSortBillFun.LoadDateCol(grdMain, FixCols, iDates); } //ÏÔʾ¼ÓÔØ private void Display() { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsK3_Customer_View oCus = new DAL.ClsK3_Customer_View(); DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View(); DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); DAL.ClsGy_Process_View oProc = new DAL.ClsGy_Process_View(); int c = 0; int i=grdMain.FixedRows; //½«¹ýÂË¿òµÄ²¿Ãź͹¤ÐòдÈë½çÃæ£¬ÈôûÓв¿ÃÅÔò Ìø³ö¹ý³Ì 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.ShowBill(oMain.HRelationInterID, ref DBUtility.ClsPub.sExeReturnInfo) == false) { //MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } //Çå¿Õ //grid½ûֹˢРgrdMain.Redraw = VSFlex7.RedrawSettings.flexRDNone; //¼ÓÔØ±íÍ· //¼ÓÔØ Ö÷±í£¬ÈÎÎñµ¥ÐÅÏ¢ foreach (Model.ClsSc_ProcPlanSortBillMain oModel in oMain.MainColl ) { if (i >= grdMain.Rows) { grdMain.Rows = grdMain.Rows + 1; } grdMain.set_TextMatrix(i, HSourceIDCol, oModel.HSourceID.ToString()); if (oSource.GetInfoByID(oModel.HSourceID)) { grdMain.set_TextMatrix(i, HSourceNumberCol,oSource.omodel.HNumber); grdMain.set_TextMatrix(i, HSourceNameCol, oSource.omodel.HName); } grdMain.set_TextMatrix(i, HGroupIDCol, oModel.HGroupID.ToString()); if (oGroup.GetInfoByID(oModel.HGroupID)) { grdMain.set_TextMatrix(i, HGroupNumberCol, oGroup.omodel.HNumber); grdMain.set_TextMatrix(i, HGroupNameCol, oGroup.omodel.HName); } grdMain.set_TextMatrix(i, HProcIDCol, oModel.HProcID.ToString()); if (oProc.GetInfoByID(oModel.HProcID)) { grdMain.set_TextMatrix(i, HProcNumberCol, oProc.omodel.HNumber); grdMain.set_TextMatrix(i, HProcNameCol, oProc.omodel.HName); } grdMain.set_TextMatrix(i, HSeOrderBilNoCol, oModel.HSeOrderBillNo); grdMain.set_TextMatrix(i, HSeOrderInterIDCol, oModel.HSeOrderInterID.ToString()); grdMain.set_TextMatrix(i, HSeOrderEntryIDCol, oModel.HSeOrderEntryID.ToString()); grdMain.set_TextMatrix(i, HICMOInterIDCol, oModel.HICMOInterID.ToString()); grdMain.set_TextMatrix(i, HSourceBillTypeCol, oModel.HSourceBillType); grdMain.set_TextMatrix(i, HSourceInterIDCol, oModel.HSourceInterID.ToString()); grdMain.set_TextMatrix(i, HSourceEntryIDCol, oModel.HSourceEntryID.ToString()); grdMain.set_TextMatrix(i, HProcPlanEntryIDCol, oModel.HProcPlanEntryID.ToString()); grdMain.set_TextMatrix(i, HProcPlanInterIDCol, oModel.HProcPlanInterID.ToString()); grdMain.set_TextMatrix(i, HProcPlanBillNoCol, oModel.HProcPlanBillNo); grdMain.set_TextMatrix(i, HCusNameCol,""); grdMain.set_TextMatrix(i, HICMoBillNoCol, oModel.HICMOBillNo); grdMain.set_TextMatrix(i, HSplitNOCol,oModel.HSplitNo); grdMain.set_TextMatrix(i, HMaterIDCol,oModel.HMaterID.ToString()); if (oMater.GetInfoByID(oModel.HMaterID)) { grdMain.set_TextMatrix(i, HMaterNumberCol, oMater.omodel.HNumber); grdMain.set_TextMatrix(i, HMaterNameCol, oMater.omodel.HName); grdMain.set_TextMatrix(i, HMaterModelCol, oMater.omodel.HModel); } grdMain.set_TextMatrix(i, HUnitIDCol, oModel.HUnitID.ToString()); if (oUnit.GetInfoByID(oModel.HUnitID)) { grdMain.set_TextMatrix(i, HUnitNumberCol, oUnit.omodel.HNumber); grdMain.set_TextMatrix(i, HUnitNameCol, oUnit.omodel.HName); } grdMain.set_TextMatrix(i, HWorkerIDCol, oModel.HWorkerID.ToString()); if (oEmp.GetInfoByID(oModel.HWorkerID)) { grdMain.set_TextMatrix(i, HWorkerNumberCol, oEmp.omodel.HNumber); grdMain.set_TextMatrix(i, HWorkerNameCol, oEmp.omodel.HName); } grdMain.set_TextMatrix(i, HPlanBeginDateCol, oModel.HPlanBeginDate.ToShortDateString()); grdMain.set_TextMatrix(i, HPlanEndDateCol,oModel.HPlanEndDate.ToShortDateString()); grdMain.set_TextMatrix(i, HPlanQtyCol, oModel.HPlanQty.ToString()); grdMain.set_TextMatrix(i, HSplitPlanQtyCol, oModel.HSplitPlanQty.ToString()); //µÃµ½ÀÛ¼Æ »ã±¨ÊýÁ¿ ºÍ²ð·Ö»ã±¨ÊýÁ¿ grdMain.set_TextMatrix(i, HRelationQtyCol, oModel.HRelationQty.ToString()); grdMain.set_TextMatrix(i, HSplitRelationQtyCol,oModel.HSplitRelationQty.ToString()); SetSourceWorkQty(i); SetSourceRelationQty(i); // //grdMain.set_TextMatrix(i, HWorkQtyCol,oModel.HWorkQty.ToString()); grdMain.set_TextMatrix(i, HYXCol, oModel.HYX.ToString()); grdMain.set_TextMatrix(i, HKTQCol,DBUtility.ClsPub.BoolToString(oModel.HKTQ)); grdMain.set_TextMatrix(i, HReadyTimesCol,oModel.HReadyTimes.ToString()); grdMain.set_TextMatrix(i, HRemarkCol,oModel.HRemark); //Èô »ã±¨ÊýÁ¿¡·¼Æ»®ÊýÁ¿ Ôò µ×É« »ÒÉ«ÏÔʾ if (DBUtility.ClsPub.isSingle(grdMain.get_TextMatrix(i, HSplitPlanQtyCol)) <= DBUtility.ClsPub.isSingle(grdMain.get_TextMatrix(i, HSplitRelationQtyCol))) { grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, grdMain.FixedCols, i, FixCols, DBUtility.ClsPub.Enum_Color.hx_Control); grdMain.set_RowHidden(i, true); } else { grdMain.set_RowHidden(i, false); grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, grdMain.FixedCols, i, FixCols, DBUtility.ClsPub.Enum_Color.hx_Write); } //¼ÓÔØ×Ó±í ÈÕÆÚÐÅÏ¢ BLL.Sc_ICMOSortBillFun.SetSubGrid(grdMain, oModel,ref c,ref i,FixCols); i++; // } //ÅÅÐò SortData(); //»­Ïß GraphLine(); //½»»õÆÚ¹ýÆÚ ±äÉ« AddColor(); //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); //»Ö¸´Ë¢Ð grdMain.Redraw = VSFlex7.RedrawSettings.flexRDBuffered; // } //AfterEdit //¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ private bool CheckJHS(int iRow) { return BLL.Sc_ICMOSortBillFun.CheckJHS(grdMain, HICMoBillNoCol, HSplitPlanQtyCol, HPlanQtyCol, iRow); } //BeforeEdit //grdMain_Click //grdmain_DblClick //ÅųÌǰ¼ì²é private bool CheckSetupData() { if (grdMain.Rows == grdMain.FixedRows) { MessageBox.Show("ûÓÐÈκε¥¾Ý£¬²»ÔÊÐíÅų̣¡"); return false; } if (!BLL.Sc_ICMOSortBillFun.IsSelectZY(grdMain, HSourceIDCol)) { MessageBox.Show("ûÓÐÑ¡Ôñ×ÊÔ´£¬²»ÔÊÐíÅų̣¡"); return false; } return true; } //½»»õÆÚ ³¬ÆÚʱ ±äÉ« private void AddColor() { BLL.Sc_ICMOSortBillFun.AddColor(grdMain, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { bool bResult; lblCaption.Focus(); // if (!AllowSave()) { return; } //ȨÏÞÅÐ¶Ï oMain.MainColl = new List(); DateTime MainDate = DBUtility.ClsPub.isDate(DBUtility.ClsPub.GetServerDate(0)); //дÈëÀà for (int i = grdMain.FixedRows; i <= grdMain.Rows - 1; i++) { //Ö÷±í¸³Öµ //if (grdMain.get_TextMatrix(i, HProcIDCol) != null && grdMain.get_TextMatrix(i, HProcIDCol) != string.Empty) //{ Model.ClsSc_ProcPlanSortBillMain oModel = new Model.ClsSc_ProcPlanSortBillMain(); oModel.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(grdMain.get_TextMatrix(i, HMaterIDCol)); oModel.HProcID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HProcIDCol)); oModel.HSourceID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol)); oModel.HUnitID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HUnitIDCol)); oModel.HGroupID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HGroupIDCol)); oModel.HWorkerID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HWorkerIDCol)); oModel.HSplitNo =grdMain.get_TextMatrix(i, HSplitNOCol).ToString(); oModel.HYX = DBUtility.ClsPub.isInt(grdMain.get_ValueMatrix(i, HYXCol)); oModel.HPlanBeginDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(i, HPlanBeginDateCol)); oModel.HPlanEndDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(i, HPlanEndDateCol)); oModel.HPlanQty = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, HPlanQtyCol)); oModel.HSplitPlanQty = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, HSplitPlanQtyCol)); oModel.HSplitRelationQty = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, HSplitRelationQtyCol)); oModel.HRelationQty = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, HRelationQtyCol)); oModel.HKTQ = DBUtility.ClsPub.GridToBool(grdMain.get_ValueMatrix(i, HKTQCol)); oModel.HWorkQty = DBUtility.ClsPub.isSingle(grdMain.get_ValueMatrix(i, HWorkQtyCol)); oModel.HReadyTimes = DBUtility.ClsPub.isSingle(grdMain.get_ValueMatrix(i, HReadyTimesCol)); oModel.HRemark = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HRemarkCol)); oModel.HMaker = DBUtility.ClsPub.CurUserName.ToString(); oModel.HMakeDate = MainDate.ToShortDateString(); oModel.HSourceInterID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceInterIDCol)); oModel.HSourceEntryID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceEntryIDCol)); oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSourceBillNoCol)); oModel.HProcPlanInterID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HProcPlanInterIDCol)); oModel.HProcPlanEntryID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HProcPlanEntryIDCol)); oModel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HProcPlanBillNoCol)); oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSourceBillTypeCol)); oModel.HICMOInterID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HICMOInterIDCol)); oModel.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol)); oModel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSeOrderBilNoCol)); oModel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSeOrderInterIDCol)); oModel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSeOrderEntryIDCol)); // oMain.MainColl.Add(oModel); // BLL.Sc_ICMOSortBillFun.SaveGridSub(grdMain, FixCols, oModel,MainDate,ref i); } //±£´æÍê±Ïºó´¦Àí bResult = oMain.AddBill(DBUtility.ClsPub.isLong(txtHDeptID.Tag), ref DBUtility.ClsPub.sExeReturnInfo); // //Ìáʾ if (bResult == true) { MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!", "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); } //µÃµ½×îÐÂÅÅ³Ì GetPcTime(); } //±£´æÇ° ¼ì²é private bool AllowSave() { for (int i = grdMain.FixedRows; i < grdMain.Rows; i++) { if (DBUtility.ClsPub.isStrNull(grdMain.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 BLL.Sc_ICMOSortBillFun.AllowRow(grdMain); } //ÅÅ³Ì private bool DateSetup(bool bAuto) { bool b = false; int m=0; int e=0; long lSourceID = 0; //ÁÙʱ´æ·Å×ÊÔ´ID if (grdMain.Rows <= grdMain.FixedRows) { return false; } SortData();//ÏȽ«ÈÎÎñµ¥°´ ×ÊÔ´ÅÅÐò£» ClearCol(bAuto);//Çå¿ÕÅųÌÈÕÆÚ GraphLine();//»­Ïß //RefreshWorkQty();//ˢвúÄÜ //GetHRelationQty(); //ˢл㱨ÊýÁ¿ // BLL.Sc_ICMOSortBillFun.DateSetupProc(grdMain, bAuto, ref m, ref b, ref lSourceID, ref e, ref bEdit, FixCols, HSourceIDCol, HWorkQtyCol, HSplitPlanQtyCol, HSplitRelationQtyCol, HPlanQtyCol, HRelationQtyCol, HICMoBillNoCol, HPlanBeginDateCol, HKTQCol, HYXCol, HPlanEndDateCol, HMaterIDCol, HReadyTimesCol,oCn); // if(MessageBox.Show("ÅųÌÍê³É,ÊÇ·ñ±£´æ£¿","Ìáʾ",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK) { SaveBill(); } return true; } //ÅÅÐò private bool SortData() { return BLL.Sc_ICMOSortBillFun.SortData(grdMain, HSplitNOCol, HICMoBillNoCol, HPlanEndDateCol, HPlanBeginDateCol, HYXCol, HSourceIDCol); } //µÃµ½ÐÂÈÕÆÚ private bool GetNewDay(long lSourceID,int iRow,int iCol) { for (int i = grdMain.FixedRows; i < iRow; i++) { if (DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, iCol)) != 0 && DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, 0)) == lSourceID) { return false; } } return true; } //¼ÆËãÿÈÕ¼Ó¹¤Ê±¼ä private double CountDayHours(int iRow,int iCol) { return BLL.Sc_ICMOSortBillFun.CountDayHours(grdMain, iRow, iCol, HMaterIDCol, HSourceIDCol, HYXCol, HReadyTimesCol,oCn); } //»­Ïß private void GraphLine() { BLL.Sc_ICMOSortBillFun.GraphLine(grdMain, HSourceIDCol); } //Çå¿Õµ±ÈÕ private void ClearCol(bool bAuto) { BLL.Sc_ICMOSortBillFun.ClearCol(grdMain, FixCols, bAuto); } //Çå¿ÕÈÕÆÚÁÐ private void ClearDateCol(bool bClear) { BLL.Sc_ICMOSortBillFun.ClearDateCol(grdMain, FixCols, bClear); } //Ëø¶¨ÈÕÆÚÁÐ private void LockDateCol(bool bClear) { BLL.Sc_ICMOSortBillFun.LockDateCol(grdMain, FixCols, bClear); } //Ñ¡ÖÐÐÐ ÊÇ·ñºÏ²¢ private bool ExistCell() { return BLL.Sc_ICMOSortBillFun.ExistCell(grdMain, HSelectCol); } //ÊÇ·ñÔÊÐí ²ð·Ö private bool AllowCF() { return BLL.Sc_ICMOSortBillFun.AllowCF(grdMain, HSelectCol); } //ÊÇ·ñ ÔÊÐíºÏ²¢ private bool AllowHB() { return BLL.Sc_ICMOSortBillFun.AllowHB(grdMain, HSelectCol, HICMoBillNoCol); } //²ð·ÖÈÎÎñµ¥ private void CFData(int lngRows) { int i = 0, n = 0,SelectRow=0; for (i = grdMain.FixedRows; i < grdMain.Rows; i++) { if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true) { SelectRow = i; break; } } //¿ªÊ¼²ð·Ö for (n =1; n < lngRows; n++) { grdMain.AddItem("", SelectRow + n); //¸´ÖÆ grdMain.set_TextMatrix(SelectRow + n, HCusNameCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HCusNameCol))); grdMain.set_TextMatrix(SelectRow + n, HSeOrderBilNoCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSeOrderBilNoCol))); grdMain.set_TextMatrix(SelectRow + n, HSeOrderInterIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSeOrderInterIDCol))); grdMain.set_TextMatrix(SelectRow + n, HSeOrderEntryIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSeOrderEntryIDCol))); grdMain.set_TextMatrix(SelectRow + n, HSourceInterIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSourceInterIDCol))); grdMain.set_TextMatrix(SelectRow + n, HSourceBillTypeCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSourceBillTypeCol))); grdMain.set_TextMatrix(SelectRow + n, HSourceEntryIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSourceEntryIDCol))); grdMain.set_TextMatrix(SelectRow + n, HSourceBillNoCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSourceBillNoCol))); grdMain.set_TextMatrix(SelectRow + n, HProcPlanInterIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcPlanInterIDCol))); grdMain.set_TextMatrix(SelectRow + n, HProcPlanEntryIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcPlanEntryIDCol))); grdMain.set_TextMatrix(SelectRow + n, HProcPlanBillNoCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcPlanBillNoCol))); grdMain.set_TextMatrix(SelectRow + n, HICMoBillNoCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HICMoBillNoCol))); grdMain.set_TextMatrix(SelectRow + n, HICMOInterIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HICMOInterIDCol))); grdMain.set_TextMatrix(SelectRow + n, HSplitNOCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HSplitNOCol))); grdMain.set_TextMatrix(SelectRow + n, HMaterIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HMaterIDCol))); grdMain.set_TextMatrix(SelectRow + n, HMaterNumberCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HMaterNumberCol))); grdMain.set_TextMatrix(SelectRow + n, HMaterNameCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HMaterNameCol))); grdMain.set_TextMatrix(SelectRow + n, HProcIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcIDCol))); grdMain.set_TextMatrix(SelectRow + n, HProcNumberCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcNumberCol))); grdMain.set_TextMatrix(SelectRow + n, HProcNameCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HProcNameCol))); grdMain.set_TextMatrix(SelectRow + n, HMaterModelCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HMaterModelCol))); grdMain.set_TextMatrix(SelectRow + n, HUnitIDCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HUnitIDCol))); grdMain.set_TextMatrix(SelectRow + n, HUnitNumberCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HUnitNumberCol))); grdMain.set_TextMatrix(SelectRow + n, HUnitNameCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HUnitNameCol))); grdMain.set_TextMatrix(SelectRow + n, HPlanBeginDateCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HPlanBeginDateCol))); grdMain.set_TextMatrix(SelectRow + n, HPlanEndDateCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HPlanEndDateCol))); grdMain.set_TextMatrix(SelectRow + n, HPlanQtyCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HPlanQtyCol))); grdMain.set_TextMatrix(SelectRow + n, HRelationQtyCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HRelationQtyCol))); grdMain.set_TextMatrix(SelectRow + n, HKTQCol, DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(SelectRow, HKTQCol))); SetSourceWorkQty(SelectRow + n); } return; } //ºÏ²¢ÈÎÎñµ¥ private void HBData(int lngCol) { BLL.Sc_ICMOSortBillFun.HBData(grdMain, HSelectCol, lngCol, HMaterIDCol, HSourceIDCol, DBUtility.ClsPub.isLong(txtHProcID.Tag), HWorkQtyCol, oMain); } //ÅжϲÎÊýÐÐÊÇ·ñ²ð·Ö¹ý private bool IsCf(int iRow) { return BLL.Sc_ICMOSortBillFun.IsCf(grdMain, HICMoBillNoCol, iRow); } //µÃµ½µÃµ½±¾¹¤Ðò µ±ÈÕÉϰàʱ¼ä private double GetWorkNumber(string FDate,long SourceID) { return BLL.Sc_ICMOSortBillFun.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_ProcPlanSortBill oK3_ICMOBill = new DAL.Cls_S_Sc_ProcPlanSortBill(); 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 == "3713") { sBool = false; //µÃµ½ÐÅÏ¢ Ds = oCn.RunProcReturn("select * from h_v_Sc_ProcPlanSortBill_add where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_Sc_ProcPlanSortBill_add"); //дÈëÐÅÏ¢ //for (int j = 0; j <= grdMain.Rows - 1; j++) //{ // if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(j, HProcPlanInterIDCol)) == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainID"])) // { // sBool = true; // MessageBox.Show("¹¤Ðò¼Æ»®µ¥£º" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"] + "ÒÑ´æÔÚ´ýÅżƻ®ÖУ¬²»ÔÊÐíÌí¼Ó£¡"), "Ìáʾ"); // break; // } //} if (sBool != true) { grdMain.Rows = grdMain.Rows + 1; Sub_WriteInForm(Ds.Tables[0], grdMain.Rows - 1); } } } } //¸ù¾ÝTABLEдÈë½çÃæ private void Sub_WriteInForm(DataTable oTable, int i) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); try { ////¼ÓÔØ±íÌå grdMain.set_TextMatrix(i, HSeOrderBilNoCol, oTable.Rows[0]["HSeOrderBillNo"].ToString()); grdMain.set_TextMatrix(i, HICMoBillNoCol, oTable.Rows[0]["HICMOBillNo"].ToString()); grdMain.set_TextMatrix(i, HCusNameCol, oTable.Rows[0]["HCusName"].ToString()); grdMain.set_TextMatrix(i, HSplitNOCol, "A"); grdMain.set_TextMatrix(i, HMaterIDCol, oTable.Rows[0]["HMaterID"].ToString()); grdMain.set_TextMatrix(i, HMaterNumberCol, oTable.Rows[0]["ÎïÁÏ´úÂë"].ToString()); grdMain.set_TextMatrix(i, HMaterNameCol, oTable.Rows[0]["ÎïÁÏÃû³Æ"].ToString()); grdMain.set_TextMatrix(i, HMaterModelCol, oTable.Rows[0]["¹æ¸ñÐͺÅ"].ToString()); grdMain.set_TextMatrix(i, HProcIDCol, oTable.Rows[0]["HProcID"].ToString()); grdMain.set_TextMatrix(i, HProcNumberCol, oTable.Rows[0]["¹¤Ðò´úÂë"].ToString()); grdMain.set_TextMatrix(i, HProcNameCol, oTable.Rows[0]["¹¤Ðò"].ToString()); grdMain.set_TextMatrix(i, HUnitIDCol, oTable.Rows[0]["HUnitID"].ToString()); //grdMain.set_TextMatrix(i, HUnitNumberCol, oTable.Rows[0]["HUnitNumber"].ToString()); grdMain.set_TextMatrix(i, HUnitNameCol, oTable.Rows[0]["¼ÆÁ¿µ¥Î»"].ToString()); grdMain.set_TextMatrix(i, HPlanBeginDateCol, oTable.Rows[0]["¼Æ»®¿ª¹¤ÈÕÆÚ"].ToString()); grdMain.set_TextMatrix(i, HPlanEndDateCol, oTable.Rows[0]["¼Æ»®Í깤ÈÕÆÚ"].ToString()); grdMain.set_TextMatrix(i, HPlanQtyCol, DBUtility.ClsPub.isDoule(oTable.Rows[0]["¼Æ»®ÊýÁ¿"], 2)); //grdMain.set_TextMatrix(i, HRelationQtyCol, DBUtility.ClsPub.isDoule(oTable.Rows[0]["HRelationQty"], 2)); grdMain.set_TextMatrix(i, HSplitPlanQtyCol, DBUtility.ClsPub.isDoule(oTable.Rows[0]["¼Æ»®ÊýÁ¿"], 2)); //grdMain.set_TextMatrix(i, HSplitRelationQtyCol, DBUtility.ClsPub.isDoule(oTable.Rows[0]["HSplitRelationQty"], 2)); grdMain.set_TextMatrix(i, HWorkQtyCol, "0"); grdMain.set_TextMatrix(i, HWorkTimesCol, "8"); grdMain.set_TextMatrix(i, HYXCol, ""); grdMain.set_TextMatrix(i, HKTQCol, "1"); grdMain.set_TextMatrix(i, HReadyTimesCol, "0"); //grdMain.set_TextMatrix(i, HRemarkCol, oTable.Rows[0]["HRemark"].ToString()); grdMain.set_TextMatrix(i, HICMOInterIDCol, oTable.Rows[0]["HICMOInterID"].ToString()); grdMain.set_TextMatrix(i, HSeOrderInterIDCol, oTable.Rows[0]["HSeOrderInterID"].ToString()); grdMain.set_TextMatrix(i, HSeOrderEntryIDCol, oTable.Rows[0]["HSeOrderEntryID"].ToString()); grdMain.set_TextMatrix(i, HSourceEntryIDCol, oTable.Rows[0]["HMainID"].ToString()); grdMain.set_TextMatrix(i, HSourceInterIDCol, oTable.Rows[0]["HSubID"].ToString()); grdMain.set_TextMatrix(i, HSourceBillTypeCol, oTable.Rows[0]["HBillType"].ToString()); grdMain.set_TextMatrix(i, HProcPlanInterIDCol, oTable.Rows[0]["HProcPlanInterID"].ToString()); grdMain.set_TextMatrix(i, HProcPlanEntryIDCol, oTable.Rows[0]["HProcPlanEntryID"].ToString()); grdMain.set_TextMatrix(i, HProcPlanBillNoCol, oTable.Rows[0]["HProcPlanBillNo"].ToString()); //¸ù¾ÝÎïÁϵõ½×ÊÔ´ //if (oSource.GetInfoByMater(DBUtility.ClsPub.isLong(oTable.Rows[0]["HMaterID"]))) //{ // grdMain.set_TextMatrix(i, HSourceIDCol, oSource.omodel.HItemID.ToString()); // grdMain.set_TextMatrix(i, HSourceNumberCol, oSource.omodel.HNumber); // grdMain.set_TextMatrix(i, HSourceNameCol, oSource.omodel.HName); // SetSourceWorkQty(i); //} } catch (Exception e) { MessageBox.Show(e.Message); } } //±£´æÁпí private void bclk_Click(object sender, EventArgs e) { //±£´æÁпí DBUtility.ClsPub.SaveGrid(grdMain, this.Name,DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdSource, this.Name + "grdSource", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdICMO, this.Name + "grdICMO", DBUtility.ClsPub.AppPath); } //ĬÈÏÁпí private void mrlk_Click(object sender, EventArgs e) { grdMain.AutoSize(0, grdMain.Cols - 1, false, 1); //²ÎÊý½âÊÍ ¿ªÊ¼ÁÐ £¬½áÊøÁУ¬ÊÇ·ñÒÔ×î´óÁпíΪ׼£¬×îСÁпí DBUtility.ClsPub.SaveGrid(grdMain, this.Name, DBUtility.ClsPub.AppPath); } //Í˳ö°´Å¥ private void tc_Click(object sender, EventArgs e) { this.Close(); } Sc_ICMOSortBill_CF oCf = new Sc_ICMOSortBill_CF(); //²ð·Ö°´Å¥ private void dj_Click(object sender, EventArgs e) { if (AllowCF()) { // oCf.ShowDialog(); if (oCf.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { CFData(DBUtility.ClsPub.isInt(oCf.txtHQty.Text)); } // this.RefreshCfBillNo(); } else { MessageBox.Show("´ËÖÖÇé¿öϲ»ÔÊÐí²ð·ÖÊý¾Ý£¡"); } } //ºÏ²¢°´Å¥ private void sc_Click(object sender, EventArgs e) { if (AllowHB()) { this.HBData(HRelationQtyCol); RefreshCfBillNo(); } else { MessageBox.Show("ÄúÑ¡ÔñµÄÏîÄ¿²»Äܺϲ¢£¡"); } } //Åų̰´Å¥ private void xz_Click(object sender, EventArgs e) { if (CheckSetupData() == false) { return; } if (CheckSource() == 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 jan_Click(object sender, EventArgs e) { // } //»Ö¸´°´Å¥ 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_ProcPlanSortBill_Load(object sender, EventArgs e) { this.Text = ModCaption; this.lblCaption.Text = ModCaption; } //°ïÖúº¯Êý private void Sub_GridKey(int sKeyCode, int sRow, int sCol) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); switch (sKeyCode) { case 118: //F7 { switch (sCol) { case HSourceNumberCol: oSource.WherePart = ""; if (oSource.RefreshViewByRelation(DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(sRow, HMaterIDCol)))) { grdMain.set_TextMatrix(sRow, HSourceIDCol, oSource.oModel.HItemID.ToString()); grdMain.set_TextMatrix(sRow, HSourceNumberCol, oSource.oModel.HNumber); grdMain.set_TextMatrix(sRow, HSourceNameCol, oSource.oModel.HName); //±¾×ÊÔ´ÉÏ°à ¹¤Ê±£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ SetSourceWorkQty(sRow); SetSourceRelationQty(sRow); // } else { grdMain.set_TextMatrix(sRow, HSourceIDCol, ""); grdMain.set_TextMatrix(sRow, HSourceNumberCol, ""); grdMain.set_TextMatrix(sRow, HSourceNameCol, ""); grdMain.set_TextMatrix(sRow, HWorkQtyCol, "0"); grdMain.set_TextMatrix(sRow, HRelationQtyCol, ""); grdMain.set_TextMatrix(sRow, HSplitRelationQtyCol, ""); } break; case HGroupNumberCol: oGroup.WherePart = ""; if (oGroup.RefreshView()) { grdMain.set_TextMatrix(sRow, HGroupIDCol, oGroup.oModel.HItemID.ToString()); grdMain.set_TextMatrix(sRow, HGroupNumberCol, oGroup.oModel.HNumber); grdMain.set_TextMatrix(sRow, HGroupNameCol, oGroup.oModel.HName); } else { grdMain.set_TextMatrix(sRow, HGroupIDCol, ""); grdMain.set_TextMatrix(sRow, HGroupNumberCol, ""); grdMain.set_TextMatrix(sRow, HGroupNameCol, ""); } break; case HWorkerNumberCol: oEmp.WherePart = ""; if (oEmp.RefreshView()) { grdMain.set_TextMatrix(sRow, HWorkerIDCol, oEmp.oModel.HItemID.ToString()); grdMain.set_TextMatrix(sRow, HWorkerNumberCol, oEmp.oModel.HNumber); grdMain.set_TextMatrix(sRow, HWorkerNameCol, oEmp.oModel.HName); } else { grdMain.set_TextMatrix(sRow, HWorkerIDCol, ""); grdMain.set_TextMatrix(sRow, HWorkerNumberCol, ""); grdMain.set_TextMatrix(sRow, HWorkerNameCol, ""); } break; default: break; } break; } case 117: //F6 { switch (sCol) { case HSourceNumberCol: oSource.WherePart = ""; if (oSource.RefreshView()) { grdMain.set_TextMatrix(sRow, HSourceIDCol, oSource.oModel.HItemID.ToString()); grdMain.set_TextMatrix(sRow, HSourceNumberCol, oSource.oModel.HNumber); grdMain.set_TextMatrix(sRow, HSourceNameCol, oSource.oModel.HName); //±¾×ÊÔ´ÉÏ°à ¹¤Ê±£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ SetSourceWorkQty(sRow); SetSourceRelationQty(sRow); // } else { grdMain.set_TextMatrix(sRow, HSourceIDCol, ""); grdMain.set_TextMatrix(sRow, HSourceNumberCol, ""); grdMain.set_TextMatrix(sRow, HSourceNameCol, ""); grdMain.set_TextMatrix(sRow, HWorkQtyCol, "0"); grdMain.set_TextMatrix(sRow, HRelationQtyCol, ""); grdMain.set_TextMatrix(sRow, HSplitRelationQtyCol, ""); } break; default: break; } break; } default: break; } } private void grdMain_KeyDownEvent(object sender, AxVSFlex7._IVSFlexGridEvents_KeyDownEvent e) { Sub_GridKey(e.keyCode, grdMain.Row, grdMain.Col); } private void grdMain_KeyDownEdit(object sender, AxVSFlex7._IVSFlexGridEvents_KeyDownEditEvent e) { Sub_GridKey(e.keyCode, grdMain.Row, grdMain.Col); } //Ë¢ÐÂÈ«²¿×ÊÔ´ ²úÄÜ private void RefreshWorkQty() { for (int i = grdMain.FixedRows; i < grdMain.Rows; i++) { if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol)) != 0) { SetSourceWorkQty(i); } } } //ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceWorkQty(int iRow) { BLL.Sc_ICMOSortBillFun.SetSourceWorkQty(grdMain, HMaterIDCol, HSourceIDCol, DBUtility.ClsPub.isLong(txtHProcID.Tag), HWorkQtyCol, iRow, oMain); } //ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿ private void SetSourceRelationQty(int iRow) { BLL.Sc_ICMOSortBillFun.SetSourceRelationQty(grdMain, 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 (AllowRow()) { int HBRow = 0; int HERow = 0; if (grdMain.Row < grdMain.RowSel) { HBRow = grdMain.Row; HERow = grdMain.RowSel; } else { HBRow = grdMain.RowSel; HERow = grdMain.Row; } for (int i = HERow; i >= HBRow; i--) { if (grdMain.get_RowHidden(i)==false) { grdMain.RemoveItem(i); } } } } private void grdMain_BeforeEdit(object sender, AxVSFlex7._IVSFlexGridEvents_BeforeEditEvent e) { if (BLL.Sc_ICMOSortBillFun.AllowEdit(FixCols,e.col,sAllowCol)) { e.cancel = true; } } private void grdMain_AfterEdit(object sender, AxVSFlex7._IVSFlexGridEvents_AfterEditEvent e) { //Åжϲð·ÖÊý if (CheckJHS(e.row) != true) { grdMain.set_TextMatrix(e.row, HSplitPlanQtyCol, "0"); MessageBox.Show("²ð·Ö¼Æ»®ÊýºÏ¼Æ±ØÐëСÓÚµÈÓڼƻ®Êý", "Ìáʾ"); } //¸ù¾Ý´úÂëµÃµ½ »ù´¡×ÊÁÏÐÅÏ¢ Sub_GetInfoByNumber(e.col,e.row); //ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç Sub_SetHandChangeFlag(e.col,e.row); } //ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç private void Sub_SetHandChangeFlag(int sCol, int sRow) { if (sCol < FixCols || sCol>=grdMain.Cols ) { return; } BLL.Sc_ICMOSortBillFun.Sub_SetHandChangeFlag(grdMain, sCol, sRow); } //¸ù¾Ý´úÂëµÃµ½ »ù´¡×ÊÁÏÐÅÏ¢ private void Sub_GetInfoByNumber(int Col,int Row) { DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View(); DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); // if (Col == HSourceNumberCol) { oSource.WherePart = ""; if (oSource.GetInfoByNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(Row, HSourceNumberCol)))) { grdMain.set_TextMatrix(Row, HSourceIDCol, oSource.omodel.HItemID.ToString()); grdMain.set_TextMatrix(Row, HSourceNumberCol, oSource.omodel.HNumber); grdMain.set_TextMatrix(Row, HSourceNameCol, oSource.omodel.HName); //±¾×ÊÔ´ÉÏ°à ¹¤Ê±£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿ SetSourceWorkQty(Row); SetSourceRelationQty(Row); // } else { grdMain.set_TextMatrix(Row, HSourceIDCol, ""); grdMain.set_TextMatrix(Row, HSourceNumberCol, ""); grdMain.set_TextMatrix(Row, HSourceNameCol, ""); grdMain.set_TextMatrix(Row, HWorkQtyCol, "0"); grdMain.set_TextMatrix(Row, HRelationQtyCol, ""); grdMain.set_TextMatrix(Row, HSplitRelationQtyCol, ""); } } // if (Col == HGroupNumberCol) { oGroup.WherePart = ""; if (oGroup.GetInfoByNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(Row, HGroupNumberCol)))) { grdMain.set_TextMatrix(Row, HGroupIDCol, oGroup.omodel.HItemID.ToString()); grdMain.set_TextMatrix(Row, HGroupNumberCol, oGroup.omodel.HNumber); grdMain.set_TextMatrix(Row, HGroupNameCol, oGroup.omodel.HName); } else { grdMain.set_TextMatrix(Row, HGroupIDCol, ""); grdMain.set_TextMatrix(Row, HGroupNumberCol, ""); grdMain.set_TextMatrix(Row, HGroupNameCol, ""); } } // if (Col == HWorkerNumberCol) { oEmp.WherePart = ""; if (oEmp.GetInfoByNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(Row, HWorkerNumberCol)))) { grdMain.set_TextMatrix(Row, HWorkerIDCol, oEmp.omodel.HItemID.ToString()); grdMain.set_TextMatrix(Row, HWorkerNumberCol, oEmp.omodel.HNumber); grdMain.set_TextMatrix(Row, HWorkerNameCol, oEmp.omodel.HName); } else { grdMain.set_TextMatrix(Row, HWorkerIDCol, ""); grdMain.set_TextMatrix(Row, HWorkerNumberCol, ""); grdMain.set_TextMatrix(Row, HWorkerNameCol, ""); } } } //¼ì²é×ÊÔ´ºÏÀíÐÔ private bool CheckSource() { int j = 0; if (!BLL.Sc_ICMOSortBillFun.CheckSource(grdMain,HProcPlanBillNoCol,HSourceIDCol,ref j)) { grdMain.set_TextMatrix(j, HSourceIDCol, ""); grdMain.set_TextMatrix(j, HSourceNameCol, ""); grdMain.set_TextMatrix(j, HSourceNumberCol, ""); grdMain.set_TextMatrix(j, HRelationQtyCol, ""); grdMain.set_TextMatrix(j, HSplitRelationQtyCol, ""); MessageBox.Show("²ð·Ö¹¤Ðò¼Æ»®µ¥£¬²»ÄÜÑ¡Ôñͬһ×ÊÔ´", "Ìáʾ"); return false; } return true; } //ˢл㱨ÊýÁ¿ private void GetHRelationQty() { //grid½ûֹˢРgrdMain.Redraw = VSFlex7.RedrawSettings.flexRDNone; //¼ÓÔØ±íÍ· for(int i=grdMain.FixedRows ;i= FixCols) { if (grdMain.Row < grdMain.FixedRows || grdMain.Row > grdMain.Rows - 1) return; lngBillKey = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(grdMain.Row, HICMOInterIDCol)); if (lngBillKey == 0) return; oRemarkDlg = new Sc_ICMOSortBillDlg_Remark(); oRemarkDlg.HICMOInterID = lngBillKey; oRemarkDlg.HSourceID = DBUtility.ClsPub.isLong(grdMain.get_ValueMatrix(grdMain.Row, HSourceIDCol)); oRemarkDlg.HSplitNO = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(grdMain.Row, HSplitNOCol)); oRemarkDlg.HDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(grdMain.FixedRows - 1, grdMain.Col)); oRemarkDlg.ShowDialog(); } } //½«ÊýÁ¿ »¯Îª ʱ¼ä private void sjb_Click(object sender, EventArgs e) { if (tbc1.Visible == false)//δÏÔʾ { // } else //ÉèÖÃʱ¼äÍø¸ñ { //¸´ÖÆ ÅųÌÍø¸ñµÄÈ«²¿ÐÅÏ¢ÖÁ CopyGrid(); //¼ÆË㿪ʼ½áÊøÊ±¼ä CountTimes(); // } } //¸´ÖÆÍø¸ñ private void CopyGrid() { BLL.Sc_ICMOSortBillFun.initGrid(grdTimes, grdMain.FixedRows); grdTimes.FixedCols = grdMain.FixedCols; grdTimes.FixedRows = grdMain.FixedRows; grdTimes.Rows = grdMain.Rows; grdTimes.Cols = grdMain.Cols; for (int i = 0; i < grdMain.Rows; i++) { grdTimes.set_RowHeight(i, grdMain.get_RowHeight(i)); grdTimes.set_RowHidden(i,grdMain.get_RowHidden(i)); for (int j = 0; j < grdMain.Cols; j++) { grdTimes.set_ColHidden(j, grdMain.get_ColHidden(j)); grdTimes.set_ColWidth(j, grdMain.get_ColWidth(j)); grdTimes.set_TextMatrix(i, j, grdMain.get_TextMatrix(i, j)); } } } //¼ÆËãʱ¼ä private void CountTimes() { //µÃµ½Éϰàʱ¼ä ϰàʱ¼ä DateTime HBTime; DateTime HETime; HBTime =Convert.ToDateTime("08:00:00"); HETime = Convert.ToDateTime( "16:00:00"); string HBeginTime = ""; string HEndTime = ""; int HQty = 0; double HUseTimes = 0; Single HWorkQty = 0; //µ¥Î»²úÄÜ string[] s; // for (int i = FixCols; i < grdTimes.Cols; i++) { for (int j = grdTimes.FixedRows; j < grdTimes.Rows; j++) { if (i == Convert.ToInt32(FixCols) || j == grdTimes.FixedRows)//Èç¹ûÊǵÚÒ»ÁÐ »òÕßµÚÒ»ÐÐ { HBTime = Convert.ToDateTime("08:00:00"); } else { if (DBUtility.ClsPub.isStrNull(grdTimes.get_TextMatrix(j - 1, i)) == "") //ÉÏÐÐûÓÐÊý¾Ý { HBTime = Convert.ToDateTime("08:00:00"); } else { //µÃµ½ÉÏÐнáÊøÊ±¼ä s = DBUtility.ClsPub.isStrNull(grdTimes.get_TextMatrix(j - 1, i)).Split(Convert.ToChar("-")); if (s.Length > 1) { HBTime =Convert.ToDateTime(s[1]); } else { HBTime = Convert.ToDateTime("08:00:00"); } } } HQty =DBUtility.ClsPub.isInt(grdTimes.get_TextMatrix(j, i)); if (HQty != 0) { HWorkQty = DBUtility.ClsPub.isSingle(grdTimes.get_TextMatrix(j, HWorkQtyCol)); //¸ù¾ÝÊýÁ¿¼ÆË㹤ʱ if (HWorkQty != 0) { HUseTimes = DBUtility.ClsPub.isDoule(HQty / HWorkQty); HETime = HBTime.AddHours(HUseTimes); HBeginTime = HBTime.ToShortTimeString(); HEndTime = HETime.ToShortTimeString(); grdTimes.set_TextMatrix(j, i, HBeginTime + "-" + HEndTime); } else { grdTimes.set_TextMatrix(j, i, "Òì³£"); } } else { grdTimes.set_TextMatrix(j, i, ""); } } } } } }