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.
376 lines
14 KiB
376 lines
14 KiB
2 years ago
|
|
||
|
$().ready(function () {
|
||
|
//$('.input-daterange').datepicker({
|
||
|
// language: 'zh-CN',//显示中文
|
||
|
// format: 'yyyy-mm-dd',
|
||
|
//});
|
||
|
//$('#txtEndtime').val(moment().format("YYYY-MM-DD"));
|
||
|
//$('#txtBegintime').val(moment().subtract(1, 'days').format("YYYY-MM-DD"));
|
||
|
//$('#ddlWorkshop').val('');
|
||
|
//$('#ddlWorkshop').select2({
|
||
|
// placeholder: "车间",
|
||
|
// allowClear: true
|
||
|
//});
|
||
|
Daterangeini();
|
||
|
QueryddlWorkshop()
|
||
|
//1.初始化Table
|
||
|
//var oTable = new TableInit();
|
||
|
//oTable.Init();
|
||
|
|
||
|
})
|
||
|
|
||
|
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);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function Daterangeini() {
|
||
|
$('#rangetime').val(moment().subtract('hours', 0).format('YYYY-MM-DD') + ' 07:20:00' + ' - ' + moment().format('YYYY-MM-DD') + ' 19:20:00');
|
||
|
|
||
|
|
||
|
$('#rangetime').daterangepicker(
|
||
|
{
|
||
|
//autoUpdateInput: false,
|
||
|
timePicker: true,
|
||
|
timePicker24Hour: true,
|
||
|
"opens": "center",
|
||
|
'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/PackOutput/QueryStatus',
|
||
|
type: 'post',
|
||
|
cache: true,
|
||
|
async: true,
|
||
|
});
|
||
|
promiseweld.done(function (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);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
$('#btnQuery').click(function () {
|
||
|
var behintime= $('#rangetime').val().substr(0, 19);
|
||
|
var endtime= $('#rangetime').val().split(' - ')[1];
|
||
|
var workshop= $('#ddlWorkshop').val();
|
||
|
var product_code= $('#txtproduct_code').val();
|
||
|
var power_grade= $('#txtpower_grade').val();
|
||
|
var containerno = $('#txtcontainerno').val();
|
||
|
if (behintime == '' && workshop == null && product_code == '' && power_grade == '' && containerno == '') {
|
||
|
alert('请输入查询条件');
|
||
|
return;
|
||
|
}
|
||
|
//$("#tbqc").bootstrapTable('destroy');
|
||
|
$("#tbqc").bootstrapTable('refresh');
|
||
|
var oTable = new TableInit();
|
||
|
oTable.Init();
|
||
|
|
||
|
})
|
||
|
var TableInit = function () {
|
||
|
var oTableInit = new Object();
|
||
|
//初始化Table
|
||
|
oTableInit.Init = function () {
|
||
|
$('#tbqc').bootstrapTable({
|
||
|
url: '/api/ShipmentsReport/ShipmentsReports', //请求后台的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: 20, //每页的记录行数(*)
|
||
|
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'],
|
||
|
|
||
|
//onClickRow: function (row) {
|
||
|
// if (template.defaults.imports.hasPermission('/payment_manager/payment_detail')) {
|
||
|
// EditBook(row.id);
|
||
|
// }
|
||
|
//},
|
||
|
|
||
|
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: [{
|
||
|
checkbox: true
|
||
|
},
|
||
|
{
|
||
|
field: 'outtime',
|
||
|
title: '发货时间'
|
||
|
}, {
|
||
|
field: 'orderid',
|
||
|
title: '订单'
|
||
|
},{
|
||
|
field: 'area_code',
|
||
|
title: '车间号/Workshop'
|
||
|
},{
|
||
|
field: 'product_code',
|
||
|
title: '产品类型/Type'
|
||
|
}, {
|
||
|
field: 'power_grade',
|
||
|
title: '功率档Pnom(W)'
|
||
|
}, {
|
||
|
field: 'containerno',
|
||
|
title: '内部柜号/Internal Container'
|
||
|
}, {
|
||
|
field: 'materialcompany',
|
||
|
title: '物流公司'
|
||
|
}, {
|
||
|
field: 'billlading',
|
||
|
title: '提单号'
|
||
|
}, {
|
||
|
field: 'plateno',
|
||
|
title: '集装箱号'
|
||
|
}, {
|
||
|
field: 'shipmentcarton',
|
||
|
title: '集装箱锁号'
|
||
|
}, {
|
||
|
field: 'pack_date',
|
||
|
title: '包装日期'
|
||
|
},
|
||
|
{
|
||
|
field: 'pallet_nbr',
|
||
|
title: '托盘号/Pallet No.'
|
||
|
}, {
|
||
|
field: 'serial_nbr',
|
||
|
title: '序列号s/N'
|
||
|
}, {
|
||
|
field: 'voc',
|
||
|
title: '开路电压Voc(V)'
|
||
|
}, {
|
||
|
field: 'isc',
|
||
|
title: '短路电流Isc(A)'
|
||
|
}, {
|
||
|
field: 'vpm',
|
||
|
title: '工作电压Vpm(V)'
|
||
|
}, {
|
||
|
field: 'ipm',
|
||
|
title: '工作电流Ipm(A)'
|
||
|
}, {
|
||
|
field: 'pmax',
|
||
|
title: '实测功率Pmp(W)'
|
||
|
}, {
|
||
|
field: 'ff',
|
||
|
title: '填充因子FF'
|
||
|
}, {
|
||
|
field: 'current_grade',
|
||
|
title: '电流档current(A)'
|
||
|
}
|
||
|
|
||
|
]
|
||
|
});
|
||
|
};
|
||
|
|
||
|
////表格超链接方法
|
||
|
//function aFormatter(value, row, index) {
|
||
|
// return [
|
||
|
// '<a href="#" >链接</a>'
|
||
|
// ].join("")
|
||
|
//}
|
||
|
|
||
|
//得到查询的参数
|
||
|
oTableInit.queryParams = function (params) {
|
||
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||
|
limit: params.limit, //页面大小
|
||
|
offset: params.offset, //页码
|
||
|
//departmentname: $("#txt_search_departmentname").val(),
|
||
|
//statu: $("#txt_search_statu").val()
|
||
|
behintime: $('#rangetime').val().substr(0, 19),
|
||
|
endtime: $('#rangetime').val().split(' - ')[1],
|
||
|
workshop: $('#ddlWorkshop').val(),
|
||
|
product_code: $('#txtproduct_code').val(),
|
||
|
power_grade: $('#txtpower_grade').val(),
|
||
|
containerno: $('#txtcontainerno').val(),
|
||
|
};
|
||
|
return temp;
|
||
|
};
|
||
|
return oTableInit;
|
||
|
};
|
||
|
|
||
|
|
||
|
var ButtonInit = function () {
|
||
|
var oInit = new Object();
|
||
|
var postdata = {};
|
||
|
|
||
|
oInit.Init = function () {
|
||
|
//初始化页面上面的按钮事件
|
||
|
};
|
||
|
|
||
|
return oInit;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* 合并单元格
|
||
|
* @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').click(function () {
|
||
|
// console.log("clicked");
|
||
|
// //var promiseweld = $.ajax({
|
||
|
// // url: '../Report/ExportToExcel',
|
||
|
// // type: 'post',
|
||
|
// // cache: true,
|
||
|
// // async: true,
|
||
|
// //});
|
||
|
|
||
|
// //promiseweld.fail(function (error) {
|
||
|
// // console.log(error)
|
||
|
// // alert(error);
|
||
|
// //});
|
||
|
// //[Route("ShipmentsReportsExcel/{workshop}/{bt}/{et}/{pc}/{pg}/{pallet}/{cont}")]
|
||
|
// //window.open('../Report/ExportToExcel?bt=2018-10-10');
|
||
|
// var a = $("<a href='/Report/ShipmentsReportsExcel/"
|
||
|
// + (!$('#ddlWorkshop').val() ? "Null" : $('#ddlWorkshop').val())+"/"
|
||
|
// + (!$('#txtBegintime').val() ? "Null" : $('#txtBegintime').val()) + "/"
|
||
|
// +( !$('#txtEndtime').val() ? "Null" : $('#txtEndtime').val()) + "/"
|
||
|
// + (!$('#txtproduct_code').val() ? "Null" : $('#txtproduct_code').val()) + "/"
|
||
|
// + (!$('#txtpower_grade').val() ? "Null" : $('#txtpower_grade').val()) + "/"
|
||
|
// + (!$('#txtcontainerno').val() ? "Null" : $('#txtcontainerno').val()) +
|
||
|
// //"/"
|
||
|
// //+( !$('#txtCheckNo').val() ? "Null" : $('#txtCheckNo').val() )+
|
||
|
// "' target='_blank'></a>").get(0);
|
||
|
// var e = document.createEvent('MouseEvents');
|
||
|
// e.initEvent('click', true, true);
|
||
|
// a.dispatchEvent(e);
|
||
|
//})
|
||
|
|
||
|
//var myArray = [];
|
||
|
//var arr = myArray.concat(behintime=$('#txtBegintime').val());
|
||
|
$('#btnExportExcel').on('click', function () {
|
||
|
var behintime = $('#rangetime').val().substr(0, 19);
|
||
|
var endtime = $('#rangetime').val().split(' - ')[1];
|
||
|
var workshop = $('#ddlWorkshop').val();
|
||
|
var product_code = $('#txtproduct_code').val();
|
||
|
var power_grade = $('#txtpower_grade').val();
|
||
|
var containerno = $('#txtcontainerno').val();
|
||
|
if (behintime == '' && workshop == null && product_code == '' && power_grade == '' && containerno == '') {
|
||
|
alert('请输入查询条件');
|
||
|
return;
|
||
|
}
|
||
|
console.log($('#rangetime').val().substr(0, 19) + '------' + $('#rangetime').val().split(' - ')[1])
|
||
|
doPost('/Report/ShipmentsReportssExcel', [behintime = $('#rangetime').val().substr(0, 19),
|
||
|
endtime = $('#rangetime').val().split(' - ')[1],
|
||
|
workshop=$('#ddlWorkshop').val(),
|
||
|
product_code=$('#txtproduct_code').val(),
|
||
|
power_grade=$('#txtpower_grade').val(),
|
||
|
containerno=$('#txtcontainerno').val()])
|
||
|
})
|
||
|
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
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|