Пример #1
0
        /// <summary>
        /// 从清单索引插入到清单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (this.CurrQD == null)
            {
                return;
            }
            if (iform.comboxTreelist1.CheckNodes.Count < 1)
            {
                this.Alert("请选择定额号");
                return;
            }
            IEnumerable <DataRowView> views = iform.comboxTreelist1.CheckNodes.Cast <DataRowView>().OrderBy(p => p["DINGEH"].ToString());
            ArrayList a = new ArrayList();

            a.AddRange(views.ToList());
            int intStart = 0;

            foreach (DataRowView item in a)
            {
                _Entity_SubInfo info = new _Entity_SubInfo();
                ///【2013.2.27 李波更改,作用处理各种备注来源】
                GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, item.Row, this.Activitie.Property.Libraries.FixedLibrary.FullName, "CXCK", ++intStart, this.CurrQD.OLDXMBM);
                _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.CurrQD);
                fix.Create(-1, info);
            }
            this.ExpandNode();
            //BindData();
            //this.bindingSource5.ResetBindings(false);

            iform.TreeListResate();
        }
Пример #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            QueryForm pform = this.ParentForm as QueryForm;

            if (pform == null)
            {
                return;
            }
            if (pform.CurrQD == null)
            {
                return;
            }
            _Entity_SubInfo info1 = new _Entity_SubInfo();
            DataRow         row   = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(pform.CurrQD.ID.ToString());

            if (row == null)
            {
                return;
            }
            _ObjectSource.GetObject(info1, row);
            pform.CurrQD = info1;


            foreach (TreeListNode node in this.treeListEx1.Nodes)
            {
                treeListEx1_AfterCheckNode(this.treeListEx1, new DevExpress.XtraTreeList.NodeEventArgs(node));
            }

            foreach (DataRowView item in this.treeListEx1.CheckNodes)
            {
                _Entity_SubInfo info = new _Entity_SubInfo();

                GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfoByTJ(info, item.Row, this.Activitie.Property.Libraries.FixedLibrary.FullName);

                DataRow[] rows = this.Activitie.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["定额表"].Select("DINGEH='" + info.OLDXMBM + "'");
                if (rows.Length > 0)
                {
                    info.JX = rows[0]["JIANGX"].Equals("是") ? true : false;
                    info.TX = rows[0]["TX1"].ToString();
                }
                // info.IsHs = false;
                _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, pform.CurrQD);
                fix.Create(-1, info);
            }

            pform.BindData();
        }
Пример #3
0
        private void CreateZm(int IsTh, _Entity_SubInfo toInfo)
        {
            _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.m_Info);

            switch (this.radioGroup3.EditValue.ToString())
            {
            case "0":        //复用含量
                fix.CopySubhendingToFix(IsTh, 0, toInfo);
                break;

            case "1":        //复用工程量
                fix.CopySubhendingToFix(IsTh, 1, toInfo);
                break;

            default:
                break;
            }
        }
Пример #4
0
        private void CreateZm(int ISth, _Entity_SubInfo fromInfo)
        {
            _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.m_Info);

            switch (this.radioGroup3.EditValue.ToString())
            {
            case "0":        //复用含量
                fix.FromSubhendingToFix(ISth, 0, fromInfo);
                // info.HL = item.HL;
                break;

            case "1":        //复用工程量
                fix.FromSubhendingToFix(ISth, 1, fromInfo);
                break;

            default:
                break;
            }
        }
Пример #5
0
        /// <summary>
        /// 插入定额
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void sButtonOK_Click1(object sender, EventArgs e)
        {
            if (this.CurrQD == null)
            {
                return;
            }
            DataRowView view = qf.bindingSource1.Current as DataRowView;

            if (view != null)
            {
                _Entity_SubInfo info = new _Entity_SubInfo();
                ///【2013.2.27 李波更改,作用处理各种备注来源】
                GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, view.Row, this.Activitie.Property.Libraries.FixedLibrary.FullName, "CXCK", 1, this.CurrQD.OLDXMBM);
                // Sform.subSegmentListData1.Z_Inset(info);
                _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.CurrQD);
                fix.Create(-1, info);
                this.ExpandNode();
                //Sform.subSegmentListData1.FocusedNode(info.ID);
                this.BindData();
            }
        }
