/// <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 + "】条子目 熟石灰-转换-生石灰"); } }
/// <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 + "】条子目 (商品混凝土)转换(普通混凝土)成功"); } }
/// <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 + "】条子目 预拌砂浆-转换-现场制拌砂浆"); } }
/// <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 + "】条子目 模板到分部成功"); } } }
private void simpleButton3_Click(object sender, EventArgs e) { BatchCalculate(); this.RefreshData(); MsgBox.Alert("同步结束"); }