private void LoadData() { try { //基本信息 string SupplierCode = Request["SupplierCode"] + ""; string projectCode = Request["projectCode"] + ""; EntityData entity = ProjectDAO.GetStandard_SupplierByCode(SupplierCode); if (entity.HasRecord()) { this.lblSupplierName.Text = entity.GetString("SupplierName"); this.lblAbbreviation.Text = entity.GetString("Abbreviation"); this.lblAreaCode.Text = entity.GetString("AreaCode"); this.lblProduct.Text = entity.GetString("Product").Replace("\n", "<br>"); this.lblQuality.Text = entity.GetString("Quality").Replace("\n", "<br>"); this.lblAchievement.Text = entity.GetString("Achievement").Replace("\n", "<br>"); this.lblCheckOpinion.Text = entity.GetString("CheckOpinion").Replace("\n", "<br>"); this.lblContractPerson.Text = entity.GetString("ContractPerson"); this.lblCreditLevel.Text = entity.GetString("CreditLevel"); this.lblIndustrySort.Text = entity.GetString("IndustrySort"); this.lblIndustryType.Text = entity.GetString("IndustryType"); this.lblLicenseID.Text = entity.GetString("LicenseID"); this.lblOfficePhone.Text = entity.GetString("OfficePhone"); this.lblMobile.Text = entity.GetString("Mobile"); this.lblFax.Text = entity.GetString("Fax"); this.lblPostCode.Text = entity.GetString("PostCode"); this.lblEmail.Text = entity.GetString("EMail"); this.lblWebAddress.Text = entity.GetString("WebAddress"); this.lblRegisteredAddress.Text = entity.GetString("RegisteredAddress"); this.lblRegisteredCapital.Text = entity.GetString("RegisteredCapital"); this.lblSJHG.Text = entity.GetString("SJHG"); this.lblTaxID.Text = entity.GetString("TaxID"); this.lblTaxNo.Text = entity.GetString("TaxNo"); this.lblWorkAddress.Text = entity.GetString("WorkAddress"); this.lblWorkTimeLimit.Text = entity.GetString("WorkTimeLimit"); this.lblArtificialPerson.Text = entity.GetString("ArtificialPerson"); this.lblWorkScope.Text = entity.GetString("WorkScope"); this.lblStructure.Text = entity.GetString("Structure"); this.lblRemark.Text = entity.GetString("Remark"); this.lblTypeName.Text = BLL.ProjectRule.GetSupplierTypeName(entity.GetString("SupplierTypeCode")); this.lblSaleType.Text = entity.GetString("saleType"); this.lblCharacterType.Text = entity.GetString("characterType"); this.lblCCC.Text = RmsPM.BLL.SupplierRule.GetTypeName(entity.GetString("IsCCC")); this.lblISO.Text = RmsPM.BLL.SupplierRule.GetTypeName(entity.GetString("IsISO")); this.lblQualityGrade.Text = entity.GetString("QualityGrade") == "" ? "未定" : entity.GetString("QualityGrade"); this.lblOpenBank.Text = entity.GetString("OpenBank"); this.lblReciver.Text = entity.GetString("Reciver"); this.lblAccount.Text = entity.GetString("Account"); } switch (this.up_sPMName.ToLower()) { case "shidaipm": this.isAuditted.Visible = true; this.TdisAuditted.Visible = true; this.isAuditted.Text = RmsPM.BLL.SupplierRule.GetIsAuditted(entity.GetInt("Status")); this.PreWorkFlowPoint.ColSpan = 4; break; case "shimaopm": this.btnGradeAdd.Visible = this.user.HasRight("2701"); this.btnPursveWorkflow.Visible = this.user.HasRight("2709"); this.DataGrid_supplierRecord.Visible = false; this.DataGrid_supplierGrade.Visible = true; RmsPM.BLL.GradeMessage cgradeMessage = new GradeMessage(); cgradeMessage.SupplierCode = SupplierCode; //cgradeMessage.State = "0"; System.Data.DataTable dtGradeMessage = cgradeMessage.GetGradeMessages(); RmsPM.DAL.QueryStrategy.WorkFlowHistory sbGradeMessage = new RmsPM.DAL.QueryStrategy.WorkFlowHistory(); sbGradeMessage.AddStrategy(new Strategy(WorkFlowHistoryStrategyName.ProcedureNameAndApplicationCodein, this.GetWorkFlowListString(dtGradeMessage))); if (!((User)Session["User"]).HasOperationRight("090102")) { sbGradeMessage.AddStrategy(new Strategy(WorkFlowHistoryStrategyName.ActUserCode, ((User)Session["User"]).UserCode)); } sbGradeMessage.AddOrder("CreateDate", false); string sqlGradeMessage = sbGradeMessage.BuildMainQueryString(); QueryAgent qaGradeMessage = new QueryAgent(); DataSet dsGradeMessage = qaGradeMessage.ExecSqlForDataSet(sqlGradeMessage); qaGradeMessage.Dispose(); if (dsGradeMessage != null) { DataTable dttempgradeMessage = dsGradeMessage.Tables[0]; dttempgradeMessage.Columns.Add("ProjectManage", System.Type.GetType("System.String")); dttempgradeMessage.Columns.Add("State", System.Type.GetType("System.String")); dttempgradeMessage.Columns.Add("SupplierCode", System.Type.GetType("System.String")); foreach (DataRow dr in dttempgradeMessage.Select()) { if (dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'").Length != 0) { dr["ProjectManage"] = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["ProjectManage"].ToString(); dr["State"] = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["State"].ToString(); dr["SupplierCode"] = dtGradeMessage.Select("GradeMessageCode='" + dr["ApplicationCode"] + "'")[0]["SupplierCode"].ToString(); } } this.DataGrid_supplierGrade.DataSource = dttempgradeMessage; this.WorkFlowPoint.Visible = true; this.lblGradePoint.Visible = true; if (dtGradeMessage.Select("state='0'").Length != 0) { this.lblGradePoint.Text = RmsPM.BLL.GradeList.GetSumGradePoint(dtGradeMessage.Select("state='0'")[0]["GradeMessageCode"].ToString()); } this.DataGrid_supplierGrade.DataBind(); } this.PreAuditted.ColSpan = 4; break; default: this.btnPG.Visible = true; this.DataGrid_supplierRecord.Visible = true; this.DataGrid_supplierGrade.Visible = false; this.isAuditted.Visible = false; this.TdisAuditted.Visible = false; this.PreAuditted.ColSpan = 4; this.PreWorkFlowPoint.ColSpan = 4; DataGrid_supplierRecord.DataSource = new DataView(entity.Tables["SupplierOpinion"], "", "OpinionDate DESC", DataViewRowState.CurrentRows); DataGrid_supplierRecord.DataBind(); break; } ContractStrategyBuilder sb = new ContractStrategyBuilder(); sb.AddStrategy(new Strategy(ContractStrategyName.SupplierCode, SupplierCode)); sb.AddStrategy(new Strategy(ContractStrategyName.Status, "0,1,2")); if (projectCode != "") { sb.AddStrategy(new Strategy(ContractStrategyName.ProjectCode, projectCode)); } ArrayList arAccess = new ArrayList(); arAccess.Add("050101"); arAccess.Add(user.UserCode); arAccess.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(ContractStrategyName.AccessRange, arAccess)); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); EntityData contract = qa.FillEntityData("Contract", sql); qa.Dispose(); contract.CurrentTable.Columns.Add("TypeName"); contract.CurrentTable.Columns.Add("StatusName"); contract.CurrentTable.Columns.Add("CheckDisplay"); //是否有权限审核,控制按钮的显示隐藏 contract.CurrentTable.Columns.Add("AHMoney", System.Type.GetType("System.Decimal")); contract.CurrentTable.Columns.Add("PHMoney", System.Type.GetType("System.Decimal")); int iCount = contract.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { contract.SetCurrentRow(i); contract.CurrentRow["TypeName"] = BLL.ContractRule.GetContractTypeName(contract.GetString("Type")); contract.CurrentRow["StatusName"] = BLL.ContractRule.GetContractStatusName(contract.GetInt("Status").ToString()); decimal ah = BLL.ContractRule.GetContractPayment(contract.GetString("ContractCode")); decimal totalMoney = contract.GetDecimal("TotalMoney"); contract.CurrentRow["AHMoney"] = ah; contract.CurrentRow["PHMoney"] = totalMoney - ah; } this.dgContract.DataSource = contract; this.dgContract.DataBind(); contract.Dispose(); LoadDocument(); // 当前厂商询价记录 LoadEnquiry(); //当前厂商联系人 LoadLinkman(); //厂商财务编码 LoadSupplierSubjectSet(entity); //添加调查意见 LoadSurvey(); //加载公司主题 LoadCompanyTitle(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "载入页面出错"); Response.Write(Rms.Web.JavaScript.Alert(true, "载入页面出错")); } }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { if ((this.divContractIDEdit.Visible) && (this.txtContractID.Value.Trim() == "")) { Response.Write(Rms.Web.JavaScript.Alert(true, "请填写合同编号 !")); return; } if (this.ContractDate.Value == "") { Response.Write(Rms.Web.JavaScript.Alert(true, "请填写生效时间 !")); return; } if (this.txtContractPerson.Value == "") { Response.Write(Rms.Web.JavaScript.Alert(true, "请选择负责人 !")); return; } try { string contractCode = Request["ContractCode"] + ""; //合同编号审核后自动生成 if ((this.txtContractID.Value.Trim() == "") && (lblContractIDAutoCreate.Visible)) { this.txtContractID.Value = BLL.ContractRule.AutoCreateContractID(contractCode, this.up_sPMName); this.lblContractID.Text = this.txtContractID.Value; } EntityData entity = DAL.EntityDAO.ContractDAO.GetStandard_ContractByCode(contractCode); int status = entity.GetInt("Status"); entity.CurrentRow["Status"] = 0; entity.CurrentRow["CheckPerson"] = base.user.UserCode; entity.CurrentRow["ContractID"] = this.txtContractID.Value; entity.CurrentRow["CheckOpinion"] = this.TextBoxCheckOpinion.Text; entity.CurrentRow["CheckDate"] = this.ContractDate.Value; entity.CurrentRow["ContractPerson"] = this.txtContractPerson.Value; if (status != 4) { if (this.ContractDate.Value != "") { entity.CurrentRow["ContractDate"] = this.ContractDate.Value; } else { entity.CurrentRow["ContractDate"] = null; } } // 如果是变更请求 if (status == 4) { string contractLabel = entity.GetString("ContractLabel"); ContractStrategyBuilder sb = new ContractStrategyBuilder(); sb.AddStrategy(new Strategy(ContractStrategyName.ContractLabel, contractLabel)); sb.AddStrategy(new Strategy(ContractStrategyName.Status, "0")); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); EntityData con = qa.FillEntityData("Contract", sql); qa.Dispose(); string oldContractCode = con.GetString("ContractCode"); EntityData oldEntity = DAL.EntityDAO.ContractDAO.GetStandard_ContractByCode(oldContractCode); oldEntity.CurrentRow["Status"] = 6; DAL.EntityDAO.ContractDAO.UpdateStandard_Contract(oldEntity); //修改原合同的文档到新合同 EntityData entityTempDSB = DAL.EntityDAO.DocumentDAO.GetDocumentAllInfoByMainCode("000001", oldContractCode); foreach (DataRow drDocument in entityTempDSB.CurrentTable.Rows) { drDocument["code"] = contractCode; } DAL.EntityDAO.DocumentDAO.UpdateDocumentConfig(entityTempDSB); entityTempDSB.Dispose(); //修改原合同招投标到新合同 EntityData entityBidding = DAL.EntityDAO.ContractDAO.GetContractBiddingByContractCode(oldContractCode); foreach (DataRow drBidding in entityBidding.CurrentTable.Rows) { drBidding["ContractCode"] = contractCode; } DAL.EntityDAO.ContractDAO.UpdateContractBidding(entityBidding); //修改原合同招投标的供应商到新合同 EntityData entitySupplier = DAL.EntityDAO.ContractDAO.GetBiddingSupplierByContractCode(oldContractCode); foreach (DataRow drSupplier in entitySupplier.CurrentTable.Rows) { drSupplier["ContractCode"] = contractCode; } DAL.EntityDAO.ContractDAO.UpdateContractBiddingSupplier(entitySupplier); // 请款单明细, 将付款子表中的AllocateCode通过AllocateLabel 改正到新合同的AllocateCode // 注意: 必须先修改请款单的子表再修改主表。否则会找不到内容。 EntityData paymentItem = DAL.EntityDAO.PaymentDAO.GetPaymentItemByContractCode(oldContractCode); foreach (DataRow drPaymentItem in paymentItem.CurrentTable.Rows) { string oldContractCostCode = (string)drPaymentItem["AllocateCode"]; string contractCostLabel = (string)oldEntity.Tables["ContractCost"].Select(String.Format("ContractCostCode='{0}'", oldContractCostCode))[0]["ContractCostLabel"]; string newContractCostCode = (string)entity.Tables["ContractCost"].Select(String.Format("ContractCostLabel='{0}'", contractCostLabel))[0]["ContractCostCode"]; drPaymentItem["AllocateCode"] = newContractCostCode; } //修改原合同的付款记录到新合同 EntityData entityPayment = DAL.EntityDAO.PaymentDAO.GetPaymentByContractCode(oldContractCode); foreach (DataRow drPayment in entityPayment.CurrentTable.Rows) { drPayment["ContractCode"] = contractCode; } DAL.EntityDAO.PaymentDAO.UpdatePayment(entityPayment); DAL.EntityDAO.PaymentDAO.UpdatePaymentItem(paymentItem); paymentItem.Dispose(); oldEntity.Dispose(); } DAL.EntityDAO.ContractDAO.UpdateContract(entity); entity.Dispose(); CloseWindow(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "审核出错:" + ex.Message)); } }