Beispiel #1
0
        public void sr_llenar_grid_detalle(ref DataGridView dgr, long tkt)
        {
            animalitos db     = new animalitos(CN.CONEC);
            int        IDSORT = func_CODSORTEO(tkt);

            var query = (from qrydetalleticket in db.dbdtickets
                         join qryanimal in db.dbanimalitos on qrydetalleticket.CODIGODTK equals qryanimal.CODIGO into AN
                         join qryestatus in db.dbestatus on qrydetalleticket.ESTATUSDTK equals qryestatus.CODESTATUS into CA
                         from ANX in AN.Where(x => x.CODIGO == qrydetalleticket.CODIGODTK).DefaultIfEmpty()
                         from CAX in CA.Where(b => b.CODESTATUS == qrydetalleticket.ESTATUSDTK).DefaultIfEmpty()

                         where qrydetalleticket.IDTICKETDTR == tkt && ANX.IDSORTEOAN == IDSORT

                         select new
            {
                qrydetalleticket.IDTICKETDTR,
                qrydetalleticket.CODIGODTK,
                ANX.NOMBRE_ANIMALITO,
                qrydetalleticket.MONTO,
                qrydetalleticket.PREMIO,
                CAX.NOMESTATUS
            }
                         ).ToList();


            dgr.DataSource = query;
        }
Beispiel #2
0
        public void AssignSPAToRow(int rowIndex, SPA <T> spa)
        {
            if (spa.Length != N)
            {
                throw new Exception("Incorrect SPA langth; impossible to assign to a matrix row");
            }

            int prevLength = IA[rowIndex + 1] - IA[rowIndex];

            if (IA[rowIndex] < AN.Count)
            {
                AN.RemoveRange(IA[rowIndex], prevLength);
                JA.RemoveRange(IA[rowIndex], prevLength);
            }

            AN.InsertRange(IA[rowIndex], spa.Data);
            JA.InsertRange(IA[rowIndex], spa.Indices);

            int diff = prevLength - spa.RealLength;

            if (diff != 0)
            {
                for (int i = rowIndex + 1; i < IA.Length; i++)
                {
                    IA[i] -= diff;
                }
            }
        }
Beispiel #3
0
        private static void LoadReferencedAssemblies(SortedDictionary <string, Assembly> LoadedAssembliesByName,
                                                     SortedDictionary <string, Assembly> LoadedAssembliesByLocation,
                                                     SortedDictionary <string, AssemblyName> ReferencedAssemblies)
        {
            do
            {
                AssemblyName[] References = new AssemblyName[ReferencedAssemblies.Count];
                ReferencedAssemblies.Values.CopyTo(References, 0);
                ReferencedAssemblies.Clear();

                foreach (AssemblyName AN in References)
                {
                    if (LoadedAssembliesByName.ContainsKey(AN.FullName))
                    {
                        continue;
                    }

                    try
                    {
                        Assembly A = AppDomain.CurrentDomain.Load(AN);
                        LoadedAssembliesByName[A.FullName]     = A;
                        LoadedAssembliesByLocation[A.Location] = A;

                        try
                        {
                            foreach (AssemblyName AN2 in A.GetReferencedAssemblies())
                            {
                                ReferencedAssemblies[AN2.FullName] = AN2;
                            }
                        }
                        catch (Exception)
                        {
                            // Referenced assemblies might not be accessible.
                        }
                    }
                    catch (BadImageFormatException ex)
                    {
                        LogException(ex);
                    }
                    catch (Exception)
                    {
                        string s = AN.ToString();

                        if (s.StartsWith("System.") ||
                            s.StartsWith("Microsoft.") ||
                            s.StartsWith("Windows.") ||
                            s.StartsWith("SQLitePCLRaw.") ||
                            s.StartsWith("SkiaSharp") ||
                            s.StartsWith("Gma.QrCodeNet.Encoding") ||
                            s.StartsWith("Esent.Interop"))
                        {
                            continue;
                        }

                        Log.Error("Unable to load assembly " + s + ".", AN.FullName);
                    }
                }
            }while (ReferencedAssemblies.Count > 0);
        }
