/// <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 + "】条子目 模板到分部成功"); } } }
/// <summary> /// 打开进度 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //void OpenUnitWorker_DoWork(object sender, DoWorkEventArgs e) void doOpen() { try { if (this.Activitie == null || this.CurrentBusiness == null) { MsgBox.Alert("请打开单位工程再刷新数据!"); return; } _Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness); DataRowView v = this.QDSource.Current as DataRowView; if (v == null) { MsgBox.Alert("当前没有清单!"); return; } if (ToolKit.ParseBoolen(v["Check"])) { //DataRow Einfo = infomation.Exists(v["QDBH"].ToString()); DataRow Einfo = null; if (v.DataView.Table.Columns.Contains("BZ")) { //Einfo = infomation.Exists(v["BZ"].ToString()); Einfo = infomation.Exists(v["TJ"].ToString()); } if (Einfo != null) { //DialogResult dl = MsgBox.Show("清单已存在是否替换?", MessageBoxButtons.YesNoCancel); //switch (dl) //{ // case DialogResult.Cancel: // return; // case DialogResult.Yes: string qdbh = v["QDBH"].ToString(); infomation.Creat(v.Row, true); MsgBox.Alert("替换清单" + qdbh + "成功!"); // break; // case DialogResult.No: // infomation.Creat(v.Row, false); // MsgBox.Alert("追加清单" + v["QDBH"].ToString() + "成功!"); // break; //} } else { bool Is_TH = false; bool Is_CZ = false; DataRow[] rowsNewDE = APP.UnInformation.DETable.Select(string.Format("TJ='{0}' and WZLX='措施项目'", v.Row["TJ"])); foreach (DataRow item in rowsNewDE) { if (Is_CZ) { break; } //根据位置找清单 DataRow[] rows = this.Activitie.StructSource.ModelMeasures.Select("XMBM='" + item["WZ"] + "'", "id desc"); if (rows.Length > 0) { _Entity_SubInfo info1 = new _Entity_SubInfo(); _ObjectSource.GetObject(info1, rows[0]); DataRow[] rowsDE = this.Activitie.StructSource.ModelMeasures.Select(string.Format(" ZDSC=True and XMBM='{0}' and PID='{1}'", item["DEBH"], info1.ID), "id desc"); if (rowsDE.Length > 0) { DialogResult dl = MsgBox.Show("措施定额已存在是否替换?", MessageBoxButtons.YesNoCancel); switch (dl) { case DialogResult.Cancel: return; case DialogResult.Yes: Is_TH = true; break; case DialogResult.No: Is_TH = false; break; } Is_CZ = true; } } } infomation.Creat(v.Row, Is_TH); MsgBox.Alert("添加清单" + v["QDBH"].ToString() + "成功!"); } } else { MsgBox.Alert("当前清单没有选中!"); } //AlertForm form = new AlertForm(); //form.Text = "自动生成分部分项"; //form.Content.Text = "当清单数据已经自动生成过(不含手动添加的数据),\"追加\"则直接新增一条新的清单;\"替换\"只替换自动生成的清单编码中编码最大的一条清单;\"取消\"则取消当前操作"; //DialogResult d = form.ShowDialog(); //if (d == DialogResult.Yes) //{ // this.Activitie.Property.SubSegments.IsZDSC = true; // this.m_Information.CreatAll(true); //} //if (d == DialogResult.No) //{ // this.Activitie.Property.SubSegments.IsZDSC = true; // this.m_Information.CreatAll(false); //} } catch (Exception) { throw; } }
/// <summary> /// 设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void checkEdit1_CheckedChanged(object sender, EventArgs e) { BatchCalculate("设置"); MsgBox.Alert("设置结束"); GetInfo(); }
/// <summary> /// 修复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { BatchCalculate("修复"); MsgBox.Alert("修复结束"); GetInfo(); }
private void simpleButton3_Click(object sender, EventArgs e) { BatchCalculate(); this.RefreshData(); MsgBox.Alert("同步结束"); }
private bool Validate(int cost, out Dictionary <string, object> result) { result = new Dictionary <string, object>(); if (cost < 0) { return(false); } if (this.txtLimitPrice.Text.Trim() == "") { MsgBox.Alert("上限控制价不能为空!"); this.txtLimitPrice.Focus(); return(false); } decimal limitPrice = 0; decimal.TryParse(this.txtLimitPrice.Text.Trim(), out limitPrice); var rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='ZZJ' and ID = 0"); decimal totalProjectFee = 0; if (rows.Length > 0) { totalProjectFee = decimal.Parse(rows[0]["value"].ToString()); } rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='CSXMF' and ID = 0"); decimal totalMeasureFee = 0; if (rows.Length > 0) { totalMeasureFee = decimal.Parse(rows[0]["value"].ToString()); } decimal totalSubsegmentFee = 0; rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='FBFXHJ' and ID = 0"); if (rows.Length > 0) { totalSubsegmentFee = decimal.Parse(rows[0]["value"].ToString()); } rows = this.pInfo.Current.StructSource.ModelSubSegments.Select("LB='清单'"); var quotaCount = rows.Length; var lockNumber = APP.GoldSoftClient.GlodSoftDiscern.CurrNo; var args = new { limitPrice = limitPrice, totalProjectFee = totalProjectFee, totalMeasureFee = totalMeasureFee, quotaCount = quotaCount, lockNumber = lockNumber, totalSubsegmentFee = totalSubsegmentFee, publish = APP.GoldSoftClient.Invite_Publish, mines = APP.GoldSoftClient.My_Count }; Bid bid = new Bid(); result = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(bid.Check(JsonConvert.SerializeObject(args)))); if (result == null) { MessageBox.Show("服务器出现错误"); return(false); } var error = result["error"] + ""; if (string.IsNullOrEmpty(error) == false) { Record(cost, error); return(false); } APP.GoldSoftClient.KCJF = int.Parse(result["cost"] + ""); APP.GoldSoftClient.ZZJ = totalProjectFee; APP.GoldSoftClient.FBFXHJ = totalSubsegmentFee; APP.GoldSoftClient.CSXMHJ = totalMeasureFee; APP.GoldSoftClient.QDZJ_TB = quotaCount; return(true); //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='ZZJ' and ID = 0"); //if (rows.Length <= 0) //{ // Record(cost, "总造价为0,项目文件不符合调标要求!"); // return false; //} //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='FBFXHJ' and ID = 0"); //if (rows.Length > 0) //{ //} //if (decimal.Parse(this.txtLimitPrice.Text.Trim()) < APP.GoldSoftClient.ZZJ) //{ // Record(cost, "上限控制价不能小于总造价!"); // this.txtLimitPrice.Focus(); // return false; //} //rows = this.pInfo.Current.StructSource.ModelProjVariable.Select("Key='CSXMF' and ID = 0"); ////rows = this.pInfo.Current.StructSource.ModelProjMetaanalysis.Select(""); //if (rows.Length <= 0) //{ // Record(cost, "措施项目合计为0,项目文件不符合调标要求!"); // return false; //} //decimal xs = Math.Abs(decimal.Parse(APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["CSFBL"].ToString())); //if (APP.GoldSoftClient.CSXMHJ <= (APP.GoldSoftClient.ZZJ * xs))//TBKZ //{ // Record(cost, "措施项目合计必须大于总造价乘以 " + xs.ToString() + ", 项目文件不符合调标要求!"); // return false; //} //rows = this.pInfo.Current.StructSource.ModelSubSegments.Select("LB='清单'"); //int qdsl = int.Parse(APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["QDSL"].ToString()); //if (rows.Length < qdsl) //{ // Record(cost, "单位工程至少包含 " + qdsl.ToString() + " 清单个数不符合调标要求!"); // return false; //} //if (APP.GoldSoftClient.QDJJTB.Tables["TBKZ"].Rows[0]["KZSH"].ToString().Contains(APP.GoldSoftClient.GlodSoftDiscern.CurrNo)) //{ // Record(cost, "当前锁号没有权限进行调标操作!"); // this.Close(); // return false; //} return(true); }