Пример #6
0
        private void CreateZJF(_Business m_Currentbus, _Entity_SubInfo item, DataRow row, Calculator calculator)
        {
            if (calculator == null)
            {
                calculator = new Calculator(m_Currentbus, Parent);
            }

            _SubSegmentsSource sorce = null;

            GLODSOFT.QDJJ.BUSINESS._Methods_Fixed fix = null;

            if (item.SSLB == 0)
            {
                sorce = this.Parent.StructSource.ModelSubSegments;
                fix   = new _Methods_Fixed(m_Currentbus, this.Parent, item);
            }
            else
            {
                sorce = this.Parent.StructSource.ModelMeasures;
                fix   = new _Mothods_MFixed(m_Currentbus, this.Parent, item);
            }

            DataRow[] rows = sorce.Select(string.Format("PID={0} and LB='子目-增加费'", item.ID));
            if (IsEsixt(rows, row["Code"].ToString()))
            {
                List <_Entity_SubInfo> list = new List <_Entity_SubInfo>();
                _Entity_SubInfo        info = new _Entity_SubInfo();
                info.OLDXMBM = row["Code"].ToString();
                info.XMBM    = row["Code"].ToString();
                info.XMMC    = row["Name"].ToString();
                info.LB      = "子目-增加费";
                info.GCL     = 1;
                list.Add(info);

                fix.Create(list);
                calculator.Entities.Add(info);
            }
            fix.Begin(null);
            calculator.Entities.Add(item);
        }
Пример #7
0
        /// <summary>
        /// 刷新定额
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (this.CurrQD == null)
            {
                return;
            }

            SubSegmentForm pform = this.ParentForm as SubSegmentForm;

            if (pform != null)
            {
                pform.ChangePositionChanged(false);
            }
            DialogResult dr = MsgBox.Show("是:删除重套定额!否:追加选中定额!取消:取消本次操作!", MessageBoxButtons.YesNoCancel);

            if (dr == DialogResult.Yes)
            {
                //this.CurrQD.RemoveAll();
                //删除所有子目
                DataRow[] rows = this.Activitie.StructSource.ModelSubSegments.Select(string.Format("PID={0}", this.CurrQD.ID));
                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i].Delete();
                }
            }
            if (dr == DialogResult.Cancel)
            {
                return;
            }
            DataRow r = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(this.CurrQD.ID.ToString());

            _ObjectSource.GetObject(this.CurrQD, r);
            string DEH   = string.Empty;
            int    intSD = 0;

            foreach (TreeListNode item1 in this.treeListEx1.Nodes)
            {
                if (!item1.Checked)
                {
                    continue;
                }

                DataRowView     item = this.treeListEx1.GetDataRecordByNode(item1) as DataRowView;
                _Entity_SubInfo info = new _Entity_SubInfo();
                DataTable       dt   = this.Activitie.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["定额表"];
                if (dt == null)
                {
                    return;
                }
                string xmbm = item["TZDEH"].ToString();
                string temp = xmbm.Split(' ')[0];
                temp = temp.Replace("换", "");
                DataRow[] rows = dt.Select(string.Format(" DINGEH='{0}'", temp));
                if (rows == null)
                {
                    return;
                }
                if (rows.Length < 1)
                {
                    return;
                }
                GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, rows[0], this.Activitie.Property.Libraries.FixedLibrary.FullName, "XMTZ", ++intSD, this.CurrQD.OLDXMBM);
                //GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, rows[0], this.Activitie.Property.Libraries.FixedLibrary.FullName);
                info.XMBM = xmbm;
                _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.CurrQD);
                fix.Create(-1, info);
                DEH += item["TZDEH"].ToString() + ",";
            }
            if (pform != null)
            {
                pform.ChangePositionChanged(true);
            }
            //if (DEH.Length > 0) DEH = DEH.Substring(0, DEH.Length - 1);
            //string XMNR = string.Empty;
            //foreach (DataRowView item in this.bindingSource1)
            //{
            //    if (item["xmtz"] is ComboBoxSoucer)
            //    {
            //        XMNR += (item["xmtz"] as ComboBoxSoucer).TZname + ",";

            //    }
            //    else
            //    {
            //    XMNR += ""+ ",";
            //    }

            //}
            //if (XMNR.Length > 0) XMNR = XMNR.Substring(0, XMNR.Length - 1);
            //this.CurrQD.XMTZZ = XMNR + "|" + DEH;
            // RefreshSubSegment();
        }
