沈泽
2021-08-20 e3ae7f17842fe7de358ced5398ef792a961f80eb
PlanM/Êý¾Ýµ¼Èë/Gy_DataIn_RoutingBill.cs
@@ -10,7 +10,7 @@
namespace PlanM
{
    public partial class Gy_DataIn_RoutingBill :BLL.Gy_DataInTmp
    public partial class Gy_DataIn_RoutingBill : BLL.Gy_DataInTmp
    {
        public Gy_DataIn_RoutingBill()
        {
@@ -18,17 +18,26 @@
        }
        public int HMaterNumberCol = 0;             //产品代码
        public int HProcNoCol = 0;       //工序序号
        public int HProcNameCol = 0;           //工序
        public int HWorkCenterNameCol = 0;        //工作中心   
        public int HWorkQtyCol = 0;          //产能
        public int HWorkQtyCol = 0;          //加工数量
        public int HBeginDayQtyCol = 6;     //开工固天
        public int HBeginFixQtyCol = 7;     //开工余量 
        public int HFixPriceCol = 8;        //定额 å°æ—¶å·¥èµ„
        public int HProcPriceCol = 9;       //工价
        public int HProcNoCol = 0;       //工序序号
        public int HTechnologyParameterCol = 0;       //工艺参数
        public int HPicNumCol = 0;       //图纸编号 
        public int HProcCheckNoteCol = 0;       //本工序确认记录
        public int HPicNumVerCol = 0;       //图号版本
        public int HPicNumAssembleCol = 0;       //总装图号
        public int HMaterTextureCol = 0;       //材质
        public int HProductNumCol = 0;       //成品编号
        public int HVerNumCol = 0;       //版本
        public int HMouldNoCol = 0;       //模具编号
        public int HProcWorkNumCol = 0;        //程序号
        public int HPassRateCol = 0;        //良率
        //
        public const int HBeginRow = 2;         //有效数据,开始行数
        // 
@@ -45,7 +54,7 @@
        {
            base.sSheetName = txtHSheetName.Text;
            return base.OpenExcelData();
        }
        }
        /// <summary>
        ///  åˆå§‹åŒ–界面
@@ -53,7 +62,7 @@
        public override void initData()
        {
            base.initData();
            base.sSheetName = txtHSheetName.Text ;
            base.sSheetName = txtHSheetName.Text;
            base.ModRightName = "Gy_DataIn_RoutingBill";
            base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck;
            base.ModRightNameClose = base.ModRightName + base.ModRightNameClose;
@@ -72,255 +81,330 @@
        //导入
        public override void Sub_DataIn()
        {
            string hnumber = "";
            string HBillNo = "";
            //
            HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("产品代码", grdMain);
            HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序", grdMain);
            HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工作中心", grdMain);
            HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("产能", grdMain);
            HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工余量", grdMain);
            HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工固天", grdMain);
            HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("小时工资", grdMain);
            HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("单个工价", grdMain);
            try
            {
                string hnumber = "";
                string HBillNo = "";
                //
                HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("产品代码", grdMain);
                HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序序号", grdMain);
                HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序", grdMain);
                HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工作中心", grdMain);
                HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("加工数量", grdMain);
                HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("图纸编号", grdMain);
                HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("工艺参数", grdMain);
                HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("本工序确认记录", grdMain);
                HPicNumVerCol = DBUtility.Gy_BaseFun.Fun_GetCol("图号版本", grdMain);
                HPicNumAssembleCol = DBUtility.Gy_BaseFun.Fun_GetCol("总装图号", grdMain);
                HMaterTextureCol = DBUtility.Gy_BaseFun.Fun_GetCol("材质", grdMain);
                HProductNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("成品编号", grdMain);
                HVerNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("版本", grdMain);
                HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("模具编号", grdMain);
                HProcWorkNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("程序号", grdMain);
                HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工余量", grdMain);
                HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工固天", grdMain);
                HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("小时工资", grdMain);
                HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("单个工价", grdMain);
                HPassRateCol = DBUtility.Gy_BaseFun.Fun_GetCol("良率", grdMain);
            HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序序号", grdMain);
            HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("工艺参数", grdMain);
            HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("图纸编号", grdMain);
            HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("本工序确认记录", grdMain);
            //没有找到列
            if (HMaterNumberCol == -1)
            {
                MessageBox.Show("没有找到【产品代码】的标题", "提示");
                return;
            }
            if (HProcNameCol == -1)
            {
                MessageBox.Show("没有找到【工序】的标题", "提示");
                return;
            }
            if (HWorkCenterNameCol == -1)
            {
                MessageBox.Show("没有找到【工作中心】的标题", "提示");
                return;
            }
            if (HWorkQtyCol == -1)
            {
                MessageBox.Show("没有找到【产能】的标题", "提示");
                return;
            }
            if (HBeginFixQtyCol == -1)
            {
                MessageBox.Show("没有找到【开工余量】的标题", "提示");
                return;
            }
            if (HBeginDayQtyCol == -1)
            {
                MessageBox.Show("没有找到【开工固天】的标题", "提示");
                return;
            }
            if (HFixPriceCol == -1)
            {
                MessageBox.Show("没有找到【小时工资】的标题", "提示");
                return;
            }
            if (HProcPriceCol == -1)
            {
                MessageBox.Show("没有找到【单个工价】的标题", "提示");
                return;
            }
            if (HProcNoCol == -1)
            {
                MessageBox.Show("没有找到【工序序号】的标题", "提示");
                return;
            }
            if (HTechnologyParameterCol == -1)
            {
                MessageBox.Show("没有找到【工艺参数】的标题", "提示");
                return;
            }
            if (HPicNumCol == -1)
            {
                MessageBox.Show("没有找到【图纸编号】的标题", "提示");
                return;
            }
            if (HProcCheckNoteCol == -1)
            {
                MessageBox.Show("没有找到【本工序确认记录】的标题", "提示");
                return;
            }
            //
            if (!Checkdata())
            {
                return;
            }
            if (grdMain.Rows.Count > 0)
            {
                hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                BillNew.omodel.HStandard = false;
                BillNew.omodel.HMainTimeUnit = "Сʱ";
                BillNew.omodel.HYear = 2011;
                BillNew.omodel.HPeriod = 1;
                BillNew.omodel.HBillNo = HBillNo;
                BillNew.omodel.HDate = DateTime.Today.Date;
                BillNew.DetailColl.Clear();
            }
            for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
            {
                string sHNumber = "";
                if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value) != "" )
                //没有找到列
                if (HMaterNumberCol == -1)
                {
                    //
                    sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                    //审核代码是否合理
                    if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    MessageBox.Show("没有找到【产品代码】的标题", "提示");
                    return;
                }
                if (HProcNameCol == -1)
                {
                    MessageBox.Show("没有找到【工序】的标题", "提示");
                    return;
                }
                if (HWorkCenterNameCol == -1)
                {
                    MessageBox.Show("没有找到【工作中心】的标题", "提示");
                    return;
                }
                if (HWorkQtyCol == -1)
                {
                    MessageBox.Show("没有找到【加工数量】的标题", "提示");
                    return;
                }
                if (HBeginFixQtyCol == -1)
                {
                    MessageBox.Show("没有找到【开工余量】的标题", "提示");
                    return;
                }
                if (HBeginDayQtyCol == -1)
                {
                    MessageBox.Show("没有找到【开工固天】的标题", "提示");
                    return;
                }
                if (HFixPriceCol == -1)
                {
                    MessageBox.Show("没有找到【小时工资】的标题", "提示");
                    return;
                }
                if (HProcPriceCol == -1)
                {
                    MessageBox.Show("没有找到【单个工价】的标题", "提示");
                    return;
                }
                if (HProcNoCol == -1)
                {
                    MessageBox.Show("没有找到【工序序号】的标题", "提示");
                    return;
                }
                if (HTechnologyParameterCol == -1)
                {
                    MessageBox.Show("没有找到【工艺参数】的标题", "提示");
                    return;
                }
                if (HPicNumCol == -1)
                {
                    MessageBox.Show("没有找到【图纸编号】的标题", "提示");
                    return;
                }
                if (HProcCheckNoteCol == -1)
                {
                    MessageBox.Show("没有找到【本工序确认记录】的标题", "提示");
                    return;
                }
                if (HPicNumVerCol == -1)
                {
                    MessageBox.Show("没有找到【图号版本】的标题", "提示");
                    return;
                }
                if (HPicNumAssembleCol == -1)
                {
                    MessageBox.Show("没有找到【总装图号】的标题", "提示");
                    return;
                }
                if (HMaterTextureCol == -1)
                {
                    MessageBox.Show("没有找到【材质】的标题", "提示");
                    return;
                }
                if (HProductNumCol == -1)
                {
                    MessageBox.Show("没有找到【成品编号】的标题", "提示");
                    return;
                }
                if (HVerNumCol == -1)
                {
                    MessageBox.Show("没有找到【版本】的标题", "提示");
                    return;
                }
                if (HMouldNoCol == -1)
                {
                    MessageBox.Show("没有找到【模具编号】的标题", "提示");
                    return;
                }
                if (HProcWorkNumCol == -1)
                {
                    MessageBox.Show("没有找到【程序号】的标题", "提示");
                    return;
                }
                if (HPassRateCol == -1)
                {
                    MessageBox.Show("没有找到【良率】的标题", "提示");
                    return;
                }
                //
                if (!Checkdata())
                {
                    return;
                }
                if (grdMain.Rows.Count > 0)
                {
                    hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                    HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                    BillNew.omodel.HStandard = false;
                    BillNew.omodel.HMainTimeUnit = "Сʱ";
                    BillNew.omodel.HYear = 2011;
                    BillNew.omodel.HPeriod = 1;
                    BillNew.omodel.HBillNo = HBillNo;
                    BillNew.omodel.HDate = DateTime.Today.Date;
                    BillNew.omodel.HPicNumVer = "";
                    BillNew.omodel.HPicNumAssemble = "";
                    BillNew.omodel.HMaterTexture = "";
                    BillNew.omodel.HProductNum = "";
                    BillNew.omodel.HVerNum = "";
                    BillNew.DetailColl.Clear();
                }
                for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
                {
                    BillNew.omodel.HPicNumVer = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumVerCol].Value);
                    BillNew.omodel.HPicNumAssemble = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumAssembleCol].Value);
                    BillNew.omodel.HMaterTexture = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterTextureCol].Value);
                    BillNew.omodel.HProductNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProductNumCol].Value);
                    BillNew.omodel.HVerNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HVerNumCol].Value);
                    string sHNumber = "";
                    if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value) != "")
                    {
                        MessageBox.Show("物料代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
                        return;
                    }
                    if (hnumber == DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value))
                    {
                        //得到物料内码
                        if (oMaterHlp.GetInfoByNumber(sHNumber))
                        {
                            if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                            {
                                BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                            }
                        }
                        else
                        {
                            BillNew.omodel.HMaterID = 0;
                            MessageBox.Show("第" + i.ToString() + "行," + sHNumber + "没有找到对应的物料!");
                            return;
                        }
                        j++;
                        //写入类
                        WriteClass(i);
                    }
                    else
                    {
                        DataSet Ds;
                        ClsCN oCn=new ClsCN();
                        bool b = false;
                        // åˆ¤æ–­æ˜¯å¦å­˜åœ¨å·¥è‰ºè·¯çº¿
                        Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                        if (checkadd.Checked == true)
                        {
                            //if (Ds.Tables[0].Rows.Count == 0)//追加
                            //{
                                //新增前 å…ˆåˆ é™¤åŽŸæ¥å·¥è‰º
                                BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                                b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                                if (b == false) return;
                                c++;
                                BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                            //}
                            //else
                            //{
                            //}
                        }
                        else
                        {
                            BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                            b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                            if (b == false) return;
                            c++;
                            BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                        }
                        BillNew.DetailColl.Clear();
                        hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                        //
                        sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                        //审核代码是否合理
                        if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                        {
                            MessageBox.Show("物料代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
                            return;
                        }
                        //得到物料内码
                        if (oMaterHlp.GetInfoByNumber(sHNumber))
                        if (hnumber == DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value))
                        {
                            if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                            //得到物料内码
                            if (oMaterHlp.GetInfoByNumber(sHNumber))
                            {
                                BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                                if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                                {
                                    BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                    BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                    BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                    BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                                }
                            }
                            else
                            {
                                BillNew.omodel.HMaterID = 0;
                                MessageBox.Show("第" + i.ToString() + "行," + sHNumber + "没有找到对应的物料!");
                                return;
                            }
                            j++;
                            //写入类
                            WriteClass(i);
                        }
                        else
                        {
                            BillNew.omodel.HMaterID = 0;
                            MessageBox.Show("第" + i.ToString() + "行," + sHNumber + "没有找到对应的物料!");
                            return;
                            DataSet Ds;
                            ClsCN oCn = new ClsCN();
                            bool b = false;
                            // åˆ¤æ–­æ˜¯å¦å­˜åœ¨å·¥è‰ºè·¯çº¿
                            Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                            if (checkadd.Checked == true)
                            {
                                //if (Ds.Tables[0].Rows.Count == 0)//追加
                                //{
                                //新增前 å…ˆåˆ é™¤åŽŸæ¥å·¥è‰º
                                BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                                b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                                if (b == false)
                                {
                                    MessageBox.Show("第" + i.ToString() + "行,物料" + BillNew.omodel.HMaterNumber + "新增工艺路线失败!代码293行中,原因:" + ClsPub.sExeReturnInfo);
                                    return;
                                }
                                c++;
                                BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                                //}
                                //else
                                //{
                                //}
                            }
                            else
                            {
                                BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                                b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                                if (b == false)
                                {
                                    MessageBox.Show("第" + i.ToString() + "行,物料" + sHNumber + "新增工艺路线失败!代码310行中");
                                    return;
                                }
                                c++;
                                BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                            }
                            BillNew.DetailColl.Clear();
                            hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                            //审核代码是否合理
                            if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                            {
                                MessageBox.Show("物料代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
                                return;
                            }
                            //得到物料内码
                            if (oMaterHlp.GetInfoByNumber(sHNumber))
                            {
                                if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                                {
                                    BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                    BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                    BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                    BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                                }
                            }
                            else
                            {
                                BillNew.omodel.HMaterID = 0;
                                MessageBox.Show("第" + i.ToString() + "行," + sHNumber + "没有找到对应的物料!");
                                return;
                            }
                            j = 0;
                            HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                            BillNew.omodel.HBillNo = HBillNo;
                            //写入类
                            WriteClass(i);
                        }
                        j = 0;
                        HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                        BillNew.omodel.HBillNo = HBillNo;
                        //写入类
                        WriteClass(i);
                    }
                    else
                    {
                        MessageBox.Show("第" + i.ToString() + "行,没有找到对应的物料!");
                        return;
                    }
                }
                else
                //最后一个物料处理
                if (BillNew.DetailColl.Count > 0)
                {
                    MessageBox.Show("第" + i.ToString() + "行,没有找到对应的物料!");
                    return;
                }
            }
            //最后一个物料处理
            if (BillNew.DetailColl.Count > 0)
            {
                DataSet Ds;
                ClsCN oCn = new ClsCN();
                bool b = false;
                //Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                //if (Ds.Tables[0].Rows.Count == 0)
                //{
                    DataSet Ds;
                    ClsCN oCn = new ClsCN();
                    bool b = false;
                    //Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                    //if (Ds.Tables[0].Rows.Count == 0)
                    //{
                    BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                    b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                    if (b == false) return;
                    c++;
                    BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                //}
                MessageBox.Show("导入完毕:共"+c.ToString()+"个工艺路线");
                grdMain.DataSource = null;
                    //}
                    MessageBox.Show("导入完毕:共" + c.ToString() + "个工艺路线");
                    grdMain.DataSource = null;
                }
                c = 0;
            }
            c = 0;
            catch (Exception e)
            {
                MessageBox.Show("导入失败!原因:" + e.Message, "提示");
            }
        }
        //写入类 ä»ŽæŽ§ä»¶
        private bool WriteClass(int row)
        {
            string sHNumber = "";
            string sHNamePoc = "";
            string sHNamePoc = "";
            string sHNumberCen = "";
            Single sWorkQty = 0;
            Single sBeginDayQty = 0;
            Single sBeginFixQty = 0;
            Single sHPassRate = 0;
            //long HItemID = 0; 
            //
            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMaterNumberCol].Value);
            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMaterNumberCol].Value);
            sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HWorkCenterNameCol].Value);
            sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcNameCol].Value);
            sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HWorkQtyCol].Value);
            sBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginDayQtyCol].Value);
            sBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginFixQtyCol].Value);
            sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HPassRateCol].Value);
            //判断是否允许 ä¿å­˜
            Model.ClsGy_RoutingBillSub oSub=new Model.ClsGy_RoutingBillSub();
            Model.ClsGy_RoutingBillSub oSub = new Model.ClsGy_RoutingBillSub();
            //得到工序内码
            if (oProcHlp.GetInfoByName(sHNamePoc))
