/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { List <ExcelHead> cellheader = new List <ExcelHead>(); cellheader.Add(new ExcelHead("ProblemOrderCode", "订单变更编号")); cellheader.Add(new ExcelHead("OrderCode", "原订单编号")); cellheader.Add(new ExcelHead("SiteName", "站点名称")); cellheader.Add(new ExcelHead("TypeCode", "类型编号")); cellheader.Add(new ExcelHead("TypeName", "类型名称")); cellheader.Add(new ExcelHead("UsePart", "使用部位")); cellheader.Add(new ExcelHead("RevokeStatus", "撤销状态")); cellheader.Add(new ExcelHead("DistributionTime", "配送时间")); cellheader.Add(new ExcelHead("DistributionAddress", "配送地址")); cellheader.Add(new ExcelHead("OldTotal", "原总量合计(kg)")); cellheader.Add(new ExcelHead("Total", "变更总量合计(kg)", 30)); var request = JsonEx.JsonToObj <ProblemOrderRequest>(jsonData); request.IsOutPut = true; var ret = _problemOrder.GetDataListForPage(request); var data = (DataTable)ret.rows; decimal hj = 0; if (data.Rows.Count > 0) { hj = Convert.ToDecimal(data.Compute("sum(Total)", "true")); } string hzzfc = "撤销重量合计(KG):" + hj; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "订单变更", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "订单变更.xls")); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //所属项目、站点、加工厂名称、原材料编号、原材料名称、规格、尺寸(m、㎡)、单位重量(kg/m、㎡)、库存数量(根)、可用数量(根)、重量(kg)、厂家、炉批号 //ProjectName,SiteName,ProcessFactoryName,MaterialCode,MaterialName,SpecificationModel,Size,MeasurementUnitZl,Number,UseNumber,Weight,Factory,BatchNumber //导出数据列 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "ProjectName", "所属项目" }, { "SiteName", "站点" }, { "ProcessFactoryName", "加工厂名称" }, { "MaterialCode", "原材料编号" }, { "MaterialName", "原材料名称" }, { "SpecificationModel", "规格" }, { "Size", "尺寸(m、㎡)" }, { "MeasurementUnitZl", "单位重量(kg/m、㎡)" }, { "Number", "库存数量(根)" }, { "UseNumber", "可用数量(根)" }, { "Weight", "重量(kg)" }, { "Factory", "厂家" }, { "BatchNumber", "炉批号" }, }; var request = JsonEx.JsonToObj <CloutStockRequest>(jsonData); var data = _cloutStock.GetExportList(request); decimal hj = 0; if (data.Rows.Count > 0) { hj = Convert.ToDecimal(data.Compute("sum(Weight)", "true")); } string hzzfc = "合计(KG):" + hj; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "余料库存", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "余料库存.xls")); }
public ActionResult SubmitForm(string model, string itemModel, string itemModelBack, string type) { try { var rMProductionMaterialModel = JsonEx.JsonToObj <TbRMProductionMaterial>(model); var item = JsonEx.JsonToObj <List <TbRMProductionMaterialDetail> >(itemModel); var itemBack = JsonEx.JsonToObj <List <RMProductionMaterialItmeBackRequest> >(itemModelBack); if (string.IsNullOrEmpty(rMProductionMaterialModel.ProjectId)) { return(Content(AjaxResult.Warning("项目Id不能为空").ToJson())); } if (type == "add") { var data = _RM.Insert(rMProductionMaterialModel, item, itemBack); return(Content(data.ToJson())); } else { var data = _RM.Update(rMProductionMaterialModel, item, itemBack); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
/// <summary> /// 新增、修改数据提交 /// </summary> /// <param name="model">主表信息</param> /// <param name="itemModel">明细信息</param> /// <param name="type">类型</param> /// <returns></returns> public ActionResult SubmitForm(string model, string itemModel, string type) { try { var PlanModel = JsonEx.JsonToObj <TbFactoryBatchNeedPlan>(model); var PlanItem = JsonEx.JsonToObj <List <TbFactoryBatchNeedPlanItem> >(itemModel); ////供应清单 //var supList = JsonEx.JsonToObj<TbSupplyList>(model); //var supDetail = JsonEx.JsonToObj<List<TbSupplyListDetail>>(itemModel); if (type == "add") { //var data = _fbnpBus.Insert(PlanModel, PlanItem, supList, supDetail); var data = _fbnpBus.Insert(PlanModel, PlanItem); return(Content(data.ToJson())); } else { //var data = _fbnpBus.Update(PlanModel, PlanItem, supList, supDetail); var data = _fbnpBus.Update(PlanModel, PlanItem); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { List <ExcelHead> cellheader = new List <ExcelHead>(); cellheader.Add(new ExcelHead("SiteName", "站点名称")); cellheader.Add(new ExcelHead("OrderCode", "订单编号")); cellheader.Add(new ExcelHead("OrderStart", "订单类型")); cellheader.Add(new ExcelHead("WeightTotal", "总量合计(kg)")); cellheader.Add(new ExcelHead("AccumulativeQuantity", "开累加工量(kg)")); cellheader.Add(new ExcelHead("TypeCode", "类型编号")); cellheader.Add(new ExcelHead("TypeName", "类型名称")); cellheader.Add(new ExcelHead("UsePart", "使用部位")); cellheader.Add(new ExcelHead("DistributionTime", "计划配送时间")); cellheader.Add(new ExcelHead("ProcessFactoryName", "加工厂名称")); var request = JsonEx.JsonToObj <OrderProgressRequest>(jsonData); var data = _orderProLogic.GetExportList(request); decimal zlhj = 0; decimal kljglhj = 0; if (data.Rows.Count > 0) { zlhj = Convert.ToDecimal(data.Compute("sum(WeightTotal)", "true")); kljglhj = Convert.ToDecimal(data.Compute("sum(AccumulativeQuantity)", "true")); } string hzzfc = "总量合计(KG):" + zlhj + ",开累加工量合计(KG):" + kljglhj; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "订单进度", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "订单进度.xls")); }
public ActionResult SavePackNum(int keyValue, string itemModel) { var item = JsonEx.JsonToObj <List <TbWorkOrderDetail> >(itemModel); var data = _workOrderLogic.SavePackNum(keyValue, item); return(Content(data.ToJson())); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //导出数据列 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "SupplyPlanCode", "补充计划编号" }, { "DemandPlanCode", "需求计划编号" }, { "RebarTypeNew", "钢筋类型" }, { "BranchName", "分部名称" }, { "WorkAreaName", "工区名称" }, { "ProcessFactoryName", "加工厂名称" }, { "DeliveryAdd", "交货地点" }, { "SupplyPlanNum", "补充计划总量(kg)" }, { "GrandTotalPlanNum", "累计计划重量(kg)" }, }; var request = JsonEx.JsonToObj <RawMonthDemSupplyPlanRequest>(jsonData); var data = _rawMonthDemSupplyPlanLogic.GetExportList(request); decimal xg = 0; decimal jzgj = 0; if (data.Rows.Count > 0) { xg = Convert.ToDecimal(data.Compute("sum(GrandTotalPlanNum)", "RebarType='SectionSteel'")); jzgj = Convert.ToDecimal(data.Compute("sum(GrandTotalPlanNum)", "RebarType='BuildingSteel'")); } decimal zzl = xg + jzgj; string hzzfc = "建筑钢筋总量(KG):" + jzgj + ",型钢总量(KG):" + xg + ",合计总量(KG):" + zzl; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "原材料月度需求补充计划", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "原材料月度需求补充计划.xls")); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { List <ExcelHead> cellheader = new List <ExcelHead>(); cellheader.Add(new ExcelHead("SiteName", "站点名称")); cellheader.Add(new ExcelHead("DistributionCode", "配送装车编号")); cellheader.Add(new ExcelHead("OrderCode", "订单编号")); cellheader.Add(new ExcelHead("TypeCode", "类型编号")); cellheader.Add(new ExcelHead("TypeName", "类型名称")); cellheader.Add(new ExcelHead("UnloadingState", "卸货状态")); cellheader.Add(new ExcelHead("SignState", "签收状态")); cellheader.Add(new ExcelHead("UsePart", "使用部位")); cellheader.Add(new ExcelHead("PlanDistributionTime", "计划配送时间")); cellheader.Add(new ExcelHead("DistributionAddress", "配送地址")); cellheader.Add(new ExcelHead("TotalAggregate", "合计总量(kg)")); cellheader.Add(new ExcelHead("CarCph", "车辆编号")); cellheader.Add(new ExcelHead("CarUser", "驾驶员")); cellheader.Add(new ExcelHead("LoadCompleteTime", "装车完成时间")); cellheader.Add(new ExcelHead("ContactsName", "站点联系人")); cellheader.Add(new ExcelHead("ContactWay", "联系方式")); var request = JsonEx.JsonToObj <FPiCiXQPlan>(jsonData); var data = _deBus.GetExportList(request); decimal zzl = Convert.ToDecimal(data.Compute("sum(TotalAggregate)", "true")); string hzzfc = "合计(KG):" + zzl; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "配送装车", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "配送装车.xls")); }
///// <summary> ///// 新增、修改 ///// </summary> ///// <param name="jdata"></param> ///// <returns></returns> //[HttpGet] //public HttpResponseMessage SaveUserData(string jdata) //{ // try // { // //{"type":"edit","model":{"UserCode":"zhangqiang","UserName":"******","UserPwd":"dEu7vwkYjTA=","UserSex":"男","UserClosed":"在职","MobilePhone":"15726831456","IDNumber":"500228199210264578","CompanyCode ":"001003002","DepartmentCode":"BM17"}} // JObject jo = (JObject)JsonConvert.DeserializeObject(jdata); // string modelstr = jo["model"] == null ? "" : jo["model"].ToString(); // string type = jo["type"] == null ? "" : jo["type"].ToString(); // if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type)) // return AjaxResult.Error("参数错误").ToJsonApi(); // var model = JsonEx.JsonToObj<TbUser>(modelstr); // if (type == "add") // { // var data = ui.Insert(model, true); // return data.ToJsonApi(); // } // else // { // var data = ui.Update(model, true); // return data.ToJsonApi(); // } // } // catch (Exception) // { // return AjaxResult.Error("操作失败").ToJsonApi(); // } //} ///// <summary> ///// 删除 ///// </summary> ///// <param name="keyValue"></param> ///// <returns></returns> //[HttpGet] //public HttpResponseMessage DeleteUserData(string userCode) //{ // var data = ui.DeleteNew(userCode, true); // return data.ToJsonApi(); //} /// <summary> /// 获取用户地址 /// </summary> /// <returns></returns> public HttpResponseMessage GetUserList(string url) { try { var dataJson = Get(strBMUrl + url); //JObject jo = (JObject)JsonConvert.DeserializeObject(dataJson); //string modelstr = jo["data"] == null ? "" : jo["data"].ToString(); //if (string.IsNullOrWhiteSpace(modelstr)) // return AjaxResult.Error("参数错误").ToJsonApi(); //DataTable dt = ToDataTable(modelstr); //dt.Columns["UserAccount"].ColumnName = "UserCode"; //dt.Columns["type"].ColumnName = "UserType"; //DataColumn dc = new DataColumn("UserClosed", typeof(string)); //dc.DefaultValue = "在职"; //dt.Columns.Add(dc); //DataColumn dc1 = new DataColumn("CreateTime", typeof(DateTime)); //dc1.DefaultValue = DateTime.Now; //dt.Columns.Add(dc1); //List<TbUser> model = ModelConvertHelper<TbUser>.ToList(dt); var requestUserList = JsonEx.JsonToObj <RequestUserModel>(dataJson); if (requestUserList.data == null) { return(AjaxResult.Success().ToJsonApi()); } var model = MapperHelper.Map <RequestUserListModel, TbUser>(requestUserList.data); var data = ui.InsertNew(model, true); return(data.ToJsonApi()); } catch (Exception) { return(AjaxResult.Error("操作失败").ToJsonApi()); } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //对账编号、所属加工厂、站点、对账时间、总量(T)、单位(T)、开始日期、结束日期、录入人、录入时间 //SigninNuber,ProcessFactoryName,SiteName,SignforTime,HavingAmount,Unit,StartDate,EndDate,UserName,InsertTime Dictionary <string, string> cellheader = new Dictionary <string, string> { { "SigninNuber", "对账编号" }, { "ProcessFactoryName", "所属加工厂" }, { "SiteName", "站点" }, { "SignforTime", "对账时间" }, { "HavingAmount", "总量(T)" }, { "Unit", "单位(T)" }, { "StartDate", "开始日期" }, { "EndDate", "结束日期" }, { "UserName", "录入人" }, { "InsertTime", "录入时间" }, }; var request = JsonEx.JsonToObj <FPiCiXQPlan>(jsonData); var data = _sdzLogic.GetExportList(request); decimal zl = 0; if (data.Rows.Count > 0) { zl = Convert.ToDecimal(data.Compute("sum(HavingAmount)", "true")); } string hzzfc = "合计(T):" + zl; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "签收对账单", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "签收对账单.xls")); }
public HttpResponseMessage SubmitForm([FromBody] JObject jdata) { try { string modelstr = jdata["model"] == null ? "" : jdata["model"].ToString(); string type = jdata["type"] == null ? "" : jdata["type"].ToString(); if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type)) { return(AjaxResult.Error("参数错误").ToJsonApi()); } var model = JsonEx.JsonToObj <TbArticle>(modelstr); if (type == "add") { model.InsertTime = DateTime.Now; var data = _article.Insert(model, true); return(data.ToJsonApi()); } else { var data = _article.Update(model, true); return(data.ToJsonApi()); } } catch (Exception) { return(AjaxResult.Error("操作失败").ToJsonApi()); } }
public ActionResult SubmitForm(string model, string itemModel, string type) { try { var inOrderModel = JsonEx.JsonToObj <TbInOrder>(model); var inOrderItem = JsonEx.JsonToObj <List <TbInOrderItem> >(itemModel); if (string.IsNullOrEmpty(inOrderModel.SiteCode)) { inOrderModel.SiteCode = ""; } if (type == "add") { var data = _inOrder.Insert(inOrderModel, inOrderItem); return(Content(data.ToJson())); } else { var data = _inOrder.Update(inOrderModel, inOrderItem); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { List <ExcelHead> cellheader = new List <ExcelHead>(); cellheader.Add(new ExcelHead("SiteName", "卸货站点")); cellheader.Add(new ExcelHead("OrderCode", "订单编号")); cellheader.Add(new ExcelHead("DistributionCode", "装车配送编号")); cellheader.Add(new ExcelHead("FlowStateShow", "卸货过程状态")); cellheader.Add(new ExcelHead("TypeCode", "类型编号")); cellheader.Add(new ExcelHead("TypeName", "类型名称")); cellheader.Add(new ExcelHead("PlanDistributionTime", "计划配送时间")); cellheader.Add(new ExcelHead("LoadCompleteTime", "实际配送时间", 20, true)); cellheader.Add(new ExcelHead("CarCph", "车牌号")); cellheader.Add(new ExcelHead("OutSpaceTime", "出场时间", 20, true)); cellheader.Add(new ExcelHead("EnterSpaceTime", "运输到场时间", 20, true)); cellheader.Add(new ExcelHead("WaitTime", "等待卸货时间")); cellheader.Add(new ExcelHead("StartDischargeTime", "开始卸货时间", 20, true)); cellheader.Add(new ExcelHead("EndDischargeTime", "卸货完成时间", 20, true)); cellheader.Add(new ExcelHead("LeaveFactoryTime", "车辆出厂时间", 20, true)); var request = JsonEx.JsonToObj <TransportProcessRequest>(jsonData); var data = _transportFlow.GetExportList(request); var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "车辆运输卸货统计", ""); return(File(fileStream, "application/vnd.ms-excel", "车辆运输卸货统计.xls")); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //计价单号、所属加工厂、站点、开始日期、结束日期、总重量(T)、总金额(元)、录入人、录入时间 //SettlementCode,ProcessFactoryName,SiteName,StartDate,EndDate,TotalWeight,AmountOfMoney,UserName,InsertTime Dictionary <string, string> cellheader = new Dictionary <string, string> { { "SettlementCode", "计价单号" }, { "ProcessFactoryName", "所属加工厂" }, { "SiteName", "站点" }, { "StartDate", "开始日期" }, { "EndDate", "结束日期" }, { "TotalWeight", "总重量(T)" }, { "AmountOfMoney", "总金额(元)" }, { "UserName", "录入人" }, { "InsertTime", "录入时间" }, }; var request = JsonEx.JsonToObj <FPiCiXQPlan>(jsonData); var data = _soLogic.GetExportList(request); decimal zlhj = 0; decimal zjehj = 0; if (data.Rows.Count > 0) { zlhj = Convert.ToDecimal(data.Compute("sum(TotalWeight)", "true")); zjehj = Convert.ToDecimal(data.Compute("sum(AmountOfMoney)", "true")); } string hzzfc = "总重量合计(T):" + zlhj + "," + "总金额合计(元):" + zjehj; var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "结算单", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "结算单.xls")); }
/// <summary> /// 新增/编辑【绑定】 /// </summary> /// <param name="type"></param> /// <param name="MCode"></param> /// <param name="TCode"></param> /// <returns></returns> public ActionResult SubmitForm(string model, string type) { //try //{ // var data = _smtLogic.SubmitForm(MCode, TCode); // return Content(data.ToJson()); //} //catch (Exception) //{ // throw; //} try { var megModel = JsonEx.JsonToObj <TbShortMessageTemplate>(model); if (type == "add") { var data = _smtLogic.Insert(megModel); return(Content(data.ToJson())); } else { var data = _smtLogic.Update(megModel); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
public HttpResponseMessage Approval([FromBody] JObject jdata) { // RequestPara model = PM.Common.Extension.JsonEx.JsonToObj<RequestPara>(para); string modelstr = jdata["para"] == null ? "" : jdata["para"].ToString(); RequestPara model = JsonEx.JsonToObj <RequestPara>(modelstr); //string UserId= var ret = PM.DataAccess.DbContext.Db.Context.From <TbUser>() .Select(TbUser._.UserId).Where(p => p.UserCode == model.UserCode).First(); var data = _flowlogic.Approval(model.FlowCode, model.performState, model.performOpinions, model.FlowPerformID, model.flowNodeCode, ret.UserId, model.FlowTitle, model.FreeNodeUser); return(data.ToJsonApi()); }
public ActionResult ReturnSubmit(string itemModel) { try { var inOrderItem = JsonEx.JsonToObj <List <TbInOrderItem> >(itemModel); var data = _inOrder.ReturnSubmit(inOrderItem); return(Content(data.ToJson())); } catch (Exception) { throw; } }
public ActionResult SubmitForm(string model) { try { var noticemodel = JsonEx.JsonToObj <TbNoticeNewsSetUp>(model); var data = noticeNewsLogic.Update(noticemodel); return(Content(data.ToJson())); } catch (Exception) { throw; } }
public ActionResult SubmitTestReport(string enclosure, string itemModel) { try { var inOrderItem = JsonEx.JsonToObj <List <TbInOrderItem> >(itemModel); var data = _inOrder.SubmitTestReport(enclosure, inOrderItem); return(Content(data.ToJson())); } catch (Exception) { throw; } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { var request = JsonEx.JsonToObj <StatisticsReportFormRequest>(jsonData); var data = _reportLogic.GetExportList(request); decimal hj = 0; if (data.Rows.Count > 0) { hj = Convert.ToDecimal(data.Compute("sum(HistoryMonthCount)", "true")); } string hzzfc = "月加工总量(kg):" + hj; MemoryStream fileStream = new MemoryStream(); if (request.level == "3") { //原材料编号,原材料名称,规格,分部,工区,月加工完成量 //MaterialCode,MaterialName,SpecificationModel,BranchName,WorkAreaName,HistoryMonthCount //导出数据列 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "MaterialCode", "原材料编号" }, { "MaterialName", "原材料名称" }, { "SpecificationModel", "规格" }, { "BranchName", "分部" }, { "WorkAreaName", "工区" }, { "HistoryMonthCount", "月加工完成量" }, }; fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "车辆运输卸货统计", hzzfc); } else { //原材料编号,原材料名称,规格,分部,工区,原材料实时库存,计划数量,批次计划数量,供货量,月加工完成量 //MaterialCode,MaterialName,SpecificationModel,BranchName,WorkAreaName,InitialCount,LjDemandNum,LjBatchPlanQuantity,LjHasSupplier,HistoryMonthCount //导出数据列 Dictionary <string, string> cellheader = new Dictionary <string, string> { { "MaterialCode", "原材料编号" }, { "MaterialName", "原材料名称" }, { "SpecificationModel", "规格" }, { "BranchName", "分部" }, { "WorkAreaName", "工区" }, { "InitialCount", "原材料实时库存" }, { "LjDemandNum", "计划数量" }, { "LjBatchPlanQuantity", "批次计划数量" }, { "LjHasSupplier", "供货量" }, { "HistoryMonthCount", "月加工完成量" }, }; fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "收发存统计报表", hzzfc); } return(File(fileStream, "application/vnd.ms-excel", "收发存统计报表.xls")); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //加工工艺、加工工艺名称 //PProcessingTechnologyName,ProcessingTechnologyName Dictionary <string, string> cellheader = new Dictionary <string, string> { { "PProcessingTechnologyName", "加工工艺" }, { "ProcessingTechnologyName", "加工工艺名称" }, }; var request = JsonEx.JsonToObj <ProcessingTechnologyRequest>(jsonData); var data = _proTeLogic.GetExportList(request); var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "加工工艺", ""); return(File(fileStream, "application/vnd.ms-excel", "加工工艺.xls")); }
/// <summary> /// 新增、修改数据提交 /// </summary> /// <param name="model">主表信息</param> /// <param name="itemModel">明细信息</param> /// <param name="type">类型</param> /// <returns></returns> public ActionResult SubmitForm(string model, string itemModel, string type) { try { var OrderProgressModel = JsonEx.JsonToObj <TbOrderProgress>(model); var OrderProDetailModel = JsonEx.JsonToObj <List <TbOrderProgressDetail> >(itemModel); var data = _orderProLogic.Update(OrderProgressModel, OrderProDetailModel); return(Content(data.ToJson())); } catch (Exception ex) { return(Content(ex.ToString()));; } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { var request = JsonEx.JsonToObj <RawMonthDemPlanRequest>(jsonData); request.IsOutput = true; var data = _rawMonthDemPlanLogic.GetDataListForPage(request); decimal xg = ((SumRowData)data.userdata).SectionSteel; decimal jzgj = ((SumRowData)data.userdata).BuildingSteel; decimal zzl = xg + jzgj; string hzzfc = "建筑钢筋总量(KG):" + jzgj + ",型钢总量(KG):" + xg + ",合计总量(KG):" + zzl; List <RawMonthDemandPlanExcel> dataList = ModelConvertHelper <RawMonthDemandPlanExcel> .ToList((DataTable)data.rows); var fileStream = ExcelHelper.EntityListToExcelStream <RawMonthDemandPlanExcel>(dataList, "原材料月度需求计划", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "原材料月度需求计划.xls")); }
public ActionResult SubmitForm(string itemModel, string type) { try { var stockRecord = JsonEx.JsonToObj <List <TbRawMaterialStockRecord> >(itemModel); foreach (var item in stockRecord) { if (string.IsNullOrWhiteSpace(item.ProjectId)) { return(Error("项目信息错误")); } if (string.IsNullOrEmpty(item.SiteCode)) { item.SiteCode = ""; } if (!item.UseCountS.HasValue) { item.UseCount = item.Count; } else { item.UseCount = item.UseCountS.Value; } item.LockCount = 0; item.HistoryCount = item.Count; item.ChackState = 1; if (type == "add") { item.InsertUserCode = base.UserCode; } } if (type == "add") { var data = _rawMaterialStock.Insert(stockRecord); return(Content(data.ToJson())); } else { var data = _rawMaterialStock.Update(stockRecord); return(Content(data.ToJson())); } } catch (Exception) { throw; } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { var request = JsonEx.JsonToObj <SemiFinishedSignRequest>(jsonData); var data = _wasRFLogic.GetExportList(request); decimal zlhj = 0; if (data.Rows.Count > 0) { zlhj = Convert.ToDecimal(data.Compute("sum(SumTotal)", "true")); } string hzzfc = "合计(KG):" + zlhj; List <SemiFinishedSignExcel> dataList = ModelConvertHelper <SemiFinishedSignExcel> .ToList(data); var fileStream = ExcelHelper.EntityListToExcelStream <SemiFinishedSignExcel>(dataList, "半成品签收", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "半成品签收.xls")); }
public HttpResponseMessage SubmitForm([FromBody] JObject jdata) { try { string modelstr = jdata["model"] == null ? "" : jdata["model"].ToString(); string itemModelstr = jdata["itemModel"] == null ? "" : jdata["itemModel"].ToString(); string type = jdata["type"] == null ? "" : jdata["type"].ToString(); if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type)) { return(AjaxResult.Error("参数错误").ToJsonApi()); } var model = JsonEx.JsonToObj <TbSafeCheck>(modelstr); var item = JsonEx.JsonToObj <List <TbSafeCheckItem> >(itemModelstr); //保存图片文件 if (!string.IsNullOrWhiteSpace(model.Enclosure)) { var files = JsonEx.JsonToObj <List <FileData> >(model.Enclosure); //保存图片文件 if (files.Any()) { base.UserCode = model.InsertUserCode; var retFile = base.UploadFileData(files, true); if (retFile == null) { return(AjaxResult.Error("图片上传失败").ToJsonApi()); } model.Enclosure = retFile.Item2; } } if (type == "add") { model.InsertTime = DateTime.Now; var data = _safeCheck.Insert(model, item, true); return(data.ToJsonApi()); } else { var data = _safeCheck.Update(model, item, true); return(data.ToJsonApi()); } } catch (Exception) { return(AjaxResult.Error("操作失败").ToJsonApi()); } }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { var request = JsonEx.JsonToObj <InOrderRequest>(jsonData); var data = _inOrder.GetExportList(request); decimal zlhj = 0; if (data.Rows.Count > 0) { zlhj = Convert.ToDecimal(data.Compute("sum(InCount)", "true")); } string hzzfc = "总量合计(KG):" + zlhj; List <InOrderExcel> dataList = ModelConvertHelper <InOrderExcel> .ToList(data); var fileStream = ExcelHelper.EntityListToExcelStream <InOrderExcel>(dataList, "原材料到货入库", hzzfc); return(File(fileStream, "application/vnd.ms-excel", "原材料到货入库.xls")); }
public HttpResponseMessage AppSaveJgcOrOrg([FromBody] JObject jdata) { //{ //"model": { // "OrgType": "2", // "ComPanyName": "十一号线经理部", // "CompanyId": "6247574415609954304", // "ProjectOrgAllId": "6247574415609954304", // "ProjectOrgAllName": "十一号线经理部", // "ProjectId": "6245721945602523136", // "RoleCode": "6352967650544590848", // "UserCode": "102787", // "UserId": "6487716734823440384", // "UserName": "******", // "LoginTime": "2019-04-25 15:31:11", // "LoginToken": "9BD8717A3C93C93C5CAEE8FBA126D353AD4562C10CE22F487CA47731EB6E842E3B6064B1DC8A4B75", // "IsSystem": false, // "IsDriver": false, // "ProcessFactoryCode": "", // "ProcessFactoryName": "所有加工厂" // } //,type:"Jgc" //} string modelstr = jdata["model"] == null ? "" : jdata["model"].ToString(); string type = jdata["type"] == null ? "" : jdata["type"].ToString(); if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type)) { return(AjaxResult.Error("参数错误").ToJsonApi()); } var model = JsonEx.JsonToObj <CurrentUserInfo>(modelstr); CurrentUserInfo operatorModel = null; if (type == "Jgc") { operatorModel = _User.AppSaveProcessFactoryCode(model); } else if (type == "Org") { operatorModel = _User.AppSaveProjectOrg(model); } OperatorProvider.Provider.RemoveCurrent(); //先移除Cookie或者Session OperatorProvider.Provider.AddCurrent(operatorModel); //在添加Cookie或者Session return(operatorModel.ToJsonApi()); }
/// <summary> /// 导出 /// </summary> /// <param name="ProjectCode"></param> /// <returns></returns> public ActionResult OutputExcel(string jsonData) { //核算编号、所属加工厂、核算月份、加工总量(T)、合计成本(元)、平均成本(元) //HeSuanCode,ProcessFactoryName,HeSuanMonth,MachiningTotal,TotalCost,AvgCost Dictionary <string, string> cellheader = new Dictionary <string, string> { { "HeSuanCode", "核算编号" }, { "ProcessFactoryName", "所属加工厂" }, { "HeSuanMonth", "核算月份" }, { "MachiningTotal", "加工总量(T)" }, { "TotalCost", "合计成本(元)" }, { "AvgCost", "平均成本(元)" }, }; var request = JsonEx.JsonToObj <MonthCostHeSuanRequest>(jsonData); var data = _monthCostHeSuanLogic.GetExportList(request); var fileStream = ExcelHelper.ExportToMemoryStream(cellheader, data, "", "", "月成本核算", ""); return(File(fileStream, "application/vnd.ms-excel", "月成本核算.xls")); }
public HttpResponseMessage InsertPositionInfo([FromBody] JObject jdata) { try { string modelstr = jdata["model"] == null ? "" : jdata["model"].ToString(); if (string.IsNullOrWhiteSpace(modelstr)) { return(AjaxResult.Error("参数错误").ToJsonApi()); } var model = JsonEx.JsonToObj <TbTransportLine>(modelstr); var data = _transportProcess.Insert(model); return(data.ToJsonApi()); } catch (Exception) { return(AjaxResult.Error("操作失败").ToJsonApi()); } }