Пример #8
0
        /// <summary>
        /// 特殊计算
        /// </summary>
        private void SpecialCalculate()
        {
            if (this.splitContainerControl1.PanelVisibility == SplitPanelVisibility.Both)
            {
                string  m_deh = this.lblDEH.Text;                    //定额号
                decimal m_tzl = Convert.ToDecimal(this.lblTZL.Text); //调整量
                decimal m_jbl = Convert.ToDecimal(this.lblJBL.Text); //基本量
                decimal m_sjz = Convert.ToDecimal(this.txtSJZ.Text); //实际值
                if (m_sjz != m_jbl)
                {
                    int     xs = Math.Abs((int)((m_sjz - m_jbl) / m_tzl)); //(实际值-基本量) = 正整数倍数
                    decimal b  = Math.Abs((m_sjz - m_jbl));                //(实际值-基本量)= 差数
                    decimal c  = (xs * m_tzl);                             //(基本量*调整量) = 实际差数
                    decimal d  = b - c;                                    //(实际差数-差数)= 余数
                    if (d > 0 && d < m_jbl)                                //余数在调整量之间时进位
                    {
                        xs = xs + 1;
                    }
                    _SubSegmentsSource m_SubSegmentsSource = null;
                    if (this.m_Methods_Subheadings.Current.SSLB == 0)
                    {
                        m_SubSegmentsSource = this.Activitie.StructSource.ModelSubSegments;
                    }
                    else
                    {
                        m_SubSegmentsSource = this.Activitie.StructSource.ModelMeasures;
                    }
                    DataRow dr = m_SubSegmentsSource.GetRowByOther(this.m_Methods_Subheadings.Current.PID.ToString());
                    if (dr != null)
                    {
                        _Entity_SubInfo m_Entity_SubInfo = new _Entity_SubInfo();
                        _ObjectSource.GetObject(m_Entity_SubInfo, dr);
                        _Methods_Fixed m_Methods_Fixed = null;
                        if (m_Entity_SubInfo.SSLB.Equals(0))
                        {
                            m_Methods_Fixed = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_Entity_SubInfo);
                        }
                        else
                        {
                            m_Methods_Fixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_Entity_SubInfo);
                        }
                        DataRow de_dr = this.Activitie.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["定额表"].Select(string.Format("DINGEH='{0}'", m_deh)).FirstOrDefault();
                        if (de_dr != null)
                        {
                            _Entity_SubInfo m_ZM_Entity_SubInfo = new _Entity_SubInfo();
                            GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(m_ZM_Entity_SubInfo, de_dr, this.Activitie.Property.Libraries.FixedLibrary.FullName);
                            m_ZM_Entity_SubInfo.XMBM += " *" + xs + "";

                            m_Methods_Fixed.Create(this.m_Methods_Subheadings.Current.Sort, m_ZM_Entity_SubInfo);
                            this.m_IFHS = true;
                        }
                    }

                    //SubSegmentForm m_ParentForm =  this.AParentForm  as SubSegmentForm;
                    //if (m_ParentForm != null)
                    //{
                    //    m_ParentForm.BindSubSegmentList();
                    //}
                    this.m_IFHS = true;
                }
            }
        }
Пример #9
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            SubSegmentForm pform = this.ParentForm as SubSegmentForm;

            if (pform != null)
            {
                pform.ChangePositionChanged(false);
            }
            if (this.CurrQD == null)
            {
                return;
            }
            // DialogResult dl = MessageBox.Show("是否删除原有子目并继续?", "提示", MessageBoxButtons.YesNo);
            DialogResult dl = MsgBox.Show("是:删除重套定额!否:追加选中定额!取消:取消本次操作!", MessageBoxButtons.YesNoCancel);

            if (dl == DialogResult.Yes)
            {
                DataRow[] rows = this.Activitie.StructSource.ModelSubSegments.Select(string.Format("PID={0}", this.CurrQD.ID));
                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i].Delete();
                }
            }
            if (dl == DialogResult.Cancel)
            {
                return;
            }
            DataRow r = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(this.CurrQD.ID.ToString());

            _ObjectSource.GetObject(this.CurrQD, r);
            GetCheckNodes();
            string DEH   = string.Empty;
            int    intSD = 0;

            foreach (DataRowView item in this.treeListEx1.CheckNodes)
            {
                _Entity_SubInfo info = new _Entity_SubInfo();
                GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, item.Row, this.Activitie.Property.Libraries.FixedLibrary.FullName, "GCNR", ++intSD, this.CurrQD.OLDXMBM);
                //GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(info, item.Row, this.Activitie.Property.Libraries.FixedLibrary.FullName);
                _Methods_Fixed fix = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, this.CurrQD);
                fix.Create(-1, info);

                DEH += item["DINGEH"].ToString() + ",";
            }

            if (pform != null)
            {
                pform.ChangePositionChanged(true);
            }
            //if (DEH.Length > 0) DEH = DEH.Substring(0, DEH.Length - 1);

            //getDE();
            //string XMNR = string.Empty;
            //foreach (DataRowView item in this.m_DEBH)
            //{
            //    XMNR += item["NEIRBH"] + "=" + item["check"] + ",";
            //}
            //if (XMNR.Length > 0) XMNR = XMNR.Substring(0, XMNR.Length-1);
            //this.CurrQD.XMNR = XMNR + "|" + DEH;
            // RefreshSubSegment();
        }
