using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace BaseSet { public partial class Gy_DataIn_ProcessPrice :BLL.Gy_DataInTmp { public Gy_DataIn_ProcessPrice() { InitializeComponent(); } public int HCollectIDCol = 1; //²É¼¯Æ÷ÄÚÂë public int HRoomIDCol = 5; //Òµ»§ÄÚÂë public int HBeginDateCol = 13; //¿ªÊ¼ÈÕÆÚ public int HEndDateCol = 10; //½áÊøÈÕÆÚ public int HItMoneyIDCol = 5; //·ÑÓÃÏîÄ¿ public int HQtyCol = 6; //ÊýÁ¿ public int HPriceCol = 7; //µ¥¼Û public int HMoneyCol = 8; //½ð¶î public int HBeginBalanceCol = 12; //¿ªÊ¼ÊýÖµ public int HEndBalanceCol = 9; //½áÊøÊýÖµ // public const int HBeginRow = 2; //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý // // //public DAL.ClsGy_Process_Ctl oProc = new DAL.ClsGy_Process_Ctl(); //public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View(); //public DAL.ClsGy_Department_View oFactory = new DAL.ClsGy_Department_View(); public DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl(); //DAL.ClsGy_Material_Ctl oMater = new DAL.ClsGy_Material_Ctl(); //DAL.ClsGy_Material_View oMaterHlp = new DAL.ClsGy_Material_View(); DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View(); DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View(); DAL.ClsIF_Source_View oSource = new DAL.ClsIF_Source_View(); DAL.ClsIF_Department_View oDept = new DAL.ClsIF_Department_View(); /// /// ³õʼ»¯½çÃæ /// public override void initData() { base.initData(); base.sSheetName = "¹¤Ðò¹¤¼Û"; base.ModRightName = "Gy_DataIn_ProcessPrice"; base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck; base.ModRightNameClose = base.ModRightName + base.ModRightNameClose; base.ModRightNameDelete = base.ModRightName + base.ModRightNameDelete; base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit; base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney; base.ModRightNameQty = base.ModRightName + base.ModRightNameQty; base.ModCaption = "¹¤Ðò¹¤¼Û"; this.Text = base.ModCaption; lblCaption.Text = base.ModCaption; // DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear); DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod); // } public override void Sub_DataIn() { int sMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain); int sMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·Ãû³Æ", grdMain); int sModelCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹æ¸ñÐͺÅ", grdMain); int sProcNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain); int sProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain); int sSourceNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("×ÊÔ´´úÂë", grdMain); int sSourceNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("Éú²ú×ÊÔ´", grdMain); int sPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("µ¥¼Û", grdMain); int sFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("¶¨¶î", grdMain); int sBadPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("²»Á¼¿Û¿î", grdMain); int sWasterPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("±¨·Ï¿Û¿î", grdMain); int sDeptNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²¿ÃÅ´úÂë", grdMain); int sDeptNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("²¿ÃÅ", grdMain); int sCostFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("Á÷תĬÈÏ", grdMain); int sPayFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×ÊĬÈÏ", grdMain); int sFlowFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("³É±¾Ä¬ÈÏ", grdMain); int sBeginDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÉúЧÈÕÆÚ", grdMain); int sEndDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ʧЧÈÕÆÚ", grdMain); for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sMaterNumberCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sProcNumberCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sPriceCol].Value) != "") { //дÈëÀà if (WriteClass(i)) { //±£´æ¼Ç¼ if (!BillNew.AddNew()) { MessageBox.Show("µ¼Èëʧ°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } } } else { MessageBox.Show("¹¤Ðò´úÂë»òÎïÁÏ´úÂëΪ¿Õ!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } } MessageBox.Show("µ¼ÈëÍê±Ï"); grdMain.DataSource = null; } //дÈëÀà ´Ó¿Ø¼þ private bool WriteClass(int row) { BillNew.DetailColl.Clear(); //string sHNumber = ""; //string sProcNumber = ""; //double Price = 0 ; string sMaterNumber = ""; string sMaterName = ""; string sModel = ""; string sProcNumber = ""; string sProcName = ""; string sSourceNumber = ""; string sSourceName = ""; double sPrice = 0; double sFixPrice = 0; double sBadPrice = 0; double sWasterPrice = 0; string sDeptNumber = ""; string sDeptName = ""; bool sCostFlag = false; bool sPayFlag = false; bool sFlowFlag = false; DateTime sBeginDate = DateTime.Today.Date; DateTime sEndDate = DateTime.Today.Date; int sMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain); int sMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·Ãû³Æ", grdMain); int sModelCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹æ¸ñÐͺÅ", grdMain); int sProcNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain); int sProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain); int sSourceNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("×ÊÔ´´úÂë", grdMain); int sSourceNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("Éú²ú×ÊÔ´", grdMain); int sPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("µ¥¼Û", grdMain); int sFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("¶¨¶î", grdMain); int sBadPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("²»Á¼¿Û¿î", grdMain); int sWasterPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("±¨·Ï¿Û¿î", grdMain); int sDeptNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²¿ÃÅ´úÂë", grdMain); int sDeptNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("²¿ÃÅ", grdMain); int sCostFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("Á÷תĬÈÏ", grdMain); int sPayFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×ÊĬÈÏ", grdMain); int sFlowFlagCol = DBUtility.Gy_BaseFun.Fun_GetCol("³É±¾Ä¬ÈÏ", grdMain); int sBeginDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÉúЧÈÕÆÚ", grdMain); int sEndDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ʧЧÈÕÆÚ", grdMain); // sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sMaterNumberCol].Value); sMaterName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sMaterNameCol].Value); sModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sModelCol].Value); sProcNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sProcNumberCol].Value); sProcName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sProcNameCol].Value); sSourceNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sSourceNumberCol].Value); sSourceName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sSourceNameCol].Value); sPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sPriceCol].Value); sFixPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sFixPriceCol].Value); sBadPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sBadPriceCol].Value); sWasterPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sWasterPriceCol].Value); sDeptNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sDeptNumberCol].Value); sDeptName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sDeptNameCol].Value); sCostFlag = DBUtility.ClsPub.StringToBool(grdMain.Rows[row].Cells[sCostFlagCol].Value); sPayFlag = DBUtility.ClsPub.StringToBool(grdMain.Rows[row].Cells[sPayFlagCol].Value); sFlowFlag = DBUtility.ClsPub.StringToBool(grdMain.Rows[row].Cells[sFlowFlagCol].Value); sBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sBeginDateCol].Value); sEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sEndDateCol].Value); //ÅжÏÊÇ·ñÔÊÐí ±£´æ //ÉóºË´úÂëÊÇ·ñºÏÀí if (!DBUtility.ClsPub.AllowNumber(sMaterNumber)) { MessageBox.Show("²úÆ·´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } if (!DBUtility.ClsPub.AllowNumber(sProcNumber)) { MessageBox.Show("¹¤Ðò´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } if (!DBUtility.ClsPub.AllowNumber(sSourceNumber)) { MessageBox.Show("×ÊÔ´´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } if (!DBUtility.ClsPub.AllowNumber(sDeptNumber)) { MessageBox.Show("²¿ÃÅ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } Model.ClsGy_ProcPrice_Model oSub=new Model.ClsGy_ProcPrice_Model(); //µÃµ½ÎïÁÏÄÚÂë if (oMater.GetInfoByNumber(sMaterNumber)) { oSub.HMaterID = oMater.omodel.HItemID; } else { oSub.HMaterID = 0; MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sMaterNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡"); return false; } //µÃµ½¹¤ÐòÄÚÂë if (oProc.GetInfoByNumber(sProcNumber)) { oSub.HProcID = oProc.omodel.HItemID; } else { oSub.HProcID = 0; MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sProcNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄ¹¤Ðò£¡"); return false; } //µÃµ½×ÊÔ´ÄÚÂë if (oSource.GetInfoByNumber(sSourceNumber)) { oSub.HSourceID = oSource.omodel.HItemID; } else { oSub.HSourceID = 0; //MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sSourceNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄ×ÊÔ´£¡"); //return false; } //µÃµ½²¿ÃÅÄÚÂë if (oDept.GetInfoByNumber(sDeptNumber)) { oSub.HDeptID = oDept.omodel.HItemID; } else { oSub.HDeptID = 0; //MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sDeptNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄ²¿ÃÅ£¡"); //return false; } //дÈëÐÅÏ¢ oSub.HCostFlag = sCostFlag; oSub.HFlowFlag =sFlowFlag; oSub.HPayFlag = sPayFlag; if ( DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sBeginDateCol].Value)!= "" ) oSub.HBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sBeginDateCol].Value); else oSub.HBeginDate =DateTime.Today.Date; if ( DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sBeginDateCol].Value)!= "" ) oSub.HEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sEndDateCol].Value); else oSub.HEndDate = DateTime.Today.Date.AddYears(100); oSub.HRemark = ""; oSub.HPrice = sPrice; oSub.HFixPrice = sFixPrice; oSub.HBadPrice = sBadPrice; oSub.HWasterPrice = sWasterPrice; oSub.HMaker = DBUtility.ClsPub.CurUserName; oSub.HMakeDate = DateTime.Today.ToShortDateString(); BillNew.DetailColl.Add(oSub); //oProc.oModel.HBillSubType = DBUtility.ClsPub.isStrNull(txtHBillSubType.Text); return true; } private void button1_Click(object sender, EventArgs e) { } } }