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.
595 lines
20 KiB
595 lines
20 KiB
|
|
$().ready(function () {
|
|
Daterangeini();
|
|
//QueryddlStatus();
|
|
QueryddlWorkshop();
|
|
//$('.input-daterange').datepicker({
|
|
// language: 'zh-CN',//显示中文
|
|
// format: 'yyyy-mm-dd',
|
|
//});
|
|
//使用datarangepickrer控件 modify by xue lei on 2018-8-2
|
|
//$('#txtEndtime').val(moment().format("YYYY-MM-DD"));
|
|
//$('#txtBegintime').val(moment().subtract(1, 'days').format("YYYY-MM-DD"));
|
|
//$('#ddlWorkshop').val('');
|
|
//$('#ddlWorkshop').select2({
|
|
|
|
//ajax: {
|
|
// url: '/api/Orders/QueryWorkshop',
|
|
// dataType: 'json',
|
|
// //data: function (params) {
|
|
// // var query = {
|
|
// // search: params.area_code
|
|
// // }
|
|
// // return query;
|
|
// //},
|
|
// //processResults: function (data, params) {
|
|
// // console.log(data);
|
|
// // var results = [data];
|
|
// // return {
|
|
// // results: results
|
|
// // };
|
|
// //}
|
|
// success: function (data) {
|
|
// console.log(data)
|
|
// }
|
|
//},
|
|
//placeholder: "车间",
|
|
//allowClear: true,
|
|
//});
|
|
|
|
|
|
//1.初始化Table
|
|
|
|
|
|
})
|
|
//车间
|
|
function QueryddlWorkshop() {
|
|
var promiseweld = $.ajax({
|
|
url: '/api/Orders/QueryWorkshop', //'/api/QC/QueryStatus'
|
|
type: 'post',
|
|
cache: true,
|
|
async: true,
|
|
});
|
|
promiseweld.done(function (r) {
|
|
console.log(r);
|
|
$.each(r.info, function (index, value) {
|
|
console.log(index);
|
|
$("#ddlWorkshop").append("<option value='" + value.area_code + "'>" + value.descriptions + "</option>");
|
|
})
|
|
$('#ddlWorkshop').val('');
|
|
$('#ddlWorkshop').select2({
|
|
placeholder: "车间",
|
|
allowClear: true
|
|
});
|
|
});
|
|
promiseweld.fail(function (error) {
|
|
console.log(error)
|
|
alert(error);
|
|
});
|
|
}
|
|
|
|
/*显示daterangepicker*/
|
|
function Daterangeini() {
|
|
$('#rangetime').val(moment().subtract('hours', 0).format('YYYY-MM-DD') + ' 08:00:00' + ' - ' + moment().format('YYYY-MM-DD') + ' 20:00:00');
|
|
|
|
|
|
$('#rangetime').daterangepicker(
|
|
{
|
|
//autoUpdateInput: false,
|
|
timePicker: true,
|
|
timePicker24Hour: true,
|
|
'locale': {
|
|
"format": 'YYYY-MM-DD HH:mm:ss',
|
|
"separator": " - ",
|
|
"applyLabel": "确定",
|
|
"cancelLabel": "取消",
|
|
"fromLabel": "起始时间",
|
|
"toLabel": "结束时间'",
|
|
"customRangeLabel": "自定义",
|
|
"weekLabel": "W",
|
|
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
|
|
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
|
"firstDay": 1,
|
|
//"cancelLabel": '清除'
|
|
}
|
|
});
|
|
//$('#rangetime').val('');
|
|
$('#rangetime').on('cancel.daterangepicker', function (ev, picker) {
|
|
$(this).val('');
|
|
});
|
|
}
|
|
|
|
function QueryddlStatus() {
|
|
var promiseweld = $.ajax({
|
|
url: '/api/QC/QueryStatus',
|
|
type: 'post',
|
|
cache: true,
|
|
async: true,
|
|
});
|
|
promiseweld.done(function (r) {
|
|
console.log(r);
|
|
$.each(r, function (index, value) {
|
|
$("#ddlStatus").append("<option value='" + value.visit_type + "'>" + value.visit_type_desc + "</option>");
|
|
})
|
|
$('#ddlStatus').val('');
|
|
$('#ddlStatus').select2({
|
|
placeholder: "状态",
|
|
allowClear: true
|
|
});
|
|
});
|
|
promiseweld.fail(function (error) {
|
|
console.log(error)
|
|
alert(error);
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//$('#rangetime').daterangepicker({
|
|
// timePicker: true, //显示时间
|
|
// timePicker24Hour: true, //时间制
|
|
// timePickerSeconds: true, //时间显示到秒
|
|
// startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
|
|
// endDate: moment(new Date()), //设置结束器日期
|
|
// maxDate: moment(new Date()), //设置最大日期
|
|
// "opens": "center",
|
|
// showWeekNumbers: true,
|
|
// locale: {
|
|
// format: "YYYY-MM-DD HH:mm:ss", //设置显示格式
|
|
// applyLabel: '确定', //确定按钮文本
|
|
// cancelLabel: '取消', //取消按钮文本
|
|
// customRangeLabel: '自定义',
|
|
// daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
|
|
// monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
|
|
// '七月', '八月', '九月', '十月', '十一月', '十二月'
|
|
// ],
|
|
// firstDay: 1
|
|
// },
|
|
//}, function (start, end, label) {
|
|
// timeRangeChange = [start.format('YYYY-MM-DD HH:mm:ss'), end.format('YYYY-MM-DD HH:mm:ss')];
|
|
// console.log(timeRangeChange);
|
|
//});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#btnQuery').click(function () {
|
|
$begintime = $('#rangetime').val().substr(0, 19),//$('#txtBegintime').val(),
|
|
$endtime = $('#rangetime').val().split(' - ')[1],
|
|
$workshop = $('#ddlWorkshop').val(),
|
|
$workorder = $('#txtWO').val(),
|
|
$serialno = $('textarea').val(),
|
|
$pallet_nbr = $('#pallet_nbr').val(),
|
|
$sale_order = $('#sale_order').val(),
|
|
$containerno = $('#containerno').val(),
|
|
$check_nbr = $('#check_nbr').val()
|
|
if ($begintime == '' && $workshop == null && $workorder == '' && $serialno == '' && $pallet_nbr == '' && $sale_order == '' && $containerno == '' && $check_nbr == '') {
|
|
alert('请输入查询条件');
|
|
return;
|
|
}
|
|
$("#tbtestdata").bootstrapTable('refresh');
|
|
var oTable = new TableInit();
|
|
oTable.Init();
|
|
|
|
})
|
|
var TableInit = function () {
|
|
var oTableInit = new Object();
|
|
//初始化Table
|
|
oTableInit.Init = function () {
|
|
$('#tbtestdata').bootstrapTable({
|
|
url: '/api/TestDataDetail/QueryData', //请求后台的URL(*)
|
|
method: 'post', //请求方式(*)
|
|
toolbar: '#toolbar', //工具按钮用哪个容器
|
|
striped: true, //是否显示行间隔色
|
|
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
|
pagination: true, //是否显示分页(*)
|
|
sortable: false, //是否启用排序
|
|
sortOrder: "asc", //排序方式
|
|
queryParams: oTableInit.queryParams,//传递参数(*)
|
|
sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
|
|
contentType: 'application/json',
|
|
pageNumber: 1, //初始化加载第一页,默认第一页
|
|
pageSize: 10, //每页的记录行数(*)
|
|
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
|
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
|
strictSearch: true,
|
|
showColumns: true, //是否显示所有的列
|
|
showRefresh: true, //是否显示刷新按钮
|
|
minimumCountColumns: 2, //最少允许的列数
|
|
clickToSelect: true, //是否启用点击选中行
|
|
//height: 500, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
|
//uniqueId: "aiid", //每一行的唯一标识,一般为主键列
|
|
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
|
cardView: false, //是否显示详细视图
|
|
detailView: false, //是否显示父子表
|
|
showExport: true, //是否显示导出
|
|
exportDataType: "all", //basic', 'all', 'selected'.
|
|
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
|
|
exportHiddenCells: true,
|
|
onLoadSuccess: function (data) {
|
|
// var data = $('#tbqc').bootstrapTable('getData', true);
|
|
// //合并单元格
|
|
// mergeCells(data, "serial_nbr", 1, $('#tbqc'));
|
|
// mergeCells(data, "schedule_nbr", 1, $('#tbqc'));
|
|
console.log(data);
|
|
},
|
|
columns: [{
|
|
field: 'no',
|
|
title: '序号',
|
|
sortable: true,
|
|
align: "center",
|
|
width: 40,
|
|
formatter: function (value, row, index) {
|
|
//获取每页显示的数量
|
|
//var pageSize = $('#tbtestdata').bootstrapTable('getOptions').pageSize;
|
|
//获取当前是第几页
|
|
//var pageNumber = $('#tbtestdata').bootstrapTable('getOptions').pageNumber;
|
|
//返回序号,注意index是从0开始的,所以要加上1
|
|
//return pageSize * (pageNumber - 1) + index + 1;
|
|
return index + 1;
|
|
}
|
|
}, {
|
|
field: 'container_nbr',
|
|
title: '柜号'
|
|
}, {
|
|
field: 'pallet_nbr',
|
|
title: '托盘号'
|
|
},
|
|
{
|
|
field: "pack_seq",
|
|
title: "包装顺序"
|
|
}, {
|
|
field: 'workorder',
|
|
title: '工单号'
|
|
}, {
|
|
field: 'sale_order',
|
|
title: '订单号'
|
|
}, {
|
|
field: 'serial_nbr',
|
|
title: '组件序列号'
|
|
}, {
|
|
field: "wks_visit_date",
|
|
title: "测试日期时间"
|
|
}, {
|
|
field: "wks_id",
|
|
title: "测试机台号"
|
|
}, {
|
|
field: 'power_grade',
|
|
title: '功率档位'
|
|
}, {
|
|
field: 'current_grade',
|
|
title: '电流档位'
|
|
}, {
|
|
field: "exterior_grade",
|
|
title: "外观等级"
|
|
}, {
|
|
field: 'el_grade',
|
|
title: 'EL等级'
|
|
}, {
|
|
field: "final_grade",
|
|
title: "最终等级"
|
|
},
|
|
{
|
|
field: "voc",
|
|
title: "VOC"
|
|
},
|
|
{
|
|
field: "isc",
|
|
title: "ISC"
|
|
},
|
|
{
|
|
field: "pmax",
|
|
title: "Pmax"
|
|
},
|
|
{
|
|
field: "vpm",
|
|
title: "VPM"
|
|
},
|
|
{
|
|
field: "ipm",
|
|
title: "IPM"
|
|
},
|
|
{
|
|
field: "ff",
|
|
title: "FF"
|
|
},
|
|
{
|
|
field: "rs",
|
|
title: "RS"
|
|
},
|
|
{
|
|
field: "rsh",
|
|
title: "RSH"
|
|
},
|
|
{
|
|
field: "eff",
|
|
title: "EFF"
|
|
},
|
|
{
|
|
field: "env_temp",
|
|
title: "Envtmp"
|
|
},
|
|
{
|
|
field: "tmod",
|
|
title: "Tmod"
|
|
},
|
|
{
|
|
field: "cell_supplier",
|
|
title: "电池片厂家"
|
|
}, {
|
|
field: "cell_uop",
|
|
title: "单片功率"
|
|
}, {
|
|
field: "cell_color",
|
|
title: "电池片颜色"
|
|
}, {
|
|
field: "cell_grade",
|
|
title: "电池片等级"
|
|
}, {
|
|
field: "cell_type",
|
|
title: "电池片类型"
|
|
}, {
|
|
field: "cell_eff",
|
|
title: "电池片效率档"
|
|
},
|
|
{
|
|
field: "pallet_status_desc",
|
|
title: "托盘状态"
|
|
}, {
|
|
field: "cell_qty",
|
|
title: "片源用量"
|
|
}, {
|
|
field: "EDGL",
|
|
title: "额定功率"
|
|
}, {
|
|
field: "fff",
|
|
title: "投入产出比"
|
|
}, {
|
|
field: "crys_type",
|
|
title: "晶体类型"
|
|
}, {
|
|
field: "cell_size",
|
|
title: "片源规格"
|
|
},
|
|
{
|
|
field: "hj_wks_id",
|
|
title: "焊接机台号"
|
|
}
|
|
]
|
|
});
|
|
};
|
|
|
|
//得到查询的参数
|
|
oTableInit.queryParams = function (params) {
|
|
var workshop;
|
|
if ($('#ddlWorkshop').val() == null) {workshop = ''} else { workshop = $('#ddlWorkshop').val() }
|
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
limit: params.limit, //页面大小
|
|
offset: params.offset, //页码
|
|
//departmentname: $("#txt_search_departmentname").val(),
|
|
//statu: $("#txt_search_statu").val()
|
|
begintime: $('#rangetime').val().substr(0, 19),//$('#txtBegintime').val(),
|
|
endtime: $('#rangetime').val().split(' - ')[1],
|
|
workshop: workshop,
|
|
workorder: $('#txtWO').val(),
|
|
serialno: $('textarea').val(),
|
|
pallet_nbr: $('#pallet_nbr').val(),
|
|
sale_order: $('#sale_order').val(),
|
|
containerno: $('#containerno').val(),
|
|
check_nbr: $('#check_nbr').val()
|
|
};
|
|
return temp;
|
|
};
|
|
return oTableInit;
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 合并单元格
|
|
* @param data 原始数据(在服务端完成排序)
|
|
* @param fieldName 合并属性名称
|
|
* @param colspan 合并列
|
|
* @param target 目标表格对象
|
|
*/
|
|
function mergeCells(data, fieldName, colspan, target) {
|
|
//声明一个map计算相同属性值在data对象出现的次数和
|
|
var sortMap = {};
|
|
for (var i = 0; i < data.length; i++) {
|
|
for (var prop in data[i]) {
|
|
if (prop == fieldName) {
|
|
var key = data[i][prop]
|
|
if (sortMap.hasOwnProperty(key)) {
|
|
sortMap[key] = sortMap[key] * 1 + 1;
|
|
} else {
|
|
sortMap[key] = 1;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
for (var prop in sortMap) {
|
|
console.log(prop, sortMap[prop])
|
|
}
|
|
var index = 0;
|
|
for (var prop in sortMap) {
|
|
var count = sortMap[prop] * 1;
|
|
$(target).bootstrapTable('mergeCells', { index: index, field: fieldName, colspan: colspan, rowspan: count });
|
|
index += count;
|
|
}
|
|
}
|
|
|
|
//导出excel
|
|
$('#btnExportExcel').on('click',function () {
|
|
var begintime = $('#rangetime').val().substr(0, 19);//$('#txtBegintime').val(),
|
|
var endtime = $('#rangetime').val().split(' - ')[1];
|
|
var workshop = $('#ddlWorkshop').val();
|
|
var workorder = $('#txtWO').val();
|
|
var serialno = $('textarea').val();
|
|
var pallet_nbr = $('#pallet_nbr').val();
|
|
var sale_order = $('#sale_order').val();
|
|
var containerno = $('#containerno').val();
|
|
var check_nbr = $('#check_nbr').val();
|
|
if (begintime == '' && workshop == null && workorder == '' && serialno == '' && pallet_nbr == '' && sale_order == '' && containerno == '' && check_nbr == '') {
|
|
alert('请输入导出条件');
|
|
return;
|
|
}
|
|
if (workshop == null) {
|
|
workshop = '';
|
|
}
|
|
var bt = $('#rangetime').val().substr(0, 19);
|
|
var Et = $('#rangetime').val().split(' - ')[1];
|
|
var text = $('textarea').val().split(/[(\r\n)\r\n]+/);
|
|
if (bt == '') {
|
|
Et = '';
|
|
} else {
|
|
Et = $('#rangetime').val().split(' - ')[1];
|
|
}
|
|
//if ($('#txtBegintime').val() == '' || $('#txtEndtime').val() == '') {
|
|
// alert('请输入查询参数');
|
|
// return;
|
|
//}
|
|
//var promiseweld = $.ajax({
|
|
// url: '../Report/ExportToExcel',
|
|
// type: 'post',
|
|
// cache: true,
|
|
// async: true,
|
|
//});
|
|
|
|
//promiseweld.fail(function (error) {
|
|
// console.log(error)
|
|
// alert(error);
|
|
//});
|
|
var texts = "";
|
|
if (text!= '') {
|
|
for (var i = 0; i < text.length; i++) {
|
|
texts += "'" + text[i] + "',"
|
|
}
|
|
texts = texts.slice(0, texts.length - 1);
|
|
} else {
|
|
texts = text;
|
|
}
|
|
doPost('/Report/TestDataDetailExcel', [
|
|
text = texts,
|
|
wo = workorder,
|
|
bt = bt,
|
|
et = Et,
|
|
workshop = workshop,
|
|
pallet_nbr = pallet_nbr,
|
|
sale_order = sale_order,
|
|
containerno = containerno,
|
|
check_nbr = check_nbr
|
|
])
|
|
//var c=
|
|
})
|
|
function doPost(to, p) { // to:提交动作(action),p:参数
|
|
var myForm = document.createElement("form");
|
|
myForm.method = "post";
|
|
myForm.action = to;
|
|
for (var i in p) {
|
|
var myInput = document.createElement("input");
|
|
myInput.setAttribute("name", "para"); // 为input对象设置name
|
|
myInput.setAttribute("value", p[i]); // 为input对象设置value
|
|
myForm.appendChild(myInput);
|
|
}
|
|
document.body.appendChild(myForm);
|
|
myForm.submit();
|
|
document.body.removeChild(myForm); // 提交后移除创建的form
|
|
}
|
|
//车间选择下拉未完成
|
|
//document.onreadystatechange = subSomething;//当页面加载状态改变的时候执行这个方法.
|
|
//function subSomething() {
|
|
// if (document.readyState == 'complete') //当页面加载状态
|
|
// {
|
|
// setTimeout(function () {
|
|
// QueryWorkshop()
|
|
// //handleIframeContent();
|
|
// }, 1000); // wait 50ms until window resize finishes.
|
|
// }
|
|
//}
|
|
//引用过来
|
|
//async function QueryDataAsync(paraworkshop) {
|
|
// try {
|
|
// let dddd = await FetchApi("Twohours", { workshop: paraworkshop });
|
|
|
|
// dddd = await dddd.json();
|
|
// _.each(dddd, function (ele, index, ary) {
|
|
// if (ele.station == "weld") {
|
|
// let weld = handleary(ele.res)
|
|
// iniChart('rptweld', '焊接', weld)
|
|
// }
|
|
// if (ele.station == "lamination") {
|
|
// let lamination = handleary(ele.res)
|
|
// iniChart('rptlamination', '叠层', lamination);
|
|
// }
|
|
// if (ele.station == "layup") {
|
|
// let layup = handleary(ele.res)
|
|
// iniChart('rptlayup', '层压', layup);
|
|
// }
|
|
// if (ele.station == "inspectionafterlayup") {
|
|
// let inspectionafterlayup = handleary(ele.res)
|
|
// iniChart('rptinspectionafterlayup', '层压后检验', inspectionafterlayup);
|
|
// }
|
|
// if (ele.station == "frame") {
|
|
// let frame = handleary(ele.res)
|
|
// iniChart('rptframe', '装框', frame);
|
|
// }
|
|
// if (ele.station == "clean") {
|
|
// let clean = handleary(ele.res)
|
|
// iniChart('rptclean', '清洗', clean);
|
|
// }
|
|
// if (ele.station == "IV") {
|
|
// let iv = handleary(ele.res)
|
|
// iniChart('rptiv', 'IV测试', iv);
|
|
// }
|
|
// if (ele.station == "EL") {
|
|
// let el = handleary(ele.res)
|
|
// iniChart('rptel', 'EL测试', el);
|
|
// }
|
|
// if (ele.station == "fullinspection") {
|
|
// let el = handleary(ele.res)
|
|
// iniChart('rptfullinspection', '全检', el);
|
|
// }
|
|
|
|
// })
|
|
// }
|
|
// catch (err) {
|
|
// console.log(err);
|
|
// }
|
|
//}
|
|
//async function QueryDataAsync(paraworkshop) { }
|
|
////fetchApi方法
|
|
//function FetchApi(funname, para) {
|
|
// return fetch("/api/Orders/" + funname + "", {
|
|
// method: "post",
|
|
// headers: {
|
|
// "Accept": "application/json, text/plain, */*",
|
|
// "Content-Type": "application/json"
|
|
// },
|
|
// body: JSON.stringify(para)
|
|
// })
|
|
//}
|
|
////车间替换
|
|
//async function QueryWorkshop() {
|
|
// let workshop = await FetchApi("QueryWorkshop", {})
|
|
// workshop = await workshop.json();
|
|
// $('#ddlWorkshop').empty()
|
|
// //_.each(workshop.info, function (ele, index, list) {
|
|
// //$('#ddlWorkshop').append("<option value='" + ele.area_code + "'>" + ele.descriptions + "</option>")
|
|
|
|
// //})
|
|
// console.log(workshop)
|
|
// //console.log('query workshop end')
|
|
// //var title = /\d*$/.exec($('#cbxWorkshop').val())[0]
|
|
// //title = title.replace(/\b0*/, '')
|
|
// //$('#wotitle').text(title)
|
|
// await QueryDataAsync($('#ddlWorkshop').val())
|
|
//}
|
|
|
|
|
|
|
|
|
|
|