Пример #10
0
        /// <summary>
        /// 第一个石灰转换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit1_Click(object sender, EventArgs e)
        {
            if (radioGroup1.SelectedIndex == 1)
            {
                ArrayList m_ArrayList = this.GetAllSub(string.Format("ZCLB='W' AND YSBH IN({0})", _Constant.石灰转换定额范围));
                DataRow   new_info    = GetSSH();
                foreach (DataRow item in m_ArrayList)
                {
                    decimal yxhl  = 0m;
                    decimal xhl   = 0m;
                    DataRow sshkg = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W'AND YSBH='10900'", item["SSLB"], item["ID"])).FirstOrDefault();
                    DataRow ssht  = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W'AND YSBH='10901'", item["SSLB"], item["ID"])).FirstOrDefault();
                    if (sshkg != null)
                    {
                        yxhl += _ConvertUnit.Convert(sshkg["DW"].ToString(), "千克") * ToolKit.ParseDecimal(sshkg["XHL"]);
                        xhl  += _ConvertUnit.Convert(sshkg["DW"].ToString(), "千克") * ToolKit.ParseDecimal(sshkg["XHL"]) * 1.3m;
                        sshkg.Delete();
                    }
                    if (ssht != null)
                    {
                        yxhl += _ConvertUnit.Convert(ssht["DW"].ToString(), "千克") * ToolKit.ParseDecimal(ssht["XHL"]);
                        xhl  += _ConvertUnit.Convert(ssht["DW"].ToString(), "千克") * ToolKit.ParseDecimal(ssht["XHL"]) * 1.3m;
                        ssht.Delete();
                    }

                    new_info["YSXHL"] = xhl;
                    new_info["XHL"]   = xhl;
                    new_info["CTIME"] = DateTime.Now;
                    new_info["SSLB"]  = item["SSLB"];
                    new_info["EnID"]  = item["EnID"];
                    new_info["UnID"]  = item["UnID"];
                    new_info["ZMID"]  = item["ID"];
                    new_info["QDID"]  = item["PID"];
                    new_info["PID"]   = DBNull.Value;
                    this.Activitie.StructSource.ModelQuantity.Add(new_info);

                    DataRow rg = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB='{0}' AND ZMID={1} AND LB='{2}'", item["SSLB"], item["ID"], "人工"), "YSBH").FirstOrDefault();
                    if (rg != null)
                    {
                        rg["XHL"] = ToolKit.ParseDecimal(rg["XHL"]) - (yxhl * 0.001m) * 0.478m;
                    }
                    DataRow sui = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB='{0}' AND ZMID={1} AND YSBH='{2}'", item["SSLB"], item["ID"], "11610"), "YSBH").FirstOrDefault();
                    if (sui != null)
                    {
                        sui["XHL"] = ToolKit.ParseDecimal(sui["XHL"]) - (yxhl * 0.001m) * 0.043m;
                    }
                    _Entity_SubInfo m_Entity_SubInfo = new _Entity_SubInfo();
                    _ObjectSource.GetObject(m_Entity_SubInfo, item);
                    _Methods_Subheadings m_Methods_Subheadings = new _Methods_Subheadings(this.CurrentBusiness, this.Activitie, m_Entity_SubInfo);
                    m_Methods_Subheadings.Begin(null);
                }
                MsgBox.Alert("【" + m_ArrayList.Count + "】条子目 生石灰-转换-熟石灰");
            }
            else
            {
                int       m_index     = 0;
                ArrayList m_ArrayList = this.GetAllSub("ZCLB='W' AND YSBH='10905'");
                foreach (DataRow item in m_ArrayList)
                {
                    _Entity_SubInfo m_QD_Entity_SubInfo = null;
                    _Entity_SubInfo m_Entity_SubInfo    = new _Entity_SubInfo();
                    _ObjectSource.GetObject(m_Entity_SubInfo, item);
                    if (m_Entity_SubInfo.SSLB == 0)
                    {
                        m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        DataRow dr_qd = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(m_Entity_SubInfo.PID.ToString());
                        if (dr_qd != null)
                        {
                            _ObjectSource.GetObject(m_QD_Entity_SubInfo, dr_qd);
                            _Methods_Fixed  m_Methods_Fixed  = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                            _Entity_SubInfo f_Entity_SubInfo = GetZMByID(m_Entity_SubInfo.OLDXMBM);
                            if (f_Entity_SubInfo != null)
                            {
                                item.Delete();
                                f_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_Methods_Fixed.Current.OLDXMBM);
                                m_Methods_Fixed.Create(m_Entity_SubInfo.Sort - 1, f_Entity_SubInfo);
                            }
                        }
                    }
                    else
                    {
                        m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        DataRow dr_qd = this.Activitie.StructSource.ModelMeasures.GetRowByOther(m_Entity_SubInfo.PID.ToString());
                        if (dr_qd != null)
                        {
                            _ObjectSource.GetObject(m_QD_Entity_SubInfo, dr_qd);
                            _Mothods_MFixed m_Mothods_MFixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                            _Entity_SubInfo c_Entity_SubInfo = GetZMByID(m_Entity_SubInfo.OLDXMBM);
                            if (c_Entity_SubInfo != null)
                            {
                                item.Delete();
                                c_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_Mothods_MFixed.Current.OLDXMBM);
                                m_Mothods_MFixed.Create(m_Entity_SubInfo.Sort - 1, c_Entity_SubInfo);
                            }
                        }
                    }
                }
                MsgBox.Alert("【" + m_ArrayList.Count + "】条子目 熟石灰-转换-生石灰");
            }
        }
