/// <summary>
        /// 创建混样的检验批
        /// </summary>
        /// <param name="wrgg"></param>
        /// <returns></returns>
        public bool CreateWRGGProfile(ReceiveMIGODraf[] wrgs, ReceiveGeneral general, out string msg)
        {
            msg = string.Empty;
            try
            {
                Console.WriteLine("--MIGOReceive InsertRecieve()--" + DateTime.Now.ToString());
                #region Find VersionID base On Material
                DataTable dt = gate.DbHelper.ExecuteStoredProcedure("MMJY_GetVersionID",
                                                                    new string[] { "UserID", "LotNo", "SampleName" },
                                                                    new object[] { DB.User, general.LOT_NO, general.SampleName }).Tables[0];
                if (dt.Rows.Count < 0)
                {
                    return(false);
                }
                Console.WriteLine(dt.Rows.Count);
                msg = dt.Rows[0]["MSG"].ToString();
                Console.WriteLine(msg);
                if (!string.IsNullOrEmpty(msg))
                {
                    return(false);
                }

                string _VersionID = dt.Rows[0]["VersionID"].ToString();

                #endregion
                string _VoucherID = CreateVoucherID(general.SampleName, DateTime.Now);
                Console.WriteLine("VoucherID:" + _VoucherID);
                if (string.IsNullOrEmpty(_VoucherID))
                {
                    msg = "CreateVoucherID failed";
                    return(false);
                }

                Console.WriteLine("VoucherID:" + _VoucherID);
                if (string.IsNullOrEmpty(_VoucherID))
                {
                    msg = "CreateVoucherID failed";
                    return(false);
                }

                general.VoucherID    = _VoucherID;
                general.UserID       = DB.User;
                general.GradeVersion = _VersionID;
                //    general.SheetDate = DateTime.Now;
                // general.Grade = "";
                // general.State = "1";
                general.Stamp = DateTime.Now;
                Console.WriteLine(JsonConvert.SerializeObject(general));
                if (db.Save(general))
                {
                    int i = 0;
                    foreach (ReceiveMIGODraf wrg in wrgs)
                    {
                        ReceiveMIGODraf wrgg = new ReceiveMIGODraf();
                        wrgg.VoucherID  = wrg.VoucherID;
                        wrgg.RVoucherID = _VoucherID;
                        wrgg.UserId     = DB.User;
                        wrgg.Stamp      = System.DateTime.Now;

                        db.Save(wrgg);
                        i++;
                    }
                    if (i == wrgs.Length)
                    {
                        return(true);
                    }
                    else
                    {
                        msg = "Save  failed";
                        return(false);
                    }
                }
                else
                {
                    msg = "save ReceiveGeneral failed";
                    return(false);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
                throw new Exception(e.Message);
            }
        }
        void butReceive_Click(object sender, EventArgs e)
        {
            string[] strs = _SerchPlanView.dtSelectBarCodes4Query;
            rawFrm.SampleDes    = _SerchPlanView.SampleDes;
            rawFrm.SampleName   = _SerchPlanView.RSampleName;
            rawFrm.LotNO        = _SerchPlanView.RLotNO;
            rawFrm.GradeVersion = GetGradeVersion(rawFrm.LotNO, rawFrm.SampleName);

            #region Recive by Isaac 2018-11-29
            //Create by Isaac EBELN, EBELP, Quantity 2018-11-29
            rawFrm.Quantity   = _SerchPlanView.Quantity;
            rawFrm.EBELN      = _SerchPlanView.EBELN;
            rawFrm.EBELP      = _SerchPlanView.EBELP;
            rawFrm.GR_NO      = _SerchPlanView.GR_NO;
            rawFrm.ReceiveNum = _SerchPlanView.ReceiveNum;
            rawFrm.GR_Unit    = _SerchPlanView.GR_Unit;
            rawFrm.Vendor     = _SerchPlanView.Vendor;
            #endregion
            rawFrm.ShowDialog();
            if (rawFrm.RValue)
            {
                ReceiveGeneral general = new ReceiveGeneral();
                general.SampleName = rawFrm.SampleName;
                general.LOT_NO     = rawFrm.LotNO;
                #region Create By Isaac
                //Creat by IS 2018-11-29

                general.SampleQuantity = rawFrm.ReceiveNum;
                general.GradeVersion   = rawFrm.GradeVersion;
                general.GR_NO          = rawFrm.GR_NO;
                general.SheetDate      = rawFrm.SheetDate;
                general.GR_Unit        = rawFrm.GR_Unit;
                general.Vendor         = rawFrm.Vendor;
                general.Quatity        = rawFrm.Quantity;
                general.EBELN          = rawFrm.EBELN;
                general.EBELP          = rawFrm.EBELP;
                general.DateOfSample   = rawFrm.DateOfSample;
                #endregion
                general.State = "1";

                general.Grade = "";

                ReceiveMIGODraf[] drfs = new ReceiveMIGODraf[strs.Length];
                int i = 0;
                foreach (string str in strs)
                {
                    ReceiveMIGODraf draf = new ReceiveMIGODraf();
                    draf.VoucherID = str;

                    drfs[i] = draf;
                    i++;
                }
                string msg = string.Empty;
                if (!biz.CreateWRGGProfile(drfs, general, out msg))
                {
                    WriteTips(8, msg, false);
                }
                Query();
                rawFrm.ResetForm();
            }
        }