You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
746 lines
27 KiB
746 lines
27 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Web;
|
||
|
using System.Web.Mvc;
|
||
|
using QMAPP.Common.Web.Controllers;
|
||
|
using QMFrameWork.WebUI.Attribute;
|
||
|
using QMAPP.FJC.Web.Models.ProductPetrospect;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.ServicesAgent;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.Entity;
|
||
|
using QMFrameWork.WebUI.DataSource;
|
||
|
using QMFrameWork.Common.Serialization;
|
||
|
using System.Data;
|
||
|
using System.Text;
|
||
|
using QMAPP.Entity.Sys;
|
||
|
using QMAPP.FJC.Entity.Andon;
|
||
|
using QMAPP.FJC.Entity.ProductPetrospect;
|
||
|
using QMAPP.FJC.Web.Models.Andon;
|
||
|
|
||
|
|
||
|
namespace QMAPP.FJC.Web.Controllers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:M5-3
|
||
|
/// 作 用:产品加工追溯控制层
|
||
|
/// 作 者:王丹丹
|
||
|
/// 编写日期:2015年06月16日
|
||
|
///</summary>
|
||
|
public class MainOperationReviewController : QController
|
||
|
{
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 加载列表
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult List(bool? callBack)
|
||
|
{
|
||
|
MainOperationReviewModel seachModel = new MainOperationReviewModel();
|
||
|
if (callBack == true)
|
||
|
TryGetSelectBuffer<MainOperationReviewModel>(out seachModel);
|
||
|
seachModel.rownumbers = true;
|
||
|
seachModel.url = "/MainOperationReview/GetList";
|
||
|
return View("MainOperationReviewList", seachModel);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="callBack">是否回调</param>
|
||
|
/// <returns>列表</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetList(bool? callBack)
|
||
|
{
|
||
|
MainOperationReviewModel seachModel = null;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
MainOperation condition = null;
|
||
|
DataResult<DataPage> pageResult = new DataResult<DataPage>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<MainOperationReviewModel>();
|
||
|
#region 获取缓存值
|
||
|
if (callBack != null)
|
||
|
{
|
||
|
TryGetSelectBuffer<MainOperationReviewModel>(out seachModel);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//保存搜索条件
|
||
|
SetSelectBuffer<MainOperationReviewModel>(seachModel);
|
||
|
}
|
||
|
#endregion
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<MainOperation, MainOperationReviewModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>(QMAPP.ServicesAgent.B9BasicService.MainOperationBLL_GetMainOperationReviewList.ToString(), condition, page);
|
||
|
DateGridResult<MainOperation> result = new DateGridResult<MainOperation>();
|
||
|
result.Total = pageResult.Result.RecordCount;
|
||
|
result.Rows = JsonConvertHelper.GetDeserialize<List<MainOperation>>(pageResult.Result.Result.ToString());
|
||
|
#endregion
|
||
|
return Content(result.GetJsonSource());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
[HandleException]
|
||
|
public ActionResult GetMainOperationReviews(bool? callBack)
|
||
|
{
|
||
|
ProductArchivesModel seachModel = new ProductArchivesModel();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<ProductArchivesModel>();
|
||
|
|
||
|
#region 获取缓存值
|
||
|
if (callBack != null)
|
||
|
{
|
||
|
TryGetSelectBuffer<ProductArchivesModel>(out seachModel);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//保存搜索条件
|
||
|
SetSelectBuffer<ProductArchivesModel>(seachModel);
|
||
|
}
|
||
|
#endregion
|
||
|
MainOperation condition1 = new MainOperation();
|
||
|
condition1.PRODUCTCODE = seachModel.ERMISCODE;
|
||
|
condition1.MAINCODE = seachModel.MAINCODE;
|
||
|
//condition = CopyToModel<ProductArchives, ProductArchivesModel>(seachModel);
|
||
|
|
||
|
#region wcf服务统一接口
|
||
|
var dlist = wcfAgent.InvokeServiceFunction("MainOperationBLL_GetMainOperations", condition1);
|
||
|
#endregion
|
||
|
return Content(dlist);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 统计
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult Count(bool? callBack)
|
||
|
{
|
||
|
CallLogModel seachModel = new CallLogModel();
|
||
|
if (callBack == true)
|
||
|
TryGetSelectBuffer<CallLogModel>(out seachModel);
|
||
|
string ids = Request.Params["PID"];
|
||
|
seachModel.rownumbers = false;
|
||
|
seachModel.url = "/MainOperationReview/GetCountList?PID=" + ids;
|
||
|
return View("CountList", seachModel);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取统计列表
|
||
|
/// </summary>
|
||
|
/// <param name="callBack">是否回调</param>
|
||
|
/// <returns>列表</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetCountList(bool? callBack)
|
||
|
{
|
||
|
CallLogModel seachModel = null;
|
||
|
DataResult<DataPage> pageResult = new DataResult<DataPage>();
|
||
|
DataPage page = new DataPage();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
CallLogEntity condition = null;
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<CallLogModel>();
|
||
|
|
||
|
#region 获取缓存值
|
||
|
|
||
|
if (callBack != null)
|
||
|
{
|
||
|
TryGetSelectBuffer<CallLogModel>(out seachModel);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//保存搜索条件
|
||
|
SetSelectBuffer<CallLogModel>(seachModel);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<CallLogEntity, CallLogModel>(seachModel);
|
||
|
string ids = Request.Params["PID"];
|
||
|
var callType = ids.Substring(0, 1);
|
||
|
var mc = ids.Substring(1);
|
||
|
condition.CALL_TYPE = callType;
|
||
|
condition.MACHINECODDE = mc;
|
||
|
|
||
|
#region wcf服务统一接口
|
||
|
|
||
|
pageResult = wcfAgent.InvokeServiceFunction<DataResult<DataPage>>("AndonCallBLL_GetCallLogListWeb",
|
||
|
condition, page);
|
||
|
if (pageResult.IsSuccess == false)
|
||
|
{
|
||
|
SetMessage(pageResult.Msg);
|
||
|
return List(true);
|
||
|
}
|
||
|
DateGridResult<CallLogEntity> result = new DateGridResult<CallLogEntity>();
|
||
|
result.Total = pageResult.Result.RecordCount;
|
||
|
result.Rows = JsonConvertHelper.GetDeserialize<List<CallLogEntity>>(pageResult.Result.Result.ToString());
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
return Content(result.GetJsonSource());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
/// <summary>
|
||
|
/// 异步刷新TABLE
|
||
|
/// </summary>
|
||
|
/// <param name="pageIndex"></param>
|
||
|
/// <returns></returns>
|
||
|
public ActionResult GetTable(string MATERIAL_CODE, string TYPE_COUNT, string START_DATE, string END_DATE)
|
||
|
{
|
||
|
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition = new QTYCompletionRateDModel();
|
||
|
|
||
|
condition.MATERIAL_CODE = MATERIAL_CODE;
|
||
|
condition.TYPE_COUNT = TYPE_COUNT;
|
||
|
|
||
|
condition.START_DATE = START_DATE;
|
||
|
condition.END_DATE = END_DATE;
|
||
|
|
||
|
List<QTYCompletionRateDModel> nli = new List<QTYCompletionRateDModel>();
|
||
|
try
|
||
|
{
|
||
|
#region wcf服务统一接口
|
||
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QTYCompletionRateDModel>>>("QTYCompletionRateBLL_GetAllList", condition);
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
string sss = GetHTMLStr(nli, TYPE_COUNT);
|
||
|
return Json(sss);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 拼接字符串
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public string GetHTMLStr(List<QTYCompletionRateDModel> nli, string TYPE_COUNT)
|
||
|
{
|
||
|
StringBuilder html = new StringBuilder();
|
||
|
|
||
|
if (nli == null || nli.Count == 0)
|
||
|
{
|
||
|
return "没有数据";
|
||
|
}
|
||
|
//测试表头
|
||
|
html.Append("<tr><td class='L1cos'>测试</td>");
|
||
|
|
||
|
int i = 0;
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
if (i == 0 || i % 2 == 0)
|
||
|
{
|
||
|
html.Append("<td colspan='2'> ");
|
||
|
html.Append("测试" + i);
|
||
|
html.Append("</td>");
|
||
|
}
|
||
|
++i;
|
||
|
}
|
||
|
html.Append("</tr>");
|
||
|
|
||
|
//拼接表头
|
||
|
html.Append("<tr><td class='L1cos'>产品种类</td>");
|
||
|
|
||
|
string dt = "号";
|
||
|
if (TYPE_COUNT == "MONTH")
|
||
|
{
|
||
|
dt = "月";
|
||
|
}
|
||
|
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
html.Append("<td>");
|
||
|
if (item.TDAY.Equals("累计"))
|
||
|
{
|
||
|
html.Append(item.TDAY);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
html.Append(item.TDAY + dt);
|
||
|
}
|
||
|
html.Append("</td>");
|
||
|
}
|
||
|
html.Append("</tr>");
|
||
|
|
||
|
Dictionary<string, List<QTYCompletionRateDModel>> dls = new Dictionary<string, List<QTYCompletionRateDModel>>();
|
||
|
|
||
|
//对结果集分类
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
if (dls.Keys.Contains(item.MATERIAL_NAME + item.MATERIAL_CODE))
|
||
|
{
|
||
|
//则添加到KEY下
|
||
|
dls[item.MATERIAL_NAME + item.MATERIAL_CODE].Add(item);
|
||
|
continue;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//新建key
|
||
|
List<QTYCompletionRateDModel> li = new List<QTYCompletionRateDModel>();
|
||
|
li.Add(item);
|
||
|
dls.Add(item.MATERIAL_NAME + item.MATERIAL_CODE, li);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//拼接主体数据
|
||
|
foreach (List<QTYCompletionRateDModel> item in dls.Values)
|
||
|
{
|
||
|
|
||
|
html.Append("<tr>");
|
||
|
html.Append("<td>计划数量");
|
||
|
html.Append("</td>");
|
||
|
foreach (QTYCompletionRateDModel itit in item)
|
||
|
{
|
||
|
html.Append("<td>");
|
||
|
|
||
|
html.Append(itit.QTY);
|
||
|
|
||
|
html.Append("</td>");
|
||
|
}
|
||
|
|
||
|
html.Append("</tr>");
|
||
|
|
||
|
html.Append("<tr>");
|
||
|
html.Append("<td>完成数量");
|
||
|
html.Append("</td>");
|
||
|
foreach (QTYCompletionRateDModel itit in item)
|
||
|
{
|
||
|
html.Append("<td>");
|
||
|
|
||
|
html.Append(itit.COMPLETE_QTY);
|
||
|
|
||
|
html.Append("</td>");
|
||
|
}
|
||
|
|
||
|
html.Append("</tr>");
|
||
|
|
||
|
}
|
||
|
|
||
|
return html.ToString();
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 多图叠加
|
||
|
/// </summary>
|
||
|
/// <returns>处理结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartDataGroup1(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel = null;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition = null;
|
||
|
List<QTYCompletionRateDModel> nli = new List<QTYCompletionRateDModel>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<QTYCompletionRateVModel>();
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<QTYCompletionRateDModel, QTYCompletionRateVModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QTYCompletionRateDModel>>>("QTYCompletionRateBLL_GetAllListNew1", condition);
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOption(nli));
|
||
|
|
||
|
}
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartDataGroup2(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel = null;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition = null;
|
||
|
List<QTYCompletionRateDModel> nli = new List<QTYCompletionRateDModel>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<QTYCompletionRateVModel>();
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<QTYCompletionRateDModel, QTYCompletionRateVModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QTYCompletionRateDModel>>>("QTYCompletionRateBLL_GetAllListNew2", condition);
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOption(nli));
|
||
|
|
||
|
}
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartDataGroup3(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel = null;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition = null;
|
||
|
List<QTYCompletionRateDModel> nli = new List<QTYCompletionRateDModel>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<QTYCompletionRateVModel>();
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<QTYCompletionRateDModel, QTYCompletionRateVModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<QTYCompletionRateDModel>>>("QTYCompletionRateBLL_GetAllListNew3", condition);
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOption(nli));
|
||
|
|
||
|
}
|
||
|
|
||
|
public string setOption(List<QTYCompletionRateDModel> nli)
|
||
|
{
|
||
|
#region 源数据定义
|
||
|
|
||
|
string jihua = "", wancheng = "", wclv = "", riqi = "", dou = "";
|
||
|
bool first = true;
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
|
||
|
jihua += dou + "'" + item.QTY + "'";
|
||
|
wancheng += dou + "'" + item.COMPLETE_QTY + "'";
|
||
|
double fenmu = 1;
|
||
|
if (!string.IsNullOrEmpty(item.QTY) && item.QTY != "0")
|
||
|
{
|
||
|
fenmu = Convert.ToDouble(item.QTY);
|
||
|
}
|
||
|
double fenzi = 1;
|
||
|
if (!string.IsNullOrEmpty(item.COMPLETE_QTY))
|
||
|
{
|
||
|
fenmu = Convert.ToDouble(item.COMPLETE_QTY);
|
||
|
}
|
||
|
wclv += dou + "'" + (fenzi / fenmu * 100).ToString("0") + "'";
|
||
|
riqi += dou + "'" + item.MATERIAL_CODE + "'";
|
||
|
if (first)
|
||
|
{
|
||
|
first = false;
|
||
|
dou = ",";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
string strOption = @"{
|
||
|
tooltip: {
|
||
|
trigger: 'axis'
|
||
|
},
|
||
|
toolbox: {
|
||
|
show: false,
|
||
|
feature: {
|
||
|
mark: { show: true },
|
||
|
dataView: { show: true, readOnly: false },
|
||
|
magicType: { show: true, type: ['line', 'bar'] },
|
||
|
restore: { show: true },
|
||
|
saveAsImage: { show: true }
|
||
|
}
|
||
|
},
|
||
|
calculable: true,
|
||
|
legend: {
|
||
|
data: ['计划数量', '完成数量']
|
||
|
},
|
||
|
xAxis: [
|
||
|
{
|
||
|
type: 'category',
|
||
|
axisLabel : { //坐标轴刻度标签的相关设置。
|
||
|
interval:'auto',
|
||
|
rotate:10,
|
||
|
|
||
|
// formatter : function(val){
|
||
|
// var strs = val.split(''); //字符串数组
|
||
|
// var str = ''
|
||
|
// for (var i = 0, s; s = strs[i++];) { //遍历字符串数组
|
||
|
// str += s;
|
||
|
// if (!(i % 10)) str += '\n';
|
||
|
// }
|
||
|
// return str
|
||
|
// }
|
||
|
},
|
||
|
data: [" + riqi + @"]
|
||
|
}
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '件',
|
||
|
axisLabel: {
|
||
|
formatter: '{value}'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '百分比',
|
||
|
axisLabel: {
|
||
|
formatter: '{value} %'
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '计划数量',
|
||
|
type: 'bar',
|
||
|
// label:{
|
||
|
// normal:{
|
||
|
// show:true,
|
||
|
//// rotate: 90,
|
||
|
//// align: 'left',
|
||
|
//// verticalAlign: 'middle',
|
||
|
// position: 'top',
|
||
|
//// distance: 15,
|
||
|
//// formatter: '{c} {name|{a}}',
|
||
|
//// fontSize: 16
|
||
|
// },
|
||
|
data: [" + jihua + @"]
|
||
|
|
||
|
},
|
||
|
{
|
||
|
name: '完成数量',
|
||
|
type: 'bar',
|
||
|
data: [" + wancheng + @"],
|
||
|
// //系列中的数据标注内容
|
||
|
// markPoint: {
|
||
|
// data: [
|
||
|
// {type: 'max', name: '最大值'},
|
||
|
// {type: 'min', name: '最小值'}
|
||
|
// ]
|
||
|
// },
|
||
|
// //系列中的数据标线内容
|
||
|
// markLine: {
|
||
|
// data: [
|
||
|
// {type: 'average', name: '平均值'}
|
||
|
// ]
|
||
|
// }
|
||
|
},
|
||
|
{
|
||
|
name: '完成率',
|
||
|
type: 'line',
|
||
|
yAxisIndex: 1,
|
||
|
data: [" + wclv + @"]
|
||
|
, itemStyle: { normal: { label: { show: true}} }
|
||
|
}
|
||
|
]
|
||
|
}";
|
||
|
#endregion
|
||
|
|
||
|
return strOption;
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 统计图页面配置
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public static string QMEChartPageConfig()
|
||
|
{
|
||
|
StringBuilder configBuilder = new StringBuilder();
|
||
|
configBuilder.AppendLine("");
|
||
|
configBuilder.AppendLine("<!--图表控件-->");
|
||
|
configBuilder.AppendLine("<script src=\"../../Scripts/echarts-2.2.2/build/dist/echarts.js\" type=\"text/javascript\" language=\"javascript\"></script>");
|
||
|
configBuilder.AppendLine("<script type=\"text/javascript\">");
|
||
|
configBuilder.AppendLine("<!-- 路径配置-->");
|
||
|
configBuilder.AppendLine(" require.config({");
|
||
|
configBuilder.AppendLine(" paths: {");
|
||
|
configBuilder.AppendLine(" echarts: '../../Scripts/echarts-2.2.2/build/dist',");
|
||
|
configBuilder.AppendLine(" themes: '../../Scripts/echarts-2.2.2/src'");
|
||
|
configBuilder.AppendLine(" }");
|
||
|
configBuilder.AppendLine(" });");
|
||
|
configBuilder.AppendLine(" if (!window.console || !console.firebug) {");
|
||
|
configBuilder.AppendLine(" var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml', 'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];");
|
||
|
|
||
|
configBuilder.AppendLine(" window.console = {};");
|
||
|
configBuilder.AppendLine(" for (var i = 0; i < names.length; ++i)");
|
||
|
configBuilder.AppendLine(" window.console[names[i]] = function () { }");
|
||
|
configBuilder.AppendLine(" } ");
|
||
|
configBuilder.AppendLine("</script>");
|
||
|
|
||
|
return configBuilder.ToString();
|
||
|
|
||
|
}
|
||
|
|
||
|
#region 导出excel
|
||
|
/// <summary>
|
||
|
/// 导出excel
|
||
|
/// </summary>
|
||
|
/// <returns>结果</returns>
|
||
|
[HttpPost]
|
||
|
public ActionResult ExportExcel()
|
||
|
{
|
||
|
MainOperationReviewModel seachModel = null;
|
||
|
MainOperation condition = null;
|
||
|
DataTable exportDt = new DataTable();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
DataResult<DataTable> result = new DataResult<DataTable>();
|
||
|
string selectKey = Request.Form["selectKey"];
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<MainOperationReviewModel>();
|
||
|
condition = CopyToModel<MainOperation, MainOperationReviewModel>(seachModel);
|
||
|
//获取数据
|
||
|
result = wcfAgent.InvokeServiceFunction<DataResult<DataTable>>(QMAPP.ServicesAgent.B9BasicService.MainOperationBLL_GetExportDataForMOR.ToString(), condition);
|
||
|
if (result.IsSuccess == false)
|
||
|
{
|
||
|
SetMessage(result.Msg);
|
||
|
return List(true);
|
||
|
}
|
||
|
|
||
|
//根据所选信息进行导出
|
||
|
if (!String.IsNullOrEmpty(selectKey))
|
||
|
{
|
||
|
DataView dv = new DataView(result.Result);
|
||
|
string strWhere = "";
|
||
|
string[] list = selectKey.Split(":".ToCharArray());
|
||
|
foreach (string ID in list)
|
||
|
{
|
||
|
strWhere += " PID='" + ID + "' or";
|
||
|
}
|
||
|
if (strWhere != "")
|
||
|
{
|
||
|
strWhere = strWhere.Remove((strWhere.Length - 2), 2);
|
||
|
}
|
||
|
dv.RowFilter = strWhere;
|
||
|
result.Result = dv.ToTable();
|
||
|
}
|
||
|
|
||
|
|
||
|
//导出
|
||
|
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
|
||
|
return efTool.GetExcelFileResult("MainOperationReviewExp", "MainOperationReviewExp.xlsx", result.Result);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
[HttpPost]
|
||
|
public ActionResult ExportExcelNew()
|
||
|
{
|
||
|
ProductArchivesModel seachModel = new ProductArchivesModel();
|
||
|
//MainOperationReviewModel seachModel = null;
|
||
|
MainOperation condition = null;
|
||
|
DataTable exportDt = new DataTable();
|
||
|
ServiceAgent wcfAgent = this.GetServiceAgent();
|
||
|
DataResult<DataTable> result = new DataResult<DataTable>();
|
||
|
string selectKey = Request.Form["selectKey"];
|
||
|
string ermiscode = Request["ermiscode"];
|
||
|
string maincode = Request["maincode"];
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<ProductArchivesModel>();
|
||
|
|
||
|
#region 获取缓存值
|
||
|
//if (callBack != null)
|
||
|
//{
|
||
|
// TryGetSelectBuffer<ProductArchivesModel>(out seachModel);
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// //保存搜索条件
|
||
|
// SetSelectBuffer<ProductArchivesModel>(seachModel);
|
||
|
//}
|
||
|
#endregion
|
||
|
MainOperation condition1 = new MainOperation();
|
||
|
condition1.PRODUCTCODE = ermiscode;
|
||
|
condition1.MAINCODE = maincode;
|
||
|
|
||
|
//seachModel = GetModel<MainOperationReviewModel>();
|
||
|
//condition = CopyToModel<MainOperation, MainOperationReviewModel>(seachModel);
|
||
|
//获取数据
|
||
|
result = wcfAgent.InvokeServiceFunction<DataResult<DataTable>>("MainOperationBLL_GetExportDataForMORNew", condition1);
|
||
|
if (result.IsSuccess == false)
|
||
|
{
|
||
|
SetMessage(result.Msg);
|
||
|
return List(true);
|
||
|
}
|
||
|
|
||
|
//根据所选信息进行导出
|
||
|
//if (!String.IsNullOrEmpty(selectKey))
|
||
|
//{
|
||
|
// DataView dv = new DataView(result.Result);
|
||
|
// string strWhere = "";
|
||
|
// string[] list = selectKey.Split(":".ToCharArray());
|
||
|
// foreach (string ID in list)
|
||
|
// {
|
||
|
// strWhere += " PID='" + ID + "' or";
|
||
|
// }
|
||
|
// if (strWhere != "")
|
||
|
// {
|
||
|
// strWhere = strWhere.Remove((strWhere.Length - 2), 2);
|
||
|
// }
|
||
|
// dv.RowFilter = strWhere;
|
||
|
// result.Result = dv.ToTable();
|
||
|
//}
|
||
|
|
||
|
|
||
|
//导出
|
||
|
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
|
||
|
return efTool.GetExcelFileResult("MainOperationReviewExp", "MainOperationReviewExp.xlsx", result.Result);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
}
|