/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaPartInfo">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaPartInfoVo tOaPartInfo) { string strSQL = SqlHelper.BuildUpdateExpress(tOaPartInfo, TOaPartInfoVo.T_OA_PART_INFO_TABLE); strSQL += string.Format(" where ID='{0}' ", tOaPartInfo.ID); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 获取对象DataTable,根据物料类型 /// </summary> /// <param name="tOaPartBuyRequst">对象</param> /// /// <param name="tOaPartInfo">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByPart(TOaPartBuyRequstVo tOaPartBuyRequst, TOaPartInfoVo tOaPartInfo, int iIndex, int iCount) { string strSQL = " select distinct C.* FROM T_OA_PART_BUY_REQUST_LST A LEFT JOIN T_OA_PART_INFO B ON B.ID=A.PART_ID LEFT JOIN T_OA_PART_BUY_REQUST C ON C.ID=A.REQUST_ID {0} "; strSQL = String.Format(strSQL, BuildWhereStatementTwo(tOaPartBuyRequst, tOaPartInfo)); return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
public void PartCollarInfor() { DataTable dt = new DataTable(); TOaPartCollarVo objItems = new TOaPartCollarVo(); TOaPartInfoVo objItemParts = new TOaPartInfoVo(); if (!String.IsNullOrEmpty(strPartCollarId)) { objItems.ID = strPartCollarId; } objItems.USER_ID = strReal_Name; if (!String.IsNullOrEmpty(strBeginDate) || !String.IsNullOrEmpty(strEndDate)) { objItems.REMARK4 = strBeginDate; objItems.REMARK5 = strEndDate; } if (!String.IsNullOrEmpty(strPartCode) || !String.IsNullOrEmpty(strPartName) || !String.IsNullOrEmpty(strPartId)) { objItemParts.ID = strPartId; objItemParts.PART_NAME = strPartName; objItemParts.PART_CODE = strPartCode; } dt = new TOaPartCollarLogic().SelectUnionPartByTable(objItems, objItemParts, 0, 0); ReportDataSource rds = new ReportDataSource("DataSet1", dt); this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rds); this.reportViewer1.LocalReport.Refresh(); }
/// <summary> /// 获取领用物料明细 /// </summary> /// <param name="tOaPartCollar"></param> /// <param name="tOaPartInfor"></param> /// <param name="iIndex"></param> /// <param name="iCount"></param> /// <returns></returns> public DataTable SelectUnionPartByTable(TOaPartCollarVo tOaPartCollar, TOaPartInfoVo tOaPartInfor, int iIndex, int iCount) { string strSQL = @" SELECT A.ID,A.PART_ID,A.USED_QUANTITY,A.USER_ID,A.LASTIN_DATE,A.REMARK1,A.REASON,B.PART_NAME,B.PART_CODE,B.UNIT,B.MODELS,C.REAL_NAME,C.USER_NAME FROM T_OA_PART_COLLAR A JOIN T_OA_PART_INFO B ON B.ID=A.PART_ID and B.IS_DEL='0' LEFT JOIN T_SYS_USER C ON C.ID=A.USER_ID WHERE 1=1"; if (!String.IsNullOrEmpty(tOaPartCollar.ID)) { strSQL += String.Format(" AND A.ID IN ('{0}')", tOaPartCollar.ID); } if (!String.IsNullOrEmpty(tOaPartInfor.ID)) { strSQL += String.Format(" AND B.ID = '{0}'", tOaPartInfor.ID); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_CODE)) { strSQL += String.Format(" AND B.PART_CODE LIKE '%{0}%'", tOaPartInfor.PART_CODE); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_NAME)) { strSQL += String.Format(" AND B.PART_NAME LIKE '%{0}%'", tOaPartInfor.PART_NAME); } if (!String.IsNullOrEmpty(tOaPartCollar.REMARK4) && !String.IsNullOrEmpty(tOaPartCollar.REMARK5)) { strSQL += " AND CONVERT(DATETIME, CONVERT(VARCHAR(100), A.LASTIN_DATE,23),111) "; strSQL += String.Format(" BETWEEN CONVERT(DATETIME, CONVERT(varchar(100), '{0}',23),111) AND CONVERT(DATETIME, CONVERT(varchar(100), '{1}',23),111)", tOaPartCollar.REMARK4, tOaPartCollar.REMARK5); } if (!String.IsNullOrEmpty(tOaPartCollar.USER_ID)) { strSQL += String.Format(" AND C.REAL_NAME LIKE '%{0}%'", tOaPartCollar.USER_ID); } return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaPartInfo_UpdateSet">UpdateSet用户对象</param> /// <param name="tOaPartInfo_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaPartInfoVo tOaPartInfo_UpdateSet, TOaPartInfoVo tOaPartInfo_UpdateWhere) { string strSQL = SqlHelper.BuildUpdateExpress(tOaPartInfo_UpdateSet, TOaPartInfoVo.T_OA_PART_INFO_TABLE); strSQL += this.BuildWhereStatement(tOaPartInfo_UpdateWhere); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
public static string deleteData(string strDelIDs) { if (strDelIDs.Length == 0) { return("0"); } string[] arrDelIDs = strDelIDs.Split(','); bool isSuccess = true; for (int i = 0; i < arrDelIDs.Length; i++) { TOaPartInfoVo objPart = new TOaPartInfoVo(); objPart.ID = arrDelIDs[i]; objPart.IS_DEL = "1"; isSuccess = new TOaPartInfoLogic().Edit(objPart); } if (isSuccess) { return("1"); } else { return("0"); } }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tOaPartInfo">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TOaPartInfoVo tOaPartInfo, int iIndex, int iCount) { string strSQL = " select * from T_OA_PART_INFO {0} "; strSQL = String.Format(strSQL, BuildWhereStatement(tOaPartInfo)); strSQL += "order by PART_NAME"; return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TOaPartInfoVo tOaPartInfo) { string strSQL = "delete from T_OA_PART_INFO "; strSQL += this.BuildWhereStatement(tOaPartInfo); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
public static string EditData(string strID, string strPART_CODE, string strPART_NAME, string strPART_TYPE, string strUNIT, string strMODELS, string strINVENTORY, string strMEDIUM, string strPURE, string strALARM, string strUSEING, string strREQUEST, string strNARURE, string isCheck) { bool isSuccess = true; string Msg = "0"; if (isCheck == "true") { TOaPartInfoVo obj = new TOaPartInfoVo(); obj.PART_CODE = strPART_CODE; obj.PART_NAME = strPART_NAME; obj.MODELS = strMODELS; obj.IS_DEL = "0"; obj = new TOaPartInfoLogic().SelectByObject(obj); if (obj.ID != "") { Msg = "存在相同的物料信息,请检查"; } } if (Msg == "0") { TOaPartInfoVo objPart = new TOaPartInfoVo(); objPart.ID = strID; objPart.IS_DEL = "0"; objPart.PART_CODE = strPART_CODE; objPart.PART_NAME = strPART_NAME; objPart.PART_TYPE = strPART_TYPE; objPart.UNIT = strUNIT; objPart.MODELS = strMODELS; objPart.INVENTORY = strINVENTORY; objPart.MEDIUM = strMEDIUM; objPart.PURE = strPURE; objPart.ALARM = strALARM; objPart.USEING = strUSEING; objPart.REQUEST = strREQUEST; objPart.NARURE = strNARURE; isSuccess = new TOaPartInfoLogic().Edit(objPart); if (isSuccess) { Msg = "1"; } else { Msg = "0"; } } return(Msg); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tBaseItemAnalysis">对象</param> /// <returns>返回行数</returns> public DataTable SelectByTable_ByJoin(TOaPartInfoVo tOaPartInfo, int iIndex, int iCount) { string strSQL1 = " select * from T_OA_PART_INFO {0} "; strSQL1 = String.Format(strSQL1, BuildWhereStatement(tOaPartInfo)); string strSQL = "select a.DICT_TEXT,i.* from (" + strSQL1 + ")i"; strSQL += " join T_SYS_DICT a on a.DICT_CODE=i.PART_TYPE and a.DICT_TYPE='PART_TYPE'"; if (tOaPartInfo.SORT_FIELD != "") { strSQL += " order by " + tOaPartInfo.SORT_FIELD + " " + tOaPartInfo.SORT_TYPE; } return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
public static string AddData(string strPART_CODE, string strPART_NAME, string strPART_TYPE, string strUNIT, string strMODELS, string strINVENTORY, string strMEDIUM, string strPURE, string strALARM, string strUSEING, string strREQUEST, string strNARURE) { bool isSuccess = true; string Msg = "0"; TOaPartInfoVo obj = new TOaPartInfoVo(); obj.PART_CODE = strPART_CODE; obj.PART_NAME = strPART_NAME; obj.MODELS = strMODELS; obj.IS_DEL = "0"; obj = new TOaPartInfoLogic().SelectByObject(obj); if (obj.ID == "") { TOaPartInfoVo objPart = new TOaPartInfoVo(); objPart.ID = GetSerialNumber("t_oa_part_info_id"); objPart.IS_DEL = "0"; objPart.PART_CODE = strPART_CODE; objPart.PART_NAME = strPART_NAME; objPart.MODELS = strMODELS; objPart.PART_TYPE = strPART_TYPE; objPart.UNIT = strUNIT; objPart.INVENTORY = strINVENTORY; objPart.MEDIUM = strMEDIUM; objPart.PURE = strPURE; objPart.ALARM = strALARM; objPart.USEING = strUSEING; objPart.REQUEST = strREQUEST; objPart.NARURE = strNARURE; isSuccess = new TOaPartInfoLogic().Create(objPart); if (isSuccess) { Msg = "1"; } else { Msg = "0"; } } else { Msg = "存在相同的物料信息,请检查"; } return(Msg); }
//获取数据 private void GetData() { 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 strSrhPART_CODE = (Request.Params["SrhPART_CODE"] != null) ? Request.Params["SrhPART_CODE"] : ""; string strSrhPART_NAME = (Request.Params["SrhPART_NAME"] != null) ? Request.Params["SrhPART_NAME"] : ""; string strSrhPART_TYPE = (Request.Params["SrhPART_TYPE"] != null) ? Request.Params["SrhPART_TYPE"] : ""; if (strSrhPART_TYPE == "" && Request.Params["type"] != null) { if (Request.Params["type"].ToString() == "other") { strSrhPART_TYPE = "03,04,05,07"; } else if (Request.Params["type"].ToString() == "drugs") { strSrhPART_TYPE = "01,02"; } else if (Request.Params["type"].ToString() == "office") { strSrhPART_TYPE = "06"; } } TOaPartInfoVo objPart = new TOaPartInfoVo(); objPart.IS_DEL = "0"; objPart.PART_CODE = strSrhPART_CODE; objPart.PART_NAME = strSrhPART_NAME; objPart.PART_TYPE = strSrhPART_TYPE; objPart.SORT_FIELD = "PART_NAME asc,MODELS"; objPart.SORT_TYPE = "asc"; objPart.REMARK1 = "query";//huangjinjun add TOaPartInfoLogic logicPart = new TOaPartInfoLogic(); int intTotalCount = logicPart.GetSelectResultCount(objPart);;//总计的数据条数 DataTable dt = logicPart.SelectByTable_ByJoin(objPart, intPageIdx, intPagesize); string strJson = CreateToJson(dt, intTotalCount); Response.Write(strJson); }
protected void btnExport_Click(object sender, EventArgs e) { string strPartCollarId = ""; strPartCollarId = this.hidExportDate.Value.ToString(); DataTable dt = new DataTable(); TOaPartCollarVo objItems = new TOaPartCollarVo(); TOaPartInfoVo objItemParts = new TOaPartInfoVo(); objItems.ID = strPartCollarId.Replace(",", "','"); if (!String.IsNullOrEmpty(strPartId)) { objItemParts.ID = strPartId; } dt = new TOaPartCollarLogic().SelectUnionPartByTable(objItems, objItemParts, 0, 0); FileStream file = new FileStream(HttpContext.Current.Server.MapPath("template/PartUsedHistorySheet.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); sheet.GetRow(2).GetCell(0).SetCellValue("生成日期:" + DateTime.Now.ToString("yyyy-MM-dd")); for (int i = 0; i < dt.Rows.Count; i++) { sheet.GetRow(i + 4).GetCell(0).SetCellValue(dt.Rows[i]["PART_NAME"].ToString()); sheet.GetRow(i + 4).GetCell(1).SetCellValue(dt.Rows[i]["PART_CODE"].ToString()); sheet.GetRow(i + 4).GetCell(2).SetCellValue(dt.Rows[i]["USED_QUANTITY"].ToString()); sheet.GetRow(i + 4).GetCell(3).SetCellValue(dt.Rows[i]["LASTIN_DATE"].ToString()); sheet.GetRow(i + 4).GetCell(4).SetCellValue(dt.Rows[i]["REAL_NAME"].ToString()); sheet.GetRow(i + 4).GetCell(5).SetCellValue(dt.Rows[i]["REASON"].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(); } }
/// <summary> /// 根据对象构造条件语句 /// </summary> /// <param name="tOaPartBuyRequst"></param> /// <returns></returns> public string BuildWhereStatementTwo(TOaPartBuyRequstVo tOaPartBuyRequst, TOaPartInfoVo tOaPartInfo) { StringBuilder strWhereStatement = new StringBuilder(" Where 1=1 "); if (null != tOaPartBuyRequst) { //物料类型 if (!String.IsNullOrEmpty(tOaPartInfo.PART_TYPE.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND B.PART_TYPE in ({0})", tOaPartInfo.PART_TYPE.ToString())); } //编号 if (!String.IsNullOrEmpty(tOaPartBuyRequst.ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND C.ID = '{0}'", tOaPartBuyRequst.ID.ToString())); } //申请科室 if (!String.IsNullOrEmpty(tOaPartBuyRequst.APPLY_DEPT_ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND C.APPLY_DEPT_ID = '{0}'", tOaPartBuyRequst.APPLY_DEPT_ID.ToString())); } //申请人 if (!String.IsNullOrEmpty(tOaPartBuyRequst.APPLY_USER_ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND C.APPLY_USER_ID = '{0}'", tOaPartBuyRequst.APPLY_USER_ID.ToString())); } //状态,1待审批,2待采购,3已采购 if (!String.IsNullOrEmpty(tOaPartBuyRequst.STATUS.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND C.STATUS in ({0})", tOaPartBuyRequst.STATUS.ToString())); } //物料类别 if (!String.IsNullOrEmpty(tOaPartBuyRequst.APPLY_TYPE.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND C.APPLY_TYPE in ({0})", tOaPartBuyRequst.APPLY_TYPE.ToString())); } } return(strWhereStatement.ToString()); }
public DataTable SelectUnionPartByTable(TOaPartBuyRequstLstVo tOaPartBuyRequstLst, TOaPartInfoVo tOaPartInfor, TOaPartBuyRequstVo tOaPartBuyRequest, int iIndex, int iCount) { return(access.SelectUnionPartByTable(tOaPartBuyRequstLst, tOaPartInfor, tOaPartBuyRequest, iIndex, iCount)); }
/// <summary> /// 返回符合条件的采购计划与验收清单总记录数 /// </summary> /// <param name="tOaPartAcceptedlist"></param> /// <param name="iIndex"></param> /// <param name="iCount"></param> /// <returns></returns> public int GetSelectUnionByTableCount(TOaPartAcceptedlistVo tOaPartAcceptedlist, TOaPartInfoVo tOaPartInfor) { string strSQL = @"SELECT A.ID,A.REQUST_LST_ID,A.ACCEPTED_ID,B.REQUST_ID,B.STATUS,C.PART_ID,C.NEED_QUANTITY,C.USERDO,C.ENTERPRISE_NAME, C.RANGE,C.STANDARD,C.PRICE,C.AMOUNT,CONVERT(DATETIME, CONVERT(VARCHAR(100), C.RECIVEPART_DATE,23),111) AS RECIVEPART_DATE,CONVERT(DATETIME, CONVERT(VARCHAR(100), C.CHECK_DATE,23),111) AS CHECK_DATE,C.CHECK_RESULT,C.CHECK_USERID,C.REMARK1,D.PART_NAME, D.PART_CODE,D.PART_TYPE,D.UNIT,D.MODELS,D.INVENTORY,D.MEDIUM,D.PURE,D.ALARM,D.USEING,D.REQUEST,D.NARURE, E.REAL_NAME,E.USER_NAME,F.DICT_TEXT AS PARTTYPE,G.DICT_TEXT AS CHECKRESULT FROM dbo.T_OA_PART_ACCEPTEDLIST A LEFT JOIN dbo.T_OA_PART_BUY_REQUST_LST B ON A.REQUST_LST_ID=B.ID LEFT JOIN dbo.T_OA_PART_ACCEPTED C ON A.ACCEPTED_ID=C.ID LEFT JOIN dbo.T_OA_PART_INFO D ON D.ID=C.PART_ID LEFT JOIN dbo.T_SYS_USER E ON E.ID=C.CHECK_USERID LEFT JOIN dbo.T_SYS_DICT F ON F.DICT_CODE=D.PART_TYPE AND F.DICT_TYPE='PART_TYPE' LEFT JOIN dbo.T_SYS_DICT G ON G.DICT_CODE=C.CHECK_RESULT AND G.DICT_TYPE='CheckResult' WHERE 1=1 AND D.IS_DEL='0'"; if (!String.IsNullOrEmpty(tOaPartAcceptedlist.REQUST_LST_ID)) { strSQL += String.Format(" AND A.REQUST_LST_ID='{0}'", tOaPartAcceptedlist.REQUST_LST_ID); } if (!String.IsNullOrEmpty(tOaPartAcceptedlist.ACCEPTED_ID)) { strSQL += String.Format(" AND A.ACCEPTED_ID='{0}'", tOaPartAcceptedlist.ACCEPTED_ID); } if (!String.IsNullOrEmpty(tOaPartAcceptedlist.ID)) { strSQL += String.Format(" AND A.ID IN ('{0}')", tOaPartAcceptedlist.ID); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_CODE)) { strSQL += String.Format(" AND D.PART_CODE LIKE '%{0}%'", tOaPartInfor.PART_CODE); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_NAME)) { strSQL += String.Format(" AND D.PART_NAME LIKE '%{0}%'", tOaPartInfor.PART_NAME); } if (!String.IsNullOrEmpty(tOaPartAcceptedlist.REMARK4) && !String.IsNullOrEmpty(tOaPartAcceptedlist.REMARK5)) { strSQL += " AND CONVERT(DATETIME, CONVERT(VARCHAR(100), C.CHECK_DATE,23),111) "; strSQL += String.Format(" BETWEEN CONVERT(DATETIME, CONVERT(varchar(100), '{0}',23),111) AND CONVERT(DATETIME, CONVERT(varchar(100), '{1}',23),111)", tOaPartAcceptedlist.REMARK4, tOaPartAcceptedlist.REMARK5); } return(SqlHelper.ExecuteDataTable(strSQL).Rows.Count); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaPartInfo">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaPartInfoVo tOaPartInfo) { return(access.Edit(tOaPartInfo)); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tOaPartInfo_UpdateSet">UpdateSet用户对象</param> /// <param name="tOaPartInfo_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TOaPartInfoVo tOaPartInfo_UpdateSet, TOaPartInfoVo tOaPartInfo_UpdateWhere) { return(access.Edit(tOaPartInfo_UpdateSet, tOaPartInfo_UpdateWhere)); }
protected void btnExport_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); string strType = this.hidGrid.Value.ToString(); string strPartBuyLstId = this.hidExportDate.Value.ToString(); if (!String.IsNullOrEmpty(strType)) { //导出采购计划明细 if (strType == "1") { TOaPartBuyRequstLstVo objItems = new TOaPartBuyRequstLstVo(); TOaPartInfoVo objItemPart = new TOaPartInfoVo(); TOaPartBuyRequstVo objItemBy = new TOaPartBuyRequstVo(); objItemBy.STATUS = "9"; if (!String.IsNullOrEmpty(strPartBuyLstId)) { objItems.ID = strPartBuyLstId.Replace(",", "','"); } objItems.STATUS = "0"; dt = new TOaPartBuyRequstLstLogic().SelectUnionPartByTable(objItems, objItemPart, objItemBy, 0, 0); DataView dv = new DataView(); dv = dt.DefaultView; if (dt.Rows.Count > 0) { dv.Sort = "DELIVERY_DATE"; } FileStream file = new FileStream(HttpContext.Current.Server.MapPath("template/PartPlanDetailSheet.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); sheet.GetRow(2).GetCell(0).SetCellValue("生成日期:" + DateTime.Now.ToString("yyyy-MM-dd")); DataTable dtTemp = new DataTable(); dtTemp = dv.ToTable().Copy();; for (int i = 0; i < dt.Rows.Count; i++) { sheet.GetRow(i + 4).GetCell(0).SetCellValue(dtTemp.Rows[i]["PART_NAME"].ToString()); sheet.GetRow(i + 4).GetCell(1).SetCellValue(dtTemp.Rows[i]["PART_CODE"].ToString()); sheet.GetRow(i + 4).GetCell(2).SetCellValue(dtTemp.Rows[i]["APPLY_TITLE"].ToString()); sheet.GetRow(i + 4).GetCell(3).SetCellValue(dtTemp.Rows[i]["DEPT_NAME"].ToString()); sheet.GetRow(i + 4).GetCell(4).SetCellValue(dtTemp.Rows[i]["REAL_NAME"].ToString()); sheet.GetRow(i + 4).GetCell(5).SetCellValue(dtTemp.Rows[i]["MODELS"].ToString()); sheet.GetRow(i + 4).GetCell(6).SetCellValue(dtTemp.Rows[i]["NEED_QUANTITY"].ToString()); sheet.GetRow(i + 4).GetCell(7).SetCellValue(dtTemp.Rows[i]["DELIVERY_DATE"].ToString()); sheet.GetRow(i + 4).GetCell(8).SetCellValue("¥" + dtTemp.Rows[i]["BUDGET_MONEY"].ToString()); sheet.GetRow(i + 4).GetCell(9).SetCellValue(dtTemp.Rows[i]["REQUEST"].ToString()); sheet.GetRow(i + 4).GetCell(10).SetCellValue(dtTemp.Rows[i]["USEING"].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(); } } //导出验收明细 if (strType == "2") { TOaPartAcceptedlistVo objItems = new TOaPartAcceptedlistVo(); if (!String.IsNullOrEmpty(strPartBuyLstId)) { objItems.ID = strPartBuyLstId.Replace(",", "','"); } TOaPartInfoVo objItemPart = new TOaPartInfoVo(); dt = new TOaPartAcceptedlistLogic().SelectUnionByTable(objItems, objItemPart, 0, 0); DataView dv = new DataView(); dv = dt.DefaultView; if (dt.Rows.Count > 0) { dv.Sort = "CHECK_DATE DESC"; } FileStream file = new FileStream(HttpContext.Current.Server.MapPath("template/PartAcceptDetailSheet.xls"), FileMode.Open, FileAccess.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheet("Sheet1"); DataTable dtTemp = new DataTable(); dtTemp = dv.ToTable().Copy();; for (int i = 0; i < dt.Rows.Count; i++) { sheet.GetRow(i + 3).GetCell(0).SetCellValue(dtTemp.Rows[i]["PARTTYPE"].ToString()); sheet.GetRow(i + 3).GetCell(1).SetCellValue(dtTemp.Rows[i]["PART_NAME"].ToString() + "(" + dtTemp.Rows[i]["PART_CODE"].ToString() + ")"); sheet.GetRow(i + 3).GetCell(2).SetCellValue(dtTemp.Rows[i]["ENTERPRISE_NAME"].ToString()); sheet.GetRow(i + 3).GetCell(3).SetCellValue(dtTemp.Rows[i]["NEED_QUANTITY"].ToString()); sheet.GetRow(i + 3).GetCell(4).SetCellValue("¥" + dtTemp.Rows[i]["PRICE"].ToString()); sheet.GetRow(i + 3).GetCell(5).SetCellValue("¥" + dtTemp.Rows[i]["AMOUNT"].ToString()); sheet.GetRow(i + 3).GetCell(6).SetCellValue(dtTemp.Rows[i]["CHECK_DATE"].ToString()); sheet.GetRow(i + 3).GetCell(7).SetCellValue(dtTemp.Rows[i]["RECIVEPART_DATE"].ToString()); sheet.GetRow(i + 3).GetCell(8).SetCellValue(dtTemp.Rows[i]["CHECKRESULT"].ToString()); sheet.GetRow(i + 3).GetCell(9).SetCellValue(dtTemp.Rows[i]["REAL_NAME"].ToString()); sheet.GetRow(i + 3).GetCell(10).SetCellValue(dtTemp.Rows[i]["REMARK1"].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(); } } } }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tOaPartInfo">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TOaPartInfoVo tOaPartInfo, int iIndex, int iCount) { return(access.SelectByTable(tOaPartInfo, iIndex, iCount)); }
/// <summary> /// 返回符合条件的采购计划与验收清单 /// </summary> /// <param name="tOaPartAcceptedlist"></param> /// <param name="iIndex"></param> /// <param name="iCount"></param> /// <returns></returns> public DataTable SelectUnionByTable(TOaPartAcceptedlistVo tOaPartAcceptedlist, TOaPartInfoVo tOaPartInfor, int iIndex, int iCount) { return(access.SelectUnionByTable(tOaPartAcceptedlist, tOaPartInfor, iIndex, iCount)); }
public TOaPartInfoLogic(TOaPartInfoVo _tOaPartInfo) { tOaPartInfo = _tOaPartInfo; access = new TOaPartInfoAccess(); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tOaPartInfo">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TOaPartInfoVo tOaPartInfo) { return(access.GetSelectResultCount(tOaPartInfo)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tOaPartInfo">对象条件</param> /// <returns>对象</returns> public TOaPartInfoVo Details(TOaPartInfoVo tOaPartInfo) { return(access.Details(tOaPartInfo)); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tOaPartInfo"></param> /// <returns></returns> public DataTable SelectByTable(TOaPartInfoVo tOaPartInfo) { return(access.SelectByTable(tOaPartInfo)); }
public int GetSelectUnionPartByTableResult(TOaPartBuyRequstLstVo tOaPartBuyRequstLst, TOaPartInfoVo tOaPartInfor, TOaPartBuyRequstVo tOaPartBuyRequest) { return(access.GetSelectUnionPartByTableResult(tOaPartBuyRequstLst, tOaPartInfor, tOaPartBuyRequest)); }
/// <summary> /// 获取用户采购计划列表 /// </summary> /// <param name="tOaPartBuyRequstLst"></param> /// <param name="iIndex"></param> /// <param name="iCount"></param> /// <returns></returns> public int GetSelectUnionPartByTableResult(TOaPartBuyRequstLstVo tOaPartBuyRequstLst, TOaPartInfoVo tOaPartInfor, TOaPartBuyRequstVo tOaPartBuyRequest) { string strSQL = @" SELECT A.ID,A.PART_ID,A.NEED_QUANTITY,A.BUDGET_MONEY,CONVERT(DATETIME, CONVERT(VARCHAR(100), A.DELIVERY_DATE,23),111) AS DELIVERY_DATE,A.USERDO,A.STATUS," + " B.PART_CODE,B.PART_TYPE,B.PART_NAME,B.UNIT,B.MODELS,B.INVENTORY,B.MEDIUM,B.PURE," + " B.ALARM,B.REQUEST,B.USEING,B.NARURE," + " C.APPLY_USER_ID,C.APPLY_DEPT_ID,C.APPLY_DATE,C.APPLY_TITLE,D.REAL_NAME,D.USER_NAME,E.DICT_TEXT AS DEPT_NAME" + " FROM dbo.T_OA_PART_BUY_REQUST_LST A " + " LEFT JOIN dbo.T_OA_PART_INFO B ON B.ID=A.PART_ID" + " LEFT JOIN dbo.T_OA_PART_BUY_REQUST C ON C.ID=A.REQUST_ID" + " LEFT JOIN dbo.T_SYS_USER D ON D.ID=C.APPLY_USER_ID" + " LEFT JOIN dbo.T_SYS_DICT E ON E.DICT_CODE=C.APPLY_DEPT_ID AND E.DICT_TYPE='dept'" + " WHERE 1=1 AND B.IS_DEL='0'"; if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.ID)) { strSQL += String.Format(" AND A.ID IN ('{0}')", tOaPartBuyRequstLst.ID); } if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.PART_ID)) { strSQL += String.Format(" AND A.PART_ID='{0}'", tOaPartBuyRequstLst.PART_ID); } if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.REQUST_ID)) { strSQL += String.Format(" AND A.REQUST_ID='{0}'", tOaPartBuyRequstLst.REQUST_ID); } if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.STATUS)) { strSQL += String.Format(" AND A.STATUS='{0}'", tOaPartBuyRequstLst.STATUS); } if (!String.IsNullOrEmpty(tOaPartBuyRequest.STATUS)) { strSQL += String.Format(" AND C.STATUS='{0}'", tOaPartBuyRequest.STATUS); } if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.REMARK3)) { strSQL += String.Format(" AND D.REAL_NAME LIKE '%{0}%' ", tOaPartBuyRequstLst.REMARK3); } if (!String.IsNullOrEmpty(tOaPartBuyRequest.APP_DEPT_ID)) { strSQL += String.Format(" AND C.APPLY_DEPT_ID LIKE '%{0}%'", tOaPartBuyRequest.APP_DEPT_ID); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_CODE)) { strSQL += String.Format(" AND B.PART_CODE LIKE '%{0}%'", tOaPartInfor.PART_CODE); } if (!String.IsNullOrEmpty(tOaPartInfor.PART_NAME)) { strSQL += String.Format(" AND B.PART_NAME LIKE '%{0}%'", tOaPartInfor.PART_NAME); } if (!String.IsNullOrEmpty(tOaPartBuyRequstLst.REMARK4) && !String.IsNullOrEmpty(tOaPartBuyRequstLst.REMARK5)) { strSQL += " CONVERT(DATETIME, CONVERT(VARCHAR(100), A.DELIVERY_DATE,23),111) "; strSQL += String.Format(" BETWEEN CONVERT(DATETIME, CONVERT(varchar(100), '{0}',23),111) AND CONVERT(DATETIME, CONVERT(varchar(100), '{1}',23),111)", tOaPartBuyRequstLst.REMARK4, tOaPartBuyRequstLst.REMARK5); } return(SqlHelper.ExecuteDataTable(strSQL).Rows.Count); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TOaPartInfoVo tOaPartInfo) { return(access.Delete(tOaPartInfo)); }
/// <summary> /// 返回符合条件的采购计划与验收清单总记录数 /// </summary> /// <param name="tOaPartAcceptedlist"></param> /// <param name="iIndex"></param> /// <param name="iCount"></param> /// <returns></returns> public int GetSelectUnionByTableCount(TOaPartAcceptedlistVo tOaPartAcceptedlist, TOaPartInfoVo tOaPartInfor) { return(access.GetSelectUnionByTableCount(tOaPartAcceptedlist, tOaPartInfor)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tOaPartInfo">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TOaPartInfoVo> SelectByObject(TOaPartInfoVo tOaPartInfo, int iIndex, int iCount) { return(access.SelectByObject(tOaPartInfo, iIndex, iCount)); }