Пример #11
0
        /// <summary>
        /// 第四个混凝土转换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit4_Click(object sender, EventArgs e)
        {
            int m_index = 0;

            if (APP.Application.Global.DataTamp.工程设置.Tables.Count == 0)
            {
                return;
            }
            if (this.radioGroup4.SelectedIndex == 1)
            {
                //普通转换商品
                DataRow[] deh_drs = APP.Application.Global.DataTamp.工程设置.Tables["混凝土转换"].Select("LB='定额编号'");
                int       count   = 0;
                using (var calculator = new Calculator(CurrentBusiness, Activitie))
                {
                    foreach (DataRow deh_item in deh_drs)
                    {
                        _Entity_SubInfo m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        _Methods_Fixed  m_QD_Methods_Fixed  = null;
                        ArrayList       zm_ArrayList        = this.GetAllHNTSub(deh_item["PTHNT"].ToString());
                        foreach (DataRow zm_item in zm_ArrayList)
                        {
                            _Entity_SubInfo new_Entity_SubInfo = null;
                            if (zm_item["SSLB"].Equals(0))
                            {
                                DataRow qd_dr = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(zm_item["PID"].ToString());
                                _ObjectSource.GetObject(m_QD_Entity_SubInfo, qd_dr);
                                m_QD_Methods_Fixed = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                                new_Entity_SubInfo = this.GetZMByID(deh_item["SPHNT"].ToString());
                            }
                            else
                            {
                                DataRow qd_dr = this.Activitie.StructSource.ModelMeasures.GetRowByOther(zm_item["PID"].ToString());
                                _ObjectSource.GetObject(m_QD_Entity_SubInfo, qd_dr);
                                m_QD_Methods_Fixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                                new_Entity_SubInfo = this.GetZMByID(deh_item["SPHNT"].ToString());
                            }
                            if (new_Entity_SubInfo != null)
                            {
                                DataRow[] phb_glj_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W'", zm_item["SSLB"], zm_item["ID"]), "BH");
                                foreach (DataRow phb_glj_item in phb_glj_drs)
                                {
                                    DataRow cl_dr = APP.Application.Global.DataTamp.工程设置.Tables["混凝土转换"].Select(string.Format("LB='材料' AND PTHNT='{0}'", phb_glj_item["YSBH"])).FirstOrDefault();
                                    if (cl_dr != null)
                                    {
                                        string[] m_mrth = deh_item["MRZTH"].ToString().Split('|');
                                        if (m_mrth.Length == 2)
                                        {
                                            if (!m_mrth[1].Equals(cl_dr["SPHNT"]))
                                            {
                                                new_Entity_SubInfo.XMBM += "换";
                                                new_Entity_SubInfo.XMMC += "//换:" + m_mrth[1] + "," + cl_dr["SPHNT"];
                                            }
                                            new_Entity_SubInfo.DECJ   = new_Entity_SubInfo.DECJ.Replace(m_mrth[1].ToString(), cl_dr["SPHNT"].ToString());
                                            new_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_QD_Methods_Fixed.Current.OLDXMBM);
                                            continue;
                                        }
                                    }
                                }


                                m_QD_Methods_Fixed.Create(ToolKit.ParseInt(zm_item["Sort"]) - 1, new_Entity_SubInfo);
                                new_Entity_SubInfo.GCL = (int)double.Parse(zm_item["GCL"].ToString());
                                new_Entity_SubInfo.HL  = (int)double.Parse(zm_item["HL"].ToString());
                                this.Activitie.StructSource.ModelSubSegments.UpDate(new_Entity_SubInfo);
                                zm_item.Delete();
                                count++;
                            }

                            calculator.Entities.Add(new_Entity_SubInfo);
                        }
                    }
                    MsgBox.Alert("【" + count + "】条子目 (普通混凝土)转换(商品混凝土)成功");
                }
            }
            else
            {
                DataTable hntzh = APP.Application.Global.DataTamp.工程设置.Tables["混凝土转换"];
                if (hntzh == null)
                {
                    return;
                }
                //商品转换普通
                DataRow[] deh_drs = APP.Application.Global.DataTamp.工程设置.Tables["混凝土转换"].Select("LB='定额编号'");
                int       count   = 0;

                using (var calculator = new Calculator(CurrentBusiness, Activitie))
                {
                    foreach (DataRow deh_item in deh_drs)
                    {
                        _Entity_SubInfo m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        _Methods_Fixed  m_QD_Methods_Fixed  = null;
                        ArrayList       zm_ArrayList        = this.GetAllHNTSub(deh_item["SPHNT"].ToString());

                        foreach (DataRow zm_item in zm_ArrayList)
                        {
                            _Entity_SubInfo new_Entity_SubInfo = null;
                            if (zm_item["SSLB"].Equals(0))
                            {
                                DataRow qd_dr = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(zm_item["PID"].ToString());
                                _ObjectSource.GetObject(m_QD_Entity_SubInfo, qd_dr);
                                m_QD_Methods_Fixed = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                                new_Entity_SubInfo = this.GetZMByID(deh_item["PTHNT"].ToString());
                            }
                            else
                            {
                                DataRow qd_dr = this.Activitie.StructSource.ModelMeasures.GetRowByOther(zm_item["PID"].ToString());
                                _ObjectSource.GetObject(m_QD_Entity_SubInfo, qd_dr);
                                m_QD_Methods_Fixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                                new_Entity_SubInfo = this.GetZMByID(deh_item["PTHNT"].ToString());
                            }
                            if (new_Entity_SubInfo != null)
                            {
                                DataRow[] phb_glj_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W'", zm_item["SSLB"], zm_item["ID"]), "BH");
                                foreach (DataRow phb_glj_item in phb_glj_drs)
                                {
                                    DataRow cl_dr = APP.Application.Global.DataTamp.工程设置.Tables["混凝土转换"].Select(string.Format("LB='材料' AND SPHNT='{0}'", phb_glj_item["YSBH"])).FirstOrDefault();
                                    if (cl_dr != null)
                                    {
                                        string[] m_mrth = deh_item["MRZTH"].ToString().Split('|');
                                        if (m_mrth.Length == 2)
                                        {
                                            if (!m_mrth[0].Equals(cl_dr["PTHNT"]))
                                            {
                                                new_Entity_SubInfo.XMBM += "换";
                                                new_Entity_SubInfo.XMMC += "//换:" + m_mrth[0] + "," + cl_dr["PTHNT"];
                                            }
                                            new_Entity_SubInfo.DECJ   = new_Entity_SubInfo.DECJ.Replace(m_mrth[0].ToString(), cl_dr["PTHNT"].ToString());
                                            new_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_QD_Methods_Fixed.Current.OLDXMBM);
                                            continue;
                                        }
                                    }
                                }

                                var entity = m_QD_Methods_Fixed.Create(ToolKit.ParseInt(zm_item["Sort"]) - 1, new_Entity_SubInfo);
                                zm_item.Delete();
                                count++;
                                calculator.Entities.Add(entity);
                            }
                        }
                    }
                }
                MsgBox.Alert("【" + count + "】条子目 (商品混凝土)转换(普通混凝土)成功");
            }
        }
