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.
1028 lines
35 KiB
1028 lines
35 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
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.Text;
|
||
|
using QMAPP.FJC.Entity.Andon;
|
||
|
using QMAPP.FJC.Web.Models.Andon;
|
||
|
|
||
|
|
||
|
namespace QMAPP.FJC.Web.Controllers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 作 用:大屏幕显示
|
||
|
/// 作 者:周晓东
|
||
|
/// 编写日期:2018年01月29日
|
||
|
///</summary>
|
||
|
public class AndonDisplayController : 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 = "/AndonDisplay/GetList";
|
||
|
return View("List", 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 = "/AndonDisplay/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();
|
||
|
}
|
||
|
|
||
|
|
||
|
[HandleException]
|
||
|
public ActionResult GetTempData()
|
||
|
{
|
||
|
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 Json(nli);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 生产完成率分析
|
||
|
/// </summary>
|
||
|
/// <returns>处理结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartDataGroup1(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition;
|
||
|
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;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition;
|
||
|
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,string name1)
|
||
|
{
|
||
|
#region 源数据定义
|
||
|
var maxWCL = -1D;
|
||
|
string jihua = "", wancheng = "", wclv = "", riqi = "", dou = "";
|
||
|
if (nli == null || nli.Count == 0)
|
||
|
{
|
||
|
jihua += "''";
|
||
|
wancheng += "''";
|
||
|
wclv += "''";
|
||
|
riqi += "''";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
bool first = true;
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
|
||
|
jihua += dou + "'" + item.QTY + "'";
|
||
|
wancheng += dou + "'" + item.COMPLETE_QTY + "'";
|
||
|
double fenzi = 0;
|
||
|
if (!string.IsNullOrEmpty(item.COMPLETE_QTY) && item.COMPLETE_QTY != "0")
|
||
|
{
|
||
|
fenzi = Convert.ToDouble(item.COMPLETE_QTY);
|
||
|
}
|
||
|
double fenmu = 0;
|
||
|
if (!string.IsNullOrEmpty(item.QTY))
|
||
|
{
|
||
|
fenmu = Convert.ToDouble(item.QTY);
|
||
|
}
|
||
|
string WCL="";
|
||
|
if(fenmu>0)
|
||
|
{
|
||
|
WCL=(fenzi/fenmu*100).ToString("0");
|
||
|
if (fenzi / fenmu * 100 > maxWCL)
|
||
|
{
|
||
|
maxWCL = fenzi / fenmu * 100;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
wclv += dou + "'" + WCL + "'";
|
||
|
riqi += dou + "'" + item.MATERIAL_SHORT + "'";
|
||
|
if (first)
|
||
|
{
|
||
|
first = false;
|
||
|
dou = ",";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if(maxWCL<0)
|
||
|
{
|
||
|
maxWCL=100;
|
||
|
}
|
||
|
|
||
|
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: ['" + name1 + @"计划数量', '" + name1 + @"完成数量','完成率']
|
||
|
},
|
||
|
xAxis: [
|
||
|
{
|
||
|
type: 'category',
|
||
|
axisLabel : { //坐标轴刻度标签的相关设置。
|
||
|
interval:0,
|
||
|
rotate:0
|
||
|
},
|
||
|
data: [" + riqi + @"]
|
||
|
}
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '件',
|
||
|
axisLabel: {
|
||
|
formatter: '{value}'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
type: 'value',
|
||
|
// name: '百分比',
|
||
|
// axisLabel: {
|
||
|
// formatter: '{value} %'
|
||
|
// }
|
||
|
splitLine:{
|
||
|
show:false
|
||
|
},
|
||
|
scale: true,
|
||
|
name: '百分比',
|
||
|
max: "+(Math.Round(maxWCL/10)*10).ToString("0") +@",
|
||
|
min: 0
|
||
|
//boundaryGap: [" + wclv + @"]
|
||
|
}
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '" + name1 + @"计划数量',
|
||
|
type: 'bar',
|
||
|
barMaxWidth: '100',
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
label: {
|
||
|
show: true,
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data: [" + jihua + @"]
|
||
|
|
||
|
},
|
||
|
{
|
||
|
name: '" + name1 + @"完成数量',
|
||
|
type: 'bar',
|
||
|
barMaxWidth: '100',
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
label: {
|
||
|
show: true,
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data: [" + wancheng + @"]
|
||
|
},
|
||
|
{
|
||
|
name: '完成率',
|
||
|
type: 'line',
|
||
|
yAxisIndex: 1,
|
||
|
data: [" + wclv + @"],
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
color:'#cc0033',
|
||
|
lineStyle:{
|
||
|
width:3,
|
||
|
color:'#ff9933'
|
||
|
},
|
||
|
label: {
|
||
|
show: true,
|
||
|
//formatter:function(value){if(value!=''){return value+'%'}else{return ''}},
|
||
|
textStyle:{
|
||
|
color:'#000000',
|
||
|
fontSize: 12,
|
||
|
fontWeight: '100'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}";
|
||
|
#endregion
|
||
|
|
||
|
return strOption;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
//返修率
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartRepair1(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition;
|
||
|
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>>>("RepairRateCountBLL_GetInjectReworkRate");
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOptionRepair(nli, "注塑"));
|
||
|
|
||
|
}
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartRepair2(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition;
|
||
|
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>>>("RepairRateCountBLL_GetReworkRate", "VW331 DP");
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOptionRepair(nli, "门板"));
|
||
|
|
||
|
}
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartRepair3(string name)
|
||
|
{
|
||
|
QTYCompletionRateVModel seachModel;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
QTYCompletionRateDModel condition;
|
||
|
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>>>("RepairRateCountBLL_GetReworkRate", "VW331/5CN IP");
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
return Content(setOptionRepair(nli, "仪表板"));
|
||
|
|
||
|
}
|
||
|
|
||
|
public string setOptionRepair(List<QTYCompletionRateDModel> nli, string name1)
|
||
|
{
|
||
|
#region 源数据定义
|
||
|
|
||
|
string jihua = "", wancheng = "", wclv = "", riqi = "", dou = "";
|
||
|
bool first = true;
|
||
|
if (nli==null || nli.Count == 0)
|
||
|
{
|
||
|
jihua += "''";
|
||
|
wancheng += "''";
|
||
|
wclv += "''";
|
||
|
riqi += "''";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//jihua += "";
|
||
|
//wancheng += "";
|
||
|
//wclv += "'',";
|
||
|
//riqi += "'',";
|
||
|
|
||
|
foreach (QTYCompletionRateDModel item in nli)
|
||
|
{
|
||
|
//jihua=生成数量QTY,wancheng=返修数量COMPLETE_QTY。 借用
|
||
|
jihua += dou + "'" + item.REWORK_QTY + "'";
|
||
|
wancheng += dou + "'" + item.COMPLETE_QTY + "'";
|
||
|
double fenmu = 1;
|
||
|
if (!string.IsNullOrEmpty(item.COMPLETE_QTY) && item.COMPLETE_QTY != "0")
|
||
|
{
|
||
|
fenmu = Convert.ToDouble(item.COMPLETE_QTY);
|
||
|
}
|
||
|
double fenzi = 0;
|
||
|
if (!string.IsNullOrEmpty(item.REWORK_QTY))
|
||
|
{
|
||
|
fenzi = Convert.ToDouble(item.REWORK_QTY);
|
||
|
}
|
||
|
wclv += dou + "'" + (fenzi/fenmu*100).ToString("0") + "'";
|
||
|
riqi += dou + "'" + item.MATERIAL_SHORT + "'";
|
||
|
if (first)
|
||
|
{
|
||
|
first = false;
|
||
|
dou = ",";
|
||
|
}
|
||
|
}
|
||
|
//jihua += ",''";
|
||
|
//wancheng += ",''";
|
||
|
//wclv += ",''";
|
||
|
//riqi += ",''";
|
||
|
}
|
||
|
|
||
|
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: ['" + name1 + @"返修数量', '" + name1 + @"生产数量','返修率']
|
||
|
},
|
||
|
xAxis: [
|
||
|
{
|
||
|
type: 'category',
|
||
|
axisLabel : { //坐标轴刻度标签的相关设置。
|
||
|
interval:0,
|
||
|
rotate:0
|
||
|
},
|
||
|
data: [" + riqi + @"]
|
||
|
}
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
name: '件',
|
||
|
axisLabel: {
|
||
|
formatter: '{value}'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
type: 'value',
|
||
|
scale: true,
|
||
|
name: '百分比',
|
||
|
max: 100,
|
||
|
min: 0,
|
||
|
boundaryGap: [" + wclv + @"]
|
||
|
}
|
||
|
],
|
||
|
series: [
|
||
|
{
|
||
|
name: '" + name1 + @"返修数量',
|
||
|
type: 'bar',
|
||
|
barMaxWidth: '100',
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
label: {
|
||
|
show: true,
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data: [" + jihua + @"]
|
||
|
|
||
|
},
|
||
|
{
|
||
|
name: '" + name1 + @"生产数量',
|
||
|
type: 'bar',
|
||
|
barMaxWidth: '100',
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
label: {
|
||
|
show: true,
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data: [" + wancheng + @"]
|
||
|
},
|
||
|
{
|
||
|
name: '返修率',
|
||
|
type: 'line',
|
||
|
yAxisIndex: 1,
|
||
|
data: [" + wclv + @"],
|
||
|
itemStyle: {
|
||
|
normal: {
|
||
|
color:'#cc0033',
|
||
|
lineStyle:{
|
||
|
width:3,
|
||
|
color:'#ff9933'
|
||
|
},
|
||
|
label: {
|
||
|
show: true,
|
||
|
//formatter:'{c}%',
|
||
|
textStyle:{
|
||
|
color:'#000000',
|
||
|
fontSize: 12,
|
||
|
fontWeight: '100'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}";
|
||
|
#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();
|
||
|
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 堆积柱状图
|
||
|
/// </summary>
|
||
|
/// <returns>处理结果</returns>
|
||
|
[HandleException]
|
||
|
public ActionResult GetEchartDataBar2()
|
||
|
{
|
||
|
RepairRateCountVModel seachModel;
|
||
|
DataPage page = null;
|
||
|
ServiceAgent wcfAgent = GetServiceAgent();
|
||
|
RepairRateCountDModel condition;
|
||
|
List<RepairRateCountDModel> nli = new List<RepairRateCountDModel>();
|
||
|
try
|
||
|
{
|
||
|
//获取查询对象
|
||
|
seachModel = GetModel<RepairRateCountVModel>();
|
||
|
//获取前台分页设置信息
|
||
|
page = this.GetDataPage(seachModel);
|
||
|
condition = CopyToModel<RepairRateCountDModel, RepairRateCountVModel>(seachModel);
|
||
|
#region wcf服务统一接口
|
||
|
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<RepairRateCountDModel>>>("RepairRateCountBLL_GetAllListNew", condition);
|
||
|
|
||
|
nli = dataResult.Result;
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
|
||
|
string mubiao = "", fxlv = "", riqi = "", dou = "";
|
||
|
bool first = true;
|
||
|
foreach (RepairRateCountDModel item in nli)
|
||
|
{
|
||
|
mubiao += dou + "'" + item.MFlV + "'";
|
||
|
fxlv += dou + "'" + (Convert.ToDouble(item.REWORK_QTY) / Convert.ToDouble(item.QTY) * 100).ToString("0") + "'";
|
||
|
riqi += dou + "'" + item.TDAY + "'";
|
||
|
if (first)
|
||
|
{
|
||
|
first = false;
|
||
|
dou = ",";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#region 源数据定义
|
||
|
|
||
|
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',
|
||
|
data: [" + riqi + @"]
|
||
|
}
|
||
|
],
|
||
|
yAxis: [
|
||
|
{
|
||
|
type: 'value',
|
||
|
scale: true,
|
||
|
name: '百分比',
|
||
|
max: 100,
|
||
|
min: 0,
|
||
|
boundaryGap: [" + fxlv + @"]
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
series: [
|
||
|
|
||
|
{
|
||
|
name: '返修率',
|
||
|
type: 'line',
|
||
|
data: [" + fxlv + @"]
|
||
|
},
|
||
|
{
|
||
|
name: '目标值',
|
||
|
type: 'line',
|
||
|
data: [" + mubiao + @"]
|
||
|
}
|
||
|
]
|
||
|
}";
|
||
|
#endregion
|
||
|
|
||
|
return Content(strOption);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|