using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Pub_Class; using SQLHelper; namespace PlanM { public partial class Gy_StdWorkTimes_RoutingBill : BLL.Gy_DataInTmp { public Gy_StdWorkTimes_RoutingBill() { InitializeComponent(); } public int HItemID =0; public int HMaker = 0; //ÖÆµ¥ÈË public int HMakeDate = 0; //ÖÆµ¥ÈÕÆÚ public int HChecker = 0; //ÉóºËÈË public int HCheckDate = 0; //ÉóºËÈÕÆÚ public int HStopflag = 0; public int HRemark = 0; public int HUSEORGName = 0; //×éÖ¯ID public int HProcName = 0; // public int HMaterName = 0; //ÎïÁÏID public int HProcNum = 0; // public int HMaterNum = 0; //ÎïÁÏID public int HStdWorkTimes = 0; //±ê×¼¹¤Ê± public int HUpperlimit = 0; //ÉÏÏÞ±ÈÀý public int HLowerlimit = 0; //ÏÂÏÞ±ÈÀý public int HStdPiece = 0; //ÉÏÏÞ±ÈÀý public int HStdPric = 0; //ÏÂÏÞ±ÈÀý // public const int HBeginRow = 2; //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý // public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View(); public DAL.ClsGy_StdWorkTimes_Ctl BillNew = new DAL.ClsGy_StdWorkTimes_Ctl(); DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View(); public override bool OpenExcelData() { base.sSheetName = txtHSheetName.Text; return base.OpenExcelData(); } /// /// ³õʼ»¯½çÃæ /// public override void initData() { base.initData(); base.sSheetName = "±ê×¼¹¤Ê±"; base.ModRightName = "Gy_StdWorkTimes_RoutingBill"; 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 sHStdWorkTimesCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¹¤Ê±", grdMain); int sHProcNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain); int sHProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain); int sHMaterNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ´úÂë", grdMain); int sHMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ", grdMain); int sHUpperlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÉÏÏß±ÈÀý", grdMain); int sHLowerlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÏÂÏß±ÈÀý", grdMain); int sHStdPieceCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¼Æ¼þ", grdMain); int sHStdPricCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¼Æ¼Û", grdMain); int sHUSEORGNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("×éÖ¯", grdMain); int sHMakerCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈË", grdMain); int sHMakeDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈÕÆÚ", grdMain); for (int i = 0; i <= grdMain.Rows.Count - 1; i++) { if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHMaterNumCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHProcNumCol].Value) != ""&& DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[sHStdWorkTimesCol].Value) != "") { if (DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHStdWorkTimesCol].Value)>0&& DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHUpperlimitCol].Value) > 0&& DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[sHLowerlimitCol].Value) > 0) { //дÈëÀà if (WriteClass(i)) { //±£´æ¼Ç¼ if (!BillNew.AddNew()) { MessageBox.Show("µ¼Èëʧ°Ü!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } } } else { MessageBox.Show("µÚ" + (i + 1) + "ÐÐ,±ê×¼¹¤Ê±¡¢ÉÏÏÞ±ÈÀýºÍÏÂÏÞ±ÈÀý²»ÄÜСÓÚ0", "Ìáʾ"); return; } } else { MessageBox.Show("µÚ"+(i+1)+"ÐÐ,¹¤Ðò´úÂë¡¢ÎïÁÏ´úÂëºÍ±ê×¼¹¤Ê±²»ÄÜΪ¿Õ!Ô­Òò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); return; } } MessageBox.Show("µ¼ÈëÍê±Ï"); grdMain.DataSource = null; } //дÈëÀà ´Ó¿Ø¼þ private bool WriteClass(int row) { BillNew.DetailColl.Clear(); string sMaterNumber = ""; string sMaterName = ""; string sProcNumber = ""; string sProcName = ""; double sStdWorkTimes = 0; double sUpperlimit = 0; double sLowerlimit = 0; double sStdPiece = 0; double sStdPric= 0; int sUSEORGName = 0; DateTime sHMakeDate = DateTime.Today.Date; string sHMaker = DBUtility.ClsPub.CurUserName; int sHStdWorkTimesCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¹¤Ê±", grdMain); int sHProcNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain); int sHProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain); int sHMaterNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ´úÂë", grdMain); int sHMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ", grdMain); int sHUpperlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÉÏÏß±ÈÀý", grdMain); int sHLowerlimitCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÏÂÏß±ÈÀý", grdMain); int sHStdPieceCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¼Æ¼þ", grdMain); int sHStdPricCol = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¼Æ¼Û", grdMain); int sHUSEORGNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("×éÖ¯", grdMain); int sHMakerCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈË", grdMain); int sHMakeDateCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈÕÆÚ", grdMain); // sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMaterNumCol].Value); //sMaterName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMaterNameCol].Value); sProcNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHProcNumCol].Value); //sProcName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHProcNameCol].Value); sStdWorkTimes = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdWorkTimesCol].Value); sUpperlimit = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHUpperlimitCol].Value); sLowerlimit = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHLowerlimitCol].Value); sStdPiece = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdPieceCol].Value); sStdPric = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[sHStdPricCol].Value); //sUSEORGName = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[sHUSEORGNameCol].Value); //sHMakeDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[sHMakeDateCol].Value); //sHMaker = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHMakerCol].Value); //ÅжÏÊÇ·ñÔÊÐí ±£´æ //ÉóºË´úÂëÊÇ·ñºÏÀí if (!DBUtility.ClsPub.AllowNumber(sMaterNumber)) { MessageBox.Show("²úÆ·´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } if (!DBUtility.ClsPub.AllowNumber(sProcNumber)) { MessageBox.Show("¹¤Ðò´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); return false; } Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model(); //µÃµ½ÎïÁÏÄÚÂë if (oMaterHlp.GetInfoByNumber(sMaterNumber)) { oSub.HMaterID = oMaterHlp.omodel.HItemID; } else { oSub.HMaterID = 0; MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sMaterNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡"); return false; } //µÃµ½¹¤ÐòÄÚÂë if (oProcHlp.GetInfoByNumber(sProcNumber)) { oSub.HProcID = oProcHlp.omodel.HItemID; } else { oSub.HProcID = 0; MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sProcNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄ¹¤Ðò£¡"); return false; } //дÈëÐÅÏ¢ oSub.HRemark = ""; oSub.HStdWorkTimes = sStdWorkTimes; oSub.HUpperlimit = sUpperlimit; oSub.HLowerlimit = sLowerlimit; oSub.HStdPiece = sStdPiece; oSub.HStdPric = sStdPric; oSub.HUSEORGID = DBUtility.ClsPub.HOrgID; 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 Gy_StdWorkTimes_RoutingBill_Load(object sender, EventArgs e) { } } }