@@ -339,20 +423,21 @@
            oSub.HProcNo = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[HProcNoCol].Value);
            oSub.HUnitTime = 1;
            oSub.HWorkQty = sWorkQty;
            oSub.HPassRate = sHPassRate;
            oSub.HRemark = "";
            oSub.HTimeUnit = "Сʱ";
            oSub.HReadyTime = 0;
            oSub.HQueueTime = 0;
            oSub.HMoveTime = 0;
            //
            //
            oSub.HCloseMan = "";
            oSub.HCloseType = false;
            oSub.HSourceInterID = 0;
            oSub.HSourceEntryID = 0;
            oSub.HSourceBillType = "";
            oSub.HSourceBillNo ="";
            oSub.HSourceBillNo = "";
            oSub.HRelationQty = 0;
            oSub.HRelationMoney = 0;
@@ -366,6 +451,8 @@
            oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HTechnologyParameterCol].Value);
            oSub.HPicNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPicNumCol].Value);
            oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcCheckNoteCol].Value);
            oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMouldNoCol].Value);
            oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcWorkNumCol].Value);
            BillNew.DetailColl.Add(oSub);
            return true;
        }
@@ -373,22 +460,39 @@
        //检查物料
        private bool Checkdata()
        {
            bool b=false;
            bool b = false;
            string sErrMsg = "";
            string sMsg = "";
            for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
            {
                string sHNumber = "";
                string sHNamePoc = "";
                string sHNamePoc = "";
                string sHNumberCen = "";
                Single sWorkQty = 0;
                Single sHPassRate = 0;
                //
                sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkCenterNameCol].Value);
                sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNameCol].Value);
                if (sHNumber != "" )
                sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HWorkQtyCol].Value);
                sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
                if (sHNumber != "")
                {
                    // 
                    int index = i + 1;
                    //加工数量不能小于等于零
                    if (sWorkQty <= 0)
                    {
                        MessageBox.Show("第" + index + "行加工数量不能小于等于零!", "提示");
                        return false;
                    }
                    //良率不能小于等于零
                    if (sHPassRate <= 0)
                    {
                        MessageBox.Show("第" + index + "行良率不能小于等于零!", "提示");
                        return false;
                    }
                    //审核代码是否合理
                    if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    {
@@ -400,9 +504,9 @@
                    if (!oMaterHlp.GetInfoByNumber(sHNumber))
                    {
                        sMsg = "[" + sHNumber + "]物料不存在";
                        if (sErrMsg.Contains(sMsg)==false)
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumber + "]物料不存在\r\n" ;
                            sErrMsg = sErrMsg + "[" + sHNumber + "]物料不存在\r\n";
                        }
                        b = true;
                    }
@@ -429,7 +533,7 @@
                    }
                }
                }
            }
            if (b == true)
            {