Пример #12
0
 /// <summary>
 /// 第三个模板应用
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit3_Click(object sender, EventArgs e)
 {
     if (radioGroup3.SelectedIndex == 1)
     {
         DataRow qd_dr = this.btnEdit1.Tag as DataRow;
         if (qd_dr != null)
         {
             ArrayList m_ArrayList = this.GetAllMBSub();
             if (m_ArrayList.Count > 0)
             {
                 _Entity_SubInfo m_QD_Entity_SubInfo = new _Entity_SubInfo();
                 _ObjectSource.GetObject(m_QD_Entity_SubInfo, qd_dr);
                 _Mothods_MFixed m_Mothods_MFixed    = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                 _Entity_SubInfo m_ZM_Entity_SubInfo = new _Entity_SubInfo();
                 foreach (DataRow item in m_ArrayList)
                 {
                     item["SC"] = false;
                     _ObjectSource.GetObject(m_ZM_Entity_SubInfo, item);
                     m_ZM_Entity_SubInfo.SC = true;
                     m_Mothods_MFixed.Create(-1, m_ZM_Entity_SubInfo);
                     DataRow[] csxm_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1}", m_ZM_Entity_SubInfo.SSLB, m_ZM_Entity_SubInfo.ID));
                     foreach (DataRow csxm_glj_item in csxm_drs)
                     {
                         csxm_glj_item.Delete();
                     }
                     DataRow[] fbfx_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1}", item["SSLB"], item["ID"]));
                     foreach (DataRow fbfx_glj_item in fbfx_drs)
                     {
                         fbfx_glj_item["QDID"] = m_ZM_Entity_SubInfo.PID;
                         fbfx_glj_item["ZMID"] = m_ZM_Entity_SubInfo.ID;
                         fbfx_glj_item["SSLB"] = m_ZM_Entity_SubInfo.SSLB;
                     }
                 }
             }
             MsgBox.Alert("【" + m_ArrayList.Count + "】条子目 模板到措施成功");
         }
     }
     else
     {
         DialogResult dl = MessageBox.Show("您确认将模板还原到分部分项?", "提示", MessageBoxButtons.YesNo);
         if (dl == DialogResult.No)
         {
             return;
         }
         DataRow[] drs = this.Activitie.StructSource.ModelMeasures.Select("TX='模板'");
         if (drs.Length > 0)
         {
             _Methods_Fixed  m_Methods_Fixed  = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, null);
             _Entity_SubInfo m_Entity_SubInfo = new _Entity_SubInfo();
             foreach (DataRow item in drs)
             {
                 _Entity_SubInfo info  = null;
                 DataRow         qd_dr = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(item["QDBH"].ToString());
                 DataRow         zm_dr = this.Activitie.StructSource.ModelSubSegments.Select(string.Format("QDBH='{0}' and XMBM='{1}'", item["QDBH"], item["XMBM"])).FirstOrDefault();
                 if (qd_dr != null)
                 {
                     info = new _Entity_SubInfo();
                     _ObjectSource.GetObject(info, qd_dr);
                     m_Methods_Fixed.Current = info;
                 }
                 if (info != null)
                 {
                     if (zm_dr == null)
                     {
                         m_Entity_SubInfo.SC = true;
                         _ObjectSource.GetObject(m_Entity_SubInfo, item);
                         m_Methods_Fixed.Create(-1, m_Entity_SubInfo);
                         DataRow[] fbfx_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("ZMID={0} and SSLB={1}", m_Entity_SubInfo.ID, m_Entity_SubInfo.SSLB));
                         foreach (DataRow fbfx_glj_item in fbfx_drs)
                         {
                             fbfx_glj_item.Delete();
                         }
                     }
                     else
                     {
                         zm_dr["SC"] = true;
                         _ObjectSource.GetObject(m_Entity_SubInfo, zm_dr);
                     }
                     DataRow[] csxm_drs = this.Activitie.StructSource.ModelQuantity.Select(string.Format("ZMID={0} and SSLB={1}", item["ID"], item["SSLB"]));
                     foreach (DataRow csxm_drs_item in csxm_drs)
                     {
                         csxm_drs_item["QDID"] = m_Entity_SubInfo.PID;
                         csxm_drs_item["ZMID"] = m_Entity_SubInfo.ID;
                         csxm_drs_item["SSLB"] = m_Entity_SubInfo.SSLB;
                     }
                 }
                 item.Delete();
             }
             MsgBox.Alert("【" + drs.Length + "】条子目 模板到分部成功");
         }
     }
 }