Beispiel #4
0
        /// <summary>
        /// 修改AN的制图参数
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public int EditModel(IModel models)
        {
            AN objModel = (AN)models;
            //编写带参数的SQL语句
            StringBuilder sqlBuilder = new StringBuilder();

            sqlBuilder.Append("Update AN set Length=@Length,Width=@Width,ANSUL=@ANSUL,ANYDis=@ANYDis,ANDropNo=@ANDropNo,ANDropDis1=@ANDropDis1,ANDropDis2=@ANDropDis2,ANDropDis3=@ANDropDis3,ANDropDis4=@ANDropDis4,ANDropDis5=@ANDropDis5,");
            sqlBuilder.Append("ANDetectorNo=@ANDetectorNo,ANDetectorEnd=@ANDetectorEnd,ANDetectorDis1=@ANDetectorDis1,ANDetectorDis2=@ANDetectorDis2,ANDetectorDis3=@ANDetectorDis3,ANDetectorDis4=@ANDetectorDis4,ANDetectorDis5=@ANDetectorDis5,");
            sqlBuilder.Append("MARVEL=@MARVEL,IRNo=@IRNo,IRDis1=@IRDis1,IRDis2=@IRDis2,IRDis3=@IRDis3 where ANId=@ANId");
            //定义参数数组
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@Length", objModel.Length),
                new SqlParameter("@Width", objModel.Width),
                new SqlParameter("@ANSUL", objModel.ANSUL),
                new SqlParameter("@ANYDis", objModel.ANYDis),
                new SqlParameter("@ANDropNo", objModel.ANDropNo),
                new SqlParameter("@ANDropDis1", objModel.ANDropDis1),
                new SqlParameter("@ANDropDis2", objModel.ANDropDis2),
                new SqlParameter("@ANDropDis3", objModel.ANDropDis3),
                new SqlParameter("@ANDropDis4", objModel.ANDropDis4),
                new SqlParameter("@ANDropDis5", objModel.ANDropDis5),
                new SqlParameter("@ANDetectorNo", objModel.ANDetectorNo),
                new SqlParameter("@ANDetectorEnd", objModel.ANDetectorEnd),
                new SqlParameter("@ANDetectorDis1", objModel.ANDetectorDis1),
                new SqlParameter("@ANDetectorDis2", objModel.ANDetectorDis2),
                new SqlParameter("@ANDetectorDis3", objModel.ANDetectorDis3),
                new SqlParameter("@ANDetectorDis4", objModel.ANDetectorDis4),
                new SqlParameter("@ANDetectorDis5", objModel.ANDetectorDis5),
                new SqlParameter("@MARVEL", objModel.MARVEL),
                new SqlParameter("@IRNo", objModel.IRNo),
                new SqlParameter("@IRDis1", objModel.IRDis1),
                new SqlParameter("@IRDis2", objModel.IRDis2),
                new SqlParameter("@IRDis3", objModel.IRDis3),
                new SqlParameter("@ANId", objModel.ANId)
            };
            try
            {
                return(SQLHelper.Update(sqlBuilder.ToString(), param));
            }
            catch (SqlException ex)
            {
                throw new Exception("数据库操作出现异常:" + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        public FrmAN(Drawing drawing, ModuleTree tree) : this()
        {
            objAN = (AN)objANService.GetModelByModuleTreeId(tree.ModuleTreeId.ToString());
            if (objAN == null)
            {
                return;
            }
            this.Text = drawing.ODPNo + " / Item: " + drawing.Item + " / Module: " + tree.Module + " - " + tree.CategoryName;
            Category objCategory = objCategoryService.GetCategoryByCategoryId(tree.CategoryId.ToString());

            pbModelImage.Image = objCategory.ModelImage.Length == 0
                ? Image.FromFile("NoPic.png")
                : (Image) new SerializeObjectToString().DeserializeObject(objCategory.ModelImage);
            FillData();
        }
Beispiel #6
0
        public void SetElem(long lineNumber, int colNumber, int index, T elem)
        {
            if (index < 0)
            {
                throw new System.IndexOutOfRangeException(
                          (lineNumber.ToString() + ", " + colNumber.ToString() + " OutOfRange exception: illegal index"));
            }
            if (index >= N)
            {
                throw new System.IndexOutOfRangeException(
                          (lineNumber.ToString() + ", " + colNumber.ToString() + " OutOfRange exception: illegal index"));
            }

            int i = JA.IndexOf(index);

            if (i != -1)
            {
                if (!isZero(elem))
                {
                    AN[i] = elem;
                }
                else
                {
                    for (int j = i; j < curCountOfElems - 1; j++)
                    {
                        AN[j] = AN[j + 1];
                        JA[j] = JA[j + 1];
                    }
                    JA[--curCountOfElems] = -1;
                }
            }
            else
            {
                if (!isZero(elem))
                {
                    if (curCountOfElems == AN.Count)
                    {
                        AN.Add(elem);
                        JA.Add(-1);
                    }

                    AN[curCountOfElems] = elem;
                    JA[curCountOfElems] = index;
                    curCountOfElems++;
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 根据条件查找AN
        /// </summary>
        /// <param name="whereSql"></param>
        /// <returns></returns>
        public IModel GetModelByWhereSql(string whereSql)
        {
            string sql =
                "select ANId,ModuleTreeId,Length,Width,ANSUL,ANYDis,ANDropNo,ANDropDis1,ANDropDis2,ANDropDis3,ANDropDis4,ANDropDis5," +
                "ANDetectorNo,ANDetectorEnd,ANDetectorDis1,ANDetectorDis2,ANDetectorDis3,ANDetectorDis4,ANDetectorDis5," +
                "MARVEL,IRNo,IRDis1,IRDis2,IRDis3 from AN";

            sql += whereSql;
            SqlDataReader objReader = SQLHelper.GetReader(sql);
            AN            objModel  = null;

            if (objReader.Read())
            {
                objModel = new AN()
                {
                    ANId         = Convert.ToInt32(objReader["ANId"]),
                    ModuleTreeId = Convert.ToInt32(objReader["ModuleTreeId"]),
                    //最好不要用=null去判断,提示类型转换错误
                    Length         = objReader["Length"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["Length"]),
                    Width          = objReader["Width"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["Width"]),
                    ANSUL          = objReader["ANSUL"].ToString().Length == 0 ? "" : objReader["ANSUL"].ToString(),
                    ANYDis         = objReader["ANYDis"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANYDis"]),
                    ANDropNo       = objReader["ANDropNo"].ToString().Length == 0 ? 0 : Convert.ToInt32(objReader["ANDropNo"]),
                    ANDropDis1     = objReader["ANDropDis1"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDropDis1"]),
                    ANDropDis2     = objReader["ANDropDis2"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDropDis2"]),
                    ANDropDis3     = objReader["ANDropDis3"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDropDis3"]),
                    ANDropDis4     = objReader["ANDropDis4"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDropDis4"]),
                    ANDropDis5     = objReader["ANDropDis5"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDropDis5"]),
                    ANDetectorNo   = objReader["ANDetectorNo"].ToString().Length == 0 ? 0 : Convert.ToInt32(objReader["ANDetectorNo"]),
                    ANDetectorEnd  = objReader["ANDetectorEnd"].ToString().Length == 0 ? "" : objReader["ANDetectorEnd"].ToString(),
                    ANDetectorDis1 = objReader["ANDetectorDis1"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDetectorDis1"]),
                    ANDetectorDis2 = objReader["ANDetectorDis2"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDetectorDis2"]),
                    ANDetectorDis3 = objReader["ANDetectorDis3"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDetectorDis3"]),
                    ANDetectorDis4 = objReader["ANDetectorDis4"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDetectorDis4"]),
                    ANDetectorDis5 = objReader["ANDetectorDis5"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["ANDetectorDis5"]),

                    MARVEL = objReader["MARVEL"].ToString().Length == 0 ? "" : objReader["MARVEL"].ToString(),
                    IRNo   = objReader["IRNo"].ToString().Length == 0 ? 0 : Convert.ToInt32(objReader["IRNo"]),
                    IRDis1 = objReader["IRDis1"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["IRDis1"]),
                    IRDis2 = objReader["IRDis2"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["IRDis2"]),
                    IRDis3 = objReader["IRDis3"].ToString().Length == 0 ? 0 : Convert.ToDecimal(objReader["IRDis3"])
                };
            }
            objReader.Close();
            return(objModel);
        }
Beispiel #8
0
        private void Total()
        {
            decimal AN, R, D, CE, PPC, Otro;

            AN = R = D = CE = PPC = Otro = decimal.Zero;

            foreach (var item in dgvDatos.Rows)
            {
                if (!item.IsFilteredOut)
                {
                    if (item.Cells["C"].Value.ToString().Equals("Artículo nuevo"))
                    {
                        AN += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Remate"))
                    {
                        R += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Devolución"))
                    {
                        D += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Compra especial"))
                    {
                        CE += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("PPC"))
                    {
                        PPC += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else
                    {
                        Otro += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                }
            }

            txtAN.Text         = AN.ToString("C0");
            txtRemate.Text     = R.ToString("C0");
            txtDevolucion.Text = D.ToString("C0");
            txtCE.Text         = CE.ToString("C0");
            txtPPC.Text        = PPC.ToString("C0");
            txtOtros.Text      = Otro.ToString("C0");
        }
Beispiel #9
0
        /// <summary>
        /// Initializes the inventory engine, registering types and interfaces available in <paramref name="Assemblies"/>.
        /// </summary>
        /// <param name="Folder">Name of folder containing assemblies to load, if they are not already loaded.</param>
        private static void Initialize()
        {
            string Folder = Path.GetDirectoryName(typeof(App).GetTypeInfo().Assembly.Location);

            string[] DllFiles = Directory.GetFiles(Folder, "*.dll", SearchOption.TopDirectoryOnly);
            Dictionary <string, Assembly>     LoadedAssemblies     = new Dictionary <string, Assembly>(StringComparer.CurrentCultureIgnoreCase);
            Dictionary <string, AssemblyName> ReferencedAssemblies = new Dictionary <string, AssemblyName>(StringComparer.CurrentCultureIgnoreCase);

            foreach (string DllFile in DllFiles)
            {
                try
                {
                    Assembly A = Assembly.LoadFile(DllFile);
                    LoadedAssemblies[A.GetName().FullName] = A;

                    foreach (AssemblyName AN in A.GetReferencedAssemblies())
                    {
                        ReferencedAssemblies[AN.FullName] = AN;
                    }
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            do
            {
                AssemblyName[] References = new AssemblyName[ReferencedAssemblies.Count];
                ReferencedAssemblies.Values.CopyTo(References, 0);
                ReferencedAssemblies.Clear();

                foreach (AssemblyName AN in References)
                {
                    if (LoadedAssemblies.ContainsKey(AN.FullName))
                    {
                        continue;
                    }

                    try
                    {
                        Assembly A = Assembly.Load(AN);
                        LoadedAssemblies[A.GetName().FullName] = A;

                        foreach (AssemblyName AN2 in A.GetReferencedAssemblies())
                        {
                            ReferencedAssemblies[AN2.FullName] = AN2;
                        }
                    }
                    catch (Exception)
                    {
                        Log.Error("Unable to load assembly " + AN.ToString() + ".");
                    }
                }
            }while (ReferencedAssemblies.Count > 0);

            Assembly[] Assemblies = new Assembly[LoadedAssemblies.Count];
            LoadedAssemblies.Values.CopyTo(Assemblies, 0);

            Types.Initialize(Assemblies);
        }
Beispiel #10
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            string AC, AN;
            AN = AC = "";

            if (DdlCRDR.SelectedValue == "1")
            {
                if (txtLoanBrCode.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Select branch first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
            }

            if (DdlCRDR.SelectedValue == "0")
            {
                lblMessage.Text = "Select transaction type...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (ddlPMTMode.SelectedValue == "0")
            {
                lblMessage.Text = "Select payment mode first...!!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (ddlPMTMode.SelectedValue == "7")
            {
                if (TxtPtype.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Enter product type first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }

                if (TxtAccNo.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Enter account number first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
            }

            if (TxtNarration.Text.Trim().ToString() == "")
            {
                lblMessage.Text = "Enter narration first...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (Convert.ToDouble(TxtAmount.Text.Trim().ToString() == "" ? "0" : TxtAmount.Text.Trim().ToString()) <= 0.00)
            {
                lblMessage.Text = "Enter proper amount First...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            //If Account Number is blank Then Set Acc No and Cust No to Zero
            string YN = CC.GetIntACCYN(ViewState["LoanBrCode"].ToString(), TxtPtype.Text);
            if (Convert.ToInt32(ViewState["GlCode"].ToString() == "" ? "0" : ViewState["GlCode"].ToString()) >= 100 && YN != "Y")
            {
                AC = "0";
                AN = TxtPname.Text.ToString();
            }
            else
            {
                AC = TxtAccNo.Text.Trim().ToString();
                AN = TxtCustName.Text.ToString();
            }

            //Check Amount is grater than zero or not
            if (Convert.ToDouble(TxtAmount.Text.Trim().ToString() == "" ? "0" : TxtAmount.Text.Trim().ToString()) > 0.00)
            {
                if (txtLoanBrCode.Text.Trim().ToString() == "")
                {
                    ResBrCode = Session["BRCD"].ToString();
                }
                else
                {
                    ResBrCode = txtLoanBrCode.Text.Trim().ToString();
                }

                //Insert Data into Temporary Table (Avs_TempMultiTransfer) in Database here
                if (ddlPMTMode.SelectedValue == "0")
                {
                    ddlPMTMode.Focus();

                    lblMessage.Text = "Select payment mode first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
                else if (ddlPMTMode.SelectedValue == "3")
                {
                    resultout = MV.InsertIntoTable(Session["BRCD"].ToString(), Session["BRCD"].ToString(), Session["BRCD"].ToString(), ResBrCode.ToString(), txtCustNo.Text.Trim().ToString() == "" ? "0" : txtCustNo.Text.Trim().ToString(), "99", "99", "0", "", TxtAmount.Text.Trim().ToString(), DdlCRDR.SelectedValue == "1" ? "1" : "2", "3", "CR", "99/0", TxtNarration.Text.ToString(), "0", "1900-01-01", Session["EntryDate"].ToString(), Session["MID"].ToString());
                }
                else if (ddlPMTMode.SelectedValue == "7")
                {
                    resultout = MV.InsertIntoTable(Session["BRCD"].ToString(), Session["BRCD"].ToString(), Session["BRCD"].ToString(), ResBrCode.ToString(), txtCustNo.Text.Trim().ToString() == "" ? "0" : txtCustNo.Text.Trim().ToString(), ViewState["GlCode"].ToString(), TxtPtype.Text.Trim().ToString(), AC.Trim().ToString(), AN.ToString(), TxtAmount.Text.Trim().ToString(), DdlCRDR.SelectedValue == "1" ? "1" : "2", "7", "TR", TxtPtype.Text.Trim().ToString() + "/" + AC.Trim().ToString() + " - " + AN.ToString() + "", TxtNarration.Text.ToString(), "0", "1900-01-01", Session["EntryDate"].ToString(), Session["MID"].ToString());
                }

                if (resultout > 0)
                {
                    ddlPMTMode.Enabled = false;
                    lblMessage.Text    = "Successfully Added...!!";
                    ModalPopup.Show(this.Page);
                }
            }
            else
            {
                lblMessage.Text = "Enter Amount First...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (resultout > 0)
            {
                DivBranch.Visible         = false;
                DdlCRDR.SelectedValue     = "0";
                ddlActivity.SelectedValue = "0";
                Getinfo();
                BindTransGrid();
                ClearText();
                DdlCRDR.Focus();
                return;
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Beispiel #11
0
        public void SetElem(long lineNumber, int colNumber, int index1, int index2, T elem)
        {
            if ((index1 < 0) || (index2 < 0))
            {
                throw new System.IndexOutOfRangeException(
                          (lineNumber.ToString() + ", " + colNumber.ToString() + " OutOfRange exception: illegal index"));
            }
            if ((index1 >= M) || (index2 >= N))
            {
                throw new System.IndexOutOfRangeException(
                          (lineNumber.ToString() + ", " + colNumber.ToString() + " OutOfRange exception: illegal index"));
            }

            int j;

            for (j = IA[index1]; j < IA[index1 + 1]; j++)
            {
                if (JA[j] == index2)
                {
                    break;
                }
            }
            if (j < IA[index1 + 1])
            {
                if (!isZero(elem))
                {
                    AN[j] = elem;
                }
                else
                {
                    for (int k = j; k < curCountOfElems - 1; k++)
                    {
                        AN[k] = AN[k + 1];
                        JA[k] = JA[k + 1];
                    }
                    JA[--curCountOfElems] = -1;
                    for (int k = index1; k < IA.Length; k++)
                    {
                        IA[k] -= 1;
                    }
                    IA[0] = 0;
                }
            }
            else
            {
                if (!isZero(elem))
                {
                    if (curCountOfElems == AN.Count)
                    {
                        AN.Add(elem);
                        JA.Add(-1);
                    }

                    for (int k = index1 + 1; k < IA.Length; k++)
                    {
                        IA[k] += 1;
                    }
                    for (int k = curCountOfElems - 1; k >= IA[index1 + 1] - 1; k--)
                    {
                        AN[k + 1] = AN[k];
                        JA[k + 1] = JA[k];
                    }
                    AN[IA[index1 + 1] - 1] = elem;
                    JA[IA[index1 + 1] - 1] = index2;
                    curCountOfElems++;
                }
            }
        }
Beispiel #12
0
        public void AutoDrawing(SldWorks swApp, ModuleTree tree, string projectPath)
        {
            //创建项目模型存放地址
            string itemPath = projectPath + @"\" + tree.Module + "-" + tree.CategoryName;

            if (!Directory.Exists(itemPath))
            {
                Directory.CreateDirectory(itemPath);
            }
            else
            {
                DialogResult result =
                    MessageBox.Show("模型文件夹" + itemPath + "存在,如果之前pack已经执行过,将不执行pack过程而是直接修改模型,如果要继续请点击YES,否请点击No中断作图", "提示信息",
                                    MessageBoxButtons.YesNo);
                if (result == DialogResult.No)
                {
                    return;
                }
            }
            //Pack的后缀
            string suffix = tree.Module + "-" + tree.ODPNo.Substring(tree.ODPNo.Length - 6);
            //判断文件是否存在,如果存在将不执行pack,如果不存在则执行pack
            //packango后需要接收打包完成的地址,参数为后缀
            string packedAssyPath = itemPath + @"\" + tree.CategoryName.ToLower() + "_" + suffix + ".sldasm";

            if (!File.Exists(packedAssyPath))
            {
                packedAssyPath = CommonFunc.PackAndGoFunc(suffix, swApp, tree.ModelPath, itemPath);
            }

            //查询参数
            AN item = (AN)objANService.GetModelByModuleTreeId(tree.ModuleTreeId.ToString());

            swApp.CommandInProgress = true; //告诉SolidWorks,现在是用外部程序调用命令
            int warnings = 0;
            int errors   = 0;

            suffix = "_" + suffix;//后缀
            ModelDoc2         swModel = default(ModelDoc2);
            ModelDoc2         swPart  = default(ModelDoc2);
            AssemblyDoc       swAssy  = default(AssemblyDoc);
            Component2        swComp;
            Feature           swFeat        = default(Feature);
            object            configNames   = null;
            ModelDocExtension swModelDocExt = default(ModelDocExtension);
            bool   status     = false;
            string compReName = string.Empty;

            //打开Pack后的模型
            swModel = swApp.OpenDoc6(packedAssyPath, (int)swDocumentTypes_e.swDocASSEMBLY,
                                     (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings) as ModelDoc2;
            swAssy = swModel as AssemblyDoc;                                                  //装配体
            string assyName = swModel.GetTitle().Substring(0, swModel.GetTitle().Length - 7); //获取装配体名称

            swModelDocExt = (ModelDocExtension)swModel.Extension;
            //打开装配体后必须重建,使Pack后的零件名都更新到带后缀的状态,否则程序出错
            swModel.ForceRebuild3(true);
            //TopOnly参数设置成true,只重建顶层,不重建零件内部

            /*注意SolidWorks单位是m,计算是应当/1000m
             * 整形与整形运算得出的结果仍然时整形,1640 / 1000m结果为0,因此必须将其中一个转化成decimal型,使用后缀m就可以了
             * (int)不进行四舍五入,Convert.ToInt32会四舍五入
             */
            //-----------计算中间值,----------

            try
            {
                //----------Top Level----------

                //----------IR保护支架----------
                if (item.MARVEL == "NO")
                {
                    swFeat = swAssy.FeatureByName("LocalLPattern1");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swFeat = swAssy.FeatureByName("LocalLPattern2");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swComp = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCB0001-1"));
                    swComp.SetSuppression2(0);                 //2解压缩,0压缩.
                }
                else
                {
                    swComp = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCB0001-1"));
                    if (item.IRNo > 0)
                    {
                        swComp.SetSuppression2(2);                //2解压缩,0压缩.
                    }
                    else
                    {
                        swComp.SetSuppression2(0);  //2解压缩,0压缩.
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern1");
                    if (item.IRNo > 1)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern1").SystemValue = item.IRDis2 / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern2");
                    if (item.IRNo > 2)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern2").SystemValue = (item.IRDis2 + item.IRDis3) / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                }
                //----------ANSUL探测器盒子----------
                if (item.ANSUL == "NO")
                {
                    swFeat = swAssy.FeatureByName("LocalLPattern3");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swFeat = swAssy.FeatureByName("LocalLPattern4");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swFeat = swAssy.FeatureByName("LocalLPattern5");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swFeat = swAssy.FeatureByName("LocalLPattern6");
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    swComp = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "5201990405-1"));
                    swComp.SetSuppression2(0);                 //2解压缩,0压缩.
                }
                else
                {
                    swComp = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "5201990405-1"));
                    if (item.ANDetectorNo > 0)
                    {
                        swComp.SetSuppression2(2);                        //2解压缩,0压缩.
                    }
                    else
                    {
                        swComp.SetSuppression2(0);  //2解压缩,0压缩.
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern3");
                    if (item.ANDetectorNo > 1)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern3").SystemValue = item.ANDetectorDis2 / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern4");
                    if (item.ANDetectorNo > 2)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern4").SystemValue = (item.ANDetectorDis2 + item.ANDetectorDis3) / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern5");
                    if (item.ANDetectorNo > 2)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern5").SystemValue = (item.ANDetectorDis2 + item.ANDetectorDis3 + item.ANDetectorDis4) / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                    swFeat = swAssy.FeatureByName("LocalLPattern6");
                    if (item.ANDetectorNo > 2)
                    {
                        swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                        swModel.Parameter("D3@LocalLPattern6").SystemValue = (item.ANDetectorDis2 + item.ANDetectorDis3 + item.ANDetectorDis4 + item.ANDetectorDis5) / 1000m;
                    }
                    else
                    {
                        swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                    }
                }
                //----------ANSUL腔体----------
                //重命名装配体内部
                compReName = "FNCE0025[AN-" + tree.Module + "]{" + (int)item.Length + "}(" + (int)item.Width + ")";
                status     = swModelDocExt.SelectByID2(CommonFunc.AddSuffix(suffix, "FNCE0025-1") + "@" + assyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                if (status)
                {
                    swModelDocExt.RenameDocument(compReName);
                }
                swModel.ClearSelection2(true);
                status = swModelDocExt.SelectByID2(compReName + "-1" + "@" + assyName, "COMPONENT", 0, 0, 0, false, 0, null, 0);
                swModel.ClearSelection2(true);
                if (status)
                {
                    swComp = swAssy.GetComponentByName(compReName + "-1");
                    swPart = swComp.GetModelDoc2(); //打开零件
                    swPart.Parameter("D2@Base-Flange1").SystemValue = item.Length / 1000m;
                    swPart.Parameter("D1@Sketch1").SystemValue      = item.Width / 1000m;
                    if (item.ANSUL == "NO")
                    {
                        swFeat = swComp.FeatureByName("AN1");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("AN2");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("AN3");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("AN4");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("AN5");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩

                        swFeat = swComp.FeatureByName("ANDTEC1");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("ANDTEC2");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("ANDTEC3");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("ANDTEC4");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("ANDTEC5");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("AN1");
                        if (item.ANDropNo > 0)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D1@Sketch7").SystemValue = item.ANYDis / 1000m;
                            swPart.Parameter("D2@Sketch7").SystemValue = item.ANDropDis1 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("AN2");
                        if (item.ANDropNo > 1)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D2@Sketch9").SystemValue = item.ANDropDis2 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("AN3");
                        if (item.ANDropNo > 2)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D2@Sketch10").SystemValue = item.ANDropDis3 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        if (item.ANDropNo > 3)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D2@Sketch11").SystemValue = item.ANDropDis4 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        if (item.ANDropNo > 4)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D2@Sketch12").SystemValue = item.ANDropDis5 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("ANDTEC1");
                        if (item.ANDetectorNo > 0)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D3@Sketch13").SystemValue = item.ANDetectorDis1 / 1000m;
                            if (item.ANDetectorEnd == "RIGHT")
                            {
                                swPart.Parameter("D1@Sketch13").SystemValue = 195m / 1000m;
                            }
                            else
                            {
                                swPart.Parameter("D1@Sketch13").SystemValue = 175m / 1000m;
                            }
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("ANDTEC2");
                        if (item.ANDetectorNo > 1)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D3@Sketch14").SystemValue = item.ANDetectorDis2 / 1000m;
                            if (item.ANDetectorEnd == "RIGHT")
                            {
                                swPart.Parameter("D1@Sketch14").SystemValue = 195m / 1000m;
                            }
                            else
                            {
                                swPart.Parameter("D1@Sketch14").SystemValue = 175m / 1000m;
                            }
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("ANDTEC3");
                        if (item.ANDetectorNo > 2)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D3@Sketch15").SystemValue = item.ANDetectorDis3 / 1000m;
                            if (item.ANDetectorEnd == "RIGHT")
                            {
                                swPart.Parameter("D1@Sketch15").SystemValue = 195m / 1000m;
                            }
                            else
                            {
                                swPart.Parameter("D1@Sketch15").SystemValue = 175m / 1000m;
                            }
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("ANDTEC4");
                        if (item.ANDetectorNo > 3)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D3@Sketch16").SystemValue = item.ANDetectorDis4 / 1000m;
                            if (item.ANDetectorEnd == "RIGHT")
                            {
                                swPart.Parameter("D1@Sketch16").SystemValue = 195m / 1000m;
                            }
                            else
                            {
                                swPart.Parameter("D1@Sketch16").SystemValue = 175m / 1000m;
                            }
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("ANDTEC5");
                        if (item.ANDetectorNo > 4)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D3@Sketch17").SystemValue = item.ANDetectorDis5 / 1000m;
                            if (item.ANDetectorEnd == "RIGHT")
                            {
                                swPart.Parameter("D1@Sketch17").SystemValue = 195m / 1000m;
                            }
                            else
                            {
                                swPart.Parameter("D1@Sketch17").SystemValue = 175m / 1000m;
                            }
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                    }
                    if (item.MARVEL == "NO")
                    {
                        swFeat = swComp.FeatureByName("MA1");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("MA2");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                        swFeat = swComp.FeatureByName("MA3");
                        swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                    }
                    else
                    {
                        swFeat = swComp.FeatureByName("MA1");
                        if (item.IRNo > 0)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D2@Sketch18").SystemValue = item.ANYDis / 1000m;
                            swPart.Parameter("D1@Sketch18").SystemValue = item.IRDis1 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("MA2");
                        if (item.IRNo > 1)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D1@Sketch19").SystemValue = item.IRDis2 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                        swFeat = swComp.FeatureByName("MA3");
                        if (item.IRNo > 2)
                        {
                            swFeat.SetSuppression2(1, 2, configNames); //参数1:1解压,0压缩
                            swPart.Parameter("D1@Sketch20").SystemValue = item.IRDis3 / 1000m;
                        }
                        else
                        {
                            swFeat.SetSuppression2(0, 2, configNames);  //参数1:1解压,0压缩
                        }
                    }
                }
                //----------ANSUL腔侧板----------
                swComp = swAssy.GetComponentByName(CommonFunc.AddSuffix(suffix, "FNCE0001-1"));
                swPart = swComp.GetModelDoc2(); //打开零件
                swPart.Parameter("D2@Sketch2").SystemValue = (item.Width - 2m) / 1000m;
                swFeat = swComp.FeatureByName("ANDTEC HOLE");
                if (item.ANSUL == "YES" && item.ANDetectorNo > 0)
                {
                    swFeat.SetSuppression2(1, 2, configNames);                                               //参数1:1解压,0压缩
                }
                else
                {
                    swFeat.SetSuppression2(0, 2, configNames); //参数1:1解压,0压缩
                }
                swModel.ForceRebuild3(true);                   //设置成true,直接更新顶层,速度很快,设置成false,每个零件都会更新,很慢
                swModel.Save();                                //保存,很耗时间
                swApp.CloseDoc(packedAssyPath);                //关闭,很快
            }
            catch (Exception ex)
            {
                throw new Exception(packedAssyPath + "作图过程发生异常,详细:" + ex.Message);
            }
            finally
            {
                swApp.CommandInProgress = false; //及时关闭外部命令调用,否则影响SolidWorks的使用
            }
        }
Beispiel #13
0
        /// <summary>
        /// 修改参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditData_Click(object sender, EventArgs e)
        {
            #region 数据验证
            //必填项目
            if (pbModelImage.Tag.ToString().Length == 0)
            {
                return;
            }
            if (!DataValidate.IsDecimal(txtLength.Text.Trim()) || Convert.ToDecimal(txtLength.Text.Trim()) < 100m)
            {
                MessageBox.Show("请认真检查ANSUL腔长度", "提示信息");
                txtLength.Focus();
                txtLength.SelectAll();
                return;
            }
            if (!DataValidate.IsDecimal(txtWidth.Text.Trim()) || Convert.ToDecimal(txtWidth.Text.Trim()) < 30m)
            {
                MessageBox.Show("请认真检查ANSUL腔宽度", "提示信息");
                txtWidth.Focus();
                txtWidth.SelectAll();
                return;
            }

            if (cobANSUL.SelectedIndex == -1)
            {
                MessageBox.Show("是否带ANSUL", "提示信息");
                cobANSUL.Focus();
                return;
            }
            if (cobMARVEL.SelectedIndex == -1)
            {
                MessageBox.Show("是否带MARVEL", "提示信息");
                cobMARVEL.Focus();
                return;
            }

            if (cobANSUL.SelectedIndex == 0)
            {
                if (cobANDetectorEnd.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择ANSUL末端探测器位置", "提示信息");
                    cobANDetectorEnd.Focus();
                    return;
                }
                if (cobANDropNo.SelectedIndex == -1)
                {
                    MessageBox.Show("请检查下喷数量", "提示信息");
                    cobANDropNo.Focus();
                    return;
                }
                if (cobANDropNo.SelectedIndex > 0)
                {
                    if (!DataValidate.IsDecimal(txtANYDis.Text.Trim()) || Convert.ToDecimal(txtANYDis.Text.Trim()) < 10m)
                    {
                        MessageBox.Show("请检查ANSUL下喷距离天花排风腔前端距离", "提示信息");
                        txtANYDis.Focus();
                        txtANYDis.SelectAll();
                        return;
                    }
                    if (!DataValidate.IsDecimal(txtANDropDis1.Text.Trim()) || Convert.ToDecimal(txtANDropDis1.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查下喷间距1", "提示信息");
                        txtANDropDis1.Focus();
                        txtANDropDis1.SelectAll();
                        return;
                    }
                }
                if (cobANDropNo.SelectedIndex > 1)
                {
                    if (!DataValidate.IsDecimal(txtANDropDis2.Text.Trim()) || Convert.ToDecimal(txtANDropDis2.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查下喷间距2", "提示信息");
                        txtANDropDis2.Focus();
                        txtANDropDis2.SelectAll();
                        return;
                    }
                }
                if (cobANDropNo.SelectedIndex > 2)
                {
                    if (!DataValidate.IsDecimal(txtANDropDis3.Text.Trim()) || Convert.ToDecimal(txtANDropDis3.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查下喷间距3", "提示信息");
                        txtANDropDis3.Focus();
                        txtANDropDis3.SelectAll();
                        return;
                    }
                }
                if (cobANDropNo.SelectedIndex > 3)
                {
                    if (!DataValidate.IsDecimal(txtANDropDis4.Text.Trim()) || Convert.ToDecimal(txtANDropDis4.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查下喷间距4", "提示信息");
                        txtANDropDis4.Focus();
                        txtANDropDis4.SelectAll();
                        return;
                    }
                }
                if (cobANDropNo.SelectedIndex > 4)
                {
                    if (!DataValidate.IsDecimal(txtANDropDis5.Text.Trim()) || Convert.ToDecimal(txtANDropDis5.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查下喷间距5", "提示信息");
                        txtANDropDis5.Focus();
                        txtANDropDis5.SelectAll();
                        return;
                    }
                }
            }
            if (cobANDetectorNo.SelectedIndex == -1)
            {
                MessageBox.Show("请检查探测器数量", "提示信息");
                cobANDetectorNo.Focus();
                return;
            }
            if (cobANDetectorNo.SelectedIndex > 0)
            {
                if (!DataValidate.IsDecimal(txtANDetectorDis1.Text.Trim()) || Convert.ToDecimal(txtANDetectorDis1.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请检查探测器间距1", "提示信息");
                    txtANDetectorDis1.Focus();
                    txtANDetectorDis1.SelectAll();
                    return;
                }
            }
            if (cobANDetectorNo.SelectedIndex > 1)
            {
                if (!DataValidate.IsDecimal(txtANDetectorDis2.Text.Trim()) || Convert.ToDecimal(txtANDetectorDis2.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请检查探测器间距2", "提示信息");
                    txtANDetectorDis2.Focus();
                    txtANDetectorDis2.SelectAll();
                    return;
                }
            }
            if (cobANDetectorNo.SelectedIndex > 2)
            {
                if (!DataValidate.IsDecimal(txtANDetectorDis3.Text.Trim()) || Convert.ToDecimal(txtANDetectorDis3.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请检查探测器间距3", "提示信息");
                    txtANDetectorDis3.Focus();
                    txtANDetectorDis3.SelectAll();
                    return;
                }
            }
            if (cobANDetectorNo.SelectedIndex > 3)
            {
                if (!DataValidate.IsDecimal(txtANDetectorDis4.Text.Trim()) || Convert.ToDecimal(txtANDetectorDis4.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请检查探测器间距4", "提示信息");
                    txtANDetectorDis4.Focus();
                    txtANDetectorDis4.SelectAll();
                    return;
                }
            }
            if (cobANDetectorNo.SelectedIndex > 4)
            {
                if (!DataValidate.IsDecimal(txtANDetectorDis5.Text.Trim()) || Convert.ToDecimal(txtANDetectorDis5.Text.Trim()) < 30m)
                {
                    MessageBox.Show("请检查探测器间距5", "提示信息");
                    txtANDetectorDis5.Focus();
                    txtANDetectorDis5.SelectAll();
                    return;
                }
            }
            if (cobMARVEL.SelectedIndex == 0)
            {
                if (cobIRNo.SelectedIndex == -1)
                {
                    MessageBox.Show("请检查IR数量", "提示信息");
                    cobIRNo.Focus();
                    return;
                }
                if (cobIRNo.SelectedIndex > 0)
                {
                    if (!DataValidate.IsDecimal(txtIRDis1.Text.Trim()) || Convert.ToDecimal(txtIRDis1.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查IR间距1", "提示信息");
                        txtIRDis1.Focus();
                        txtIRDis1.SelectAll();
                        return;
                    }
                }
                if (cobIRNo.SelectedIndex > 1)
                {
                    if (!DataValidate.IsDecimal(txtIRDis2.Text.Trim()) || Convert.ToDecimal(txtIRDis2.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查IR间距2", "提示信息");
                        txtIRDis2.Focus();
                        txtIRDis2.SelectAll();
                        return;
                    }
                }
                if (cobIRNo.SelectedIndex > 2)
                {
                    if (!DataValidate.IsDecimal(txtIRDis3.Text.Trim()) || Convert.ToDecimal(txtIRDis3.Text.Trim()) < 30m)
                    {
                        MessageBox.Show("请检查IR间距3", "提示信息");
                        txtIRDis3.Focus();
                        txtIRDis3.SelectAll();
                        return;
                    }
                }
            }

            #endregion
            //封装对象
            AN objAN = new AN()
            {
                ANId = Convert.ToInt32(pbModelImage.Tag),

                ANSUL         = cobANSUL.Text,
                ANDetectorEnd = cobANDetectorEnd.Text.Trim().Length == 0 ? "NO" : cobANDetectorEnd.Text,
                ANDropNo      = cobANDropNo.Text.Trim().Length == 0 ? 0 : Convert.ToInt32(cobANDropNo.Text),
                ANDetectorNo  = cobANDetectorNo.Text.Trim().Length == 0 ? 0 : Convert.ToInt32(cobANDetectorNo.Text),
                MARVEL        = cobMARVEL.Text,
                IRNo          = cobIRNo.Text.Trim().Length == 0 ? 0 : Convert.ToInt32(cobIRNo.Text),


                Length         = Convert.ToDecimal(txtLength.Text.Trim()),
                Width          = Convert.ToDecimal(txtWidth.Text.Trim()),
                ANYDis         = Convert.ToDecimal(txtANYDis.Text.Trim()),
                ANDropDis1     = Convert.ToDecimal(txtANDropDis1.Text.Trim()),
                ANDropDis2     = Convert.ToDecimal(txtANDropDis2.Text.Trim()),
                ANDropDis3     = Convert.ToDecimal(txtANDropDis3.Text.Trim()),
                ANDropDis4     = Convert.ToDecimal(txtANDropDis4.Text.Trim()),
                ANDropDis5     = Convert.ToDecimal(txtANDropDis5.Text.Trim()),
                ANDetectorDis1 = Convert.ToDecimal(txtANDetectorDis1.Text.Trim()),
                ANDetectorDis2 = Convert.ToDecimal(txtANDetectorDis2.Text.Trim()),
                ANDetectorDis3 = Convert.ToDecimal(txtANDetectorDis3.Text.Trim()),
                ANDetectorDis4 = Convert.ToDecimal(txtANDetectorDis4.Text.Trim()),
                ANDetectorDis5 = Convert.ToDecimal(txtANDetectorDis5.Text.Trim()),
                IRDis1         = Convert.ToDecimal(txtIRDis1.Text.Trim()),
                IRDis2         = Convert.ToDecimal(txtIRDis2.Text.Trim()),
                IRDis3         = Convert.ToDecimal(txtIRDis3.Text.Trim())
            };
            //提交修改
            try
            {
                if (objANService.EditModel(objAN) == 1)
                {
                    MessageBox.Show("制图数据修改成功", "提示信息");
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }