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_WorkCenter :BLL.Gy_DataInTmp 
 | 
    { 
 | 
        public Gy_DataIn_WorkCenter() 
 | 
        { 
 | 
            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_WorkCenter_Ctl oProc = new DAL.ClsGy_WorkCenter_Ctl(); 
 | 
        public DAL.ClsGy_WorkCenter_View oProcHlp = new DAL.ClsGy_WorkCenter_View(); 
 | 
        public DAL.ClsGy_Department_View oFactory = new DAL.ClsGy_Department_View(); 
 | 
        public DAL.ClsGy_Process_View oProce = new DAL.ClsGy_Process_View(); 
 | 
        //public DAL.ClsCB_ItemMoneyBill_Tmp oBill = new DAL.ClsCB_ItemMoneyBill_Tmp(); 
 | 
  
 | 
        //public DAL.ClsGy_ItemMoney_View oItemMoney = new DAL.ClsGy_ItemMoney_View(); 
 | 
        //public DAL.ClsGy_Room_View oRoom = new DAL.ClsGy_Room_View(); 
 | 
        //public DAL.ClsGy_Collect_View oCollect = new DAL.ClsGy_Collect_View(); 
 | 
        //public DAL.ClsGy_Building_View oBuilding = new DAL.ClsGy_Building_View(); 
 | 
  
 | 
        /// <summary> 
 | 
        ///  ³õʼ»¯½çÃæ 
 | 
        /// </summary> 
 | 
        public override void initData() 
 | 
        { 
 | 
            base.initData(); 
 | 
            base.sSheetName = "¹¤×÷ÖÐÐÄ"; 
 | 
            base.ModRightName = "Gy_DataIn_WorkCenter"; 
 | 
            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() 
 | 
        { 
 | 
  
 | 
            for (int i = 0; i <= grdMain.Rows.Count - 1; i++) 
 | 
            { 
 | 
                if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[0].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[1].Value) != "") 
 | 
                { 
 | 
                    //дÈëÀà 
 | 
                    if (WriteClass(i)) 
 | 
                    { 
 | 
                        //±£´æ¼Ç¼ 
 | 
                        if (!oProc.AddNew()) 
 | 
                        { 
 | 
                            MessageBox.Show("µ¼Èëʧ°Ü!ÔÒò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); 
 | 
                            return; 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    MessageBox.Show("¹¤Ðò´úÂë»òÃû³ÆÎª¿Õ!ÔÒò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ"); 
 | 
                    return; 
 | 
                } 
 | 
            } 
 | 
            MessageBox.Show("µ¼ÈëÍê±Ï"); 
 | 
            grdMain.DataSource = null; 
 | 
        } 
 | 
  
 | 
        //дÈëÀ࠴ӿؼþ 
 | 
        private bool WriteClass(int row) 
 | 
        { 
 | 
            string sHNumber = ""; 
 | 
            string sHName = ""; 
 | 
            string sWorkNumber = ""; 
 | 
            string sQty = ""; 
 | 
            string sWordG = ""; 
 | 
            string sTime = ""; 
 | 
            long HItemID = 0; 
 | 
            int sCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ÖÐÐÄ´úÂë", grdMain); 
 | 
            int sHNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ÖÐÐÄ", grdMain); 
 | 
            int sWorkCol = DBUtility.Gy_BaseFun.Fun_GetCol("ËùÊô²¿ÃÅ", grdMain); 
 | 
            int sQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("É豸ÊýÁ¿", grdMain); 
 | 
            int sWorkGCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain); 
 | 
            int sTimeCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ʱ¼ä", grdMain); 
 | 
            // 
 | 
            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sCol].Value); 
 | 
            sWorkNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sWorkCol].Value); 
 | 
            sHName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sHNameCol].Value); 
 | 
            sQty = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sQtyCol].Value); 
 | 
            sWordG = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sWorkGCol].Value); 
 | 
            sTime = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[sTimeCol].Value); 
 | 
  
 | 
            //ÅжÏÊÇ·ñÔÊÐí ±£´æ 
 | 
            //ÉóºË´úÂëÊÇ·ñºÏÀí 
 | 
            if (!DBUtility.ClsPub.AllowNumber(sHNumber)) 
 | 
            { 
 | 
                MessageBox.Show("´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ"); 
 | 
                return false; 
 | 
            } 
 | 
  
 | 
            //ÊÇ·ñÖØ¸´´úÂë 
 | 
            if (oProc.HavSameNumber(HItemID, sHNumber)) 
 | 
            { 
 | 
                MessageBox.Show("´úÂëÖØ¸´£¡", "Ìáʾ"); 
 | 
                return false; 
 | 
            } 
 | 
            //¼ì²é¸¸¼¶ÊÇ·ñ´æÔÚ 
 | 
            string sParent; 
 | 
            sParent = DBUtility.ClsPub.GetParentCode(sHNumber); 
 | 
            if (sParent.Trim() == "") 
 | 
            { 
 | 
                oProc.oModel.HParentID = 0; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                if (oProc.HavParentCode(sParent.Trim(), HItemID)) 
 | 
                { 
 | 
                    oProc.oModel.HParentID = oProc.oModel.HItemID; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    MessageBox.Show("Éϼ¶´úÂë²»´æÔÚ»ò±»½ûÓã¡", "Ìáʾ"); 
 | 
                    return false; 
 | 
                } 
 | 
            } 
 | 
            //µÃµ½¶Ì´úÂë 
 | 
            string sShortNumber; 
 | 
            sShortNumber = DBUtility.ClsPub.GetShortNumber(sHNumber); 
 | 
            if (sShortNumber.Trim() == "") 
 | 
            { 
 | 
                return false; 
 | 
            } 
 | 
            //±£´æÔ´úÂë 
 | 
            if (oProcHlp.GetInfoByID(HItemID)) 
 | 
            { 
 | 
                oProc.HOldNumber = oProcHlp.oModel.HNumber; 
 | 
                //ÊÇ·ñдúÂëÊÇ×Ô¼º×ÓÏîÄ¿µÄ¡¡×ÓÏîÄ¿ 
 | 
                if (sParent.Length >= oProc.HOldNumber.Length) 
 | 
                { 
 | 
                    if (sParent.Substring(0, oProc.HOldNumber.ToString().Length) == oProc.HOldNumber.Trim()) 
 | 
                    { 
 | 
                        MessageBox.Show("дúÂë²»ÄÜÊÇ×Ô¼ºµÄϼ¶µÄ×ÓÏîÄ¿£¡", "Ìáʾ"); 
 | 
                        return false; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oProc.HOldNumber = ""; 
 | 
            } 
 | 
  
 | 
            //µÃµ½³µ¼äÄÚÂë 
 | 
            if (oFactory.GetInfoByNumber(sWorkNumber)) 
 | 
            { 
 | 
                oProc.oModel.HDeptID = oFactory.omodel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oProc.oModel.HDeptID = 0; 
 | 
                MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sWorkNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄ²¿ÃÅ£¡"); 
 | 
                return false; 
 | 
            } 
 | 
            //дÈëÐÅÏ¢ 
 | 
            oProc.oModel.HShortNumber = sShortNumber; 
 | 
            oProc.oModel.HEndFlag = true; 
 | 
            oProc.oModel.HLevel = DBUtility.ClsPub.GetLevel(sHNumber); 
 | 
            oProc.oModel.HNumber = sHNumber; 
 | 
            oProc.oModel.HHelpCode = ""; 
 | 
            oProc.oModel.HName = sHName; 
 | 
            oProc.oModel.HStopflag = false; 
 | 
            oProc.oModel.HRemark = ""; 
 | 
            oProc.oModel.HBarCode = ""; 
 | 
            if (oFactory.GetInfoByName(sWorkNumber)) 
 | 
            { 
 | 
                oProc.oModel.HDeptID = oFactory.omodel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oProc.oModel.HDeptID = 0; 
 | 
                return false; 
 | 
            } 
 | 
            oProc.oModel.HQty = DBUtility.ClsPub.isLong(sQty); 
 | 
            oProc.oModel.HWorkTimes = DBUtility.ClsPub.isDoule(sTime); 
 | 
            if (oProce.GetInfoByName(sWordG)) 
 | 
            { 
 | 
                oProc.oModel.HProcID = oProce.omodel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oProc.oModel.HProcID = 0; 
 | 
                return false; 
 | 
            } 
 | 
            return true; 
 | 
        } 
 | 
  
 | 
        private void button1_Click(object sender, EventArgs e) 
 | 
        { 
 | 
  
 | 
        } 
 | 
  
 | 
         
 | 
  
 | 
    } 
 | 
} 
 |