using System; using System.Collections.Generic; using com.hnshituo.pur.vo; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Pur.Entity; using Pur.Entity.configureEntity; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Pur.ck; using CoreFS.CA06; using Pur.Pop_upWindow; using System.Collections; using Core.Mes.Client.Comm.Server; using Infragistics.Win.UltraWinEditors; using Pur.require_plan; using Pur.configure; namespace Pur.pur_plan { public partial class frmBID_FUNCTION : FrmPmsBase { string fileName = ""; public string strSelName = ""; public string strSelId = ""; public frmBID_FUNCTION() { InitializeComponent(); } /// /// 维护界面toolbar /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "doQuery": QureyBasePriceM(""); break; case "doAdd": AddBasePriceM(); break; case "doEffect": doEffect();//提报 break; case "doRevokeEffect": doRevokeEffect();//撤销提报 break; case "doSure": doSure1();//主管部长审核 break; case "doSure1": doSure();//业务科长审核 break; case "Save"://修改分配方案 doUpdateBidFunctionM(); break; case "SaveEvaRemark"://修改评标人员意见 SaveEvaRemark(); break; case "doDelete": DeleteBasePriceM(); break; case "doExcel": //doExcel(); break; case "Close": this.Close(); break; } } /// /// 弹窗按钮控件 /// /// /// private void barsManagerButon_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key.ToString()) { case "SelectSupp": { SelectFunction(); } break; case "ESC": { this.Close(); } break; } } private void SelectFunction() { strSelName = ultraGrid1.ActiveRow.Cells["NAME"].Value.ToString(); strSelId = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); } private void frmBID_FUNCTION_Load(object sender, EventArgs e) { splitContainer1.SplitterDistance = splitContainer1.Height / 2; //评标人员角色 DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1224" }, this.ob); dt1.DefaultView.RowFilter = "Validflag='1'"; dt1 = dt1.DefaultView.ToTable(); cmb_EVA_ROLE_NAME.DataSource = dt1; cmb_EVA_ROLE_NAME.DisplayMember = "BASENAME"; cmb_EVA_ROLE_NAME.ValueMember = "BASECODE"; } /// /// 查询分配方案 /// private void QureyBasePriceM(String strId) { try { this.Cursor = Cursors.WaitCursor; clearTab(); PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); //权限控制 pm.ValidDataPurviewIds = this.ValidDataPurviewIds; //判断当前拥有此页面功能的角色是否启用数据权限,//0未启用 //string QstrDataFlag = this.execute("com.hnshituo.pur.utils.service.UtilsService", "getRoleDataFlag", new object[] { UserInfo.GetUserID(), "Pur.pur_plan.frmTaskMana_MC" }); pm.Name = Qname.Text.Trim(); pm.Validflag = "1"; if (txt_status.SelectedIndex != -1) { pm.Flag = txt_status.Value.ToString().Trim(); } DataTable re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doQureyBidFunctionM", new object[] { pm }); GridHelper.CopyDataToDatatable(re, dataTable1, true); comm.RefreshAndAutoSizeExceptColumns(ultraGrid1); if (!String.IsNullOrEmpty(strId)) { PublicTools.publicPms.doActiveSelRow(ultraGrid1, "id", strId); } } finally { this.Cursor = Cursors.Default; } } /// /// 查询评审人员 /// /// private void doQueryEva() { dataTable4.Clear(); PurBidFunctionEvasEntity pc = new PurBidFunctionEvasEntity(); string strId = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); pc.VersionNo = strId; pc.Validflag = "1"; DataTable re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionEvasService", "find", new object[] { pc,0,0 }); GridHelper.CopyDataToDatatable(re, dataTable4, true); GridHelper.RefreshAndAutoSize(ultraGrid3); } /// /// 查询行 /// /// /// private void doQueryBasePriceC(String strId) { dataTable2.Clear(); PurBidFunctionCEntity pc = new PurBidFunctionCEntity(); pc.VersionNo = strId; pc.Validflag = "1"; DataTable re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "doQureyBidFunctionC", new object[] { pc }); if (re.Rows.Count>0) { re.DefaultView.Sort = "ID asc"; re = re.DefaultView.ToTable(); } GridHelper.CopyDataToDatatable(re, dataTable2, true); comm.RefreshAndAutoSizeExceptColumns(ultraGrid2); } // 加载附件 private void getOrderAppend(string strOrderId, string p) { fujian.Clear(); OrderAppend append = new OrderAppend(); append.OrderId = strOrderId; append.Validflag = "1"; DataTable dt = this.execute("com.hnshituo.pur.order.service.OrderAppendService", "find", new object[] { append, 0, 0 }); GridHelper.CopyDataToDatatable(dt, dataTable6, true); GridHelper.RefreshAndAutoSize(ultraGrid4); if (!String.IsNullOrEmpty(p)) { PublicTools.publicPms.doActiveSelRow(ultraGrid4, "CERTPATH", p); } } /// /// 添加 /// private void AddBasePriceM() { PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); if (String.IsNullOrEmpty(edtName.Text.Trim())) { MessageUtil.ShowTips("方案名称不能为空"); edtName.Focus(); return; } //if (String.IsNullOrEmpty(txt_remark.Text.Trim())) //{ // MessageUtil.ShowTips("请填写申请部门意见"); // txt_remark.Focus(); // return; //} pm.Remark = txt_remark.Text.Trim(); pm.Name = edtName.Text.Trim(); pm.BuyerUnitCode =UserInfo.GetDeptid(); pm.BuyerUnitDesc = this.UserInfo.GetDepartment(); if (MessageUtil.ShowYesNoAndQuestion("确定新增?") != DialogResult.Yes) { return; } string strId = this.execute("com.hnshituo.pur.utils.service.UtilsService", "getOddNumber_yymm", new object[] { "PUR_BID_FUNCTION_M", "ID", "FA", "4" }); pm.Id = strId; pm.Flag = "0"; pm.Validflag = "1"; pm.Status = "1"; pm.CreateName = UserInfo.GetUserName(); pm.CreateTime = System.DateTime.Now; pm.CreateUserid = UserInfo.GetUserID(); //DataTable re1 = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doQureyBidFunctionM", new object[] { pm }); CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doInsert", new object[] { pm }); if (re.Resultcode == 0) { MessageBox.Show("新增成功", "提示"); QureyBasePriceM(re.Resultmsg); } else { MessageBox.Show("操作失败:" + re.Resultmsg, "提示"); return; } } /// /// 提报 /// private void doEffect() { if (ultraGrid1.ActiveRow==null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus=getTaskStatusNum(); if (strStatus != "1" && strStatus!="4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能提报", "提示"); return; } PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Status = "2"; pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); if (MessageUtil.ShowYesNoAndQuestion("确定提报招标方案【" + ultraGrid1.ActiveRow.Cells["NAME"].Value.ToString() + "】?") != DialogResult.Yes) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode == 0) { MessageBox.Show("提报成功", "提示"); QureyBasePriceM(re.Resultmsg); } else { MessageBox.Show("操作失败:" + re.Resultmsg, "提示"); return; } } /// /// 撤销提报 /// private void doRevokeEffect() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } if (getTaskStatusNum() != "2") { MessageBox.Show("当前状态不为业务科长审批,不能撤销", "提示"); return; } PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Status = "1"; pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); if (MessageUtil.ShowYesNoAndQuestion("确定撤销提报招标方案【" + ultraGrid1.ActiveRow.Cells["NAME"].Value.ToString() + "】?") != DialogResult.Yes) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode == 0) { MessageBox.Show("撤销成功", "提示"); QureyBasePriceM(""); } else { MessageBox.Show("撤销失败:" + re.Resultmsg, "提示"); return; } } /// /// 修改分配方案 /// private void doUpdateBidFunctionM() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Remark = txt_remark.Text; pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); if (MessageUtil.ShowYesNoAndQuestion("确定修改招标方案【" + ultraGrid1.ActiveRow.Cells["NAME"].Value.ToString() + "】?") != DialogResult.Yes) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode == 0) { MessageBox.Show("修改成功", "提示"); QureyBasePriceM(pm.Id); } else { MessageBox.Show("修改失败:" + re.Resultmsg, "提示"); return; } } /// /// 保存评标人员意见 /// private void SaveEvaRemark() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } ultraGrid3.UpdateData(); if (MessageUtil.ShowYesNoAndQuestion("确定修改评标人员意见?") != DialogResult.Yes) { return; } foreach (UltraGridRow row in ultraGrid3.Rows) { PurBidFunctionEvasEntity pm = new PurBidFunctionEvasEntity(); pm.EvaMsg = row.Cells["EVAMSG"].Value.ToString(); pm.EvaId = row.Cells["EVAID"].Value.ToString(); CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionEvasService", "doUpdate", new object[] { pm }); if (re.Resultcode == 0) { //QureyBasePriceM(re.Resultmsg); } else { MessageBox.Show("保存失败:" + re.Resultmsg, "提示"); return; } } MessageBox.Show("保存成功", "提示"); doQueryEva(); } /// /// 删除 /// private void DeleteBasePriceM() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能删除", "提示"); return; } PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Validflag = "0"; pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); if (MessageUtil.ShowYesNoAndQuestion("确定删除招标方案【" + ultraGrid1.ActiveRow.Cells["NAME"].Value.ToString() + "】?") != DialogResult.Yes) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode == 0) { MessageBox.Show("删除成功", "提示"); QureyBasePriceM(re.Resultmsg); } else { MessageBox.Show("操作失败:" + re.Resultmsg, "提示"); return; } } /// /// 提报 /// private void doSure() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } if (getTaskStatusNum() != "2") { MessageBox.Show("当前状态不为业务科长审批", "提示"); return; } string strTips = ""; PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); frmExamineShow Fex = new frmExamineShow(); Fex.ShowDialog(); if (Fex.Status == "2")//审批通过 { pm.Status = "5";//去掉审批环节,提报后直接改状态为审批通过 strTips = "通过"; } else if (Fex.Status == "1")//审批不通过 { pm.Status = "4";//去掉审批环节,提报后直接改状态为审批通过 strTips = "不通过"; pm.Examinemessage="业务科长审批不通过【"+Fex.ExamineMessage+"】"; } else { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode != 0) { MessageUtil.ShowTips("审批失败 " + re.Resultmsg); return; } MessageUtil.ShowTips("审批结果:" + strTips); QureyBasePriceM(pm.Id); } /// /// 提报 /// private void doSure1() { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } if (getTaskStatusNum() != "5") { MessageBox.Show("当前状态不为主管部长审批", "提示"); return; } string strTips = ""; PurBidFunctionMEntity pm = new PurBidFunctionMEntity(); pm.Id = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); frmExamineShow Fex = new frmExamineShow(); Fex.ShowDialog(); if (Fex.Status == "2")//审批通过 { pm.Status = "3";//去掉审批环节,提报后直接改状态为审批通过 strTips = "通过"; } else if (Fex.Status == "1")//审批不通过 { pm.Status = "4";//去掉审批环节,提报后直接改状态为审批通过 pm.Examinemessage = "主管部长审批不通过【" + Fex.ExamineMessage + "】"; strTips = "不通过"; } else { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "doUpdate", new object[] { pm }); if (re.Resultcode != 0) { MessageUtil.ShowTips("审批失败 " + re.Resultmsg); return; } MessageUtil.ShowTips("审批结果:" + strTips); QureyBasePriceM(pm.Id); } /// /// 清空编辑区 /// private void clearTab() { dataTable1.Rows.Clear(); dataTable2.Rows.Clear(); dataTable4.Rows.Clear(); dataTable6.Rows.Clear(); edtName.Clear(); //txt_effectTime.Value = DateTime.Now; txt_remark.Clear(); } private void ultraGrid1_AfterRowActivate(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { return; } String strId = ultraGrid1.ActiveRow.Cells["id"].Value.ToString(); if (String.IsNullOrEmpty(strId)) { return; } PurBidFunctionMEntity pp = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "findById", new object[] { strId }); //判断当前激活行是否为空 edtName.Text = pp.Name; txt_remark.Text = pp.Remark == null ? null : pp.Remark.Replace("\n", "\r\n"); doQueryEva(); doQueryBasePriceC(strId); getOrderAppend(strId, ""); } private void ultraButton1_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } if (string.IsNullOrEmpty(txt_EVA_ORG_ID.Text)) { MessageUtil.ShowTips("请选择人员"); return; } if (string.IsNullOrEmpty(cmb_EVA_ROLE_NAME.Text)) { MessageUtil.ShowTips("请选择角色"); return; } if (dataTable4.Rows.Contains(txt_EVA_USERID.Text)) { MessageUtil.ShowTips("已经存在同一个人员,不要重复添加"); return; } else { ArrayList al_Eva = new ArrayList(); PurBidFunctionEvasEntity TaskEvaUsersEntity = new PurBidFunctionEvasEntity(); string strTaskName = this.execute("com.hnshituo.pur.utils.service.UtilsService", "getOddNumber_yymm", new object[] { "PUR_BID_FUNCTION_EVAS", "EVA_ID", "GNEVA", "3" }); TaskEvaUsersEntity.EvaId = strTaskName; TaskEvaUsersEntity.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); TaskEvaUsersEntity.Validflag = "1"; TaskEvaUsersEntity.CreateName = UserInfo.GetUserName(); TaskEvaUsersEntity.CreateUserid = UserInfo.GetUserID(); TaskEvaUsersEntity.CreateTime = System.DateTime.Now; TaskEvaUsersEntity.EvaRoleId = cmb_EVA_ROLE_NAME.Value.ToString();//角色Id TaskEvaUsersEntity.EvaRoleName = cmb_EVA_ROLE_NAME.Text.ToString();//角色名称 TaskEvaUsersEntity.EvaUserId = txt_EVA_USERID.Text;//用户Id TaskEvaUsersEntity.EvaUserName = txt_EVA_USERNAME.Text;//用户名称 TaskEvaUsersEntity.EvaOrgId = txt_EVA_ORG_ID.Text;//科室Id TaskEvaUsersEntity.EvaOrgName = txt_EVA_ORG_NAME.Text;//科室名称 al_Eva.Add(TaskEvaUsersEntity); for (int i = 0; i < al_Eva.Count; i++) { CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionEvasService", "doInsert", new object[] { TaskEvaUsersEntity }); if (re.Resultcode != 0) { MessageUtil.ShowTips("插入失败 " + re.Resultmsg); return; } } MessageUtil.ShowTips("添加成功!"); doQueryEva(); //清空控件 txt_EVA_ORG_ID.Text = null; txt_EVA_ORG_NAME.Text = null; txt_EVA_USERID.Text = null; txt_EVA_USERNAME.Text = null; cmb_EVA_ROLE_NAME.Value = null; } ultraGrid3.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand); } private void btnSelEvaGroup_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } frmPopSelEvaGroup frm = new frmPopSelEvaGroup(this.ob); frm.ShowDialog(); ArrayList al_Eva = new ArrayList(); if (frm.dtEvaGroup != null) { DataTable dt = frm.dtEvaGroup; //string strTaskName = this.execute("com.hnshituo.pur.utils.service.UtilsService", "getOddNumber_yymm", new object[] { "PUR_BID_FUNCTION_EVAS", "EVA_ID", "GNEVA", "3" }); //添加评标人员 foreach (DataRow dr in dt.Rows) { if (!dataTable4.Rows.Contains(dr["EVAUSERID"])) { PurBidFunctionEvasEntity TaskEvaUsersEntity = new PurBidFunctionEvasEntity(); //TaskEvaUsersEntity.EvaId = strTaskName; TaskEvaUsersEntity.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); TaskEvaUsersEntity.Validflag = "1"; TaskEvaUsersEntity.CreateName = UserInfo.GetUserName(); TaskEvaUsersEntity.CreateUserid = UserInfo.GetUserID(); TaskEvaUsersEntity.CreateTime = System.DateTime.Now; TaskEvaUsersEntity.EvaRoleId = dr["EVAROLEID"].ToString();//评审角色编号 TaskEvaUsersEntity.EvaRoleName = dr["EVAROLENAME"].ToString();//评审角色 TaskEvaUsersEntity.EvaOrgId = dr["EVAORGID"].ToString();//评审人部门编号 TaskEvaUsersEntity.EvaOrgName = dr["EVAORGNAME"].ToString();//评审人部门 TaskEvaUsersEntity.EvaUserName = dr["EVAUSERNAME"].ToString();//评审人 TaskEvaUsersEntity.EvaUserId = dr["EVAUSERID"].ToString();//评审人 al_Eva.Add(TaskEvaUsersEntity); } } } if (al_Eva.Count == 0) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionEvasService", "doInsertBFEvas", new object[] { al_Eva }); if (re.Resultcode != 0) { MessageUtil.ShowTips("插入失败 " + re.Resultmsg); return; } MessageUtil.ShowTips("添加成功!"); doQueryEva(); //清空控件 txt_EVA_ORG_ID.Text = null; txt_EVA_ORG_NAME.Text = null; txt_EVA_USERID.Text = null; txt_EVA_USERNAME.Text = null; cmb_EVA_ROLE_NAME.Value = null; } /// /// 删除评标人员 /// /// /// private void ultraButton2_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } PurBidFunctionEvasEntity TaskEvaUsersEntity = new PurBidFunctionEvasEntity(); TaskEvaUsersEntity.EvaId = ultraGrid3.ActiveRow.Cells["EvaId"].Value.ToString(); TaskEvaUsersEntity.Validflag = "0"; if (MessageUtil.ShowYesNoAndQuestion("确定删除人员" + ultraGrid3.ActiveRow.Cells["EVAUSERNAME"].Value.ToString() + "?") != DialogResult.Yes) { return; } CoreResult re = this.execute("com.hnshituo.pur.purplan.service.BidFunctionEvasService", "doUpdate", new object[] { TaskEvaUsersEntity }); if (re.Resultcode != 0) { MessageUtil.ShowTips("删除失败 " + re.Resultmsg); return; } MessageUtil.ShowTips("删除成功!"); doQueryEva(); } private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e) { try { if (e.Button.Key.ToLower().Equals("insert")) { OpenFileDialog file = new OpenFileDialog(); file.Multiselect = false; DialogResult drStat; drStat = file.ShowDialog(); if (drStat == DialogResult.OK) { fileName = file.FileName; string filena = System.IO.Path.GetFileName(fileName); txt_certPath.Text = filena; } } } catch (Exception ex) { MessageUtil.ShowTips("操作失败:" + ex); } } private void ultraButton3_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } if (ultraGrid1.ActiveRow == null) { MessageUtil.ShowTips("未选择方案"); return; } string strId = ultraGrid1.ActiveRow.GetValue("id"); if (String.IsNullOrEmpty(strId)) { MessageUtil.ShowTips("方案ID为空"); return; } String filena = txt_certPath.Text.ToString().Trim(); if (String.IsNullOrEmpty(filena) || String.IsNullOrEmpty(fileName)) { MessageUtil.ShowTips("请选择待上传文件"); return; } OrderAppend sat = new OrderAppend(); sat.OrderId = strId; String filePathNew = "Pms/CERT/" + strId + "/"; sat.CertPath = filena; sat.CertPathOld = filePathNew + filena; sat.CreateUserid = UserInfo.GetUserID(); sat.CreateName = UserInfo.GetUserName(); sat.CreateTime = DateTime.Now; sat.Validflag = "1"; sat.CertDesc = txt_CERTDESC.Text.Trim(); if (GetCraftFileCraftNoCnt(filena, strId) > 0) { MessageUtil.ShowTips("方案已存在该附件文件:" + filena); return; } List list = new List(); FileBean bean = new FileBean(); bean = new FileBean(); bean.setFileName(filena); bean.setPathName(filePathNew); bean.setFile(FileHelper.FileToArray(fileName)); list.Add(bean); bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list); if (isSuccess) { //开始写数据库 CoreResult crt = this.execute("com.hnshituo.pur.order.service.OrderAppendService", "insert_append", new object[] { sat }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("上传失败:" + crt.Resultmsg); } else { MessageUtil.ShowTips("上传成功"); ClearTab5(); } } else { MessageBox.Show("上传失败"); } //刷新界面并激活当前行 getOrderAppend(sat.OrderId, sat.CertPath); } /// /// 判断是否之前已提交相同的文件 /// /// /// private int GetCraftFileCraftNoCnt(string CERT_PATH, string orderId) { OrderAppend sat = new OrderAppend(); sat.CertPath = CERT_PATH; sat.OrderId = orderId; sat.Validflag = "1"; int dt = this.execute("com.hnshituo.pur.order.service.OrderAppendService", "count", new object[] { sat }); return dt; } private void ClearTab5() { txt_certPath.Clear(); txt_CERTDESC.Clear(); fileName = ""; } private void ultraButton4_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } UltraGridRow uge = ultraGrid1.ActiveRow; if (uge == null) { MessageUtil.ShowTips("请选择方案!"); return; } String strId = uge.Cells["id"].Value.ToString().Trim(); if (String.IsNullOrEmpty(strId)) { MessageUtil.ShowTips("该方案ID为空!"); return; } UltraGridRow rowAppend = ultraGrid4.ActiveRow; if (rowAppend == null) { MessageUtil.ShowTips("请选择需删除的附件!"); return; } String strAppendID = rowAppend.Cells["ID"].Value.ToString().Trim(); String strcertPath = rowAppend.Cells["CERTPATH"].Value.ToString().Trim(); String strCertPathOld = rowAppend.Cells["CERTPATHOLD"].Value.ToString().Trim(); if (String.IsNullOrEmpty(strAppendID)) { MessageUtil.ShowTips("该价格政策附件编号为空!"); return; } if (String.IsNullOrEmpty(strCertPathOld)) { MessageUtil.ShowTips("未获取到任务单附件地址信息!"); return; } //验证任务单头是否可以增删改 if (testOrderAppendStatus(strAppendID, 1) == false) { return; } OrderAppend append = new OrderAppend(); append.Id = strAppendID; append.Validflag = "0"; append.DeleteName = UserInfo.GetUserName(); append.DeleteTime = DateTime.Now; append.DeleteUserid = UserInfo.GetUserID(); if (MessageUtil.ShowYesNoAndQuestion("确定删除附件:" + strcertPath + "?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.order.service.OrderAppendService", "delete_append", new object[] { append }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("删除失败!" + crt.Resultmsg); return; } else { bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Delete(strCertPathOld); if (isSuccess) { MessageUtil.ShowTips("删除成功"); } else { MessageBox.Show("删除成功"); } } getOrderAppend(strId, ""); } /// /// 验证价格政策输入数据的有效性 /// /// private bool testOrderAppendStatus(String strId, int p)// 验证合同附件 { OrderAppend append = this.execute("com.hnshituo.pur.order.service.OrderAppendService", "findById", new object[] { strId }); if (append == null) { MessageUtil.ShowTips("未发现价格政策附件:" + strId + "信息记录,可能已作废"); return false; } if (append.Validflag != "1") { MessageUtil.ShowTips("价格政策附件:" + strId + "信息记录可能已作废"); return false; } if (append.CreateUserid != UserInfo.GetUserID()) { MessageUtil.ShowTips("非本人上传价格政策附件无权限进行增删改"); return false; } if (p == 1) { } else { MessageUtil.ShowTips("未知参数:" + p + ""); return false; } return true; } private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e) { try { UltraGridRow row = ultraGrid4.ActiveRow; string filePathOld = row.GetValue("certPathOld"); if (e.Button.Key.ToLower().Equals("select")) { FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld); down.DeleteButton.Visible = false; down.ShowDialog(); } } catch (Exception ex) { MessageUtil.ShowTips("操作失败:" + ex); } } /// /// 获取最大排名+1 /// /// private int OrderNum() { PurBidFunctionCEntity pc = new PurBidFunctionCEntity(); pc.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); pc.Validflag = "1"; int num = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "count", new object[] { pc }); num = num + 1; return num; } //新增排名 private void ultraButton5_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } //判定总分配比例不能超过100 PurBidFunctionCEntity pc1 = new PurBidFunctionCEntity(); pc1.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); pc1.Validflag = "1"; DataTable dt = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "find", new object[] { pc1,0,0 }); double numAssignValue = 0; foreach(DataRow dr in dt.Rows) { double d = double.Parse(dr["AssignValue"].ToString()); numAssignValue += d; } int num = OrderNum(); PurBidFunctionCEntity pc = new PurBidFunctionCEntity(); string strId = this.execute("com.hnshituo.pur.utils.service.UtilsService", "getOddNumber_yymm", new object[] { "PUR_BID_FUNCTION_C", "ID", "GZ", "4" }); pc.Id = strId; pc.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); pc.Validflag = "1"; pc.CreateName = UserInfo.GetUserName(); pc.CreateTime = System.DateTime.Now; pc.CreateUserid = UserInfo.GetUserID(); pc.Remark = txtRemark_BidFunctionC.Text; pc.AssignName = num.ToString(); if (ultraNumericEditor1.Value == null ) { MessageUtil.ShowTips("请输入>0的排名比例"); return; } else { numAssignValue += double.Parse(ultraNumericEditor1.Value.ToString()); pc.AssignValue = ultraNumericEditor1.Value.ToString(); if(numAssignValue>100) { MessageUtil.ShowTips("所有的名次比例总和不能>100%"); return; } } CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "doInsert", new object[] { pc }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("插入失败:" + crt.Resultmsg); } else { MessageUtil.ShowTips("插入成功"); } doQueryBasePriceC(pc.VersionNo); } private void ultraButton7_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } //判定总分配比例不能超过100 PurBidFunctionCEntity pc = new PurBidFunctionCEntity(); pc.Id = ultraGrid2.ActiveRow.Cells["Id"].Value.ToString(); pc.Remark = txtRemark_BidFunctionC.Text; pc.UpdateName = UserInfo.GetUserName(); pc.UpdateUserid = UserInfo.GetUserID(); if (ultraNumericEditor1.Value == null) { MessageUtil.ShowTips("请输入排名比例"); return; } else { pc.AssignValue = ultraNumericEditor1.Value.ToString(); PurBidFunctionCEntity pc1 = new PurBidFunctionCEntity(); pc1.VersionNo = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); pc1.Validflag = "1"; DataTable dt = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "find", new object[] { pc1, 0, 0 }); double numAssignValue = 0; foreach (DataRow dr in dt.Rows) { if (ultraGrid2.ActiveRow.Cells["Id"].Value.ToString() == dr["id"].ToString()) { double d = double.Parse(ultraNumericEditor1.Value.ToString()); numAssignValue += d; } else { double d = double.Parse(dr["AssignValue"].ToString()); numAssignValue += d; } } if (numAssignValue > 100) { MessageUtil.ShowTips("所有的名次比例总和不能>100%"); return; } } if (MessageUtil.ShowYesNoAndQuestion("确定修改" + ultraGrid2.ActiveRow.Cells["ASSIGNNAME"].Value.ToString() + "的比例为"+pc.AssignValue+"?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "doUpdate", new object[] { pc }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("修改失败:" + crt.Resultmsg); } else { MessageUtil.ShowTips("修改成功"); } doQueryBasePriceC(ultraGrid1.ActiveRow.Cells["ID"].Value.ToString()); } private void ultraButton6_Click(object sender, System.EventArgs e) { if (ultraGrid1.ActiveRow == null) { MessageBox.Show("请选择方案", "提示"); return; } string strStatus = getTaskStatusNum(); if (strStatus != "1" && strStatus != "4") { MessageBox.Show("方案必须为待提报或者审批不通过状态才能修改", "提示"); return; } PurBidFunctionCEntity pc = new PurBidFunctionCEntity(); pc.Validflag = "1"; pc.VersionNo = ultraGrid1.ActiveRow.Cells["Id"].Value.ToString(); pc.AssignName = (OrderNum() - 1).ToString(); DataTable dt=this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "find", new object[] { pc, 0, 0 }); if (dt.Rows.Count<1) { MessageUtil.ShowTips("删除失败:未找到可删除的排名"); return; } pc.Id = dt.Rows[0]["ID"].ToString(); if (MessageUtil.ShowYesNoAndQuestion("确定删除第" + dt.Rows[0]["ASSIGNNAME"].ToString() + "名分配规则?") != DialogResult.Yes) { return; } CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.BidFunctionCService", "doDelete", new object[] { pc }); if (crt.Resultcode != 0) { MessageUtil.ShowTips("删除失败:" + crt.Resultmsg); } else { MessageUtil.ShowTips("删除成功"); } doQueryBasePriceC(ultraGrid1.ActiveRow.Cells["ID"].Value.ToString()); } private void txt_EVA_USERNAME_EditorButtonClick(object sender, EditorButtonEventArgs e) { SetectManByDept frm = new SetectManByDept(this.ob, this.UserInfo.GetDeptid()); frm.ShowDialog(); txt_EVA_ORG_ID.Text = frm.StrDeptId; txt_EVA_ORG_NAME.Text = frm.StrDeptName; txt_EVA_USERID.Text = frm.StrUserID; txt_EVA_USERNAME.Text = frm.StrUserName; } private void ultraGrid2_Click(object sender, System.EventArgs e) { this.ultraTabControl1.SelectedTab = this.ultraTabControl1.Tabs["1"]; } private void ultraGrid1_Click(object sender, System.EventArgs e) { this.ultraTabControl1.SelectedTab = this.ultraTabControl1.Tabs["0"]; } private void ultraGrid3_Click(object sender, System.EventArgs e) { this.ultraTabControl1.SelectedTab = this.ultraTabControl1.Tabs["2"]; } private void ultraGrid4_Click(object sender, System.EventArgs e) { this.ultraTabControl1.SelectedTab = this.ultraTabControl1.Tabs["3"]; } public string getTaskStatusNum() { string strTaskStatus = ""; PurBidFunctionMEntity M_PurTaskM = new PurBidFunctionMEntity(); M_PurTaskM = this.execute("com.hnshituo.pur.purplan.service.BidFunctionMService", "findById", new object[] { ultraGrid1.ActiveRow.Cells["ID"].Value.ToString() }); if (M_PurTaskM != null) { strTaskStatus = M_PurTaskM.Status; } return strTaskStatus; } } }