protected void Page_Load(object sender, EventArgs e) { GetHiddenParme(); if (!IsPostBack) { //wfControl.InitWFDict(); var workID = Request.QueryString["WorkID"]; workID = workID ?? "-9999999"; //workID = "355"; var contract = new TMisContractLogic().SelectByObject(new TMisContractVo { REMARK5 = workID }); this.hidTaskId.Value = contract.ID; } if (Request.QueryString["type"] == "check") { if (Request.QueryString["test"] == "false") { Response.Write(HttpUtility.UrlEncode("false状态不正确,不能发送")); } //else //{ // Response.Write("true"); //} Response.ContentType = "text/plain"; //Request.ContentEncoding = Encoding.GetEncoding("GBK"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var workID = Request.QueryString["WorkID"]; workID = workID ?? "-9999999"; //workID = "355"; var contract = new TMisContractLogic().SelectByObject(new TMisContractVo { REMARK5 = workID }); if (string.IsNullOrEmpty(contract.ID)) { this.hidIsNew.Value = "true"; } else { this.hidIsNew.Value = "false"; this.hidTaskId.Value = contract.ID; } //wfControl.InitWFDict(); } //获取隐藏域参数 GetHiddenParme(); // if (!String.IsNullOrEmpty(task_id)&&!String.IsNullOrEmpty(strTaskCode)&&!String.IsNullOrEmpty(strTaskProjectName)) //修复无委托书编号时,无法进行工作流注册的问题 胡方扬2013-05-20 //if (!String.IsNullOrEmpty(task_id)&&!String.IsNullOrEmpty(strTaskProjectName)) // { // //注册委托书编号 // wfControl.ServiceCode = strTaskCode; // //注册委托书项目名称 // wfControl.ServiceName = strTaskProjectName; //} }
/// <summary> /// 获取备注 /// </summary> /// <param name="strTaskID">监测任务</param> /// <returns></returns> protected string GetRemark(string strTaskID) { string strRemark = ""; TMisMonitorTaskVo objTask = new TMisMonitorTaskLogic().Details(strTaskID); TMisContractVo objContract = new TMisContractLogic().Details(objTask.CONTRACT_ID); //备注信息 同意分包 if (!string.IsNullOrEmpty(objContract.AGREE_OUTSOURCING)) { strRemark += new TSysDictLogic().GetDictNameByDictCodeAndType("accept_subpackage", "Contract_Remarks") + ";"; } //备注信息 是否同意使用的监测方法 if (!string.IsNullOrEmpty(objContract.AGREE_METHOD)) { strRemark += new TSysDictLogic().GetDictNameByDictCodeAndType("accept_useMonitorMethod", "Contract_Remarks") + ";"; } //是否同意使用非标准方法 if (!string.IsNullOrEmpty(objContract.AGREE_NONSTANDARD)) { strRemark += new TSysDictLogic().GetDictNameByDictCodeAndType("accept_usenonstandard", "Contract_Remarks") + ";"; } //是否同意其他 if (!string.IsNullOrEmpty(objContract.AGREE_OTHER)) { strRemark += new TSysDictLogic().GetDictNameByDictCodeAndType("accept_other", "Contract_Remarks") + ";"; } return(strRemark); }
protected void SetReport(string strContractID) { //获取委托书信息 TMisContractVo objContract = new TMisContractLogic().Details(strContractID); #region 构造监测任务对象 TMisMonitorTaskVo objTask = new TMisMonitorTaskVo(); CopyObject(objContract, objTask); objTask.ID = GetSerialNumber("t_mis_monitor_taskId"); objTask.CONTRACT_ID = objContract.ID; objTask.PLAN_ID = ""; objTask.CONSIGN_DATE = objContract.ASKING_DATE; objTask.CREATOR_ID = LogInfo.UserInfo.ID; objTask.CREATE_DATE = DateTime.Now.ToString(); objTask.TASK_STATUS = "09"; objTask.COMFIRM_STATUS = "0"; #endregion #region 构造监测任务委托企业信息 //委托企业信息 TMisContractCompanyVo objContractClient = new TMisContractCompanyLogic().Details(objContract.CLIENT_COMPANY_ID); //受检企业信息 TMisContractCompanyVo objContractTested = new TMisContractCompanyLogic().Details(objContract.TESTED_COMPANY_ID); //构造监测任务委托企业信息 TMisMonitorTaskCompanyVo objTaskClient = new TMisMonitorTaskCompanyVo(); CopyObject(objContractClient, objTaskClient);//复制对象 objTaskClient.ID = GetSerialNumber("t_mis_monitor_taskcompanyId"); objTaskClient.TASK_ID = objTask.ID; objTaskClient.COMPANY_ID = objContract.CLIENT_COMPANY_ID; //构造监测任务受检企业信息 TMisMonitorTaskCompanyVo objTaskTested = new TMisMonitorTaskCompanyVo(); CopyObject(objContractTested, objTaskTested);//复制对象 objTaskTested.ID = GetSerialNumber("t_mis_monitor_taskcompanyId"); objTaskTested.TASK_ID = objTask.ID; objTaskTested.COMPANY_ID = objContract.TESTED_COMPANY_ID; //重新赋值监测任务企业ID objTask.CLIENT_COMPANY_ID = objTaskClient.ID; objTask.TESTED_COMPANY_ID = objTaskTested.ID; #endregion #region 构造监测报告 TMisMonitorReportVo objReportVo = new TMisMonitorReportVo(); objReportVo.ID = GetSerialNumber("t_mis_monitor_report_id"); objReportVo.TASK_ID = objTask.ID; objReportVo.REPORT_CODE = objTask.CONTRACT_CODE; objReportVo.REPORT_EX_ATTACHE_ID = GetAttID(objTask.CONTRACT_ID, "AcceptanceContract"); objReportVo.IF_GET = "0"; if (new TMisMonitorTaskLogic().SaveTrans(objTask, objTaskClient, objTaskTested, objReportVo)) { WriteLog("生成验收委托监测任务", "", LogInfo.UserInfo.USER_NAME + "生成验收委托监测任务" + objTask.ID + "成功"); } #endregion }
/// <summary> /// 获得委托书信息 /// </summary> protected string getContractInfo() { string strSortname = Request.Params["sortname"]; string strSortorder = Request.Params["sortorder"]; int intPageIdx = Convert.ToInt32(Request.Params["page"]); int intPagesize = Convert.ToInt32(Request.Params["pagesize"]); //合同ID if (!string.IsNullOrEmpty(Request.QueryString["contract_id"])) { string strContractId = Request.QueryString["contract_id"].ToString(); //委托年度 string strYear = !string.IsNullOrEmpty(Request.QueryString["SrhYear"]) ? Request.QueryString["SrhYear"].ToString() : ""; //委托类型 string strContractType = !string.IsNullOrEmpty(Request.QueryString["SrhContractType"]) ? Request.QueryString["SrhContractType"].ToString() : ""; //合同号 string strContractCode = !string.IsNullOrEmpty(Request.QueryString["SrhContractCode"]) ? Request.QueryString["SrhContractCode"].ToString() : ""; //任务单号 string strDutyCode = !string.IsNullOrEmpty(Request.QueryString["DutyCode"]) ? Request.QueryString["DutyCode"].ToString() : ""; //报告号 string strReportCode = !string.IsNullOrEmpty(Request.QueryString["ReportCode"]) ? Request.QueryString["ReportCode"].ToString() : ""; //委托客户 string strClientName = !string.IsNullOrEmpty(Request.QueryString["ClientName"]) ? Request.QueryString["ClientName"].ToString() : ""; //合同类别 string strItemType = !string.IsNullOrEmpty(Request.QueryString["ItemType"]) ? Request.QueryString["ItemType"].ToString() : ""; //项目名称 string strProjectName = !string.IsNullOrEmpty(Request.QueryString["SrhProjectName"]) ? Request.QueryString["SrhProjectName"].ToString() : ""; //构造查询对象 TMisContractVo objContract = new TMisContractVo(); TMisContractLogic objContractLogic = new TMisContractLogic(); if (strSortname == null || strSortname.Length == 0) { strSortname = TMisContractVo.CONTRACT_CODE_FIELD; } objContract.ID = strContractId; objContract.SORT_FIELD = strSortname; objContract.SORT_TYPE = strSortorder; objContract.CONTRACT_YEAR = strYear; objContract.CONTRACT_TYPE = strContractType; objContract.CONTRACT_CODE = strContractCode; objContract.CLIENT_COMPANY_ID = strClientName; objContract.TEST_TYPE = strItemType; objContract.PROJECT_NAME = strProjectName; int intTotalCount = objContractLogic.GetSelectResultCount(objContract);//总计的数据条数 DataTable dt = objContractLogic.SelectByTable(objContract, intPageIdx, intPagesize); return(CreateToJson(dt, intTotalCount)); } return(""); }
/// <summary> /// 获得委托书信息 /// </summary> protected void SelectContract() { string strSortname = Request.Params["sortname"]; string strSortorder = Request.Params["sortorder"]; int intPageIdx = Convert.ToInt32(Request.Params["page"]); int intPagesize = Convert.ToInt32(Request.Params["pagesize"]); //委托年度 string strYear = !string.IsNullOrEmpty(Request.QueryString["SrhYear"]) ? Request.QueryString["SrhYear"].ToString() : ""; //委托类型 string strContractType = !string.IsNullOrEmpty(Request.QueryString["SrhContractType"]) ? Request.QueryString["SrhContractType"].ToString() : ""; //合同号 string strContractCode = !string.IsNullOrEmpty(Request.QueryString["SrhContractCode"]) ? Request.QueryString["SrhContractCode"].ToString() : ""; //任务单号 string strDutyCode = !string.IsNullOrEmpty(Request.QueryString["DutyCode"]) ? Request.QueryString["DutyCode"].ToString() : ""; //报告号 string strReportCode = !string.IsNullOrEmpty(Request.QueryString["ReportCode"]) ? Request.QueryString["ReportCode"].ToString() : ""; //委托客户 string strClientName = !string.IsNullOrEmpty(Request.QueryString["ClientName"]) ? Request.QueryString["ClientName"].ToString() : ""; //合同类别 string strItemType = !string.IsNullOrEmpty(Request.QueryString["ItemType"]) ? Request.QueryString["ItemType"].ToString() : ""; //项目名称 string strProjectName = !string.IsNullOrEmpty(Request.QueryString["SrhProjectName"]) ? Request.QueryString["SrhProjectName"].ToString() : ""; //构造查询对象 TMisContractVo objContract = new TMisContractVo(); TMisContractLogic objContractLogic = new TMisContractLogic(); if (strSortname == null || strSortname.Length == 0) { strSortname = TMisContractVo.CONTRACT_CODE_FIELD; } //objContract.SORT_FIELD = strSortname; //objContract.SORT_TYPE = strSortorder; objContract.SORT_FIELD = "ID"; objContract.SORT_TYPE = "desc"; objContract.CONTRACT_YEAR = strYear; objContract.CONTRACT_TYPE = "05"; objContract.PROJECT_ID = base.LogInfo.UserInfo.ID; objContract.CONTRACT_CODE = strContractCode; objContract.PROJECT_NAME = strProjectName; objContract.CLIENT_COMPANY_ID = strClientName; objContract.TEST_TYPE = strItemType; int intTotalCount = objContractLogic.GetSelectResultCount(objContract);//总计的数据条数 DataTable dt = objContractLogic.SelectByTable(objContract, intPageIdx, intPagesize); string strJson = CreateToJson(dt, intTotalCount); Response.Write(strJson); Response.End(); }
/// <summary> /// 发送时更改委托书提交状态 /// </summary> protected string ChangeStatusBySend() { TMisContractVo objContractVo = new TMisContractVo(); objContractVo.ID = this.CONTRACT_ID.Value; objContractVo.CONTRACT_STATUS = "9"; new TMisContractLogic().Edit(objContractVo); //委托书信息 objContractVo = new TMisContractLogic().Details(this.CONTRACT_ID.Value); wfControl.ServiceCode = objContractVo.CONTRACT_CODE; wfControl.ServiceName = objContractVo.PROJECT_NAME; return(objContractVo.ID); }
void IWFStepRules.CreatAndRegisterBusinessData() { TMisContractVo objContractVo = new TMisContractLogic().Details(this.CONTRACT_ID.Value.Trim()); //这里是产生和注册业务数据的地方 if (this.CONTRACT_ID.Value.Length > 0 && this.hidBtnType.Value.Trim() == "send") { if (objContractVo.CONTRACT_STATUS == "3") { //方案编制 objContractVo.CONTRACT_STATUS = "4"; } else if (objContractVo.CONTRACT_STATUS == "4") { //方案审核 objContractVo.CONTRACT_STATUS = "5"; } else if (objContractVo.CONTRACT_STATUS == "5") { //费用审核 objContractVo.CONTRACT_STATUS = "9"; } wfControl.DoContractTaskWF(this.CONTRACT_ID.Value, this.hidCompanyId.Value, this.hidBtnType.Value, strConfigFreqSetting); new TMisContractLogic().Edit(objContractVo); } else if (this.CONTRACT_ID.Value.Length > 0 && this.hidBtnType.Value.Trim() == "back") { if (objContractVo.CONTRACT_STATUS == "5") { //费用审核 objContractVo.CONTRACT_STATUS = "4"; } else if (objContractVo.CONTRACT_STATUS == "4") { //方案审核 objContractVo.CONTRACT_STATUS = "3"; } else if (objContractVo.CONTRACT_STATUS == "3") { //方案编制 objContractVo.CONTRACT_STATUS = "2"; } wfControl.DoContractTaskWF(this.CONTRACT_ID.Value, this.hidCompanyId.Value, this.hidBtnType.Value, strConfigFreqSetting); new TMisContractLogic().Edit(objContractVo); } }
/// <summary> /// 获得受检企业信息 /// </summary> /// <returns></returns> protected string GetTestedCompanyInfo() { //委托书信息 TMisContractVo objContractInfo = new TMisContractVo(); objContractInfo.ID = this.hdnContracID.Value; objContractInfo.CONTRACT_STATUS = "9"; objContractInfo = new TMisContractLogic().Details(objContractInfo); //受检企业 TMisContractCompanyVo objTestedInfo = new TMisContractCompanyVo(); objTestedInfo.ID = objContractInfo.TESTED_COMPANY_ID; objTestedInfo.IS_DEL = "0"; objTestedInfo = new TMisContractCompanyLogic().Details(objTestedInfo); return(ToJson(objTestedInfo)); }
protected void Page_Load(object sender, EventArgs e) { GetHiddenParme(); if (!IsPostBack) { //wfControl.InitWFDict(); var workID = Request.QueryString["WorkID"]; workID = workID ?? "-9999999"; //workID = "355"; var contract = new TMisContractLogic().SelectByObject(new TMisContractVo { REMARK5 = workID }); this.hidTaskId.Value = contract.ID; } }
void IWFStepRules.CreatAndRegisterBusinessData() { TMisContractVo objContractVo = new TMisContractLogic().Details(this.CONTRACT_ID.Value.Trim()); //这里是产生和注册业务数据的地方 if (this.CONTRACT_ID.Value.Length > 0 && this.hidBtnType.Value.Trim() == "send") { if (objContractVo.CONTRACT_STATUS == "0") { //委托书录入 wfControl.ServiceCode = objContractVo.CONTRACT_CODE; wfControl.ServiceName = objContractVo.PROJECT_NAME; objContractVo.CONTRACT_STATUS = "1"; } else if (objContractVo.CONTRACT_STATUS == "1") { //副站长审核 objContractVo.CONTRACT_STATUS = "2"; } else if (objContractVo.CONTRACT_STATUS == "2") { //主任审核 objContractVo.CONTRACT_STATUS = "3"; } wfControl.DoContractTaskWF(this.CONTRACT_ID.Value, this.hidCompanyId.Value, this.hidBtnType.Value, strConfigFreqSetting); new TMisContractLogic().Edit(objContractVo); } else if (this.CONTRACT_ID.Value.Length > 0 && this.hidBtnType.Value.Trim() == "back") { if (objContractVo.CONTRACT_STATUS == "2") { //主任审核 objContractVo.CONTRACT_STATUS = "1"; } else if (objContractVo.CONTRACT_STATUS == "1") { //副站长审核 objContractVo.CONTRACT_STATUS = "0"; } wfControl.DoContractTaskWF(this.CONTRACT_ID.Value, this.hidCompanyId.Value, this.hidBtnType.Value, strConfigFreqSetting); new TMisContractLogic().Edit(objContractVo); } }
/// <summary> /// 获得委托书信息 /// </summary> protected void SelectContract() { string strSortname = Request.Params["sortname"]; string strSortorder = Request.Params["sortorder"]; int intPageIdx = Convert.ToInt32(Request.Params["page"]); int intPagesize = Convert.ToInt32(Request.Params["pagesize"]); //委托年度 string strContract_id = !string.IsNullOrEmpty(Request.QueryString["contract_id"]) ? Request.QueryString["contract_id"].ToString() : ""; if (strContract_id.Trim().Length == 0) { Response.Write(""); Response.End(); return; } //构造查询对象 TMisContractVo objContract = new TMisContractVo(); TMisContractLogic objContractLogic = new TMisContractLogic(); if (strSortname == null || strSortname.Length == 0) { strSortname = TMisContractVo.CONTRACT_CODE_FIELD; } objContract.SORT_FIELD = strSortname; objContract.SORT_TYPE = strSortorder; objContract.ID = strContract_id; //int intTotalCount = objContractLogic.GetSelectResultCount(objContract);//总计的数据条数 DataTable dt = objContractLogic.SelectByTable(objContract, 0, 0); string strJson = CreateToJson(dt, dt.Rows.Count); Response.Write(strJson); Response.End(); }
/// <summary> /// 获得委托点位信息 /// </summary> /// <param name="strContractID">委托书ID</param> /// <returns></returns> protected void getContractPoint(string strContractID) { string strSortname = Request.Params["sortname"]; string strSortorder = Request.Params["sortorder"]; int intPageIdx = Convert.ToInt32(Request.Params["page"]); int intPagesize = Convert.ToInt32(Request.Params["pagesize"]); //构造查询对象 TMisContractPointVo objPoint = new TMisContractPointVo(); TMisContractPointLogic objPointLogic = new TMisContractPointLogic(); if (strSortname == null || strSortname.Length == 0) { strSortname = TMisContractPointVo.NUM_FIELD; } objPoint.SORT_FIELD = strSortname; objPoint.SORT_TYPE = strSortorder; objPoint.CONTRACT_ID = strContractID; objPoint.IS_DEL = "0"; int intTotalCount = objPointLogic.GetSelectResultCount(objPoint);//总计的数据条数 DataTable dt = objPointLogic.SelectByTable(objPoint, intPageIdx, intPagesize); //插入委托书编号 if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { dr["REMARK1"] = new TMisContractLogic().Details(strContractID).CONTRACT_CODE; } } string strJson = CreateToJson(dt, intTotalCount); Response.Write(strJson); Response.End(); }
protected void btnExport_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); TMisContractVo objItems = new TMisContractVo(); if (!String.IsNullOrEmpty(task_id)) { objItems.ID = task_id; } dt = new TMisContractLogic().GetExportInforData(objItems); FileStream file = new FileStream(HttpContext.Current.Server.MapPath("TempFile/ContractInforSheet.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); //插入委托书单号 sheet.GetRow(2).GetCell(6).SetCellValue("No:" + dt.Rows[0]["CONTRACT_CODE"].ToString()); sheet.GetRow(4).GetCell(2).SetCellValue(dt.Rows[0]["COMPANY_NAME"].ToString()); sheet.GetRow(4).GetCell(5).SetCellValue(dt.Rows[0]["CONTACT_NAME"].ToString()); sheet.GetRow(4).GetCell(8).SetCellValue(dt.Rows[0]["PHONE"].ToString()); sheet.GetRow(5).GetCell(2).SetCellValue(dt.Rows[0]["CONTACT_ADDRESS"].ToString()); sheet.GetRow(5).GetCell(5).SetCellValue(dt.Rows[0]["POST"].ToString()); DataTable dtDict = PageBase.getDictList("RPT_WAY"); DataTable dtSampleSource = PageBase.getDictList("SAMPLE_SOURCE"); string strWay = "", strSampleWay = "";; if (dtDict != null) { foreach (DataRow dr in dtDict.Rows) { strWay += dr["DICT_TEXT"].ToString(); if (dr["DICT_CODE"].ToString() == dt.Rows[0]["RPT_WAY"].ToString()) { strWay += "■ "; } else { strWay += "□ "; } } } if (dtSampleSource != null) { foreach (DataRow dr in dtSampleSource.Rows) { strSampleWay += dr["DICT_TEXT"].ToString(); if (dr["DICT_TEXT"].ToString() == dt.Rows[0]["SAMPLE_SOURCE"].ToString()) { strSampleWay += "■ "; } else { strSampleWay += "□ "; } } } sheet.GetRow(5).GetCell(8).SetCellValue(strWay); sheet.GetRow(7).GetCell(2).SetCellValue(strSampleWay); sheet.GetRow(8).GetCell(2).SetCellValue(dt.Rows[0]["TEST_PURPOSE"].ToString()); sheet.GetRow(9).GetCell(2).SetCellValue(dt.Rows[0]["PROVIDE_DATA"].ToString()); sheet.GetRow(11).GetCell(2).SetCellValue(dt.Rows[0]["OTHER_ASKING"].ToString()); sheet.GetRow(16).GetCell(1).SetCellValue(dt.Rows[0]["MONITOR_ACCORDING"].ToString()); sheet.GetRow(20).GetCell(1).SetCellValue(dt.Rows[0]["REMARK2"].ToString()); using (MemoryStream stream = new MemoryStream()) { hssfworkbook.Write(stream); HttpContext curContext = HttpContext.Current; // 设置编码和附件格式 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Response.ContentEncoding = Encoding.UTF8; curContext.Response.Charset = ""; curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("委托监测协议书-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8)); curContext.Response.BinaryWrite(stream.GetBuffer()); curContext.Response.End(); } }
protected void btnExport_QY_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); TMisContractVo objItems = new TMisContractVo(); string strWorkContent = ""; if (!String.IsNullOrEmpty(task_id)) { objItems.ID = task_id; } dt = new TMisContractLogic().GetExportInforData(objItems); FileStream file = new FileStream(HttpContext.Current.Server.MapPath("TempFile/QY/ContractInforSheet.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); //插入委托书单号 sheet.GetRow(2).GetCell(6).SetCellValue("No:" + dt.Rows[0]["CONTRACT_CODE"].ToString()); sheet.GetRow(4).GetCell(2).SetCellValue(dt.Rows[0]["COMPANY_NAME"].ToString()); //委托单位 sheet.GetRow(4).GetCell(5).SetCellValue(dt.Rows[0]["CONTACT_NAME"].ToString()); //联系人 sheet.GetRow(4).GetCell(8).SetCellValue(dt.Rows[0]["PHONE"].ToString()); //联系电话 sheet.GetRow(5).GetCell(2).SetCellValue(dt.Rows[0]["CONTACT_ADDRESS"].ToString()); //地址 sheet.GetRow(5).GetCell(5).SetCellValue(dt.Rows[0]["POST"].ToString()); //邮编 sheet.GetRow(9).GetCell(2).SetCellValue(dt.Rows[0]["TESTED_COMPANY_NAME"].ToString()); //受检单位 sheet.GetRow(9).GetCell(4).SetCellValue(dt.Rows[0]["TESTED_PHONE"].ToString()); //联系电话 sheet.GetRow(9).GetCell(8).SetCellValue(dt.Rows[0]["TESTED_CONTACT_ADDRESS"].ToString()); //地址 sheet.GetRow(9).GetCell(6).SetCellValue(dt.Rows[0]["TESTED_POST"].ToString()); //邮编 DataTable dtDict = PageBase.getDictList("RPT_WAY"); DataTable dtSampleSource = PageBase.getDictList("SAMPLE_SOURCE"); string strWay = "", strSampleWay = "";; if (dtDict != null) { foreach (DataRow dr in dtDict.Rows) { strWay += dr["DICT_TEXT"].ToString(); if (dr["DICT_CODE"].ToString() == dt.Rows[0]["RPT_WAY"].ToString()) { strWay += "■ "; } else { strWay += "□ "; } } } if (dtSampleSource != null) { foreach (DataRow dr in dtSampleSource.Rows) { strSampleWay += dr["DICT_TEXT"].ToString(); if (dr["DICT_TEXT"].ToString() == dt.Rows[0]["SAMPLE_SOURCE"].ToString()) { strSampleWay += "■ "; } else { strSampleWay += "□ "; } } } sheet.GetRow(5).GetCell(8).SetCellValue(strWay); //领取方式 sheet.GetRow(6).GetCell(2).SetCellValue(strSampleWay); //监测类型 sheet.GetRow(7).GetCell(2).SetCellValue(dt.Rows[0]["TEST_PURPOSE"].ToString()); //监测目的 sheet.GetRow(8).GetCell(2).SetCellValue(dt.Rows[0]["PROVIDE_DATA"].ToString()); //提供资料 sheet.GetRow(10).GetCell(2).SetCellValue(dt.Rows[0]["OTHER_ASKING"].ToString()); //其他要求 sheet.GetRow(15).GetCell(1).SetCellValue(dt.Rows[0]["MONITOR_ACCORDING"].ToString()); //监测依据 sheet.GetRow(20).GetCell(1).SetCellValue(dt.Rows[0]["REMARK2"].ToString()); //备注 string strExplain = @"1.是否有分包:□是[□电话确认;□其它: ] □否 是否使用非标准方法: □是 □否 2.监测收费参照广东省物价局粤价函[1996]64号文规定执行。委托单位到本站办公室(603室)领取《清远市非税收入缴款通知书》限期到通知书列明的银行所属任何一个网点缴监测费{0}元({1}),到颁行缴款后应将盖有银行收讫章的广东省非税收入(电子)票据执收单位联送回给本站综合室。 3.本站在确认已缴监测费用和委托方提供了必要的监测条件后60个工作日内完成监测。"; string strBUDGET = dt.Rows[0]["BUDGET"].ToString() == "" ? "0" : dt.Rows[0]["BUDGET"].ToString(); strExplain = string.Format(strExplain, strBUDGET, DaXie(strBUDGET)); sheet.GetRow(18).GetCell(1).SetCellValue(strExplain); //监测内容 string[] strMonitroTypeArr = dt.Rows[0]["TEST_TYPES"].ToString().Split(';'); if (dt.Rows[0]["SAMPLE_SOURCE"].ToString() == "送样") { //strWorkContent += "地表水、地下水(送样)\n"; int intLen = strMonitroTypeArr.Length; int INTSHOWLEN = 0; foreach (string strMonitor in strMonitroTypeArr) { INTSHOWLEN++; strWorkContent += GetMonitorName(strMonitor) + "、"; if (INTSHOWLEN == intLen - 1) { strWorkContent += "(送样)\n"; } } } //获取当前监测点信息 TMisContractPointVo ContractPointVo = new TMisContractPointVo(); ContractPointVo.CONTRACT_ID = task_id; ContractPointVo.IS_DEL = "0"; DataTable dtPoint = new TMisContractPointLogic().SelectByTable(ContractPointVo); string strOutValuePoint = "", strOutValuePointItems = ""; if (strMonitroTypeArr.Length > 0) { foreach (string strMonitor in strMonitroTypeArr) { string strMonitorName = "", strPointName = ""; DataRow[] drPoint = dtPoint.Select("MONITOR_ID='" + strMonitor + "'"); if (drPoint.Length > 0) { foreach (DataRow drrPoint in drPoint) { string strPointNameForItems = "", strPointItems = ""; strMonitorName = GetMonitorName(strMonitor) + ":"; strPointName += drrPoint["POINT_NAME"].ToString() + "、"; //获取当前点位的监测项目 TMisContractPointitemVo ContractPointitemVo = new TMisContractPointitemVo(); ContractPointitemVo.CONTRACT_POINT_ID = drrPoint["ID"].ToString(); DataTable dtPointItems = new TMisContractPointitemLogic().GetItemsForPoint(ContractPointitemVo); if (dtPointItems.Rows.Count > 0) { foreach (DataRow drItems in dtPointItems.Rows) { strPointNameForItems = strMonitorName.Substring(0, strMonitorName.Length - 1) + drrPoint["POINT_NAME"] + "(" + (drrPoint["SAMPLE_DAY"].ToString() == "" ? "1" : drrPoint["SAMPLE_DAY"].ToString()) + "天" + (drrPoint["SAMPLE_FREQ"].ToString() == "" ? "1" : drrPoint["SAMPLE_FREQ"].ToString()) + "次):"; strPointItems += drItems["ITEM_NAME"].ToString() + "、"; } strOutValuePointItems += strPointNameForItems + strPointItems.Substring(0, strPointItems.Length - 1) + ";\n"; } } //获取输出监测类型监测点位信息 strOutValuePoint += strMonitorName + strPointName.Substring(0, strPointName.Length - 1) + ";\n"; } } } strWorkContent += "监测点位:\n" + strOutValuePoint; strWorkContent += "监测因子与频次:\n" + strOutValuePointItems; sheet.GetRow(12).GetCell(1).SetCellValue(strWorkContent); using (MemoryStream stream = new MemoryStream()) { hssfworkbook.Write(stream); HttpContext curContext = HttpContext.Current; // 设置编码和附件格式 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Response.ContentEncoding = Encoding.UTF8; curContext.Response.Charset = ""; curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("委托监测协议书-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8)); curContext.Response.BinaryWrite(stream.GetBuffer()); curContext.Response.End(); } }
/// <summary> /// 获得委托书信息 /// </summary> protected void SelectContract() { string strSortname = Request.Params["sortname"]; string strSortorder = Request.Params["sortorder"]; int intPageIdx = Convert.ToInt32(Request.Params["page"]); int intPagesize = Convert.ToInt32(Request.Params["pagesize"]); //未办、已办状态 0:未办,1:已办 string strStatus = !string.IsNullOrEmpty(Request.QueryString["Status"]) ? Request.QueryString["Status"].ToString() : ""; //委托年度 string strYear = !string.IsNullOrEmpty(Request.QueryString["SrhYear"]) ? Request.QueryString["SrhYear"].ToString() : ""; //委托类型 string strContractType = !string.IsNullOrEmpty(Request.QueryString["SrhContractType"]) ? Request.QueryString["SrhContractType"].ToString() : ""; //合同号 string strContractCode = !string.IsNullOrEmpty(Request.QueryString["SrhContractCode"]) ? Request.QueryString["SrhContractCode"].ToString() : ""; //任务单号 string strDutyCode = !string.IsNullOrEmpty(Request.QueryString["DutyCode"]) ? Request.QueryString["DutyCode"].ToString() : ""; //报告号 string strReportCode = !string.IsNullOrEmpty(Request.QueryString["ReportCode"]) ? Request.QueryString["ReportCode"].ToString() : ""; //委托客户 string strClientName = !string.IsNullOrEmpty(Request.QueryString["ClientName"]) ? Request.QueryString["ClientName"].ToString() : ""; //合同类别 string strItemType = !string.IsNullOrEmpty(Request.QueryString["ItemType"]) ? Request.QueryString["ItemType"].ToString() : ""; //项目名称 string strProjectName = !string.IsNullOrEmpty(Request.QueryString["SrhProjectName"]) ? Request.QueryString["SrhProjectName"].ToString() : ""; //构造查询对象 TMisContractVo objContract = new TMisContractVo(); TMisContractLogic objContractLogic = new TMisContractLogic(); if (strSortname == null || strSortname.Length == 0) { strSortname = TMisContractVo.CONTRACT_CODE_FIELD; } //objContract.SORT_FIELD = strSortname; //objContract.SORT_TYPE = strSortorder; objContract.SORT_FIELD = "ID"; objContract.SORT_TYPE = "desc"; objContract.CONTRACT_YEAR = strYear; objContract.CONTRACT_TYPE = strContractType; objContract.CONTRACT_CODE = strContractCode; objContract.CLIENT_COMPANY_ID = strClientName; objContract.TEST_TYPE = strItemType; objContract.PROJECT_NAME = strProjectName; //int intTotalCount = objContractLogic.GetSelectResultCountEx(objContract, strStatus);//总计的数据条数 //DataTable dt = objContractLogic.SelectByTableEx(objContract, strStatus, intPageIdx, intPagesize); //string strJson = CreateToJson(dt, intTotalCount); string strJson = ""; //int intTotalCount = objTaskLogic.GetSelectResultCount(objTask);//总计的数据条数 DataTable dt = objContractLogic.SelectByTableEx(objContract, strStatus, 0, 0); int intTotalCount = dt.Rows.Count; var ccflowDt = CCFlowFacade.GetCCFLowStatus(this.LogInfo.UserInfo.USER_NAME, dt, strStatus, intPageIdx, intPagesize, out intTotalCount); strJson = CreateToJson(ccflowDt, intTotalCount); Response.Write(strJson); Response.End(); }
/// <summary> /// 预约办理 /// </summary> /// <param name="strPlanID">预约表ID</param> protected string doPlanTask(string strPlanID) { string strReturn = ""; string strTaskFreqType = "0"; strTaskFreqType = System.Configuration.ConfigurationManager.AppSettings["TaskFreqType"].ToString(); //预约表对象 TMisContractPlanVo objContractPlan = new TMisContractPlanLogic().Details(strPlanID); if (objContractPlan != null) { //获取委托书信息 TMisContractVo objContract = new TMisContractLogic().Details(objContractPlan.CONTRACT_ID); #region 构造监测任务对象 TMisMonitorTaskVo objTask = new TMisMonitorTaskVo(); CopyObject(objContract, objTask); objTask.ID = GetSerialNumber("t_mis_monitor_taskId"); objTask.CONTRACT_ID = objContract.ID; objTask.PLAN_ID = strPlanID; objTask.CONSIGN_DATE = objContract.ASKING_DATE; objTask.CREATOR_ID = LogInfo.UserInfo.ID; objTask.CREATE_DATE = DateTime.Now.ToString(); objTask.TASK_STATUS = "01"; objTask.COMFIRM_STATUS = "0"; if (!String.IsNullOrEmpty(Request.Params["strContractYear"])) { objTask.CONTRACT_YEAR = Request.Params["strContractYear"].ToString(); } if (!String.IsNullOrEmpty(Request.Params["strTest_Type"])) { objTask.TEST_TYPE = Request.Params["strTest_Type"].ToString(); } if (!String.IsNullOrEmpty(Request.Params["strAskingDate"])) { objTask.ASKING_DATE = Request.Params["strAskingDate"].ToString(); } //objTask.QC_STATUS = "1"; if (!String.IsNullOrEmpty(objTask.TEST_TYPE)) { TMisContractVo objContract_Edit = new TMisContractVo(); objContract_Edit.ID = objContract.ID; objContract_Edit.TEST_TYPES = objTask.TEST_TYPE; new TMisContractLogic().Edit(objContract_Edit); } //string strQcSetting = ConfigurationManager.AppSettings["QCsetting"].ToString(); //if (!String.IsNullOrEmpty(strQcSetting)) //{ // if (strQcSetting == "1") // { // objTask.QC_STATUS = "1"; // } // else // { // objTask.QC_STATUS = "2"; // } //} //生成任务编号 TBaseSerialruleVo objSerialTask = new TBaseSerialruleVo(); objSerialTask.SERIAL_TYPE = "4"; //潘德军 2013-12-23 任务单号可改,且初始不生成 //objTask.TICKET_NUM = PageBase.CreateBaseDefineCode(objSerialTask, objContract); objTask.TICKET_NUM = "未编号"; #endregion #region 构造监测任务委托企业信息 //委托企业信息 TMisContractCompanyVo objContractClient = new TMisContractCompanyLogic().Details(objContract.CLIENT_COMPANY_ID); //受检企业信息 TMisContractCompanyVo objContractTested = new TMisContractCompanyLogic().Details(objContract.TESTED_COMPANY_ID); //构造监测任务委托企业信息 TMisMonitorTaskCompanyVo objTaskClient = new TMisMonitorTaskCompanyVo(); CopyObject(objContractClient, objTaskClient);//复制对象 objTaskClient.ID = GetSerialNumber("t_mis_monitor_taskcompanyId"); objTaskClient.TASK_ID = objTask.ID; objTaskClient.COMPANY_ID = objContract.CLIENT_COMPANY_ID; //构造监测任务受检企业信息 TMisMonitorTaskCompanyVo objTaskTested = new TMisMonitorTaskCompanyVo(); CopyObject(objContractTested, objTaskTested);//复制对象 objTaskTested.ID = GetSerialNumber("t_mis_monitor_taskcompanyId"); objTaskTested.TASK_ID = objTask.ID; objTaskTested.COMPANY_ID = objContract.TESTED_COMPANY_ID; //重新赋值监测任务企业ID objTask.CLIENT_COMPANY_ID = objTaskClient.ID; objTask.TESTED_COMPANY_ID = objTaskTested.ID; #endregion #region 监测报告 胡方扬 2013-04-23 Modify 将报告记录初始化生成数据移到委托书办理完毕后就生成 TMisMonitorReportVo objReportVo = new TMisMonitorReportVo(); objReportVo.ID = GetSerialNumber("t_mis_monitor_report_id"); //生成报告编号 胡方扬 2013-04-24 //TBaseSerialruleVo objSerial = new TBaseSerialruleVo(); //objSerial.SERIAL_TYPE = "3"; //objReportVo.REPORT_CODE = PageBase.CreateBaseDefineCode(objSerial, objContract); DataTable objDt = PageBase.getDictList("RptISWT_Code"); if (objDt.Rows.Count > 0) { if (objDt.Rows[0]["DICT_CODE"].ToString() == "1") { objReportVo.REPORT_CODE = objTask.TICKET_NUM; } } objReportVo.TASK_ID = objTask.ID; objReportVo.IF_GET = "0"; #endregion #region 监测子任务信息 根据委托书监测类别进行构造 //监测子任务信息 根据委托书监测类别进行构造 ArrayList arrSubTask = new ArrayList(); //监测子任务集合 ArrayList arrTaskPoint = new ArrayList(); //监测点位集合 ArrayList arrPointItem = new ArrayList(); //监测点位明细集合 ArrayList arrSample = new ArrayList(); //样品集合 ArrayList arrSampleResult = new ArrayList(); //样品结果集合 ArrayList arrSampleResultApp = new ArrayList(); //样品分析执行表 #endregion //监测类别集合 DataTable dtTestType = new TMisContractPointLogic().GetTestType(strPlanID); //预约点位 DataTable dtPoint = new TMisContractPointLogic().SelectPointTable(strPlanID); //获取预约点位明细信息 DataTable dtContractPoint = new TMisContractPointLogic().SelectByTableForPlan(strPlanID); //监测子任务 #region 监测子任务 if (dtTestType.Rows.Count > 0) { string strSubTaskIDs = new PageBase().GetSerialNumberList("t_mis_monitor_subtaskId", dtTestType.Rows.Count); string[] arrSubTaskIDs = strSubTaskIDs.Split(','); for (int i = 0; i < dtTestType.Rows.Count; i++) { string str = dtTestType.Rows[i]["MONITOR_ID"].ToString();//监测类别 if (str.Length > 0) { #region 监测子任务 //监测子任务 TMisMonitorSubtaskVo objSubtask = new TMisMonitorSubtaskVo(); string strSampleManagerID = ""; //采样负责人ID string strSampleID = ""; //采样协同人ID串 GetSamplingMan(str, objContract.ID, ref strSampleManagerID, ref strSampleID); objSubtask.ID = arrSubTaskIDs[i]; objSubtask.TASK_ID = objTask.ID; objSubtask.MONITOR_ID = str; if (objContract.PROJECT_ID != "") { objSubtask.SAMPLING_MANAGER_ID = objContract.PROJECT_ID; } else { objSubtask.SAMPLING_MANAGER_ID = strSampleManagerID; } objSubtask.SAMPLING_ID = strSampleID; objSubtask.TASK_TYPE = "发送"; objSubtask.TASK_STATUS = "01"; arrSubTask.Add(objSubtask); #endregion #region 类别分点位 //按类别分点位 DataRow[] dtTypePoint = dtPoint.Select("MONITOR_ID=" + str); if (dtTypePoint.Length > 0) { string strTaskPointIDs = new PageBase().GetSerialNumberList("t_mis_monitor_taskpointId", dtTypePoint.Length); string[] arrTaskPointIDs = strTaskPointIDs.Split(','); string strSampleIDs = new PageBase().GetSerialNumberList("MonitorSampleId", dtTypePoint.Length); string[] arrSampleIDs = strSampleIDs.Split(','); for (int j = 0; j < dtTypePoint.Length; j++) { DataRow drPoint = dtTypePoint[j]; #region 监测点位 // 监测点位 TMisMonitorTaskPointVo objTaskPoint = new TMisMonitorTaskPointVo(); objTaskPoint.ID = arrTaskPointIDs[j]; objTaskPoint.TASK_ID = objTask.ID; objTaskPoint.SUBTASK_ID = objSubtask.ID; objTaskPoint.POINT_ID = drPoint["POINT_ID"].ToString(); objTaskPoint.MONITOR_ID = str; objTaskPoint.COMPANY_ID = objTaskTested.ID; objTaskPoint.CONTRACT_POINT_ID = drPoint["ID"].ToString(); objTaskPoint.POINT_NAME = drPoint["POINT_NAME"].ToString(); objTaskPoint.DYNAMIC_ATTRIBUTE_ID = drPoint["DYNAMIC_ATTRIBUTE_ID"].ToString(); objTaskPoint.ADDRESS = drPoint["ADDRESS"].ToString(); objTaskPoint.LONGITUDE = drPoint["LONGITUDE"].ToString(); objTaskPoint.LATITUDE = drPoint["LATITUDE"].ToString(); objTaskPoint.FREQ = drPoint["FREQ"].ToString(); objTaskPoint.DESCRIPTION = drPoint["DESCRIPTION"].ToString(); objTaskPoint.NATIONAL_ST_CONDITION_ID = drPoint["NATIONAL_ST_CONDITION_ID"].ToString(); objTaskPoint.INDUSTRY_ST_CONDITION_ID = drPoint["INDUSTRY_ST_CONDITION_ID"].ToString(); objTaskPoint.LOCAL_ST_CONDITION_ID = drPoint["LOCAL_ST_CONDITION_ID"].ToString(); objTaskPoint.IS_DEL = "0"; objTaskPoint.NUM = drPoint["NUM"].ToString(); objTaskPoint.CREATE_DATE = DateTime.Now.ToString(); arrTaskPoint.Add(objTaskPoint); #endregion //点位采用的标准条件项ID string strConditionID = ""; if (!string.IsNullOrEmpty(objTaskPoint.NATIONAL_ST_CONDITION_ID)) { strConditionID = objTaskPoint.NATIONAL_ST_CONDITION_ID; } if (!string.IsNullOrEmpty(objTaskPoint.LOCAL_ST_CONDITION_ID)) { strConditionID = objTaskPoint.LOCAL_ST_CONDITION_ID; } if (!string.IsNullOrEmpty(objTaskPoint.INDUSTRY_ST_CONDITION_ID)) { strConditionID = objTaskPoint.INDUSTRY_ST_CONDITION_ID; } //计算采样频次 int intFreq = 1, intSampleDay = 1; if (drPoint["SAMPLE_FREQ"].ToString().Length > 0) { intFreq = int.Parse(drPoint["SAMPLE_FREQ"].ToString()); } //计算周期 if (drPoint["SAMPLE_DAY"].ToString().Length > 0) { intSampleDay = int.Parse(drPoint["SAMPLE_DAY"].ToString()); } #region 样品信息、结果、结果执行 #region 如果 strTaskFreqType 判断为0 if (!String.IsNullOrEmpty(strTaskFreqType) && strTaskFreqType == "0") { #region 样品 //样品 与点位对应 TMisMonitorSampleInfoVo objSampleInfo = new TMisMonitorSampleInfoVo(); objSampleInfo.ID = arrSampleIDs[j]; objSampleInfo.SUBTASK_ID = objSubtask.ID; objSampleInfo.POINT_ID = objTaskPoint.ID; objSampleInfo.SAMPLE_NAME = objTaskPoint.POINT_NAME; objSampleInfo.QC_TYPE = "0"; //默认原始样 objSampleInfo.NOSAMPLE = "0"; //默认未采样 arrSample.Add(objSampleInfo); #endregion //预约项目明细 DataRow[] dtPointItem = dtContractPoint.Select("CONTRACT_POINT_ID=" + drPoint["ID"].ToString()); if (dtPointItem.Length > 0) { string strTaskItemIDs = new PageBase().GetSerialNumberList("t_mis_monitor_task_item_id", dtPointItem.Length); string[] arrTaskItemIDs = strTaskItemIDs.Split(','); string strSampleResultIDs = new PageBase().GetSerialNumberList("MonitorResultId", dtPointItem.Length); string[] arrSampleResultIDs = strSampleResultIDs.Split(','); string strResultAppIDs = new PageBase().GetSerialNumberList("MonitorResultAppId", dtPointItem.Length); string[] arrResultAppIDs = strResultAppIDs.Split(','); for (int k = 0; k < dtPointItem.Length; k++) { DataRow drPointItem = dtPointItem[k]; //项目采用的标准上限、下限 string strUp = ""; string strLow = ""; string strConditionType = ""; getStandardValue(drPointItem["ITEM_ID"].ToString(), strConditionID, ref strUp, ref strLow, ref strConditionType); #region 构造监测任务点位明细表 //构造监测任务点位明细表 TMisMonitorTaskItemVo objMonitorTaskItem = new TMisMonitorTaskItemVo(); objMonitorTaskItem.ID = arrTaskItemIDs[k]; objMonitorTaskItem.TASK_POINT_ID = objTaskPoint.ID; objMonitorTaskItem.ITEM_ID = drPointItem["ITEM_ID"].ToString(); objMonitorTaskItem.CONDITION_ID = strConditionID; objMonitorTaskItem.CONDITION_TYPE = strConditionType; objMonitorTaskItem.ST_UPPER = strUp; objMonitorTaskItem.ST_LOWER = strLow; objMonitorTaskItem.IS_DEL = "0"; arrPointItem.Add(objMonitorTaskItem); #endregion #region 构造样品结果表 //构造样品结果表 string strAnalysisID = ""; //分析方法ID string strStandardID = ""; //方法依据ID string strCheckOut = ""; //检出限 getMethod(drPointItem["ITEM_ID"].ToString(), ref strAnalysisID, ref strStandardID, ref strCheckOut); TMisMonitorResultVo objSampleResult = new TMisMonitorResultVo(); objSampleResult.ID = arrSampleResultIDs[k]; objSampleResult.SAMPLE_ID = objSampleInfo.ID; objSampleResult.QC_TYPE = objSampleInfo.QC_TYPE; objSampleResult.ITEM_ID = drPointItem["ITEM_ID"].ToString(); objSampleResult.SAMPLING_INSTRUMENT = GetItemSamplingInstrumentID(drPointItem["ITEM_ID"].ToString()); objSampleResult.ANALYSIS_METHOD_ID = strAnalysisID; objSampleResult.STANDARD_ID = strStandardID; objSampleResult.RESULT_CHECKOUT = strCheckOut; objSampleResult.QC = "0"; // 默认原始样手段 objSampleResult.TASK_TYPE = "发送"; objSampleResult.RESULT_STATUS = "01"; //默认分析结果填报 objSampleResult.PRINTED = "0"; //默认未打印 arrSampleResult.Add(objSampleResult); #endregion #region 构造样品执行表 //构造样品执行表 TMisMonitorResultAppVo objResultApp = new TMisMonitorResultAppVo(); objResultApp.ID = arrResultAppIDs[k]; objResultApp.RESULT_ID = objSampleResult.ID; objResultApp.HEAD_USERID = drPointItem["ANALYSIS_MANAGER"].ToString(); objResultApp.ASSISTANT_USERID = drPointItem["ANALYSIS_ID"].ToString(); arrSampleResultApp.Add(objResultApp); #endregion } } } #endregion #region 如果 strTaskFreqType 判断为1 if (!String.IsNullOrEmpty(strTaskFreqType) && strTaskFreqType == "1") { for (int r = 0; r < intSampleDay; r++) { for (int s = 0; s < intFreq; s++) { #region 样品 //样品 与点位对应 TMisMonitorSampleInfoVo objSampleInfo = new TMisMonitorSampleInfoVo(); //objSampleInfo.ID = arrSampleIDs[j]; objSampleInfo.ID = new PageBase().GetSerialNumberList("MonitorSampleId", 1); objSampleInfo.SUBTASK_ID = objSubtask.ID; objSampleInfo.POINT_ID = objTaskPoint.ID; //objSampleInfo.SAMPLE_NAME = objTaskPoint.POINT_NAME; objSampleInfo.SAMPLE_NAME = objTaskPoint.POINT_NAME + " 第" + (r + 1).ToString() + "天" + " 第" + (s + 1).ToString() + "次"; objSampleInfo.QC_TYPE = "0"; //默认原始样 objSampleInfo.NOSAMPLE = "0"; //默认未采样 arrSample.Add(objSampleInfo); #endregion //预约项目明细 DataRow[] dtPointItem = dtContractPoint.Select("CONTRACT_POINT_ID=" + drPoint["ID"].ToString()); if (dtPointItem.Length > 0) { string strTaskItemIDs = new PageBase().GetSerialNumberList("t_mis_monitor_task_item_id", dtPointItem.Length); string[] arrTaskItemIDs = strTaskItemIDs.Split(','); string strSampleResultIDs = new PageBase().GetSerialNumberList("MonitorResultId", dtPointItem.Length); string[] arrSampleResultIDs = strSampleResultIDs.Split(','); string strResultAppIDs = new PageBase().GetSerialNumberList("MonitorResultAppId", dtPointItem.Length); string[] arrResultAppIDs = strResultAppIDs.Split(','); for (int k = 0; k < dtPointItem.Length; k++) { DataRow drPointItem = dtPointItem[k]; //项目采用的标准上限、下限 string strUp = ""; string strLow = ""; string strConditionType = ""; getStandardValue(drPointItem["ITEM_ID"].ToString(), strConditionID, ref strUp, ref strLow, ref strConditionType); #region 构造监测任务点位明细表 //构造监测任务点位明细表 TMisMonitorTaskItemVo objMonitorTaskItem = new TMisMonitorTaskItemVo(); objMonitorTaskItem.ID = arrTaskItemIDs[k]; objMonitorTaskItem.TASK_POINT_ID = objTaskPoint.ID; objMonitorTaskItem.ITEM_ID = drPointItem["ITEM_ID"].ToString(); objMonitorTaskItem.CONDITION_ID = strConditionID; objMonitorTaskItem.CONDITION_TYPE = strConditionType; objMonitorTaskItem.ST_UPPER = strUp; objMonitorTaskItem.ST_LOWER = strLow; objMonitorTaskItem.IS_DEL = "0"; arrPointItem.Add(objMonitorTaskItem); #endregion #region 构造样品结果表 //构造样品结果表 string strAnalysisID = ""; //分析方法ID string strStandardID = ""; //方法依据ID string strCheckOut = ""; //检出限 getMethod(drPointItem["ITEM_ID"].ToString(), ref strAnalysisID, ref strStandardID, ref strCheckOut); TMisMonitorResultVo objSampleResult = new TMisMonitorResultVo(); objSampleResult.ID = arrSampleResultIDs[k]; objSampleResult.SAMPLE_ID = objSampleInfo.ID; objSampleResult.QC_TYPE = objSampleInfo.QC_TYPE; objSampleResult.ITEM_ID = drPointItem["ITEM_ID"].ToString(); objSampleResult.SAMPLING_INSTRUMENT = GetItemSamplingInstrumentID(drPointItem["ITEM_ID"].ToString()); objSampleResult.ANALYSIS_METHOD_ID = strAnalysisID; objSampleResult.STANDARD_ID = strStandardID; objSampleResult.RESULT_CHECKOUT = strCheckOut; objSampleResult.QC = "0"; // 默认原始样手段 objSampleResult.TASK_TYPE = "发送"; objSampleResult.RESULT_STATUS = "01"; //默认分析结果填报 objSampleResult.PRINTED = "0"; //默认未打印 arrSampleResult.Add(objSampleResult); #endregion #region 构造样品执行表 //构造样品执行表 TMisMonitorResultAppVo objResultApp = new TMisMonitorResultAppVo(); objResultApp.ID = arrResultAppIDs[k]; objResultApp.RESULT_ID = objSampleResult.ID; objResultApp.HEAD_USERID = drPointItem["ANALYSIS_MANAGER"].ToString(); objResultApp.ASSISTANT_USERID = drPointItem["ANALYSIS_ID"].ToString(); arrSampleResultApp.Add(objResultApp); #endregion } } } } } #endregion #endregion } } #endregion } } } #endregion #region 监测子任务 注释 //if (dtTestType.Rows.Count > 0) //{ // string strSubTaskIDs = GetSerialNumberList("t_mis_monitor_subtaskId", dtTestType.Rows.Count); // string[] arrSubTaskIDs = strSubTaskIDs.Split(','); // for (int i = 0; i < dtTestType.Rows.Count; i++) // { // string str = dtTestType.Rows[i]["MONITOR_ID"].ToString();//监测类别 // if (str.Length > 0) // { // #region 监测子任务 // //监测子任务 // TMisMonitorSubtaskVo objSubtask = new TMisMonitorSubtaskVo(); // string strSampleManagerID = "";//采样负责人ID // string strSampleID = "";//采样协同人ID串 // GetSamplingMan(str, objContract.ID, ref strSampleManagerID, ref strSampleID); // objSubtask.ID = arrSubTaskIDs[i]; // objSubtask.TASK_ID = objTask.ID; // objSubtask.MONITOR_ID = str; // if (objContract.PROJECT_ID != "") // { // objSubtask.SAMPLING_MANAGER_ID = objContract.PROJECT_ID; // } // else // { // objSubtask.SAMPLING_MANAGER_ID = strSampleManagerID; // } // objSubtask.SAMPLING_ID = strSampleID; // objSubtask.TASK_TYPE = "发送"; // objSubtask.TASK_STATUS = "01"; // arrSubTask.Add(objSubtask); // #endregion // #region 按类别分点位 // //按类别分点位 // DataRow[] dtTypePoint = dtPoint.Select("MONITOR_ID=" + str); // if (dtTypePoint.Length > 0) // { // string strTaskPointIDs = GetSerialNumberList("t_mis_monitor_taskpointId", dtTypePoint.Length); // string[] arrTaskPointIDs = strTaskPointIDs.Split(','); // string strSampleIDs = GetSerialNumberList("MonitorSampleId", dtTypePoint.Length); // string[] arrSampleIDs = strSampleIDs.Split(','); // for (int j = 0; j < dtTypePoint.Length; j++) // { // DataRow drPoint = dtTypePoint[j]; // #region 监测点位 // // 监测点位 // TMisMonitorTaskPointVo objTaskPoint = new TMisMonitorTaskPointVo(); // objTaskPoint.ID = arrTaskPointIDs[j]; // objTaskPoint.TASK_ID = objTask.ID; // objTaskPoint.SUBTASK_ID = objSubtask.ID; // objTaskPoint.POINT_ID = drPoint["POINT_ID"].ToString(); // objTaskPoint.MONITOR_ID = str; // objTaskPoint.COMPANY_ID = objTaskTested.ID; // objTaskPoint.CONTRACT_POINT_ID = drPoint["ID"].ToString(); // objTaskPoint.POINT_NAME = drPoint["POINT_NAME"].ToString(); // objTaskPoint.DYNAMIC_ATTRIBUTE_ID = drPoint["DYNAMIC_ATTRIBUTE_ID"].ToString(); // objTaskPoint.ADDRESS = drPoint["ADDRESS"].ToString(); // objTaskPoint.LONGITUDE = drPoint["LONGITUDE"].ToString(); // objTaskPoint.LATITUDE = drPoint["LATITUDE"].ToString(); // objTaskPoint.FREQ = drPoint["FREQ"].ToString(); // objTaskPoint.DESCRIPTION = drPoint["DESCRIPTION"].ToString(); // objTaskPoint.NATIONAL_ST_CONDITION_ID = drPoint["NATIONAL_ST_CONDITION_ID"].ToString(); // objTaskPoint.INDUSTRY_ST_CONDITION_ID = drPoint["INDUSTRY_ST_CONDITION_ID"].ToString(); // objTaskPoint.LOCAL_ST_CONDITION_ID = drPoint["LOCAL_ST_CONDITION_ID"].ToString(); // objTaskPoint.IS_DEL = "0"; // objTaskPoint.NUM = drPoint["NUM"].ToString(); // objTaskPoint.CREATE_DATE = DateTime.Now.ToString(); // arrTaskPoint.Add(objTaskPoint); // #endregion // #region 样品 // //样品 与点位对应 // TMisMonitorSampleInfoVo objSampleInfo = new TMisMonitorSampleInfoVo(); // objSampleInfo.ID = arrSampleIDs[j]; // objSampleInfo.SUBTASK_ID = objSubtask.ID; // objSampleInfo.POINT_ID = objTaskPoint.ID; // objSampleInfo.SAMPLE_NAME = objTaskPoint.POINT_NAME; // objSampleInfo.QC_TYPE = "0";//默认原始样 // objSampleInfo.NOSAMPLE = "0";//默认未采样 // arrSample.Add(objSampleInfo); // #endregion // //点位采用的标准条件项ID // string strConditionID = ""; // if (!string.IsNullOrEmpty(objTaskPoint.NATIONAL_ST_CONDITION_ID)) // { // strConditionID = objTaskPoint.NATIONAL_ST_CONDITION_ID; // } // if (!string.IsNullOrEmpty(objTaskPoint.LOCAL_ST_CONDITION_ID)) // { // strConditionID = objTaskPoint.LOCAL_ST_CONDITION_ID; // } // if (!string.IsNullOrEmpty(objTaskPoint.INDUSTRY_ST_CONDITION_ID)) // { // strConditionID = objTaskPoint.INDUSTRY_ST_CONDITION_ID; // } // //预约项目明细 // DataRow[] dtPointItem = dtContractPoint.Select("CONTRACT_POINT_ID=" + drPoint["ID"].ToString()); // if (dtPointItem.Length > 0) // { // string strTaskItemIDs = GetSerialNumberList("t_mis_monitor_task_item_id", dtPointItem.Length); // string[] arrTaskItemIDs = strTaskItemIDs.Split(','); // string strSampleResultIDs = GetSerialNumberList("MonitorResultId", dtPointItem.Length); // string[] arrSampleResultIDs = strSampleResultIDs.Split(','); // string strResultAppIDs = GetSerialNumberList("MonitorResultAppId", dtPointItem.Length); // string[] arrResultAppIDs = strResultAppIDs.Split(','); // for (int k = 0; k < dtPointItem.Length; k++) // { // DataRow drPointItem = dtPointItem[k]; // //项目采用的标准上限、下限 // string strUp = ""; // string strLow = ""; // string strConditionType = ""; // getStandardValue(drPointItem["ITEM_ID"].ToString(), strConditionID, ref strUp, ref strLow, ref strConditionType); // #region 构造监测任务点位明细表 // //构造监测任务点位明细表 // TMisMonitorTaskItemVo objMonitorTaskItem = new TMisMonitorTaskItemVo(); // objMonitorTaskItem.ID = arrTaskItemIDs[k]; // objMonitorTaskItem.TASK_POINT_ID = objTaskPoint.ID; // objMonitorTaskItem.ITEM_ID = drPointItem["ITEM_ID"].ToString(); // objMonitorTaskItem.CONDITION_ID = strConditionID; // objMonitorTaskItem.CONDITION_TYPE = strConditionType; // objMonitorTaskItem.ST_UPPER = strUp; // objMonitorTaskItem.ST_LOWER = strLow; // objMonitorTaskItem.IS_DEL = "0"; // arrPointItem.Add(objMonitorTaskItem); // #endregion // #region 构造样品结果表 // //构造样品结果表 // string strAnalysisID = "";//分析方法ID // string strStandardID = "";//方法依据ID // getMethod(drPointItem["ITEM_ID"].ToString(), ref strAnalysisID, ref strStandardID); // TMisMonitorResultVo objSampleResult = new TMisMonitorResultVo(); // objSampleResult.ID = arrSampleResultIDs[k]; // objSampleResult.SAMPLE_ID = objSampleInfo.ID; // objSampleResult.QC_TYPE = objSampleInfo.QC_TYPE; // objSampleResult.ITEM_ID = drPointItem["ITEM_ID"].ToString(); // objSampleResult.SAMPLING_INSTRUMENT =GetItemSamplingInstrumentID( drPointItem["ITEM_ID"].ToString()); // objSampleResult.ANALYSIS_METHOD_ID = strAnalysisID; // objSampleResult.STANDARD_ID = strStandardID; // objSampleResult.QC = "0";// 默认原始样手段 // objSampleResult.TASK_TYPE = "发送"; // objSampleResult.RESULT_STATUS = "01";//默认分析结果填报 // objSampleResult.PRINTED = "0";//默认未打印 // arrSampleResult.Add(objSampleResult); // #endregion // #region 构造样品执行表 // //构造样品执行表 // TMisMonitorResultAppVo objResultApp = new TMisMonitorResultAppVo(); // objResultApp.ID = arrResultAppIDs[k]; // objResultApp.RESULT_ID = objSampleResult.ID; // objResultApp.HEAD_USERID = drPointItem["ANALYSIS_MANAGER"].ToString(); // objResultApp.ASSISTANT_USERID = drPointItem["ANALYSIS_ID"].ToString(); // arrSampleResultApp.Add(objResultApp); // #endregion // } // } // } // } // #endregion // } // } //} #endregion if (new TMisMonitorTaskLogic().SaveTrans(objTask, objTaskClient, objTaskTested, objReportVo, arrTaskPoint, arrSubTask, arrPointItem, arrSample, arrSampleResult, arrSampleResultApp)) { strReturn = "1"; } } return(strReturn); }
/// <summary> /// 根据监测天数拆分任务(验收监测) Create By:weilin 2014-12-04 /// </summary> /// <param name="strTaskID"></param> /// <returns></returns> private static bool SplitAcceptTask(string strTaskID, TBaseSerialruleVo objSerial) { bool bResult = true; TMisMonitorTaskVo objTaskVo = new TMisMonitorTaskLogic().Details(strTaskID); TMisMonitorReportVo objReportVo = new TMisMonitorReportVo(); if (objTaskVo.CONTRACT_TYPE == "05") //验收监测 { TMisContractVo objContractVo = new TMisContractLogic().Details(objTaskVo.CONTRACT_ID); TMisContractPointVo objContractPointVo = new TMisContractPointVo(); objContractPointVo.CONTRACT_ID = objTaskVo.CONTRACT_ID; objContractPointVo.IS_DEL = "0"; objContractPointVo = new TMisContractPointLogic().Details(objContractPointVo); if (objContractPointVo.SAMPLE_DAY != "" && IsNumeric(objContractPointVo.SAMPLE_DAY) && objContractVo.REMARK5 == "") { int iSampleDay = int.Parse(objContractPointVo.SAMPLE_DAY); TMisMonitorTaskCompanyVo objClient = new TMisMonitorTaskCompanyLogic().Details(objTaskVo.CLIENT_COMPANY_ID); TMisMonitorTaskCompanyVo objTested = new TMisMonitorTaskCompanyLogic().Details(objTaskVo.TESTED_COMPANY_ID); for (int i = 1; i < iSampleDay; i++) { TMisMonitorTaskVo objTaskAddVo = new TMisMonitorTaskVo(); objTaskAddVo.ID = GetSerialNumber("t_mis_monitor_taskId"); objTaskAddVo.CONTRACT_ID = objTaskVo.CONTRACT_ID; objTaskAddVo.PLAN_ID = objTaskVo.PLAN_ID; objTaskAddVo.CONTRACT_CODE = objTaskVo.CONTRACT_CODE; objTaskAddVo.TICKET_NUM = objTaskVo.TICKET_NUM + "-" + (i + 1).ToString(); objTaskAddVo.PROJECT_NAME = objTaskVo.PROJECT_NAME; objTaskAddVo.CONTRACT_YEAR = objTaskVo.CONTRACT_YEAR; objTaskAddVo.CONTRACT_TYPE = objTaskVo.CONTRACT_TYPE; objTaskAddVo.TEST_TYPE = objTaskVo.TEST_TYPE; objTaskAddVo.TEST_PURPOSE = objTaskVo.TEST_PURPOSE; objTaskAddVo.ASKING_DATE = objTaskVo.ASKING_DATE; objTaskAddVo.SAMPLE_SOURCE = objTaskVo.SAMPLE_SOURCE; objTaskAddVo.CREATOR_ID = objTaskVo.CREATOR_ID; objTaskAddVo.CREATE_DATE = objTaskVo.CREATE_DATE; objTaskAddVo.TASK_STATUS = objTaskVo.TASK_STATUS; objTaskAddVo.REMARK1 = objTaskVo.REMARK1; objTaskAddVo.REMARK2 = objTaskVo.REMARK2; objTaskAddVo.REMARK3 = objTaskVo.REMARK3; objTaskAddVo.QC_STATUS = objTaskVo.QC_STATUS; objTaskAddVo.COMFIRM_STATUS = objTaskVo.COMFIRM_STATUS; objTaskAddVo.ALLQC_STATUS = objTaskVo.ALLQC_STATUS; objTaskAddVo.REPORT_HANDLE = objTaskVo.REPORT_HANDLE; //构造监测任务委托企业信息 TMisMonitorTaskCompanyVo objClientAdd = new TMisMonitorTaskCompanyVo(); PageBase.CopyObject(objClient, objClientAdd);//复制对象 objClientAdd.ID = PageBase.GetSerialNumber("t_mis_monitor_taskcompanyId"); objClientAdd.TASK_ID = objTaskAddVo.ID; //构造监测任务受检企业信息 TMisMonitorTaskCompanyVo objTestedAdd = new TMisMonitorTaskCompanyVo(); PageBase.CopyObject(objTested, objTestedAdd);//复制对象 objTestedAdd.ID = PageBase.GetSerialNumber("t_mis_monitor_taskcompanyId"); objTestedAdd.TASK_ID = objTaskAddVo.ID; objTaskAddVo.CLIENT_COMPANY_ID = objClientAdd.ID; objTaskAddVo.TESTED_COMPANY_ID = objTestedAdd.ID; TMisMonitorReportVo objReportAdd = new TMisMonitorReportVo(); objReportVo.ID = GetSerialNumber("t_mis_monitor_report_id"); objReportVo.REPORT_CODE = objReportVo.REPORT_CODE + "-" + (i + 1).ToString(); objReportVo.TASK_ID = objTaskAddVo.ID; objReportVo.IF_GET = "0"; //监测子任务信息 根据委托书监测类别进行构造 ArrayList arrSubTask = new ArrayList(); //监测子任务集合 ArrayList arrSubTaskApp = new ArrayList(); ArrayList arrTaskPoint = new ArrayList(); //监测点位集合 ArrayList arrPointItem = new ArrayList(); //监测点位明细集合 ArrayList arrSample = new ArrayList(); //样品集合 ArrayList arrSampleResult = new ArrayList(); //样品结果集合 ArrayList arrSampleResultApp = new ArrayList(); //样品分析执行表 List <TMisMonitorSubtaskVo> listSubTask = new TMisMonitorSubtaskLogic().SelectByObject(new TMisMonitorSubtaskVo() { TASK_ID = objTaskVo.ID }, 0, 0); for (int j = 0; j < listSubTask.Count; j++) { TMisMonitorSubtaskVo objSubTaskAdd = new TMisMonitorSubtaskVo(); CopyObject(listSubTask[j], objSubTaskAdd); objSubTaskAdd.ID = GetSerialNumber("t_mis_monitor_subtaskId"); objSubTaskAdd.TASK_ID = objTaskAddVo.ID; arrSubTask.Add(objSubTaskAdd); TMisMonitorSubtaskAppVo objSubTaskApp = new TMisMonitorSubtaskAppVo(); objSubTaskApp.SUBTASK_ID = listSubTask[j].ID; objSubTaskApp = new TMisMonitorSubtaskAppLogic().Details(objSubTaskApp); TMisMonitorSubtaskAppVo objSubTaskAppAdd = new TMisMonitorSubtaskAppVo(); CopyObject(objSubTaskApp, objSubTaskAppAdd); objSubTaskAppAdd.ID = GetSerialNumber("TMisMonitorSubtaskAppID"); objSubTaskAppAdd.SUBTASK_ID = objSubTaskAdd.ID; arrSubTaskApp.Add(objSubTaskAppAdd); List <TMisMonitorTaskPointVo> listTaskPoint = new TMisMonitorTaskPointLogic().SelectByObject(new TMisMonitorTaskPointVo() { TASK_ID = objTaskVo.ID, SUBTASK_ID = listSubTask[j].ID, IS_DEL = "0" }, 0, 0); for (int k = 0; k < listTaskPoint.Count; k++) { TMisMonitorTaskPointVo objTaskPointAdd = new TMisMonitorTaskPointVo(); CopyObject(listTaskPoint[k], objTaskPointAdd); objTaskPointAdd.ID = GetSerialNumber("t_mis_monitor_taskpointId"); objTaskPointAdd.TASK_ID = objTaskAddVo.ID; arrTaskPoint.Add(objTaskPointAdd); TMisMonitorSampleInfoVo objSampleInfoVo = new TMisMonitorSampleInfoVo(); objSampleInfoVo.SUBTASK_ID = listSubTask[j].ID; objSampleInfoVo.POINT_ID = listTaskPoint[k].ID; objSampleInfoVo = new TMisMonitorSampleInfoLogic().Details(objSampleInfoVo); TMisMonitorSampleInfoVo objSampleInfoAdd = new TMisMonitorSampleInfoVo(); CopyObject(objSampleInfoVo, objSampleInfoAdd); objSampleInfoAdd.ID = GetSerialNumber("MonitorSampleId"); objSampleInfoAdd.SUBTASK_ID = objSubTaskAdd.ID; objSampleInfoAdd.POINT_ID = objTaskPointAdd.ID; objSampleInfoAdd.SAMPLE_CODE = CreateBaseDefineCodeForSample(objSerial, objTaskAddVo, objSubTaskAdd); arrSample.Add(objSampleInfoAdd); List <TMisMonitorTaskItemVo> listTaskItem = new TMisMonitorTaskItemLogic().SelectByObject(new TMisMonitorTaskItemVo() { TASK_POINT_ID = listTaskPoint[k].ID, IS_DEL = "0" }, 0, 0); for (int l = 0; l < listTaskItem.Count; l++) { TMisMonitorTaskItemVo objTaskItemAdd = new TMisMonitorTaskItemVo(); CopyObject(listTaskItem[l], objTaskItemAdd); objTaskItemAdd.ID = GetSerialNumber("t_mis_monitor_task_item_id"); objTaskItemAdd.TASK_POINT_ID = objTaskPointAdd.ID; arrPointItem.Add(objTaskItemAdd); } List <TMisMonitorResultVo> listResult = new TMisMonitorResultLogic().SelectByObject(new TMisMonitorResultVo() { SAMPLE_ID = objSampleInfoVo.ID }, 0, 0); for (int l = 0; l < listResult.Count; l++) { TMisMonitorResultVo objResultAdd = new TMisMonitorResultVo(); CopyObject(listResult[l], objResultAdd); objResultAdd.ID = GetSerialNumber("MonitorResultId"); objResultAdd.SAMPLE_ID = objSampleInfoAdd.ID; arrSampleResult.Add(objResultAdd); TMisMonitorResultAppVo objResultAppVo = new TMisMonitorResultAppVo(); objResultAppVo.RESULT_ID = listResult[l].ID; objResultAppVo = new TMisMonitorResultAppLogic().Details(objResultAppVo); TMisMonitorResultAppVo objResultAppAdd = new TMisMonitorResultAppVo(); CopyObject(objResultAppVo, objResultAppAdd); objResultAppAdd.ID = GetSerialNumber("MonitorResultAppId"); objResultAppAdd.RESULT_ID = objResultAdd.ID; arrSampleResultApp.Add(objResultAppAdd); } } } if (new TMisMonitorTaskLogic().SaveTrans(objTaskAddVo, objClientAdd, objTestedAdd, objReportVo, arrTaskPoint, arrSubTask, arrSubTaskApp, arrPointItem, arrSample, arrSampleResult, arrSampleResultApp)) { bResult = true; } } //更新任务单号 objTaskVo.TICKET_NUM = objTaskVo.TICKET_NUM + "-1"; new TMisMonitorTaskLogic().Edit(objTaskVo); //更新报告单号 objReportVo.REPORT_CODE = objReportVo.REPORT_CODE + "-1"; new TMisMonitorReportLogic().Edit(objReportVo); //更新验收委托书任务已经拆分任务的标志 objContractVo.REMARK5 = "1"; new TMisContractLogic().Edit(objContractVo); } } return(bResult); }
public static string getCompanyName(string strValue) { string strID = new TMisContractLogic().Details(strValue).CLIENT_COMPANY_ID; return(new TMisContractCompanyLogic().Details(strID).COMPANY_NAME); }
/// <summary> /// 获取 未确认的监测报告 /// </summary> /// <returns></returns> protected string GetReportInfo(string strTabType) { string result = ""; int intTotalCount = 0; //页数 int pageIndex = Int32.Parse(Request.Params["page"].ToString()); //分页数 int pageSize = Int32.Parse(Request.Params["pagesize"].ToString()); DataTable dtEval = new DataTable(); //监测任务对象 TMisMonitorTaskVo objTask = new TMisMonitorTaskVo(); //创建标准JSON数据 objTask.SORT_FIELD = Request.Params["sortname"]; objTask.SORT_TYPE = Request.Params["sortorder"]; //过滤条件 //委托类型 objTask.CONTRACT_TYPE = !String.IsNullOrEmpty(Request.Params["srhContractType"]) ? Request.Params["srhContractType"].ToString() : ""; //委托书编号 objTask.CONTRACT_CODE = !String.IsNullOrEmpty(Request.Params["srhContractCode"]) ? Request.Params["srhContractCode"].ToString() : ""; //项目名称 objTask.PROJECT_NAME = !String.IsNullOrEmpty(Request.Params["srhProjectName"]) ? Request.Params["srhProjectName"].ToString() : ""; //任务单号 objTask.TICKET_NUM = !String.IsNullOrEmpty(Request.Params["srhTaskCode"]) ? Request.Params["srhTaskCode"].ToString() : ""; //任务状态 objTask.TASK_STATUS = "09"; //确认状态 未确认 objTask.COMFIRM_STATUS = strTabType; if (!base.LogInfo.UserInfo.REAL_NAME.Contains("管理员") && strType == "QY") { //过滤处理人 objTask.REPORT_HANDLE = base.LogInfo.UserInfo.ID; } dtEval = new TMisMonitorTaskLogic().SelectByTable(objTask, pageIndex, pageSize); //添加监测类型 TMisContractVo objContractVo = new TMisContractVo(); TBaseMonitorTypeInfoVo objMonitorTypeVo = new TBaseMonitorTypeInfoVo(); DataTable dt = new DataTable(); string[] objType; string strTypeName = ""; for (int i = 0; i < dtEval.Rows.Count; i++) { strTypeName = ""; //objTask = null; if (string.IsNullOrEmpty(dtEval.Rows[i]["CONTRACT_ID"].ToString())) { TMisMonitorSubtaskVo tMisMonitorSubtaskVo = new TMisMonitorSubtaskVo(); tMisMonitorSubtaskVo.TASK_ID = dtEval.Rows[i]["ID"].ToString(); DataTable dtTemp = new TMisMonitorSubtaskLogic().SelectByTable(tMisMonitorSubtaskVo); objType = new string[dtTemp.Rows.Count]; for (int j = 0; j < dtTemp.Rows.Count; j++) { objType[j] = dtTemp.Rows[j]["MONITOR_ID"].ToString(); } List <string> listTemp = objType.ToList <string>(); objType = listTemp.Distinct().ToArray <string>(); } else { objContractVo = new TMisContractLogic().Details(dtEval.Rows[i]["CONTRACT_ID"].ToString()); objType = objContractVo.TEST_TYPES.Split(';'); } for (int j = 0; j < objType.Length; j++) { objMonitorTypeVo = new TBaseMonitorTypeInfoLogic().Details(objType[j]); strTypeName += objMonitorTypeVo.MONITOR_TYPE_NAME + ","; } dtEval.Rows[i]["REMARK1"] = strTypeName.TrimEnd(','); } intTotalCount = new TMisMonitorTaskLogic().GetSelectResultCount(objTask); //处理现场项目任务 现场项目任务未审核完成时将报告任务移除 result = LigerGridDataToJson(dtEval, intTotalCount); return(result); }
protected void ReturnAllTaskStep() { //任务对象 TMisMonitorTaskVo objTask = new TMisMonitorTaskLogic().Details(this.TASK_ID.Value); //子任务信息 TMisMonitorSubtaskVo objSubTask = new TMisMonitorSubtaskLogic().Details(new TMisMonitorSubtaskVo() { TASK_ID = this.TASK_ID.Value, MONITOR_ID = this.dllMonitor.SelectedValue }); //样品信息 TMisMonitorSampleInfoVo objSample = new TMisMonitorSampleInfoLogic().Details(new TMisMonitorSampleInfoVo() { SUBTASK_ID = objSubTask.ID, QC_TYPE = "0" }); //样品结果信息 DataTable dtResult = new TMisMonitorResultLogic().SelectResultAndAppWithSubtaskID(objSubTask.ID); //校阅 //委托书对象 TMisContractVo objContract = new TMisContractLogic().Details(objTask.CONTRACT_ID); //预约表 TMisContractPlanVo objPlan = new TMisContractPlanLogic().Details(new TMisContractPlanVo() { CONTRACT_ID = objContract.ID }); //预约频次表(已预约未办理数) TMisContractPointFreqVo objPointFreq = new TMisContractPointFreqLogic().Details(new TMisContractPointFreqVo() { CONTRACT_ID = objContract.ID }); //自送样预约数(已预约未办理数) TMisContractSamplePlanVo objSamplePlan = new TMisContractSamplePlanLogic().Details(new TMisContractSamplePlanVo() { CONTRACT_ID = objContract.ID, }); #region 暂行的定制生成任务追踪方法 页面HTML构建 //定义已处理DIV样式 string strDivHas = "<div style='width:150px;height:auto;background-color:#5a8f5a;text-align: center;vertical-align: middle;'>{0}</div>"; //定义待处理DIV样式 string strDivWait = "<div style='width:150px;height:auto;background-color:#de9a1d;text-align: center;vertical-align: middle;'>{0}</div>"; //定义特殊处理DIV样式 //string strDivSepecial = "<div style='width:100px;height:50px;background-color:#e34323;text-align: center;vertical-align: middle;'>{0}</div"; //定义未处理DIV样式 //string strDivNo = "<div style='width:100px;height:50px;background-color:#a9a9a9;text-align: center;vertical-align: middle;'>{0}</div>"; #region 办理人 //采样负责人 string strSampleManager = GetSampleManager(objSubTask.SAMPLING_MANAGER_ID); //交接人 string strSampleAccept = GetDefaultOrFirstDutyUser("sample_allocation_sheet", this.dllMonitor.SelectedValue); //采样任务分配人 string strSampleSender = GetDefaultOrFirstDutyUser("duty_other_sampling", this.dllMonitor.SelectedValue); //采样后质控人 string strQcEnd = GetDefaultOrFirstDutyUser("sample_qc_end", this.dllMonitor.SelectedValue); //分析任务分配人 string strAnalyseSender = GetDefaultOrFirstDutyUser("duty_other_analyse", this.dllMonitor.SelectedValue); //校核人 string strAnalyseChecker = GetDefaultOrFirstDutyUser("duty_other_audit ", this.dllMonitor.SelectedValue); //复核人 string strAnalyseAgainChecker = GetDefaultOrFirstDutyUser("duty_other_analyse_result", this.dllMonitor.SelectedValue); //审核人 string strQcChecker = GetDefaultOrFirstDutyUser("duty_other_analyse_control", this.dllMonitor.SelectedValue); #endregion Table table1 = new Table(); table1.CssClass = "tMain"; TableRow row1 = new TableRow();//委托流程连接 TableCell cell1 = new TableCell(); cell1.Text = string.Format(strDivHas, "委托流程"); row1.Cells.Add(cell1); table1.Rows.Add(row1); //是否已预约 if (!string.IsNullOrEmpty(objPointFreq.ID)) { if (objPointFreq.IF_PLAN == null)//未预约 { table1 = GetCommonRow(table1, strDivWait, "采样预约", ""); this.divSample.Controls.Add(table1); return; } else if (objPointFreq.IF_PLAN == "0")//已预约未办理 { table1 = GetCommonRow(table1, strDivHas, "采样预约", ""); } } //自送样 预约 if (objSamplePlan.IF_PLAN == "0")//未预约 { table1 = GetCommonRow(table1, strDivWait, "送样预约", ""); this.divSample.Controls.Add(table1); return; } else if (objSamplePlan.IF_PLAN == "1")//已预约 { table1 = GetCommonRow(table1, strDivWait, "送样预约", ""); this.divSample.Controls.Add(table1); return; } else if (objSamplePlan.IF_PLAN == "2")//预约办理 { table1 = GetCommonRow(table1, strDivHas, "送样预约", ""); } //是否预约办理 if (objPlan.ID != "") { if (objPlan.HAS_DONE == "1")//已办理 { table1 = GetCommonRow(table1, strDivHas, "预约办理", strSampleSender); } else if (objPlan.HAS_DONE == "0" || string.IsNullOrEmpty(objPlan.HAS_DONE)) { table1 = GetCommonRow(table1, strDivWait, "预约办理", strSampleSender); this.divSample.Controls.Add(table1); return; } } //是否采样 if (objSubTask.TASK_STATUS == "02") { table1 = GetCommonRow(table1, strDivWait, "采样", strSampleManager); } //样品交接 if (objSubTask.TASK_STATUS == "021") { if (!string.IsNullOrEmpty(objPlan.ID)) { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); } table1 = GetCommonRow(table1, strDivWait, "样品交接", strSampleAccept); } //分析任务分配 DataRow[] dr1 = dtResult.Select(" RESULT_STATUS='01'");//过滤过分析分配环节任务 //分析结果录入 DataRow[] dr2 = dtResult.Select(" RESULT_STATUS='20'"); //数据审核 DataRow[] dr3 = dtResult.Select(" RESULT_STATUS='30'"); //分析室主任审核 DataRow[] dr4 = dtResult.Select(" RESULT_STATUS='40'"); //技术室主任审核 DataRow[] dr5 = dtResult.Select(" RESULT_STATUS='50'"); if (objSubTask.TASK_STATUS == "03") { if (dr1.Length > 0)//环节在分析任务分配 { if (!string.IsNullOrEmpty(objPlan.ID)) { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); } table1 = GetCommonRow(table1, strDivHas, "样品交接", strSampleAccept); table1 = GetCommonRow(table1, strDivWait, "分析任务分配", strAnalyseSender); } else { if (!string.IsNullOrEmpty(objPlan.ID)) { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); } table1 = GetCommonRow(table1, strDivHas, "样品交接", strSampleAccept); table1 = GetCommonRow(table1, strDivHas, "分析任务分配", strAnalyseSender); table1 = GetResultRow(table1, strDivHas, strDivWait, "分析结果录入", dtResult); if (dr2.Length > 0) //结果提交不完全时 { if (dr5.Length > 0) //流程已到技术室审核环节(最后环节) { table1 = GetCommonRow(table1, strDivWait, "数据审核", strAnalyseChecker); table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", strAnalyseAgainChecker); table1 = GetCommonRow(table1, strDivWait, "技术室主任审核", strQcChecker); } else { if (dr4.Length > 0)//流程仅到分析室审核 { table1 = GetCommonRow(table1, strDivWait, "数据审核", strAnalyseChecker); table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", strAnalyseAgainChecker); } else { if (dr3.Length > 0)//流程仅到数据审核 { table1 = GetCommonRow(table1, strDivWait, "数据审核", strAnalyseChecker); } } } } else//结果提交完全时 { if (dr3.Length > 0)//数据审核不完全 { table1 = GetCommonRow(table1, strDivWait, "数据审核", strAnalyseChecker); } else { table1 = GetCommonRow(table1, strDivHas, "数据审核", strAnalyseChecker); } if (dr4.Length > 0)//分析审核不完全 { table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", strAnalyseAgainChecker); } else if (dr3.Length == 0)//已经全部发送 { table1 = GetCommonRow(table1, strDivHas, "分析室主任审核", strAnalyseAgainChecker); } if (dr5.Length > 0) //流程已到技术室审核环节(最后环节) { if (objSubTask.TASK_STATUS == "09" && objTask.TASK_STATUS == "09") //分析流程完成 { table1 = GetCommonRow(table1, strDivHas, "技术室主任审核", strQcChecker); } else { table1 = GetCommonRow(table1, strDivWait, "技术室主任审核", strQcChecker); } } } } } else if (objTask.TASK_STATUS == "09" && objSubTask.TASK_STATUS == "09")//报告 { if (!string.IsNullOrEmpty(objPlan.ID)) { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); } table1 = GetCommonRow(table1, strDivHas, "样品交接", strSampleAccept); table1 = GetCommonRow(table1, strDivHas, "分析任务分配", strAnalyseSender); table1 = GetResultRow(table1, strDivHas, strDivWait, "分析结果录入", dtResult); table1 = GetCommonRow(table1, strDivHas, "数据审核", strAnalyseChecker); table1 = GetCommonRow(table1, strDivHas, "分析室主任审核", strAnalyseAgainChecker); table1 = GetCommonRow(table1, strDivHas, "技术室主任审核", strQcChecker); table1.Rows.Add(GetFollowRow()); TableRow row = new TableRow();//报告流程连接 TableCell cell = new TableCell(); // cell.Text = string.Format(strDivHas, "<a href='#' onclick='ShowReport(" + this.TASK_ID.Value + ");'>报告流程</a>"); cell.Text = string.Format(strDivHas, "报告流程"); row.Cells.Add(cell); table1.Rows.Add(row); } this.divSample.Controls.Add(table1); #endregion }
protected void ReturnAllTaskStep() { //任务对象 TMisMonitorTaskVo objTask = new TMisMonitorTaskLogic().Details(this.TASK_ID.Value); //子任务信息 TMisMonitorSubtaskVo objSubTask = new TMisMonitorSubtaskLogic().Details(new TMisMonitorSubtaskVo() { TASK_ID = this.TASK_ID.Value, MONITOR_ID = this.dllMonitor.SelectedValue }); //样品信息 TMisMonitorSampleInfoVo objSample = new TMisMonitorSampleInfoLogic().Details(new TMisMonitorSampleInfoVo() { SUBTASK_ID = objSubTask.ID, QC_TYPE = "0" }); //样品结果信息 DataTable dtResult = new TMisMonitorResultLogic().SelectResultAndAppWithSubtaskID(objSubTask.ID); //校阅 //委托书对象 TMisContractVo objContract = new TMisContractLogic().Details(objTask.CONTRACT_ID); //预约表 TMisContractPlanVo objPlan = new TMisContractPlanLogic().Details(new TMisContractPlanVo() { CONTRACT_ID = objContract.ID }); //预约频次表(已预约未办理数) int intIsPlanNoDo = new TMisContractPointFreqLogic().GetSelectResultCount(new TMisContractPointFreqVo() { CONTRACT_ID = objContract.ID, IF_PLAN = "0" }); #region 暂行的定制生成任务追踪方法 页面HTML构建 //定义已处理DIV样式 string strDivHas = "<div style='width:150px;height:50px;background-color:#5a8f5a;text-align: center;vertical-align: middle;'>{0}</div>"; //定义待处理DIV样式 string strDivWait = "<div style='width:150px;height:50px;background-color:#de9a1d;text-align: center;vertical-align: middle;'>{0}</div>"; //定义特殊处理DIV样式 //string strDivSepecial = "<div style='width:100px;height:50px;background-color:#e34323;text-align: center;vertical-align: middle;'>{0}</div"; //定义未处理DIV样式 //string strDivNo = "<div style='width:100px;height:50px;background-color:#a9a9a9;text-align: center;vertical-align: middle;'>{0}</div>"; Table table1 = new Table(); table1.CssClass = "tMain"; TableRow row1 = new TableRow();//委托流程连接 TableCell cell1 = new TableCell(); cell1.Text = string.Format(strDivHas, "<a href='#' onclick='ShowContract();'>委托流程</a>"); row1.Cells.Add(cell1); table1.Rows.Add(row1); //是否已预约 if (intIsPlanNoDo > 0) { table1 = GetCommonRow(table1, strDivHas, "采样预约", ""); } else { table1 = GetCommonRow(table1, strDivWait, "采样预约", ""); this.divSample.Controls.Add(table1); return; } //是否预约办理 if (objPlan.HAS_DONE == "1")//已办理 { table1 = GetCommonRow(table1, strDivHas, "预约办理", ""); } else { table1 = GetCommonRow(table1, strDivWait, "预约办理", ""); this.divSample.Controls.Add(table1); return; } //采样负责人 string strSampleManager = GetSampleManager(objSubTask.SAMPLING_MANAGER_ID); //交接人 string strSampleAccept = string.Empty; DataTable dtSampleAccept = new TSysUserDutyLogic().SelectUserDuty("sample_allocation_sheet", this.dllMonitor.SelectedValue); if (dtSampleAccept.Rows.Count > 0) { strSampleAccept = GetSampleManager(dtSampleAccept.Rows[0]["USERID"].ToString()); } //是否采样 if (objSubTask.TASK_STATUS == "02") { table1 = GetCommonRow(table1, strDivWait, "采样", strSampleManager); } //样品交接 if (objSubTask.TASK_STATUS == "021") { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); table1 = GetCommonRow(table1, strDivWait, "样品交接", strSampleAccept); } //分析任务分配 DataRow[] dr1 = dtResult.Select(" RESULT_STATUS='01'");//过滤过分析分配环节任务 //分析结果录入 DataRow[] dr2 = dtResult.Select(" RESULT_STATUS='20'"); //数据审核 DataRow[] dr3 = dtResult.Select(" RESULT_STATUS='30'"); //分析室主任审核 DataRow[] dr4 = dtResult.Select(" RESULT_STATUS='40'"); //技术室主任审核 DataRow[] dr5 = dtResult.Select(" RESULT_STATUS='50'"); if (objSubTask.TASK_STATUS == "03") { if (dr1.Length > 0)//环节在分析任务分配 { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); table1 = GetCommonRow(table1, strDivHas, "样品交接", strSampleAccept); table1 = GetCommonRow(table1, strDivWait, "分析任务分配", ""); } else { table1 = GetCommonRow(table1, strDivHas, "采样", strSampleManager); table1 = GetCommonRow(table1, strDivHas, "样品交接", strSampleAccept); table1 = GetCommonRow(table1, strDivHas, "分析任务分配", ""); table1 = GetResultRow(table1, strDivHas, strDivWait, "分析结果录入", dtResult); if (dr2.Length > 0) //结果提交不完全时 { if (dr5.Length > 0) //流程已到技术室审核环节(最后环节) { table1 = GetCommonRow(table1, strDivWait, "数据审核", ""); table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", ""); table1 = GetCommonRow(table1, strDivWait, "技术室主任审核", ""); } else { if (dr4.Length > 0)//流程仅到分析室审核 { table1 = GetCommonRow(table1, strDivWait, "数据审核", ""); table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", ""); } else { if (dr3.Length > 0)//流程仅到数据审核 { table1 = GetCommonRow(table1, strDivWait, "数据审核", ""); } } } } else//结果提交完全时 { if (dr3.Length > 0)//数据审核不完全 { table1 = GetCommonRow(table1, strDivWait, "数据审核", ""); } else { table1 = GetCommonRow(table1, strDivHas, "数据审核", ""); } if (dr4.Length > 0)//分析审核不完全 { table1 = GetCommonRow(table1, strDivWait, "分析室主任审核", ""); } else { table1 = GetCommonRow(table1, strDivHas, "分析室主任审核", ""); } if (dr5.Length > 0) //流程已到技术室审核环节(最后环节) { if (objSubTask.TASK_STATUS == "09" && objTask.TASK_STATUS == "09") //分析流程完成 { table1 = GetCommonRow(table1, strDivHas, "技术室主任审核", ""); TableRow row = new TableRow();//委托流程连接 TableCell cell = new TableCell(); cell.Text = string.Format(strDivHas, "<a href='#' onclick='ShowReport();'>报告流程</a>"); row.Cells.Add(cell); table1.Rows.Add(row); } else { table1 = GetCommonRow(table1, strDivWait, "技术室主任审核", ""); } } } } } this.divSample.Controls.Add(table1); #endregion }
protected void btnExport_QY_FEE_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); DataTable dtAtt = new DataTable(); DataRow[] dr; TMisContractVo objItems = new TMisContractVo(); int r = 1; string strMonitorTypes = ""; string[] strMonitroType; string strTEST_FEE = ""; string strATT_FEE = ""; string strBUDGET = ""; double dFeeTemp = 0; if (!String.IsNullOrEmpty(task_id)) { objItems.ID = task_id; } dt = new TMisContractLogic().GetContractFreeData(objItems); FileStream file = new FileStream(HttpContext.Current.Server.MapPath("../TempFile/QY/ContractInforFee.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); IRow iRow; ICell iCell; if (dt.Rows.Count > 0) { strTEST_FEE = dt.Rows[0]["TEST_FEE"].ToString() == "" ? "0" : dt.Rows[0]["TEST_FEE"].ToString(); strATT_FEE = dt.Rows[0]["ATT_FEE"].ToString() == "" ? "0" : dt.Rows[0]["ATT_FEE"].ToString(); strBUDGET = dt.Rows[0]["BUDGET"].ToString() == "" ? "0" : dt.Rows[0]["BUDGET"].ToString(); strMonitorTypes = dt.Rows[0]["TEST_TYPES"].ToString(); sheet.GetRow(0).GetCell(0).SetCellValue(dt.Rows[0]["PROJECT_NAME"].ToString() + "经费计算表"); for (int i = 0; i < dt.Rows.Count; i++) { r++; iRow = sheet.CreateRow(r); iRow.CreateCell(0).SetCellValue(dt.Rows[i]["MONITOR_TYPE_NAME"].ToString()); iRow.CreateCell(1).SetCellValue(dt.Rows[i]["ITEM_NAME"].ToString()); iRow.CreateCell(2).SetCellValue(dt.Rows[i]["PRETREATMENT_FEE"].ToString()); iRow.CreateCell(3).SetCellValue(dt.Rows[i]["TEST_ANSY_FEE"].ToString()); iRow.CreateCell(4).SetCellValue(dt.Rows[i]["TEST_NUM"].ToString()); iRow.CreateCell(5).SetCellValue(dt.Rows[i]["FREQ"].ToString()); iRow.CreateCell(6).SetCellValue(dt.Rows[i]["TEST_POWER_PRICE"].ToString()); iRow.CreateCell(7).SetCellValue(dt.Rows[i]["TEST_PRICE"].ToString()); iRow.CreateCell(8).SetCellValue(dt.Rows[i]["TEST_POINT_NUM"].ToString()); iRow.CreateCell(9).SetCellValue(dt.Rows[i]["FEE_COUNT"].ToString()); } r += 2; iRow = sheet.CreateRow(r); iRow.CreateCell(0).SetCellValue(dt.Rows[0]["PROJECT_NAME"].ToString() + "经费汇总"); iRow.CreateCell(9).SetCellValue(strTEST_FEE); strMonitroType = strMonitorTypes.Split(';'); for (int j = 0; j < strMonitroType.Length; j++) { dr = dt.Select("MONITOR_ID='" + strMonitroType[j].ToString() + "'"); if (dr.Length > 0) { r++; dFeeTemp = 0; for (int k = 0; k < dr.Length; k++) { dFeeTemp += double.Parse(dr[k]["FEE_COUNT"].ToString() == "" ? "0" : dr[k]["FEE_COUNT"].ToString()); } iRow = sheet.CreateRow(r); iRow.CreateCell(0).SetCellValue(dr[0]["MONITOR_TYPE_NAME"].ToString() + "监测分析费"); iRow.CreateCell(9).SetCellValue(dFeeTemp.ToString()); } } dtAtt = new TMisContractLogic().GetContractAttFeeData(task_id); for (int i = 0; i < dtAtt.Rows.Count; i++) { r++; iRow = sheet.CreateRow(r); iRow.CreateCell(0).SetCellValue(dtAtt.Rows[i]["ATT_FEE_ITEM"].ToString()); iRow.CreateCell(9).SetCellValue(dtAtt.Rows[i]["FEE"].ToString()); } r++; iRow = sheet.CreateRow(r); iRow.CreateCell(0).SetCellValue("合计:"); iRow.CreateCell(9).SetCellValue(strBUDGET); } using (MemoryStream stream = new MemoryStream()) { hssfworkbook.Write(stream); HttpContext curContext = HttpContext.Current; // 设置编码和附件格式 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Response.ContentEncoding = Encoding.UTF8; curContext.Response.Charset = ""; curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("委托监测费用明细-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8)); curContext.Response.BinaryWrite(stream.GetBuffer()); curContext.Response.End(); } }
/// <summary> /// 获得委托书信息 /// </summary> /// <returns></returns> protected string GetContractInfo() { TMisContractVo objContractInfo = new TMisContractVo(); objContractInfo.ID = this.hdnContracID.Value; objContractInfo.CONTRACT_STATUS = "9"; objContractInfo = new TMisContractLogic().Details(objContractInfo); //签订日期 格式 try { objContractInfo.ASKING_DATE = DateTime.Parse(objContractInfo.ASKING_DATE).ToString("yyyy-MM-dd"); } catch { } //备注信息组装 string strRemark = ""; //同意分包 if (objContractInfo.AGREE_OUTSOURCING == "1") { string strDictText = new TSysDictLogic().GetDictNameByDictCodeAndType("accept_subpackage", "Contract_Remarks"); strRemark += strDictText.Length > 0 ? strDictText + ";" : ""; } //同意监测方法 if (objContractInfo.AGREE_METHOD == "1") { string strDictText = new TSysDictLogic().GetDictNameByDictCodeAndType("accept_useMonitorMethod", "Contract_Remarks"); strRemark += strDictText.Length > 0 ? strDictText + ";" : ""; } //同意使用非标准方法 if (objContractInfo.AGREE_NONSTANDARD == "1") { string strDictText = new TSysDictLogic().GetDictNameByDictCodeAndType("accept_usenonstandard", "Contract_Remarks"); strRemark += strDictText.Length > 0 ? strDictText + ";" : ""; } //同意其他 if (objContractInfo.AGREE_OTHER == "1") { string strDictText = new TSysDictLogic().GetDictNameByDictCodeAndType("accept_other", "Contract_Remarks"); strRemark += strDictText.Length > 0 ? strDictText + ";" : ""; } if (strRemark.Length > 0) { strRemark = strRemark.Remove(strRemark.LastIndexOf(";")); } objContractInfo.REMARK1 = strRemark; //添加监测类型 string strMonitorType = ""; //合同类型字符串 if (objContractInfo.TEST_TYPES.Length > 0) //所有监测类型 { string[] strTestType = objContractInfo.TEST_TYPES.Split(';'); foreach (string str in strTestType) { if (str.Length > 0) { //监测类别名称 string strTypeName = new TBaseMonitorTypeInfoLogic().Details(str).MONITOR_TYPE_NAME; strMonitorType += strTypeName.Length > 0 ? strTypeName + "," : ""; } } } strMonitorType = strMonitorType.Length > 0 ? strMonitorType.Remove(strMonitorType.LastIndexOf(",")) : ""; objContractInfo.TEST_TYPES = strMonitorType; return(ToJson(objContractInfo)); }
protected void btnImport_Click(object sender, EventArgs e) { if (this.PLAN_ID.Value.Length == 0) { return; } TMisContractPlanVo objPlan = new TMisContractPlanLogic().Details(this.PLAN_ID.Value); string strContractID = objPlan.CONTRACT_ID; TMisContractVo objContract = new TMisContractLogic().Details(strContractID); TMisContractCompanyVo objCompany = new TMisContractCompanyLogic().Details(objContract.TESTED_COMPANY_ID); string strPointNames = ""; string strItemS = ""; int intPointCount = 0; GetInfoForPrint(ref strPointNames, ref intPointCount, ref strItemS); string strSAMPLE_ASK_DATE = this.strSAMPLE_ASK_DATE.Value; string strSAMPLE_FINISH_DATE = this.strSAMPLE_FINISH_DATE.Value; FileStream file = new FileStream(HttpContext.Current.Server.MapPath("template/MoniterTaskNotify.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); sheet.GetRow(3).GetCell(1).SetCellValue(objContract.PROJECT_NAME); sheet.GetRow(3).GetCell(3).SetCellValue(objCompany.COMPANY_NAME); sheet.GetRow(4).GetCell(1).SetCellValue(objCompany.MONITOR_ADDRESS); sheet.GetRow(4).GetCell(3).SetCellValue(objCompany.CONTACT_NAME + "、" + objCompany.PHONE); sheet.GetRow(5).GetCell(1).SetCellValue(strSAMPLE_ASK_DATE); sheet.GetRow(5).GetCell(3).SetCellValue(strSAMPLE_FINISH_DATE); //获取当前监测类别信息 DataTable dtMonitor = GetPendingPlanDistinctMonitorDataTable(objPlan.ID); DataTable dtPoint = GetPendingPlanPointDataTable(objPlan.ID); if (dtMonitor.Rows.Count > 0) { int i = 0; foreach (DataRow drr in dtMonitor.Rows) { string strMonitorName = "", strPointName = "", strOutValuePoint = "", strOutValuePointItems = ""; DataRow[] drPoint = dtPoint.Select("MONITOR_ID='" + drr["MONITOR_ID"].ToString() + "'"); if (drPoint.Length > 0) { foreach (DataRow drrPoint in drPoint) { string strPointNameForItems = "", strPointItems = ""; strMonitorName = drrPoint["MONITOR_TYPE_NAME"].ToString(); strPointName += drrPoint["POINT_NAME"].ToString() + "、"; //获取当前点位的监测项目 DataTable dtPointItems = GetPendingPlanPointItemsDataTable(drrPoint["CONTRACT_POINT_ID"].ToString()); if (dtPointItems.Rows.Count > 0) { foreach (DataRow drItems in dtPointItems.Rows) { strPointNameForItems = drrPoint["POINT_NAME"] + ":"; strPointItems += drItems["ITEM_NAME"].ToString() + "、"; } strOutValuePointItems += strPointNameForItems + strPointItems.Substring(0, strPointItems.Length - 1) + ";\n"; } } //获取输出监测类型监测点位信息 strOutValuePoint += strPointName.Substring(0, strPointName.Length - 1) + ";\n"; } sheet.GetRow(i + 7).GetCell(0).SetCellValue(strMonitorName); sheet.GetRow(i + 7).GetCell(1).SetCellValue(strOutValuePoint); sheet.GetRow(i + 7).GetCell(2).SetCellValue(strOutValuePointItems); i++; } } using (MemoryStream stream = new MemoryStream()) { hssfworkbook.Write(stream); HttpContext curContext = HttpContext.Current; // 设置编码和附件格式 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Response.ContentEncoding = Encoding.UTF8; curContext.Response.Charset = ""; curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("采样任务分配表.xls", Encoding.UTF8)); curContext.Response.BinaryWrite(stream.GetBuffer()); curContext.Response.End(); } }
public static string getContractType(string strValue) { string strID = new TMisContractLogic().Details(strValue).CONTRACT_TYPE; return(getDictName(strID, "CONTRACT_TYPE")); }