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.
236 lines
8.1 KiB
236 lines
8.1 KiB
$(document).ready(function () {
|
|
QueryddlWorkshop();
|
|
$('#wodaterange').tooltip();
|
|
|
|
})
|
|
|
|
//车间
|
|
function QueryddlWorkshop() {
|
|
console.log('kw');
|
|
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 QueryddlStatus() {
|
|
// var promiseweld = $.ajax({
|
|
// url: '../api/QC/QueryStatus',
|
|
// type: 'post',
|
|
// cache: true,
|
|
// async: true,
|
|
// });
|
|
// promiseweld.done(function (r) {
|
|
// $.each(r, function (index, value) {
|
|
// $("#ddlWorkshop").append("<option value='" + value.visit_type + "'>" + value.visit_type_desc + "</option>");
|
|
// })
|
|
// $('#ddlWorkshop').val('');
|
|
// $('#ddlWorkshop').select2({
|
|
// placeholder: "状态",
|
|
// allowClear: true
|
|
// });
|
|
// });
|
|
// promiseweld.fail(function (error) {
|
|
// console.log(error)
|
|
// alert(error);
|
|
// });
|
|
//}
|
|
|
|
|
|
$('#btnQuery').click(function () {
|
|
if ($('#txtWO').val() == '' && $('#txtSales').val() == '' && $('#ddlWorkshop').val() == null) {
|
|
alert('请输入查询条件');
|
|
return;
|
|
}
|
|
//1.初始化Table
|
|
var oTable = new TableInit();
|
|
oTable.Init();
|
|
//$("#tbqc").bootstrapTable('refresh');
|
|
|
|
})
|
|
var TableInit = function () {
|
|
var oTableInit = new Object();
|
|
//初始化Table
|
|
oTableInit.Init = function () {
|
|
$('#tbWOStatus').bootstrapTable('destroy').bootstrapTable({
|
|
url: '/api/SuppliesConsumed/SuppliesConsumed', //请求后台的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'],
|
|
|
|
|
|
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: 'workshop',
|
|
title: '车间'
|
|
}, {
|
|
field: 'OEMcustomer',
|
|
title: 'OEM客户'
|
|
}, {
|
|
field: 'workorder',
|
|
title: '工单'
|
|
}, {
|
|
field: 'part_nbr',
|
|
title: '料号'
|
|
},
|
|
{
|
|
field: 'part_type',
|
|
title: '物料类别'
|
|
},
|
|
{
|
|
field: 'descriptions',
|
|
title: '描述'
|
|
},
|
|
{
|
|
field: 'is_primary',
|
|
title: '是否主料'
|
|
},
|
|
{
|
|
field: 'primary_part',
|
|
title: '主料号'
|
|
},
|
|
{
|
|
field: 'serial_requirement',
|
|
title: '单耗'
|
|
}, {
|
|
field: 'uom',
|
|
title: '单位'
|
|
}, {
|
|
field: 'orig_batch_nbr',
|
|
title: '来料批号'
|
|
}, {
|
|
field: 'SQJC',
|
|
title: '上期结存'
|
|
}, {
|
|
field: 'real_nbr',
|
|
title: '实发数量'
|
|
}, {
|
|
field: 'consume',
|
|
title: '工序消耗量'
|
|
}, {
|
|
field: 'LLBL',
|
|
title: '来料不良'
|
|
}, {
|
|
field: 'ZCBL',
|
|
title: '制程不良'
|
|
}, {
|
|
field: 'BF',
|
|
title: '报废不良'
|
|
}, {
|
|
field: 'JY',
|
|
title: '现场结余'
|
|
}]
|
|
});
|
|
};
|
|
|
|
//得到查询的参数
|
|
oTableInit.queryParams = function (params) {
|
|
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
limit: params.limit, //页面大小
|
|
offset: params.offset, //页码
|
|
sale_order: $('#txtSales').val(),
|
|
workorder: $('#txtWO').val(),
|
|
workshop: $('#ddlWorkshop').val()
|
|
|
|
};
|
|
return temp;
|
|
};
|
|
return oTableInit;
|
|
};
|
|
|
|
|
|
|
|
var ButtonInit = function () {
|
|
var oInit = new Object();
|
|
var postdata = {};
|
|
|
|
oInit.Init = function () {
|
|
//初始化页面上面的按钮事件
|
|
};
|
|
|
|
return oInit;
|
|
};
|
|
|
|
|
|
//导出excel
|
|
$('#btnExportExcel').on('click', function () {
|
|
if ($('#txtWO').val() == '' && $('#txtSales').val() == '' && $('#ddlWorkshop').val() == null) {
|
|
alert('请输入查询条件');
|
|
return;
|
|
}
|
|
var $workshop = $('#ddlWorkshop').val();
|
|
if ($workshop == null) {
|
|
$workshop = '';
|
|
}
|
|
doPost('/Report/SuppliesConsumedExcel', [
|
|
//workshop = $('#ddlWorkshop').val(),
|
|
txtsales = $('#txtSales').val(),
|
|
txtwo = $('#txtWO').val(),
|
|
workshop = $workshop])
|
|
})
|
|
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
|
|
|
|
}
|