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.
398 lines
16 KiB
398 lines
16 KiB
$(document).ready(function () {
|
|
Daterangeini();
|
|
QueryddlWorkshop();
|
|
QueryStock();
|
|
//var oTable = new TableInit();
|
|
//oTable.Init();
|
|
})
|
|
//时间
|
|
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', //'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 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(value);
|
|
$("#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);
|
|
});
|
|
}
|
|
$('#btnQuery').click(function () {
|
|
var workshop = $('#ddlWorkshop').val();
|
|
var bt= $('#rangetime').val().substr(0, 10);//$('#txtBegintime').val(),
|
|
var et = $('#rangetime').val().split(' - ')[1];
|
|
var name = $('#ddlStock option:selected').text();
|
|
var locationname = $('#ddlLocation option:selected').text();
|
|
var final_grade = $('#txtfinal_grade').val();
|
|
var power_grade= $('#txtpower_grade').val();
|
|
var containerno= $('#txtcontainerno').val();
|
|
var palletno= $('#txtpalletno').val();
|
|
var workorder= $('#txtWorkorder').val();
|
|
var saleorder = $('#saleorder').val();
|
|
var serial = $('#txtserial').val();
|
|
if (workshop == null && bt == '' && name == '' && locationname == '' && final_grade == '' && power_grade == '' && containerno == '' && palletno == '' && workorder == '' && saleorder == '' && serial == '') {
|
|
alert('请输入查询条件');
|
|
return;
|
|
}
|
|
$('#tbqc').bootstrapTable('refresh');
|
|
var oTable = new TableInit();
|
|
oTable.Init();
|
|
})
|
|
var datas = null;
|
|
var TableInit = function () {
|
|
var oTableInit = new Object();
|
|
//初始化Table
|
|
oTableInit.Init = function () {
|
|
$('#tbqc').bootstrapTable('destroy').bootstrapTable({
|
|
url: '/api/StorageReport/StorageReports', //请求后台的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'],
|
|
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);
|
|
datas = data;
|
|
},
|
|
columns: [{
|
|
field: 'id',
|
|
title: '序号'
|
|
}, {
|
|
field: 'createtime',
|
|
title: '入库时间'
|
|
}, {
|
|
field: 'name',
|
|
title: '仓库'
|
|
}, {
|
|
field: 'locationname',
|
|
title: '库位'
|
|
}, {
|
|
field: 'sale_order',
|
|
title: '订单'
|
|
}, {
|
|
field: 'workorder',
|
|
title: '工单'
|
|
}, {
|
|
field: 'containerno',
|
|
title: '柜号'
|
|
}, {
|
|
field: 'palletno',
|
|
title: '托盘号'
|
|
}, {
|
|
field: 'serial_nbr',
|
|
title: '序列号'
|
|
}, {
|
|
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)'
|
|
}, {
|
|
field: 'product_code',
|
|
title: '产品类型'
|
|
}, {
|
|
field: 'power_grade',
|
|
title: '功率档'
|
|
}, {
|
|
field: 'busbar_type_desc',
|
|
title: ' 栅数'
|
|
}
|
|
//, {
|
|
//field: 'pallet_qty',
|
|
//title: '入库数量'
|
|
//}
|
|
, {
|
|
field: 'final_grade',
|
|
title: '等级'
|
|
}, {
|
|
field: 'frame_type_desc',
|
|
title: '组件尺寸'
|
|
}, {
|
|
field: 'jbox_type_desc',
|
|
title: '接线盒类型'
|
|
}, {
|
|
field: 'statuss',
|
|
title: '状态'
|
|
}, {
|
|
field: 'descriptions',
|
|
title: '车间'
|
|
}
|
|
]
|
|
});
|
|
};
|
|
console.log(datas);
|
|
//得到查询的参数
|
|
oTableInit.queryParams = function (params) {
|
|
console.log($('#rangetime').val().substr(0, 19) + '----' + $('#rangetime').val().split(' - ')[1]);
|
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
limit: params.limit, //页面大小
|
|
offset: params.offset, //页码
|
|
//departmentname: $("#txt_search_departmentname").val(),
|
|
//statu: $("#txt_search_statu").val()
|
|
workshop: $('#ddlWorkshop').val(),
|
|
bt: $('#rangetime').val().substr(0, 10),//$('#txtBegintime').val(),
|
|
et: $('#rangetime').val().split(' - ')[1],
|
|
name: $('#ddlStock option:selected').text(),
|
|
locationname: $('#ddlLocation option:selected').text(),
|
|
final_grade: $('#txtfinal_grade').val(),
|
|
power_grade: $('#txtpower_grade').val(),
|
|
containerno: $('#txtcontainerno').val(),
|
|
palletno: $('#txtpalletno').val() ,
|
|
workorder: $('#txtWorkorder').val(),
|
|
saleorder: $('#saleorder').val(),
|
|
serial: $('#txtserial').val()
|
|
};
|
|
return temp;
|
|
};
|
|
return oTableInit;
|
|
};
|
|
//查询仓库的库位
|
|
function QueryStorageLocationByStock(stockid) {
|
|
//oTableInit.onLoadSuccess;
|
|
var promise = $.ajax({
|
|
url: '/api/StockIn/QueryLocationByStock',
|
|
type: 'post',
|
|
cache: false,
|
|
async: true,
|
|
contentType: "application/json",
|
|
data: JSON.stringify({
|
|
stockid: stockid
|
|
})
|
|
});
|
|
promise.done(function (r) {
|
|
var options = '';
|
|
$.each(r, function (i, v) {
|
|
options += "<option value='" + v.id + "'>" + v.locationname + "</option>";//v.id修改为v.locationname
|
|
});
|
|
$('#ddlLocation').html(options);
|
|
$('#ddlLocation').val('');
|
|
$('#ddlLocation').select2({
|
|
placeholder: "选择库位",
|
|
allowClear: true
|
|
});
|
|
//查询库位的条件 2019-2-20 xue lei
|
|
$('#ddlLocation').on('select2:select', function (e) {
|
|
console.log($(this).val());
|
|
var selectvalue = $(this).val();
|
|
QueryLocationCondiction(selectvalue);
|
|
});
|
|
//清空选项就清空库位条件
|
|
$('#ddlLocation').on('select2:close', function (e) {
|
|
console.log('清空选项');
|
|
$('#cbxPowerGrade').iCheck('uncheck')
|
|
$('#cbxIGrade').iCheck('uncheck')
|
|
$('#cbxCellQty').iCheck('uncheck')
|
|
$('#cbxBarType').iCheck('uncheck')
|
|
$('#cbxModuleSpec').iCheck('uncheck')
|
|
$('#cbxFinalGrade').iCheck('uncheck')
|
|
$('#cbxColor').iCheck('uncheck')
|
|
});
|
|
});
|
|
promise.fail(function (error) {
|
|
console.log(error)
|
|
//alert(error);
|
|
});
|
|
}
|
|
//查询仓库
|
|
function QueryStock() {
|
|
var promise = $.ajax({
|
|
url: '/api/StockIn/QueryStock',
|
|
type: 'post',
|
|
cache: false,
|
|
async: true,
|
|
contentType: "application/json",
|
|
//data: JSON.stringify({
|
|
// lotid: $("#LotID").val()
|
|
//}),
|
|
});
|
|
promise.done(function (r) {
|
|
console.log(r);
|
|
//删除仓库重复项
|
|
//r[2] = null;
|
|
//var a = new Array;
|
|
//a[0] = r[0];
|
|
//a[1] = r[1];
|
|
//a[2] = r[3];
|
|
//a[3] = r[4];
|
|
var options = '';
|
|
//console.log(a);
|
|
$.each(r, function (i, v) {
|
|
console.log(i);
|
|
options += "<option value='" + v.id + "'>" + v.name + "</option>";//v.id修改为v.name
|
|
})
|
|
$('#ddlStock').html(options);
|
|
$('#ddlStock').val('');
|
|
$('#ddlStock').select2({
|
|
placeholder: "选择仓库",
|
|
allowClear: true
|
|
});
|
|
$('#ddlStock').on('select2:select', function (e) {
|
|
console.log($(this).val());
|
|
var selectvalue = $(this).val();
|
|
QueryStorageLocationByStock(selectvalue);
|
|
});
|
|
});
|
|
promise.fail(function (error) {
|
|
console.log(error);
|
|
//alert(error);
|
|
});
|
|
}
|
|
|
|
//查询库位的条件
|
|
//function QueryLocationCondiction(lacotionid) {
|
|
// fetch("/api/StockIn/QueryLocationCondiction", {
|
|
// method: "post",
|
|
// headers: {
|
|
// "Accept": "application/json, text/plain, */*",
|
|
// 'Content-Type': 'application/json'
|
|
// },
|
|
// body: JSON.stringify({ locationid: lacotionid })
|
|
// }).then(function (res) {
|
|
// return res.json();
|
|
// }).then(function (res) {
|
|
// const CondictionAry = ['powergrade', 'igrade', 'color', 'cellqty', 'bartype', 'modulespec', 'finalgrade'];
|
|
|
|
// if (res.powergrade != null) { $('#cbxPowerGrade').iCheck('check'); };
|
|
// if (res.igrade != null) { $('#cbxIGrade').iCheck('check'); };
|
|
// if (res.cellqty != null) { $('#cbxCellQty').iCheck('check'); };
|
|
// if (res.bartype != null) { $('#cbxBarType').iCheck('check'); };
|
|
// if (res.modulespec != null) { $('#cbxModuleSpec').iCheck('check'); };
|
|
// if (res.finalgrade != null) { $('#cbxFinalGrade').iCheck('check'); };
|
|
// if (res.color != null) { $('#cbxColor').iCheck('check'); };
|
|
|
|
// console.log("查询库位条件结束");
|
|
// }).catch(function (ex) {
|
|
// console.log('request failed', ex);
|
|
// })
|
|
//}
|
|
|
|
$('#btnExportExcel').on('click', function () {
|
|
var workshop = $('#ddlWorkshop').val();
|
|
var bt = $('#rangetime').val().substr(0, 10);//$('#txtBegintime').val(),
|
|
var et = $('#rangetime').val().split(' - ')[1];
|
|
var name = $('#ddlStock option:selected').text();
|
|
var locationname = $('#ddlLocation option:selected').text();
|
|
var final_grade = $('#txtfinal_grade').val();
|
|
var power_grade = $('#txtpower_grade').val();
|
|
var containerno = $('#txtcontainerno').val();
|
|
var palletno = $('#txtpalletno').val();
|
|
var workorder = $('#txtWorkorder').val();
|
|
var saleorder = $('#saleorder').val();
|
|
var serial = $('#txtserial').val();
|
|
if (workshop == null && bt == '' && name == '' && locationname == '' && final_grade == '' && power_grade == '' && containerno == '' && palletno == '' && workorder == '' && saleorder == '' && serial == '') {
|
|
alert('请输入查询条件');
|
|
return;
|
|
}
|
|
doPost('/Report/StorageReportExcel', [bt = $('#rangetime').val().substr(0, 10),
|
|
et = $('#rangetime').val().split(' - ')[1],
|
|
//workshop = $('#ddlWorkshop').val();
|
|
name = $('#ddlStock option:selected').text(),
|
|
locationname = $('#ddlLocation option:selected').text(),
|
|
final_grade= $('#txtfinal_grade').val(),
|
|
power_grade = $('#txtpower_grade').val(),
|
|
containerno = $('#txtcontainerno').val(),
|
|
palletno = $('#txtpalletno').val(),
|
|
workorder = $('#txtWorkorder').val(),
|
|
sareorder = $('#sareorder').val(),
|
|
area_code = $('#ddlWorkshop').val(),
|
|
serial = $('#txtserial').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
|
|
}
|