Пример #13
0
        /// <summary>
        /// 第二个砂浆转换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit2_Click(object sender, EventArgs e)
        {
            APP.UserPriceLibrary.AllQuantityUnit = this.Activitie.StructSource.ModelQuantity;
            APP.UserPriceLibrary.UnName          = this.Activitie.Name;
            APP.UserPriceLibrary.Range           = 1;
            if (this.radioGroup2.SelectedIndex == 1)
            {
                ArrayList m_ArrayList = this.GetAllSub("ZCLB='W' AND YSBH='J06016' AND XHL <> 0");
                int       count       = m_ArrayList.Count;
                //抹灰工程
                foreach (DataRow item in m_ArrayList)
                {
                    DataRow[] mh = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND YSBH IN({2})", item["SSLB"], item["ID"], _Constant.抹灰工程定额范围));
                    if (mh.Length > 0)
                    {
                        DataRow rg    = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND LB='人工'", item["SSLB"], item["ID"]), "YSBH").FirstOrDefault();
                        DataRow jx    = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND BH='J06016'", item["SSLB"], item["ID"]), "YSBH").FirstOrDefault();
                        decimal rgxhl = 0m;
                        foreach (DataRow dr in mh)
                        {
                            if (!dr["MC"].ToString().Contains("(预拌砂浆)"))
                            {
                                dr.BeginEdit();
                                dr["MC"] = dr["MC"].ToString() + "(预拌砂浆)";
                                APP.UserPriceLibrary.Update("MC", dr["MC", DataRowVersion.Current], dr);
                                dr.EndEdit();
                            }
                        }
                        //修改消耗量
                        foreach (DataRow mhs in mh)
                        {
                            rgxhl += ToolKit.ParseDecimal(mhs["XHL"]) * 1.1m * _ConvertUnit.Convert(mhs["DW"].ToString(), "立方米");
                        }
                        if (rg != null)
                        {
                            rg["XHL"] = ToolKit.ParseDecimal(rg["XHL"]) - rgxhl;
                        }
                        if (jx != null)
                        {
                            jx["XHL"] = 0m;
                        }
                    }

                    //砌筑工程
                    DataRow[] qz = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND YSBH IN ({2}) ", item["SSLB"], item["ID"], _Constant.筑工程定额范围));
                    if (qz.Count() > 0)
                    {
                        DataRow rg    = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND LB='人工'", item["SSLB"], item["ID"]), "YSBH").FirstOrDefault();
                        DataRow jx    = this.Activitie.StructSource.ModelQuantity.Select(string.Format("SSLB={0} AND ZMID={1} AND ZCLB='W' AND BH='J06016'", item["SSLB"], item["ID"]), "YSBH").FirstOrDefault();
                        decimal rgxhl = 0m;
                        //修改名称
                        DataRow dr = qz.FirstOrDefault();
                        if (dr != null)
                        {
                            if (!dr["MC"].ToString().Contains("(预拌砂浆)"))
                            {
                                dr.BeginEdit();
                                dr["MC"] = dr["MC"].ToString() + "(预拌砂浆)";
                                APP.UserPriceLibrary.Update("MC", dr["MC", DataRowVersion.Current], dr);
                                dr.EndEdit();
                            }
                        }
                        foreach (DataRow qzs in qz)
                        {
                            rgxhl += ToolKit.ParseDecimal(qzs["XHL"]) * 0.69m * _ConvertUnit.Convert(qzs["DW"].ToString(), "立方米");
                        }
                        if (rg != null)
                        {
                            rg["XHL"] = ToolKit.ParseDecimal(rg["XHL"]) - rgxhl;
                        }
                        if (jx != null)
                        {
                            jx["XHL"] = 0m;
                        }
                    }
                    string m_NewSubheadings = item["EnID"] + "," + item["UnID"] + "," + item["SSLB"] + "," + item["ID"] + "|";
                    if (!APP.UserPriceLibrary.SubheadingsInfo.Contains(m_NewSubheadings))
                    {
                        APP.UserPriceLibrary.SubheadingsInfo += m_NewSubheadings;
                    }
                }
                _Methods_Subheadings m_Methods_Subheadings = new _Methods_Subheadings(this.Activitie);
                m_Methods_Subheadings.BatchCalculate();
                MsgBox.Alert("【" + count + "】条子目 现场制拌砂浆-转换-预拌砂浆");
            }
            else
            {
                int       m_index     = 0;
                ArrayList m_ArrayList = this.GetAllSub("ZCLB='W' AND YSBH='J06016' AND XHL=0");
                foreach (DataRow item in m_ArrayList)
                {
                    _Entity_SubInfo m_QD_Entity_SubInfo = null;
                    _Entity_SubInfo m_Entity_SubInfo    = new _Entity_SubInfo();
                    _ObjectSource.GetObject(m_Entity_SubInfo, item);
                    if (m_Entity_SubInfo.SSLB == 0)
                    {
                        m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        DataRow dr_qd = this.Activitie.StructSource.ModelSubSegments.GetRowByOther(m_Entity_SubInfo.PID.ToString());
                        if (dr_qd != null)
                        {
                            _ObjectSource.GetObject(m_QD_Entity_SubInfo, dr_qd);
                            _Methods_Fixed  m_Methods_Fixed  = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                            _Entity_SubInfo f_Entity_SubInfo = GetZMByID(m_Entity_SubInfo.OLDXMBM);
                            if (f_Entity_SubInfo != null)
                            {
                                item.Delete();
                                f_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_Methods_Fixed.Current.OLDXMBM);
                                m_Methods_Fixed.Create(m_Entity_SubInfo.Sort - 1, f_Entity_SubInfo);
                            }
                        }
                    }
                    else
                    {
                        m_QD_Entity_SubInfo = new _Entity_SubInfo();
                        DataRow dr_qd = this.Activitie.StructSource.ModelMeasures.GetRowByOther(m_Entity_SubInfo.PID.ToString());
                        if (dr_qd != null)
                        {
                            _ObjectSource.GetObject(m_QD_Entity_SubInfo, dr_qd);
                            _Mothods_MFixed m_Mothods_MFixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_QD_Entity_SubInfo);
                            _Entity_SubInfo c_Entity_SubInfo = GetZMByID(m_Entity_SubInfo.OLDXMBM);
                            if (c_Entity_SubInfo != null)
                            {
                                item.Delete();
                                c_Entity_SubInfo.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("GCSZ", ++m_index, m_Mothods_MFixed.Current.OLDXMBM);
                                m_Mothods_MFixed.Create(m_Entity_SubInfo.Sort - 1, c_Entity_SubInfo);
                            }
                        }
                    }
                }
                MsgBox.Alert("【" + m_ArrayList.Count + "】条子目 预拌砂浆-转换-现场制拌砂浆");
            }
        }