初始化项目

This commit is contained in:
2025-11-20 13:11:05 +08:00
commit d5edc62c08
2412 changed files with 2201918 additions and 0 deletions

506
AUTS.Web/Plugin/Capacity.js Normal file
View File

@@ -0,0 +1,506 @@
/// 主体下拉框更改事件
$("#title_selected").bind().change(function () {
Getselectcontent();
});
//条形图对象
var mixedChart = null;
//产能统计时用户点击的 产能分类划分值
var partitioncriterionval = 0;
//保存日期
var preservetime = 0;
//获取主体内容
function Getselectcontent() {
let selval = $("#title_selected").val();
let resdata = {
typeid: selval
};
if (Checkselected(selval)) {
return;
}
$.ajax({
url: "/app/Dataanalysis/selected",
async: true,
type: "post",
data: resdata,
success: function (data) {
if (data.indexOf("selected" + selval) >= 0) {
$("#selectcontent").append(data);
} else {
$.toastr.error('查询失败,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
}, error: function (xhr, textStatus, errorThrown) {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
//请求参数 暂未用到
function getdata(selval) {
let data = [];
switch (selval) {
case 0:
data.push(0);
break;
case 1:
break;
case 2:
break;
}
}
// 历史选择
var TodayProductions_old_select = null;
//加载使用产能统计
let select_oy_Capacitydata = localStorage.getItem("select_oy_Capacitydata") || null;
if (select_oy_Capacitydata != null) {
select_oy_Capacitydata = JSON.parse(select_oy_Capacitydata);
}
if (TodayProductions_old_select == null && select_oy_Capacitydata != null) {
TodayProductions_old_select = select_oy_Capacitydata;
partitioncriterionval = TodayProductions_old_select.typeid;
}
Getselectcontent();
// 获取机型订单
function GetOrderList() {
var projectID = $("#projectList").val();
let resdata = { "projectID": projectID };
$.ajax({
url: "/app/Home/GetOrderList",
async: true,
type: "post",
data: resdata,
success: function (data) {
$("#OrderList").html(data);
if (TodayProductions_old_select != null && TodayProductions_old_select.OrderInternalID != null) {
$("#OrderList").val(TodayProductions_old_select.OrderInternalID);
if (TodayProductions_old_select.Station == null) {
TodayProductions_old_select = null;
} else {
TodayProductions_old_select.OrderInternalID = null;
}
}
}, error: function (xhr, textStatus, errorThrown) {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
// 工艺站
function GetstationList() {
var projectID = $("#projectList").val();
$("#checkbox").html("");
//$("#checkbox").html(`<option value="0">选择站位</option>`);
if (projectID != 0) {
$.ajax({
type: "POST",
url: "/APP/TestLog/GetStation",
cache: false,
data: { "productID": projectID },
success: function (data) {
if (data.Status == 200) {
for (var i = 0; i < data.Data.length; i++) {
$("#checkbox").append(` <option value="` + data.Data[i].ID + `">` + data.Data[i].StationName + `</option>`);
}
}
if (TodayProductions_old_select != null && TodayProductions_old_select.Station != null) {
preservetime = localStorage.getItem("select_oy_num");
//读取历史记录改变查询日期颜色
partitioncriterion(preservetime, null);
//保存去重历史记录
$("#checkboxtool input").get(0).checked = TodayProductions_old_select.tool[0];
$("#checkbox").val(TodayProductions_old_select.Station.Station);
if (TodayProductions_old_select != null) {
GoData();
}
if (TodayProductions_old_select.OrderInternalID == null) {
TodayProductions_old_select = null;
} else {
TodayProductions_old_select.Station = null;
}
}
}
});
}
};
//选择机型
function projectListchange() {
// 更改订单选择下拉框
GetOrderList();
// 更改站位
GetstationList();
};
// 查询点击事件
function GoData() {
let startTime = $("#startTime").val();
let finish = $("#finish").val();
let EndTime = $("#EndTime").val();
let star = $("#start").val();
let tool = new Array();
// 选择的划分类型
let typeid = partitioncriterionval;
// 判断是否去重
tool.push($("#checkboxtool input").get(0).checked);
// 合并站位 暂未使用
tool.push(true);
//判断是否为已天为单位
if (star == finish) {
typeid = 0
}
// 获取选择中的时间
let datatime = $("#start").bind().val();
//给详细信息添加日期单位
if (typeid == 0) {
$('#dateselect').html("时间 日");
}
else if (typeid == 1) {
$('#dateselect').html("时间 周");
}
else if (typeid == 2) {
$('#dateselect').html("时间 月");
}
// 订单id
let OrderInternalID = Number($("#OrderList").val());
// 产品
let projectID = Number($("#projectList").val());
if (projectID <= 0) {
$.toastr.error('请选择产品!', {
time: 3000,
position: 'top-center'
});
return;
}
let Station = Number($("#checkbox").val());
$('#cesid').html("详细数据");
if (Station <= 0) {
$.toastr.error('请选择站位!', {
time: 3000,
position: 'top-center'
});
return;
}
console.log(Station);
// 默认日产能查询范围 0 -23
var resdata = {
"typeid": typeid, "datatime": datatime, "jsTime": finish, "productID": projectID, "startTime": startTime, "EndTime": EndTime, "OrderInternalID": OrderInternalID, "Station":Station , "tool": tool, "OrderInternalID": OrderInternalID
};
//保存历史记录
localStorage.setItem("select_oy_Capacitydata", JSON.stringify(resdata));
$.ajax({
url: "/App/Dataanalysis/SelectData2",
type: "post",
async: false,
data: resdata,
success: function (data) {
try {
data = JSON.parse(data);
} catch (e) {
$.toastr.error('查询失败~', {
time: 3000,
position: 'top-center'
});
}
let DATASTR = JSON.parse(JSON.stringify(data));
//异常信息
if (typeid == 2) {
//月查询
GetError(DATASTR, datatime.substr(5, 2));
} else {
GetError(DATASTR,0);
}
let DATA = {
labels: [],
datasets: []
};
DATA.datasets.push({
label: 'PASS',
data: [],
backgroundColor: "#9bbefd",
borderColor: [
'rgba(55,99,12,1)',
'rgba(5, 16, 235, 1)',
'rgba(55, 26, 86, 1)',
'rgba(7, 19, 192, 1)',
'rgba(13, 12, 255, 1)',
'rgba(25, 19, 64, 1)'
],
});
DATA.datasets.push({
label: 'FALL',
data: [],
backgroundColor: "red",
borderColor: [],
});
$('#cesid').append(" Total" + data.ruleList["ztall"] + "<span style='color: #00B400'>Pass" + data.ruleList["tureall"] + " (" + GetPercent(data.ruleList["tureall"], data.ruleList["ztall"]) + ")" + "</span> / " + "<span style='color: red'> Fall" + data.ruleList["faultall"] + " (" + GetPercent(data.ruleList["faultall"], data.ruleList["ztall"]) + ")");
for (var key in data.ok) {
DATA.labels.push(key);
DATA.datasets[0].data.push(data.ok[key]);
DATA.datasets[1].data.push(data.bad[key]);
}
GetstackedBarChart(DATA);
}, error: function (xhr, textStatus, errorThrown) {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
//生成条形图
function GetstackedBarChart(data) {
var ctx = $('#stackedBarChart').get(0).getContext('2d');
if (mixedChart != null) {
mixedChart.destroy();
}
mixedChart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
title: {
display: true,
text: "Custom Chart Title",
fontColor: "#f00",
},
scales: {
xAxes:
{
stacked: true
}
,
yAxes:
{
stacked: true
}
}
}
});
}
//判断是否存在 selected
function Checkselected(selval) {
$(".selected0").hide();
$(".selected1").hide();
$(".selected2").hide();
$(".selected" + selval).show();
return $(".selected" + selval).length > 0;
}
// 产能统计时用户点击的 产能分类
function partitioncriterion(type, that) {
let num = type;
localStorage.setItem("select_oy_num", num);
if (type != 0) {
num = num- 1;
}
if (type == 3) {
type = 2
}
else if (type == 7) {
type = 2
}
else if (type == 30)
{
type = 2
}
partitioncriterionval = type;
$('.partitioncriterion').removeClass("btn-primary");
$('.partitioncriterion_' + num).addClass("btn-primary");
if (that != null) {
// 范围选择器初始化
initTime();
}
$("#start").val(formatDate(new Date(new Date().setDate(new Date().getDate() - num))));
$("#finish").val(formatDate(new Date(new Date().setDate(new Date().getDate()))));
GoData();
}
function bian(tupe) {
}
// 生成错误信息列表
function GetError(data,date) {
let content = `<div class="col-xs-4 col-sm-4" style="padding:0 5px;">
<label class="form-control input-sm " style="border:none;">{{tump}}</label>
</div>`;
//加按钮
let content2 = `<div class="col-xs-4 col-sm-4" style="padding:0 5px;">
<label class="form-control input-sm " style="border:none;" onclick="Showinfo()">{{tump}}</label>
</div>`;
// 移除第3个之后的所有元素
$($("#errinfo").children().get(2)).nextAll().remove();
let error = data.err;
let keylist = new Array();
for (let key in error) {
keylist.push(key);
}
//倒叙
keylist.sort(function (a, b) { return Number(b) - Number(a) });
var oklist = 0;
// 错误总数
var errlistall = 0;
for (let key = 0; key < keylist.length; key++) {
oklist = oklist + Number(data.ok[keylist[key]]);
errlistall += Number(data.bad[keylist[key]]);
}
$("#errinfo").append(content.replace("{{tump}}","总计"));
$("#errinfo").append(content.replace("{{tump}}", oklist));
$("#errinfo").append(content2.replace("{{tump}}", errlistall));
$("#errinfo").append(`<div id="ShowAll"; style=" display:none;";></div>`);
let errallkey = [];
let errallval = [];
let errInfo = [];
for (let key = 0; key < keylist.length; key++) {
// 失败和成功数量 为 0 不显示
if (data.bad[keylist[key]] > 0 || data.ok[keylist[key]] > 0) {
// 添加时间
if (date != 0) {
//月查询在前面加上月份
$("#errinfo").append(content.replace("{{tump}}",keylist[key]));
} else {
$("#errinfo").append(content.replace("{{tump}}", keylist[key]));
}
// 添加成功数量
$("#errinfo").append(content.replace("{{tump}}", data.ok[keylist[key]]));
//// 添加失败数量
$("#errinfo").append(`<div onclick="ShwoErr('err_` + keylist[key].replace(/ /g,'') + `')" class="col-xs-4 col-sm-4" style="padding:0 5px;">
<label class="form-control input-sm " style="border:none;">{{tump}}</label>
</div>`.replace("{{tump}}", data.bad[keylist[key]]));
let errlist = new Array();
for (let errkey in data.err[keylist[key]]) {
errlist.push({ key: errkey, data: data.err[keylist[key]][errkey] })
}
// 取出异常信息后排序 Item2 是数量 Item1 是错误信息 key 是错误码
errlist.sort(function (a, b) { return b.data.Item2 - a.data.Item2 });
// 其他异常
let othereror = 0;
var ErrorAll = [];
for (var i = 0; i < errlist.length; i++) {
// 错误码 数量 大于 50 就显示为 其他错误
if (i <= 50) {
$("#errinfo").append(`<div class="col-xs-12 hide col-sm-12 err_` + keylist[key].replace(/ /g, '') + `" style="padding:0 5px; color:#FF0000;">` + errlist[i].data.Item2 + `<span style="color:#d3d7d4;">:</span> <span style="color:#0080FF;">` + GetPercent(errlist[i].data.Item2,data.bad[keylist[key]]) + `</span>` + ` <span style="color:#d3d7d4;">:</span><span style="color:#FF0000;">` + errlist[i].key + `-</span> <span style="color:#d3d7d4;">` + errlist[i].data.Item1 + "</span></div>");
}
else {
othereror += errlist[i].data.Item2;
}
ErrorAll.push(errlist[i]);
}
//添加总数失败
for (var j = 0; j < ErrorAll.length; j++) {
let index = errallkey.indexOf(ErrorAll[j].key);
if (index >= 0) {
errallval[index] = Number(errallval[index]) + Number(ErrorAll[j].data.Item2);
} else {
errallkey.push(ErrorAll[j].key);
errallval.push(Number(ErrorAll[j].data.Item2));
errInfo.push(ErrorAll[j].data.Item1);
}
}
// 添加 其他错误
if (othereror > 0) {
$("#errinfo").append(`<div class="col-xs-12 hide col-sm-12 err_` + keylist[key].replace(/ /g, '') + `" style="padding:0 5px; color:#FF0000;">` + othereror + `<span style="color:#d3d7d4;">:</span> <span style="color:#0080FF;">` + GetPercent(othereror, data.bad[keylist[key]]) + `</span>` + ` <span style="color:#d3d7d4;">:</span><span style="color:#FF0000;">其他 -</span> <span style="color:#d3d7d4;">其他错误`+ "</span></div>");
$("#errinfo").append(`<div class="col-xs-4 hide col-sm-4" style="padding:0 5px;">` + "其他 : " + othereror + "</div>");
}
// 起到换行作用
$("#errinfo").append(`<div class="hide col-xs-12 hide col-sm-12 err_` + keylist[key].replace(/ /g, '') + `"></div>`);
}
}
//判断是否大于5 0
let sun = 0;
if (errallval.length >= 50){
sun = 50;
} else {
sun = errallval.length;
}
// 错误码 数量 大于 5 就显示为 其他错误
for (var i = 0; i < sun; i++) {
let index = errallval.indexOf( Math.max.apply(null, errallval));
$("#ShowAll").append(`<div class="col-xs-12 col-sm-12" style="padding:0 5px; color:#FF0000;">` + errallval[index] + `<span style="color:#d3d7d4;">:</span> <span style="color:#0080FF;">` + GetPercent(errallval[index], errlistall) + `</span>` + ` <span style="color:#d3d7d4;">:</span><span style="color:#FF0000;">` + errallkey[index] + `-</span> <span style="color:#d3d7d4;">` + errInfo[index] + "</span></div>");
errallval[index] = -1;
}
let allerrsum = 0;
for (var i = 0; i < errallval.length; i++) {
if (errallval[i] >= 0) {
allerrsum += errallval[i];
}
}
//判断是否大于5 没有则不显示
//if (sun >= 5) {
// $("#ShowAll").append(`<div class="col-xs-12 col-sm-12" style="padding:0 5px; color:#FF0000;">` + allerrsum + `<span style="color:#d3d7d4;">:</span> <span style="color:#0080FF;">` + GetPercent(allerrsum, errlistall) + `</span><span style="color:#d3d7d4;">:</span><span style="color:#FF0000;">其他 -</span> <span style="color:#d3d7d4;">其他错误</span></div>`);
//}
}
// 显示错误信息
function ShwoErr(classname) {
if ($('.' + classname).attr("class").indexOf('hide') >= 0) {
$('.' + classname).removeClass('hide');
} else {
$('.' + classname).addClass('hide');
}
}
function Showinfo() {
$("#ShowAll").toggle();
}
//多余的字用省略号代替(......
function subStrFormat(data, max) {
if (data != null && data != undefined && data.length > max) {
return data.substr(0, max) + ` ...`;
} else {
return data;
}
}
/// <summary>
/// 求百分比
/// </summary>
/// <param name="num">当前数</param>
/// <param name="total">总数</param>
function GetPercent(num, total) {
num = parseFloat(num);
total = parseFloat(total);
if (isNaN(num) || isNaN(total)) {
return "-";
}
return total <= 0 ? "0%" : (Math.round(num / total * 10000) / 100.0).toFixed(1) + "%";
}

474
AUTS.Web/Plugin/HIndex.js Normal file
View File

@@ -0,0 +1,474 @@
var ProductionInterval;
// 显示在线设备
let typeall = 0;
function showservicelist(type) {
$("#ServiceList").show();
switch (type) {
case '1':
if (typeall == 1) {
$('.NoOnline').hide();
typeall = 0;
} else {
$('.NoOnline').hide();
$('.Online').toggle();
}
break;
case '2':
if (typeall == 1) {
$('.Online').hide();
typeall = 0;
} else {
$('.Online').hide();
$('.NoOnline').toggle();
}
break;
default:
if (typeall == 0) {
$('.Online').show();
$('.NoOnline').show();
typeall = 1;
} else {
typeall = 0;
$('.Online').hide();
$('.NoOnline').hide();
}
break;
}
}
/// 首页上次用户选择
let TodayProductions_old_select = null;
$(document).ready(function () {
sessionStorage.setItem("BarCode", "");
sessionStorage.setItem("orderProduct", "");
sessionStorage.setItem("OInteriorID", "");
sessionStorage.setItem("ProjectID", "");
//gotoDetailPartialNew();
if ($(document).width() <= 764) {
$("#orderInfoNum *").css("font-size", "13px");
$("select *").css("font-size", "13px");
$("select").css("padding", "0px");
}
// 订单信息
OInternalInfo();
/// 首页上次用户选择
TodayProductions_old_select = localStorage.getItem("TodayProductions_old_select") || "";
let speedySreach_old_select = localStorage.getItem("speedySreach_old_select") || "";
if (TodayProductions_old_select != "") {
TodayProductions_old_select = JSON.parse(TodayProductions_old_select)
if (speedySreach_old_select == "") {
$("#end").bind().val(TodayProductions_old_select.EndTime);
$("#start").bind().val(TodayProductions_old_select.startTime);
} else {
speedySreach(speedySreach_old_select, false)
}
$("#projectList").val(TodayProductions_old_select.projectID);
$("#projectList").change();
//// 点击样式
//$('#index_speedySreach' + index_speedySreach).trigger("focus");
//// 模拟点击
// $("#end").change();
} else {
todayData();
}
TodayProduction();
ServiceList();
});
//快捷查询
// 0 今天 3 天 7天 30天 全部
function speedySreach(num, ischange = true) {
num = Number(num);
setTimeout(function () {
localStorage.setItem("speedySreach_old_select", num);
}, 200);
$(".index_speedySreach").attr("class", "btn btn-default btn-sm index_speedySreach");
$("#index_speedySreach" + num).attr("class", "btn btn-primary btn-sm index_speedySreach");
if (num == -1) {
$("#start").bind().val("2021/10/1");
$("#end").val(formatDate(new Date(new Date().setDate(new Date().getDate()))));
if (ischange) {
$("#end").change();
}
return;
}
$("#start").val(formatDate(new Date(new Date().setDate(new Date().getDate() - num))));
$("#end").val(formatDate(new Date(new Date().setDate(new Date().getDate()))));
if (ischange) {
$("#end").change();
}
}
function formatDate(time) {
var date = new Date(time);
var year = date.getFullYear(),
month = date.getMonth() + 1,//月份是从0开始的
day = date.getDate(),
hour = date.getHours(),
min = date.getMinutes(),
sec = date.getSeconds();
var newTime = year + '/' +
month + '/'
+ day //+ ' ' +
//hour + ':' +
//min + ':' +
//sec;
return newTime;
}
//指定时间
$("#end").change(function (e) {//右
localStorage.setItem("speedySreach_old_select", "");
TodayProduction();
todayData();
})
$("#start").change(function (e) {//左
localStorage.setItem("speedySreach_old_select", "");
TodayProduction();
todayData();
});
//选择机型
$("#projectList").bind().change(function () {
//OrderList
if (TodayProductions_old_select == null) {
$("#OrderList").val("0");
todayData();
}
GetOrderList();
});
// 获取机型订单
function GetOrderList() {
var projectID = $("#projectList").val();
let resdata = { "projectID": projectID };
$.ajax({
url: "/app/Home/GetOrderList",
// async: true,
type: "post",
data: resdata,
success: function (data) {
$("#OrderList").html(data);
if (TodayProductions_old_select != null) {
$("#OrderList").val(TodayProductions_old_select.OrderInternalID);
TodayProductions_old_select = null;
todayData();
}
}, error: function (xhr, textStatus, errorThrown) {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
function todayData(back) {
var finishTime = $("#end").bind().val();
var startTime = $("#start").bind().val();
var projectID = $("#projectList").val();
var OrderInternalID = $("#OrderList").val();
var resdata = { "projectID": projectID, "OrderInternalID": OrderInternalID, "startTime": startTime, "EndTime": finishTime };
//$.toastr.info('查询中', {
// time:9999,
// position: 'top-center'
//});
$.ajax({
url: "/app/Home/GetTodayData",
type: "post",
//async: false,
data: resdata,
success: function (data) {
localStorage.setItem("TodayProductions_old_select", JSON.stringify(resdata));
//$(".toastr-info").hide();
if (currentTime - lastTime < diff) {
$.toastr.success('查询成功', {
time: 3000,
position: 'top-center'
});
}
$("#SnInfo").html(data);
if (back != null) {
back();
}
}, error: function (xhr, textStatus, errorThrown) {
//$(".toastr-info").hide();
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
//// 产能显示
function Showtable(e) {
$(e).next().toggle();
}
function TodayProduction() {
return;
var finishTime = $("#end").bind().val();
var startTime = $("#start").bind().val();
$.cookie("startTime", startTime, { expires: 7 });
$.cookie("endTime", finishTime, { expires: 7 });
var projectID = $("#projectList").val();
let resdata = { "projectID": projectID, "startTime": startTime, "EndTime": finishTime };
$.ajax({
url: "/app/Home/TodayProductions",
// async: true,
type: "post",
data: resdata,
success: function (data) {
localStorage.setItem("TodayProductions_old_select", JSON.stringify(resdata));
$("#orderInfo").html(data);
$.toastr.success('查询成功', {
time: 1500,
position: 'top-center'
});
}, error: function (xhr, textStatus, errorThrown) {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
});
}
function OInternalInfo() {
$.ajax({
url: "/app/Home/OInternalInfo",
// async: true,
type: "post",
dataType: "json",
success: function (data) {
//console.log(data);
$("#Confirm").html($("#Confirm").html() + "<strong>" + data.Confirm + "</strong>");
$("#BarCode").html($("#BarCode").html() + "<strong>" + data.BarCode + "</strong>");
$("#Scheduling").html($("#Scheduling").html() + "<strong>" + data.Scheduling + "</strong>");
$("#Yield").html($("#Yield").html() + "<strong>" + data.Yield + "</strong>");
$("#prodCompletion").html($("#prodCompletion").html() + "<strong>" + data.prodCompletion + "</strong>");
$("#Accomplish").html($("#Accomplish").html() + "<strong>" + data.Accomplish + "</strong>");
$(".orderCount").html("(" + data.orderCount + ")");
}
});
}
function getOInternal(status) {
window.location.href = "/App/Order/OrderInternalList?Status=" + status;
}
function gotoDetailPartialNew() {
// Ajax提交数据
$.ajax({
url: "/app/Order/GetOrdersPlannedSpeed",
type: "post",
dataType: "json",
success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
if (res.Status == 200) {
$("#ordersPlannedSpeedBox_Content").empty();
if (res.Data) {
//填充数据
var jsonArray = res.Data;
var headArray = [];
//循环取字段名
for (var i in jsonArray[0]) {
headArray[headArray.length] = i;
}
var div = document.getElementById("ordersPlannedSpeedBox_Content");
var table = document.createElement("table");
table.id = "new_table";
table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
var theadH = document.createElement("thead");
var thead = document.createElement("tr");
//表头 从1开始 忽略ID
for (var count = 1; count < headArray.length; count++) {
var td = document.createElement("th");
td.innerHTML = headArray[count];
thead.appendChild(td);
}
theadH.appendChild(thead);
table.appendChild(theadH);
var theadY = document.createElement("tbody");
//表格数据
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
var tr = document.createElement("tr");
tr.setAttribute("onclick", "clickaction(" + jsonArray[tableRowNo]["ID"] + ")")
//从1开始 忽略ID
for (var headCount = 1; headCount < headArray.length; headCount++) {
var cell = document.createElement("td");
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
tr.appendChild(cell);
}
theadY.appendChild(tr);
table.appendChild(theadY);
}
div.appendChild(table);
} else { }
}
},
});
};
function clickaction(id) {
GetOrderInfo(id);
OrdersPlannedSpeedDetails(id);
}
function OrdersPlannedSpeedDetails(id) {
// Ajax提交数据
$.ajax({
url: "/App/Order/GetOrdersPlannedSpeedDetails",
type: "POST",
// async: true,
data: { "id": id },
dataType: "JSON",
success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
if (res.Status == 200) {
$("#detailsBox_Content").empty();
if (res.Data) {
//填充数据
var jsonArray = res.Data;
var headArray = [];
//循环取字段名
for (var i in jsonArray[0]) {
headArray[headArray.length] = i;
}
var div = document.getElementById("detailsBox_Content");
var table = document.createElement("table");
table.id = "new_table2";
table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
var theadH = document.createElement("thead");
var thead = document.createElement("tr");
//表头 从1开始 忽略ID
for (var count = 0; count < headArray.length; count++) {
var td = document.createElement("th");
td.innerHTML = headArray[count];
thead.appendChild(td);
}
theadH.appendChild(thead);
table.appendChild(theadH);
var theadY = document.createElement("tbody");
//表格数据
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
var tr = document.createElement("tr");
tr.setAttribute("onclick", "clickaction(" + jsonArray[tableRowNo]["ID"] + ")")
//从1开始 忽略ID
for (var headCount = 0; headCount < headArray.length; headCount++) {
var cell = document.createElement("td");
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
tr.appendChild(cell);
}
theadY.appendChild(tr);
table.appendChild(theadY);
}
div.appendChild(table);
} else { }
}
},
});
}
function GetOrderInfo(id) {
//$("#orderInfo_Box").empty();
$.ajax({
cache: true,
// async: true,
data: { "id": id },
url: "/app/Order/OrdersInfo",
success: function (data) {
$('#orderInfo_Box').html(data);
}
});
}
///获取设备
function ServiceList(back = null) {
$.ajax({
url: "/app/Home/ServiceList",
//async: true,
type: "post",
//dataType: "json",
success: function (data) {
let display = $("#ServiceList").css("display") || null;
let NoOnline = $(".NoOnline").css("display") || null;
let Online = $(".Online").css("display") || null;
$("#ServiceListdata").html(data);
if (display != null) {
$("#ServiceList").css("display", display)
$(".Online").css("display", Online)
$(".NoOnline").css("display", NoOnline)
}
if (back != null) {
back();
}
}
});
}
///15s自動刷新
$(document).on('mouseover', function () {
lastTime = new Date().getTime();
});
let currentTime = new Date().getTime(),
lastTime = new Date().getTime(),
diff = 15000;
let timering = 0;
let timer = setInterval(function () {
if (timering < 0) {
return;
}
currentTime = new Date().getTime();
if (currentTime - lastTime > diff) {
//-- clearInterval(timer);
timering = -3;
ServiceList(function () {
timering++;
if (timering == -1) {
lastTime = new Date().getTime();
timering = 0;
}
});
todayData(function () {
timering++;
if (timering == -1) {
lastTime = new Date().getTime();
timering = 0;
}
});
}
}, 1000);

View File

@@ -0,0 +1,62 @@
//function datewhere(price) {
// let elect = 0;
// switch (price) {
// case 1:
// elect = 1;
// break;
// case 2:
// elect = 3;
// break;
// case 3:
// elect = 7;
// break;
// case 4:
// elect = 30;
// break;
// case 5:
// elect = -1;
// break;
// }
// $('#verdict').val(elect);
// console.log($('#verdict').val());
// qureyData('/App/BasicFunc/MaintainLogSelect');
//}
function actionProductShow() {
try {
var typeid = $('#projectList').val();
$("select[name='StationID']").empty();
$("select[name='StationID']").append(` <option value="0">全部</option>`);
$.ajax({
url: "/App/ProductMaintain/tanceSelect",
data: { id: typeid },
type: "post",// 提交方式
success: function (res) {
res = JSON.parse(res)
for (var i = 0; i < res.length; i++) {
$("select[name='StationID']").append(` <option value="` + res[i].ID + `">` + res[i].StationName + `</option>`);
}
}
});
} catch (e) {
console.log(e)
}
}
actionProductShow();
function Tiemwhere(url)
{
if ($('#start').bind().val() != "") {
if ($('#end').bind().val() == "") {
$.toastr.error('结束时间不可为空',
{
position: 'top-center',
time: 1000,
});
}
else {
qureyData(url)
}
} else {
qureyData(url)
}
}

View File

@@ -0,0 +1,165 @@

var recordNum = 1;
$(document).ready(function () {
var orderID = $("#orderID").find("option:selected").val();
//console.log(orderID);
if (orderID != undefined) {
getStation(orderID);
getOrdreInfo(orderID);
} else {
$.toastr.warning('操作失败! <br />暂无P/O订单', {
time: 3000,
position: 'top-center'
});
}
//setTimeout(show, 250);
});
//自动勾选
function show() {
let station = $(".stationList").val()
if (station != "") {
let arr = station.split(',');
let stationLength = $("#stationList>tr").size();
for (var i = 0; i < stationLength; i++) {
for (var j = 0; j < arr.length; j++) {
if ($("#stationList>tr>td>.i-checks").eq(i).val() == arr[j]) {
recordNum++;
$("#stationList>tr>td>.i-checks").eq(i).prop("checked", "checked");
}
}
}
}
Edit();
}
//选择订单
$("#orderID").off("change").change(function () {
var orderID = $("#orderID").find("option:selected").val();
//console.log(orderID);
getStation(orderID);
getOrdreInfo(orderID);
});
//获取P/O数据
function getOrdreInfo(OrderNo) {
$.ajax({
url: "/app/order/OrderInternalGetOInfo",
type: "post",
data: { "OrderNo": OrderNo },
success: function (data) {
$(".Company").text(data.Data.CustomerAbbr)
$(".DeliveryTime").text(data.Data.DeliveryTime);
$(".ObjectiveYield").val(data.Data.OrderCount);
}
});
}
//var recordNum = 0;
//点击勾选
function record(e, ID) {
var stationList = "";
var x = $(e).is(":checked");
var StationName = $(e).val();
if (x) {
$.ajax({
url: "/app/order/GetStationSnType",
type: "post",
data: { "StationID": ID },
success: function (res) {
if (res.Status != 200) {
$.toastr.error('操作失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$(e).attr("checked", false);
} else {
recordNum++;
}
}
});
} else {
recordNum--;
}
Edit();
}
//修改 表单 number stationList 数据
function Edit() {
var recordNumclone = 0;
//var station = $("#stationList>tr").size();
var stationList = "";
setTimeout(function () {
/* for (var i = 0; i < station; i++) {*/
var colson = $("#stationList>tr>td>.i-checks:checked").each(function () {
stationList += $(this).val()+",";
console.log(stationList);
recordNumclone++;
});
//console.log(colson);
// if (colson) {
// stationList += $("#stationList>tr>td>.i-checks").eq(i).val() + ",";
// }
//}
recordNum = recordNumclone
$(".stationList").val(stationList);
$(".number").val(recordNum);
}, 200);
}
//工艺站
function getStation(OrderNo) {
$.ajax({
url: "/app/order/GetStation",
type: "post",
data: { "OrderNo": OrderNo },
success: function (data) {
//console.log(data);
$("#stationList").empty();
if (data.Status == 200) {
$(".projectName").text(data.Message);
for (var i = 0; i < data.Data.length; i++) {
var tr = '<tr><td><input type="checkbox" class="i-checks" onclick="record(this,' + data.Data[i].ID + ')" value="' + data.Data[i].StationName + '" name="input[]"/></td>';
tr += '<td>' + data.Data[i].StationName + '</td>';
tr += '<td>' + data.Data[i].StationDesc + '</td>';
tr += '</tr>';
$("#stationList").append(tr);
}
show();
} else {
$.toastr.error('操作失败 - 工艺站获取失败! <br />' + data.Message, {
time: 3000,
position: 'top-center'
});
}
Edit();
}
});
}
//function companyChange() {
// var myselect = document.getElementById("orderID");
// var index = myselect.selectedIndex;
// var orderID = myselect.options[index].value;
// //var pid = $(this).children('option:selected').val();//这就是selected的值
// // Ajax提交数据
// $.ajax({
// url: "/app/Order/GetOrderDetailsOnMO",//"APP/login/login", // 提交到controller的url路径
// type: "post", // 提交方式
// data: { "id": orderID }, // data为String类型必须为 Key/Value 格式。
// success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
// $("#OrderDetailsBox").empty();
// $('#OrderDetailsBox').html(res);
// },
// });
//};

View File

@@ -0,0 +1,134 @@

var recordNum = 1;
$(document).ready(function () {
var orderID = $("#orderID").find("option:selected").val();
getStation(orderID);
getOrdreInfo(orderID);
//setTimeout(show, 250);
});
//自动勾选
function show() {
let station = $(".stationList").val()
if (station != "") {
//console.log(station);
let arr = station.split(',');
let stationLength = $("#stationList>tr").size();
//console.log(stationLength);
for (var i = 0; i < stationLength; i++) {
for (var j = 0; j < arr.length; j++) {
//console.log(arr[j]);
if ($("#stationList>tr>td>.i-checks").eq(i).val() == arr[j]) {
//console.log(arr[j]);
$("#stationList>tr>td>.i-checks").eq(i).prop("checked", "checked");
}
}
}
}
}
//选择订单
$("#orderID").off("change").change(function () {
var orderID = $("#orderID").find("option:selected").val();
//console.log(orderID);
getStation(orderID);
getOrdreInfo(orderID);
});
//获取P/O数据
function getOrdreInfo(OrderNo) {
$.ajax({
url: "/app/order/OrderInternalGetOInfo",
type: "post",
data: { "OrderNo": OrderNo },
success: function (data) {
$(".Company").text(data.Data.CustomerAbbr)
$(".DeliveryTime").text(data.Data.DeliveryTime);
$(".ObjectiveYield").val(data.Data.OrderCount);
}
});
}
var recordNum = 0;
//点击勾选
function record(e) {
var stationList = "";
var x = $(e).is(":checked");
if (x) {
recordNum++;
} else {
recordNum--;
}
var station = $("#stationList>tr").size();
for (var i = 0; i < station; i++) {
var colson = $("#stationList>tr>td>.i-checks").eq(i).is(":checked");
//console.log(colson);
if (colson) {
stationList += $("#stationList>tr>td>.i-checks").eq(i).val() + ",";
}
}
$(".stationList").val(stationList);
$(".number").val(recordNum);
}
//工艺站
function getStation(OrderNo) {
$.ajax({
url: "/app/order/GetStation",
type: "post",
data: { "OrderNo": OrderNo },
success: function (data) {
//console.log(data);
$("#stationList").empty();
if (data.Status == 200) {
$(".projectName").text(data.Message);
for (var i = 0; i < data.Data.length; i++) {
var tr = '<tr><td><input type="checkbox" class="i-checks" onclick="record(this)" value="' + data.Data[i].StationName + '" name="input[]"/></td>';
tr += '<td>' + data.Data[i].StationName + '</td>';
tr += '<td>' + data.Data[i].StationDesc + '</td>';
tr += '</tr>';
$("#stationList").append(tr);
}
show();
} else {
$.toastr.error('操作失败! <br />' + data.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
}
//function companyChange() {
// var myselect = document.getElementById("orderID");
// var index = myselect.selectedIndex;
// var orderID = myselect.options[index].value;
// //var pid = $(this).children('option:selected').val();//这就是selected的值
// // Ajax提交数据
// $.ajax({
// url: "/app/Order/GetOrderDetailsOnMO",//"APP/login/login", // 提交到controller的url路径
// type: "post", // 提交方式
// data: { "id": orderID }, // data为String类型必须为 Key/Value 格式。
// success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
// $("#OrderDetailsBox").empty();
// $('#OrderDetailsBox').html(res);
// },
// });
//};

View File

@@ -0,0 +1,313 @@

//if (window.screen.width<500) {
// var td = document.getElementsByTagName("td")[10];
// var data = td.innerHTML;
//}
$(document).ready(function () {
var orderProduct = sessionStorage.getItem("orderProduct");
if (orderProduct != "") {
$("#projectList").val(orderProduct);
sessionStorage.setItem("orderProduct", "");
}
if ($(document).width() > 764) {
$("#orderData *").css("font-size", "16px");
$("select").css("width", "200px");
} else {
var thNum = $(".BarCode").length;
for (var i = 1; i < thNum; i++) {//循环th
var thStr = $(".BarCode").eq(i).html().length;//获取每个th的字数
var thHtml = $(".BarCode").eq(i).html();//获取th的内容
if (thStr > 19) {//th字数大于3时开始执行换行动作
var thHtml_New = thHtml.substring(0, 18);//th前4个字的内容
var thHtml_New2 = thHtml.substring(18);//获取th第4个字以后的内容
var strNew = thHtml_New + "<br>" + thHtml_New2;//拼接加换行符
$(".BarCode").eq(i).html(strNew);//搞定
}
}
$("select").css("font-size", "13px");
}
$('.table').on('click', 'tbody.order', function () {
$(".table > tbody.order").css("background-color", "white");
$(this).css("background-color", "#FFFAF0");
var tbodyIndex = $(this).index();
var tbody = $(this);
var tbodyID = $(this).attr('id');
var ProjectID = $(this).children('.ProjectID').val();
var orderId = $(this).children('.ID').val();
if (tbodyID == "show") {
if ($(this).children(".stationData").html() != undefined) {
$(this).children(".stationData").remove();
}
QueryTestLog(tbody, tbodyIndex, orderId, ProjectID)
$(this).attr("id", "");
} else {
$(this).attr("id", "show");
$(this).children(".stationData").remove();
}
});
});
function production(Id, InternalNo)
{
swal({
title: "开始生产",
text: "ID:" + Id + " 单号:" + InternalNo,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确认",
cancelButtonText: "取消",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
url: "/app/order/finishproduction",
type: "post",
data: { "id": Id },
success: function (res) {
if (res.Status == 200) {
swal("生产中!");
location.href = "/APP/Order/OrderInternalList";
} else {
swal("操作失败", res.Message, "error");
}
}
});
}
});
}
//结单
function btnCloseOrder(id, InternalNo) {
swal({
title: "订单结单",
text: "ID:" + id + " 单号:" + InternalNo,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确认",
cancelButtonText: "取消",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
swal({
title: "1.结单操作不可逆 2.结单后所有数据将冻结,无法再分配条码 请谨慎选择",
text: "ID:" + id + " 单号:" + InternalNo,
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "确认结单",
cancelButtonText: "取消",
closeOnConfirm: false
}, function (Confirm) {
if (Confirm) {
$.ajax({
url: "/app/order/finishOInternal",
type: "post",
data: { "id": id },
success: function (res) {
if (res.Status == 200) {
swal("订单!", "结单成功", "success");
location.href = "/APP/Order/OrderInternalList";
} else {
swal("结单失败", res.Message, "error");
}
}
});
}
});
}
});
}
function btnGetData(OIId, ProId) {
sessionStorage.setItem("OInteriorID", OIId);
sessionStorage.setItem("ProjectID", ProId);
window.location.href = "/App/selproduct/sntestlist";
}
function GoToUrl(ProductName) {
window.location.href = "/App/BasicFunc/ProjectList?ProductName=" + ProductName;
}
$("button").click(function () {
window.event ? window.event.cancelBubble = true : e.stopPropagation();
});
function QueryTestLog(tbody, tbodyIndex, orderId, ProjectID) {
$.ajax({
url: "/APP/Order/TestLog",
data: {"OrderInternalID": orderId, "ProjectID": ProjectID },
type: "POST",
success: function (res) {
if (res.Status == 200) {
if (res.Data.length > 0) {
var StationList = $(".StationList").eq(tbodyIndex).val();
var arr = StationList.split(',');
var html = '<tr class="stationData"><td colspan="2">';
html += '<table class="table table-striped Info" style="margin-bottom:0px">';
html += '<thead><tr>';
html += '<th>站</th>';
html += '<th>PASS</th>';
html += '<th>FALL</th>';
html += '<th>Total</th>';
html += '</tr></thead>';
html += '<tbody>';
var tdcolor = '';
for (var i = 0; i < res.Data.length; i++) {
var isStation = false;
html += '<tr>';
for (var j = 0; j < arr.length; j++) {
if (arr[j] != "" && arr[j] == res.Data[i].StationName) {
isStation = true;
break;
}
}
if (isStation) {
tdcolor = '<td style="color:blue; width: 25%;">';
html += '<span style="color:blue;" >' + tdcolor + '</span>' + + res.Data[i].StationName + ":" + res.Data[i].StationDesc + ' </td>';
} else {
tdcolor = '<td style="width: 25%;">';
html += tdcolor + '<span style="color: blue">' + res.Data[i].StationName + '</span>' + ":" + res.Data[i].StationDesc + ' </td>';
}
if
(isStation) {
tdcolor = '<td style="color:blue; width:5%;">';
} else {
tdcolor = '<td style="width:5%;">';
}
html += tdcolor+ res.Data[i].PassNum + '</td>';
html += tdcolor + res.Data[i].FailNum + '</td>';
html += tdcolor + res.Data[i].Total + '</td>';
html += '</tr>';
}
html += '</tbody></table>';
html += '</tr></td>';
tbody.append(html);
//console.log("添加"+tbodyIndex);
}
else {
$.toastr.success('暂无工艺站',
{
position: 'top-center',
time: 1500,
});
}
} else {
$.toastr.error('查询失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
}
function SelTestLog(tbody, tbodyIndex, orderId) {
$.ajax({
url: "/APP/Order/OrderTestLog",
data: { "ProjectID": orderId },
type: "POST",
success: function (res) {
if (res.Status == 200) {
if (res.Data.length > 0) {
var StationList = $(".StationList").eq(tbodyIndex).val();
var arr = StationList.split(',');
var html = '<tr><td colspan="2">';
html += '<table class="table table-striped Info">';
html += '<thead><tr>';
html += '<th>站</th>';
html += '<th>PASS</th>';
html += '<th>FALL</th>';
html += '<th>Total</th>';
html += '</tr></thead>';
html += '<tbody>';
for (var i = 0; i < res.Data.length; i++) {
var isStation = false;
html += '<tr>';
for (var j = 0; j < arr.length; j++) {
if (arr[j] != "" && arr[j] == res.Data[i].StationName) {
isStation = true;
break;
}
}
if (isStation) {
html += '<td style="color:blue;">';
} else {
html += '<td>';
}
html += res.Data[i].StationName + '</td>';
html += '<td>' + res.Data[i].PassNum + '</td>';
html += '<td>' + res.Data[i].FailNum + '</td>';
html += '<td>' + res.Data[i].Total + '</td>';
html += '</tr>';
}
html += '</tbody></table>';
html += '</tr></td>';
tbody.append(html);
//console.log("添加"+tbodyIndex);
}
else {
$.toastr.success('暂无工艺站',
{
position: 'top-center',
time: 1500,
});
}
} else {
$.toastr.error('查询失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
},
error: function (error) {
alert(error);
}
});
}
//更新数据
function btnUpData(OIId, ProId) {
$.ajax({
url: "/APP/Order/OrderUp",
data: { "OrderInternalID": OIId, "ProjectID": ProId },
type: "POST",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('更新成功! <br />', {
time: 3000,
position: 'top-center'
});
} else {
if (res.Status == 500) {
$.toastr.error('更新异常! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
} else {
$.toastr.success('部分数据未更新! <br />', {
time: 3000,
position: 'top-center'
});
}
}
}
})
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,113 @@

//产品类型
$("#ProductType").off("change").change(function () {
GetProjectDataList();
});
//有无效产品
$("#ValidProduct").off("change").change(function () {
GetProjectDataList();
});
//搜索
$("#search").click(function () {
//var search = $("#searchData").val();
//if (search.trim() == "") {
// $.toastr.error('搜索失败 <br /> 请输入名称', {
// time: 3000,
// position: 'top-center'
// });
// return;
//}
GetProjectDataList()
});
function GetProjectDataList() {
var ProductType = $("#ProductType").find("option:selected").val();
var ValidProduct = $("#ValidProduct").find("option:selected").val();
var search = $("#searchData").val();
$.ajax({
url: "/App/BasicFunc/ProjectDataList",
type: "post",
async: true,
data: { "ProductType": ProductType, "ValidProduct": ValidProduct, "search": search },
success: function (res) {
$("#orderData").html("");
//console.log(res);
$("#orderData").html(res);
$(".count").text($("#count").val());
}
});
}
$("table.table>tbody.tbodyList").click(function () {
var colorIndex = $(this).index();
var tbody = $(this);
$("tbody.tbodyList").css("background-color", "white");
$("tbody.tbodyList").eq(colorIndex).css("background-color", "#FFFAF0");
var id = $(this).children().children().children(".ID").val();
var order = $(this).children(".ordersInfo");
if (order.length > 0) {
if (order.is(':hidden')) {
order.show();
} else {
order.hide();
}
} else {
getOrders(tbody, id);
}
});
function getOrders(tbody, id) {
$.ajax({
url: "/App/BasicFunc/getOrders",
type: "post",
async: true,
data: { "productId": id },
success: function (res) {
//console.log(res);
if (res.Status == 200) {
var html = '<tr class="ordersInfo"><td colspan="3">';
html += '<table class="table table-striped Info" style="margin-bottom:0px;">';
html += '<thead><tr>';
html += '<th>M/O</th>';
html += '<th>数量</th>';
html += '<th>状态</th>';
html += '<th>操作</th>';
html += '</tr></thead>';
html += '<tbody>';
for (var i = 0; i < res.Data.length; i++) {
html += '<tr>';
html += '<td>' + res.Data[i].InternalNo + '</td>';
html += '<td>' + res.Data[i].ObjectiveYield + '</td>';
html += '<td>' + res.Data[i].OrderStatu + '</td>';
html += '<td style="font-size:15px"><a onclick="JumpToOInternal(' + id + ')">前往</a></td>';
html += '</tr>';
}
html += '</tbody>';
html += '</table>';
//console.log(html);
html += '</tr></td>';
tbody.append(html);
} else {
$.toastr.error('网络异常,请稍后再试。', {
time: 3000,
position: 'top-center'
});
}
}
})
}
function JumpToOInternal(id) {
sessionStorage.setItem("orderProduct", id);
window.location.href = "/App/order/OrderInternalList";
}

View File

@@ -0,0 +1,102 @@
(function (glb) {
var gTypeDomMap = new Map();//column type --> which condition area show/hide and use
var gAllDomRange = new Map();//range1 div, range2 div
function initTypeMap() {
let numRangeDomRef = null, startNumDomRef = null, endNumDomRef = null;
let dateRangeDomRef = null, startDateDomRef = null, endDateDomRef = null;
numRangeDomRef = document.querySelector('#numRangePicker');
if (numRangeDomRef) {
startNumDomRef = numRangeDomRef.children[0];
endNumDomRef = numRangeDomRef.children[2];
}
dateRangeDomRef = document.querySelector('#dateRangePicker');
if (dateRangeDomRef) {
startDateDomRef = dateRangeDomRef.children[0];
endDateDomRef = dateRangeDomRef.children[2];
}
let arrNum = [numRangeDomRef, startNumDomRef, endNumDomRef];
let arrDate = [dateRangeDomRef, startDateDomRef, endDateDomRef];
//Dom area information
gAllDomRange.set('NUM_ELE', arrNum);
gAllDomRange.set('DATE_ELE', arrDate);
//Database data type --> Dom area
gTypeDomMap.set('INT', 'NUM_ELE');
gTypeDomMap.set('TINYINT', 'NUM_ELE');
gTypeDomMap.set('VARCHAR', 'NUM_ELE');//use number temporary for string
gTypeDomMap.set('DATETIME', 'DATE_ELE');
gTypeDomMap.set('OtherOutofScope', 'NUM_ELE');
//every time column changed, show/hide the area based on column data type.
$("#column").on("change", onChangeRangeByQueryConditionType);
//call it for 1st time hide/show selected value.
onChangeRangeByQueryConditionType();
};
function onChangeRangeByQueryConditionType() {
let showAreaKey = getAreaKey();
gAllDomRange.forEach(function (curval, curkey, mapitself) {
let curDomTmp = $(curval[0]);
if (curkey === showAreaKey) {
if (curDomTmp.hasClass("hidden"))
curDomTmp.removeClass("hidden");
//if (!curDomTmp.hasClass("show"))
// curDomTmp.addClass("show");
}
else //hide
{
//if (curDomTmp.hasClass("show"))
// curDomTmp.removeClass("show");
if (!curDomTmp.hasClass("hidden")) {
curDomTmp.addClass("hidden");
//clear value when turn to hidden ???
$(curval[1]).val = '';
$(curval[2]).val = '';
}
}
});
};
function getAreaKey() {
let conditionType = "INT";
let showAreaKey = 'NUM_ELE';
if (document.querySelector("#column").selectedOptions && document.querySelector("#column").selectedOptions.length > 0)
conditionType = document.querySelector("#column").selectedOptions[0].dataset.coltype;
if (gTypeDomMap.has(conditionType)) {
showAreaKey = gTypeDomMap.get(conditionType);
}
else {
showAreaKey = gTypeDomMap.get('OtherOutofScope');
}
return showAreaKey;
};
function getASelected() {
let showAreaKey = getAreaKey();
let domRefArr = gAllDomRange.get(showAreaKey);
if (showAreaKey === 'DATE_ELE')
return "'" + $(domRefArr[1]).val() + "'"; //for database mysql: between '2023-06-01' and '2023-06-06'
else
return $(domRefArr[1]).val();
};
function getBSelected() {
let showAreaKey = getAreaKey();
let domRefArr = gAllDomRange.get(showAreaKey);
if (showAreaKey === 'DATE_ELE')
return "'" + $(domRefArr[2]).val() + "'"; //for database mysql: between '2023-06-01' and '2023-06-06'
else
return $(domRefArr[2]).val();
};
let retObj = {
initTypeMap: initTypeMap,
getASelected: getASelected,
getBSelected: getBSelected
}
glb.SwitchNumDateRange = retObj;
})(window);

View File

@@ -0,0 +1,93 @@

$(".dataCount").html($("#dataCount").val());
var pagesNum = $("li.pages").size();//获取页数
$("li.left").hide();
if (pagesNum > 2) {
$("li.right").show();
} else {
$("li.right").hide();
}
//第一页
function firstPage(url) {
qureyData(url, 0, 10, 0);
}
//最后一页
function lastPage(url) {
var max = pagesNum * 10;
var min = (pagesNum - 1) * 10;
qureyData(url, min, max, (pagesNum - 1));//起始显示,显示结束,页数背景色的下标
}
//选择页数
function SpecifyPage(page, url) {
//console.log(page);
var max = (page+1) * 10;
var min = page * 10;
(url, min, max, page);
}
function queryInfo(url) {
qureyData(url, 0, 10, 0);
}
function qureyData(url, min, max, colorIndex) {
console.log("1111");
var company = $("#CompanyList").val();
var projectID = $("#projectList").val();//产品
var statusID = $("#StatusList").val();
var property = $("#ValidProduct").val();
var pType = $("#ProductType").val();
var search = $("#searchData").val();
var search = $("#searchData").val();
var search = $("#searchData").val();
var Customer = $("#Customer").val();//不良品
var inquire = $("#inquire").val();//单号
var verdict = $('#verdict').val();//判断是当天3天7天30天
var SN = $('#BarCode').val();//SN号或者订单号
var project = $('#projectid').val();//维修类型
var Station = $("select[name = 'StationID']").val();//站位
var startTime = $('#start').bind().val();//起始时间
var EndTime = $('#end').bind().val();//结束时间
var Userid = $('#Userid').val();//操作人
var data = {
OInteriorID: "1",
OrderNo: "2",
ProjectID: projectID,
CustomerAbbr: company,
OStatus: statusID,
dataMin: min,
dataMax: max,
Property: property,
ProductType: pType,
Search: search,
company: Customer,
inquire: inquire,
Day: verdict,
Snmark: SN,
repair: project,
StationID: Station,
startTime: startTime,
EndTime: EndTime,
CustomerAbbr: Userid
};
$.ajax({
url: url,
type: "post",
data: JSON.stringify(data),
contentType: 'application/json',
async: true,
success: function (res) {
//console.log(res);
$("#orderData").empty();
$("#orderData").html(res);
$("li.pages a").eq(colorIndex).css("color", "white");//添加选中字体颜色
$("li.pages a").eq(colorIndex).css("background-color", "#00BFFF");//添加选中背景颜色
}
});
}

View File

@@ -0,0 +1,167 @@

//修改会员
$("#btnModifyPLine").click(function () {
var btnText = $('#btnModifyPLine').html()
$("#btnModifyPLine").attr("disabled", "true"); //设置禁用按钮
$('#btnModifyPLine').text('提交中...'); //显示提交中
$("#modifyPLineForm").ajaxSubmit({
url: "/APP/BasicFunc/ModifyPLine",
type: "post",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('保存成功',
{
position: 'top-center',
time: 2000,
callback: function () {
$('#btnModifyPLine').text(btnText); //还原显示
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
location.href = "/APP/BasicFunc/PLineList";
}
});
} else {
$.toastr.error('保存失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$('#btnModifyPLine').text(btnText); //还原显示
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
}
},
error: function (error) {
$('#btnModifyPLine').removeAttr('disabled')//重置按钮
$('#btnModifyPLine').text(btnText); //还原显示
alert(error);
}
});
});
//修改提交
function excutedUpDate(btnID, url, formID) {
try {
var btnText = $('#' + btnID).html();
$('#' + btnID).attr("disabled", "true"); //设置禁用按钮
$('#' + btnID).text('提交中...'); //显示提交中
$('#' + formID).ajaxSubmit({
url: url,
type: "POST",
success: function (res) {
if (res.Status == 200) {
if (!res.Message) {
$.toastr.success('保存成功',
{
position: 'top-center',
time: 2000,
callback: function () {
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
//location.href = sucUrl;
}
});
}
else {
$.toastr.success('保存成功! <br />' + res.Message,
{
position: 'top-center',
time: 3000,
callback: function () {
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
//location.href = sucUrl;
}
});
}
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
} else {
$.toastr.error('保存失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
}
},
error: function (error) {
$('#' + btnID).removeAttr('disabled')//重置按钮
$('#' + btnID).text(btnText); //还原显示
alert(error);
}
});
} catch (e) {
$('#' + btnID).removeAttr('disabled')//重置按钮
$('#' + btnID).text(btnText); //还原显示
}
};
//添加修改内部单生产计划
function excutedUpDatePPlan(btnID, url, formID, orderInternalID) {
var btnText = $('#' + btnID).html();
$('#' + btnID).attr("disabled", "true"); //设置禁用按钮
$('#' + btnID).text('提交中...'); //显示提交中
$('#' + formID).ajaxSubmit({
url: url,
type: "POST",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('保存成功',
{
position: 'top-center',
time: 2000,
callback: function () {
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
gotoDetailPartial('/APP/PPlan/PPlanInternalDetails', orderInternalID, 'pPlanInterBox_Content')
}
});
} else {
$.toastr.error('保存失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$('#' + btnID).text(btnText); //还原显示
$('#' + btnID).removeAttr('disabled')//重置按钮
}
},
error: function (error) {
$('#' + btnID).removeAttr('disabled')//重置按钮
$('#' + btnID).text(btnText); //还原显示
alert(error);
}
});
};
function leave() {
var name = $("input[name='Matlab']").val();
console.log(name);
$.ajax({
url: "/APP/ProductMaintain/judgecode",
data: { name: name },
type: "POST",
success: function (res)
{
if (res)
{
$('#hintname').val("已用此不良代码");
}
}
})
}

231
AUTS.Web/Plugin/common.js Normal file
View File

@@ -0,0 +1,231 @@

//修改数据库选择
$("#userCustomer").change(function () {
var customerID = $("#userCustomer").val();
$("#ordersPlannedSpeedBox_Content").empty();
// Ajax提交数据
$.ajax({
url: "/app/Home/SetCustomerID",//"APP/login/login", // 提交到controller的url路径
type: "post", // 提交方式
data: { "customerID": customerID }, // data为String类型必须为 Key/Value 格式。
dataType: "json", // 服务器端返回的数据类型
success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
if (res.Status == 200) {
//textToast(res.Message);
//gotoDetailCommon();//首页数据表格显示
window.location.href = "/APP/Home/index";
}
else if (res.Status != 200) {
//textToast(res.Message);
}
},
});
});
//打开普通的局部页
function gotoCommonPartial(url, containerDiv) {
$.ajax({
cache: true,
async: true,
type: 'POST',
url: url,
success: function (data) {
$('#' + containerDiv).html(data);
}
});
}
// 链接到明细数据页
function gotoDetailPartial(url, id, containerDiv) {
url = url + "/" + id;
$.ajax({
cache: true,
async: true,
type: 'POST',
url: url,
success: function (data) {
$('#' + containerDiv).html(data);
}
});
}
//打开普通的局部页
function gotoCommonPartialNeedDate(url, containerDiv) {
$.ajax({
cache: true,
async: true,
type: 'POST',
url: url,
success: function (data) {
addDatepicker();
$('#' + containerDiv).html(data);
}
});
}
// 链接到明细数据页 需要时间控件
function gotoDetailPartialNeedDate(url, id, containerDiv) {
url = url + "/" + id;
$.ajax({
cache: true,
async: true,
type: 'POST',
url: url,
success: function (data) {
addDatepicker();
$('#' + containerDiv).html(data);
}
});
}
// 链接到明细数据页 两个视图
function gotoDetailPartialTwoView(url, id, containerDiv, url2, containerDiv2) {
url = url + "/" + id;
$.ajax({
cache: true,
async: true,
type: 'POST',
url: url,
success: function (data) {
$('#' + containerDiv).html(data);
gotoDetailPartial(url2, id, containerDiv2);
}
});
}
function addDatepicker() {
$.getScript('/Theme/js/plugins/datapicker/bootstrap-datepicker.js');
$.getScript('/Theme/js/plugins/datapicker/locales/bootstrap-datepicker.zh-CN.js');
}
function gotoDetailCommon() {
// Ajax提交数据
$.ajax({
url: "/app/Order/GetOrdersPlannedSpeed",
type: "post",
dataType: "json",
success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
if (res.Status == 200) {
$("#ordersPlannedSpeedBox_Content").empty();
if (res.Data) {
//填充数据
var jsonArray = res.Data;
var headArray = [];
//循环取字段名
for (var i in jsonArray[0]) {
headArray[headArray.length] = i;
}
var div = document.getElementById("ordersPlannedSpeedBox_Content");
var table = document.createElement("table");
table.id = "new_table";
table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
var theadH = document.createElement("thead");
var thead = document.createElement("tr");
//表头 从1开始 忽略ID
for (var count = 1; count < headArray.length; count++) {
var td = document.createElement("th");
td.innerHTML = headArray[count];
thead.appendChild(td);
}
theadH.appendChild(thead);
table.appendChild(theadH);
var theadY = document.createElement("tbody");
//表格数据
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
var tr = document.createElement("tr");
tr.setAttribute("onclick", "clickaction(" + jsonArray[tableRowNo]["ID"] + ")")
//从1开始 忽略ID
for (var headCount = 1; headCount < headArray.length; headCount++) {
var cell = document.createElement("td");
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
tr.appendChild(cell);
}
theadY.appendChild(tr);
table.appendChild(theadY);
}
div.appendChild(table);
} else { }
}
},
});
};
function updateCommonCache(url, sucUrl) {
$.ajax({
cache: true,
async: true,
type: 'GET',
url: url,
success: function (res) {
if (res.Status == 200) {
$.toastr.success('更新成功',
{
position: 'top-center',
time: 350,
callback: function () {
location.href = sucUrl;
}
});
}
else {
$.toastr.error('清除失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
};
function formatDate(time) {
var date = new Date(time);
var year = date.getFullYear(),
month = date.getMonth() + 1,//月份是从0开始的
day = date.getDate(),
hour = date.getHours(),
min = date.getMinutes(),
sec = date.getSeconds();
var newTime = year + '/' +
month + '/'
+ day //+ ' ' +
//hour + ':' +
//min + ':' +
//sec;
return newTime;
}
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
if (pair[0] == variable) { return pair[1]; }
}
return (false);
}

227
AUTS.Web/Plugin/data.js Normal file
View File

@@ -0,0 +1,227 @@
json = {
"R1": [
13.3,
12.7,
12.9,
12.3,
12.8,
11.4,
12.7,
12.7,
12.4,
12.5,
12.5,
11.5,
13.1,
12,
12.8,
12.3,
12.4,
12.6,
12.5,
11.8,
12.3,
12.9,
13.3,
12.9,
12.3,
12.6,
12.7,
12.6,
12.8,
12.4,
12.8,
11.9,
11.7,
12.3,
12.4,
12.2,
12,
13.3,
12.6,
13.2,
14.6,
12.6,
12.6,
12.8,
12,
12.3,
12.5,
12.7,
12.3,
11.9,
13.3,
12.5,
13.3,
11.7,
12.4,
12.4,
12.2,
12.5,
12.7,
13,
13.9,
12.6,
12.4,
12.8,
12.5,
12.8,
12.2,
13.4,
14.8,
13.8,
12.8,
12.4,
12.3,
12.6,
12.6,
12.8,
12.7,
12.2,
12.2,
12.6,
12.1,
12.2,
12.6,
12,
11.7,
12.5,
11.9,
14.3,
12.5,
12.4,
14.9,
12.7,
12.6,
12,
11.8,
12.3,
14.3,
12.3,
13.2,
13.3,
11.9,
13.1,
13,
11.1,
11.8,
12.9,
12.5,
12.3,
12.9,
13,
11.7,
12.9,
12.1,
12.4,
13.1,
13.1,
13,
15.4,
13.3,
12.4,
12.2,
12,
13.7,
11.9,
12.4,
12.7,
13.6,
11.3,
12.3,
12.4,
13.5,
12.2,
12.5,
13.4,
12.2,
11.5,
11.2,
13.7,
10.5,
12.9,
14.8,
14.2,
13.5,
13.9,
14.5,
12.5,
13.2,
12.5,
12.4,
14.2,
12.2,
13,
12.8,
12.8,
13.7,
12.5,
12.6,
13.9,
13.1,
11.9,
13.6,
12.4,
13.1,
13.3,
14.4,
11.8,
12.7,
12.7,
12.9,
12.6,
14.3,
12.5,
12.6,
12.8,
14.2,
12.5,
12.6,
12.9,
14.1,
14.2,
13.5,
12,
13.2,
12.3,
12.1,
11.1,
11.9,
12.8,
13.5,
13.2,
13.9,
13.2,
12.7,
12.5,
12.6,
11.7,
12.4,
12.4,
12.6,
12.6,
14.9,
12.8,
13,
13.8,
12.5,
12.2,
12.5,
13.3,
12.2,
12.7,
12.8,
12.8,
12,
13.2,
11.3,
11.3,
11.8,
11.4,
11.5,
11.8,
11.1
],
"R2": [], "R3": []
}

14
AUTS.Web/Plugin/fileinput.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,21 @@

// Collapse ibox function
$('.collapse-link-partial').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$('.close-link-partial').click(function () {
var content = $(this).closest('div.ibox');
content.remove();
});

View File

@@ -0,0 +1,54 @@
// onload是等所有的资源文件加载完毕以后再绑定事件
window.onload = function () {
}
//// 获取图片列表即img标签列表
var imgs = document.querySelectorAll('img');
function getTop(e) {
return e.offsetTop;
}
// 懒加载实现
function lazyload(imgs) {
imgs = document.querySelectorAll('img');
for (let i of imgs) {
if ($(i).is(':visible') == true) {
let trueSrc = i.getAttribute("data-src");
if (trueSrc != 'null' && trueSrc != null && trueSrc.indexOf('{{') < 0 && trueSrc.indexOf('}}') < 0) {
$(i).removeAttr("data-src")
i.setAttribute("src", trueSrc);
}
}
}
return;
// 可视区域高度
var h = window.innerHeight;
//滚动区域高度
var s = document.documentElement.scrollTop || document.body.scrollTop;
for (let i of imgs) {
//图片距离顶部的距离大于可视区域和滚动区域之和时懒加载
//计算方式和第一种方式不同
if (i.getBoundingClientRect().top < window.innerHeight) {
let trueSrc = i.getAttribute("data-src");
if (trueSrc != 'null' && trueSrc != null && trueSrc.indexOf('{{') < 0 && trueSrc.indexOf('}}') < 0) {
$(i).removeAttr("data-src")
i.setAttribute("src", trueSrc);
}
}
}
}
setTimeout(lazyload(imgs), 20);
// 滚屏函数
window.onscroll = function () {
//保证每次取到的为最新的
lazyload(imgs);
}

64
AUTS.Web/Plugin/login.js Normal file
View File

@@ -0,0 +1,64 @@

//登录
$("#btnlogin").click(function () {
var btnText = $('#btnlogin').html();
$("#btnlogin").attr("disabled", "true"); //设置禁用按钮
$('#btnlogin').text('登录中...'); //显示提交中
$("#loginForm").ajaxSubmit({
url: "/APP/login/login",
type: "post",
success: function (res) {
if (res.Status == 200) {
save_cookies();
$.toastr.success('登录成功',
{
position: 'top-center',
time: 350,
callback: function () {
location.href = "/APP/Home/index";
}
});
$('#btnlogin').text(btnText); //还原显示
$('#btnlogin').removeAttr('disabled')//重置按钮
} else {
$.toastr.error('登录失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$('#btnlogin').text(btnText); //还原显示
$('#btnlogin').removeAttr('disabled')//重置按钮
//toastr.options = {
// closebutton: false,
// progressbar: true,
// showmethod: 'slidedown',
// timeout: 2000,
// positionclass: "toast-top-center",
//};
//toastr.error("登录失败:" + res.message);
}
},
error: function (error) {
$('#btnlogin').removeAttr('disabled')//重置按钮
alert(error);
}
});
});
function save_cookies() {
if ($("#remember").prop("checked")) {
var username = $("#username").val();
var password = $("#password").val();
$.cookie("remember", "true", { expires: 7 });
$.cookie("username", username, { expires: 7 });
$.cookie("password", password, { expires: 7 });
} else {
$.cookie("remember", "false", { expires: -1 });
$.cookie("username", "", { expires: -1 });
$.cookie("password", "", { expires: -1 });
}
};

1
AUTS.Web/Plugin/login.min.js vendored Normal file
View File

@@ -0,0 +1 @@
$("#btnlogin").click(function(){var a=$("#btnlogin").html();$("#btnlogin").attr("disabled","true");$("#btnlogin").text("登录中...");$("#loginForm").ajaxSubmit({url:"/APP/login/login",type:"post",success:function(b){if(b.Status==200){save_cookies();$.toastr.success("登录成功",{position:"top-center",time:350,callback:function(){location.href="/APP/Home/index"}});$("#btnlogin").text(a);$("#btnlogin").removeAttr("disabled")}else{$.toastr.error("登录失败! <br />"+b.Message,{time:3000,position:"top-center"});$("#btnlogin").text(a);$("#btnlogin").removeAttr("disabled")}},error:function(b){$("#btnlogin").removeAttr("disabled");alert(b)}})});function save_cookies(){if($("#remember").prop("checked")){var b=$("#username").val();var a=$("#password").val();$.cookie("remember","true",{expires:7});$.cookie("username",b,{expires:7});$.cookie("password",a,{expires:7})}else{$.cookie("remember","false",{expires:-1});$.cookie("username","",{expires:-1});$.cookie("password","",{expires:-1})}};

View File

@@ -0,0 +1,90 @@
$(document).ready(function () {
if ($(document).width() > 764) {
$(".ibox-content *").css("font-size", "16px");
$("select").css("width", "200px");
} else {
$("select").css("font-size", "13px");
}
$('.table').on('click', 'tbody.order', function () {
$(".table > tbody.order").css("background-color", "white");
$(this).css("background-color", "#FFFAF0");
var tbodyIndex = $(this);
var tbodyID = $(this).attr('id');
var orderId = $(this).children().val();
if (tbodyID == "show") {
SelTestLog(tbodyIndex, orderId);
$(this).attr("id", "");
} else {
$(this).attr("id", "show");
$(this).next().next(".Info").remove();
$(this).next(".Info").remove();
}
});
});
$("button").click(function () {
window.event ? window.event.cancelBubble = true : e.stopPropagation();
});
function SelTestLog(tbodyIndex, orderId) {
$.ajax({
url: "/APP/Order/GetOrderInternal",
data: { "orderId": orderId },
type: "POST",
success: function (res) {
//console.log(res);
//$("#outputValueTbody").empty();
if (res.Status == 200) {
if (res.Data.length > 0) {
var html = '<table class="table table-striped Info">';
html += '<thead><tr>';
html += '<th>M/O</th>';
html += '<th>数量</th>';
html += '<th>状态</th>';
html += '</tr></thead>';
html += '<tbody>';
for (var i = 0; i < res.Data.length; i++) {
html += '<tr>';
html += '<td>' + res.Data[i].InternalNo + '</td>';
html += '<td>' + res.Data[i].ObjectiveYield + '</td>';
html += '<td>' + res.Data[i].OrderStatus + '</td>';
html += '</tr>';
}
html += '</tbody></table>';
tbodyIndex.after(html);
//console.log("添加"+tbodyIndex);
}
else {
$.toastr.success('暂无M/O订单',
{
position: 'top-center',
time: 1500,
});
}
} else {
$.toastr.error('查询失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
},
error: function (error) {
alert(error);
}
});
}

360
AUTS.Web/Plugin/pplan.js Normal file
View File

@@ -0,0 +1,360 @@
$(".addColor").click(function () {
$(".addColor").removeAttr("style");
$(this).css("background-color", "#FFFAF0");
});
if ($(document).width() > 764) {
$("select").css("width", "200px");
$("b").css("font-size", "16px");
} else {
$("select").css("font-size", "13px");
}
function gotoDetailPartialNew(id) {
$("#pPlanInterBox_Content").empty();
removePPInfo();
// Ajax提交数据
$.ajax({
url: "/APP/PPlan/PPlanInternalDetailsNew",//"@Url.Action("PPlanInternalDetailsNew", "PPlan")",//"APP/login/login", // 提交到controller的url路径
type: "post", // 提交方式
data: { "id": id }, // data为String类型必须为 Key/Value 格式。
dataType: "json", // 服务器端返回的数据类型
success: function (res) { // 请求成功后的回调函数其中的参数data为controller返回的map,也就是说然后通过data这个参数取JSON数据中的值
if (res.Status == 200) {
setPPInfo(res);
if (res.Data.rows) {
//正则
var n = /^[0-9]*$/;
var re = new RegExp(n);
//填充数据
var jsonArray = res.Data.rows;
var headArray = [];
var exist = false;
//console.log(res.Data.rows);
//循环取字段名
for (var i in jsonArray[0]) {
headArray[headArray.length] = i;
//console.log("字段名?" + headArray[headArray.length] + "i的值" + i);
}
var div = document.getElementById("pPlanInterBox_Content");
var table = document.createElement("table");
table.id = "new_table";
//table.setAttribute("class", "table table-striped table-bordered table-hover dataTables-example");
var theadH = document.createElement("thead");
var thead = document.createElement("tr");
for (var count = 1; count < headArray.length; count++) {
var td = document.createElement("th");
td.setAttribute("style", "width:90px")
td.innerHTML = headArray[count];
thead.appendChild(td);
}
theadH.appendChild(thead);
table.appendChild(theadH);
var theadY = document.createElement("tbody");
var trColor = "background-color:#FFFAF0";
var num = 0;
for (var tableRowNo = 0; tableRowNo < jsonArray.length; tableRowNo++) {
var tr = document.createElement("tr");
if (tableRowNo % 2 == 0) {
num++;
if (num % 2 == 0) {
trColor = "background-color:#F5F5F5";
} else {
trColor = "background-color:#FFFAF0";
}
}
tr.setAttribute("style", trColor);
var number = 99999;
for (var headCount = 1; headCount < headArray.length; headCount++) {
var cell = document.createElement("td");
cell.setAttribute("class", jsonArray[tableRowNo][headArray[0]] + " " + headArray[headCount]);
cell.innerHTML = jsonArray[tableRowNo][headArray[headCount]];
//判断数量是否正常
if (re.test(jsonArray[tableRowNo][headArray[headCount]])) {
//console.log(number);
//console.log(jsonArray[tableRowNo][headArray[headCount]]);
if (number< parseInt(jsonArray[tableRowNo][headArray[headCount]])) {
cell.setAttribute("class", jsonArray[tableRowNo][headArray[0]] + " " + headArray[headCount] + " tdColor");
//console.log(jsonArray[tableRowNo][headArray[headCount]]); console.log(number);
exist = true;
}
number = parseInt(jsonArray[tableRowNo][headArray[headCount]] == "" ? 0 : jsonArray[tableRowNo][headArray[headCount]]);
}
//cell.data("station", headArray[headCount]);
cell.dataset.station = headArray[headCount];
cell.dataset.datetime = jsonArray[tableRowNo][headArray[1]];
tr.appendChild(cell);
}
theadY.appendChild(tr);
table.appendChild(theadY);
}
div.appendChild(table);
if (exist) {
$("#pPlanInterBox_Content").append("<p style='color:red'>*红色字体数据可能违规,请重新检查</p>");
}
newTable(table.id);
$('.ToDay.Date').css({ 'border-bottom': '1px solid #FFF' });
$('.Total').css({ 'border-bottom': '1px solid #333' });
$('.Total:not(.Date)').css({ 'color': '#1C1C1C', 'font-size': '12px' });
$('.ToDay:not(.Date)').css({ 'font-size': '16px' });
//$("#pPlanInterBox_Content").focus();
//location.href = "#ppInfo";
//$('html, body').animate({ scrollTop: $('#ppInfo').offset().top }, 1000);
//for (var tableRowNo = 1; tableRowNo <= (jsonArray.length / 2); tableRowNo++) {
// mergeCell('new_table', tableRowNo * 2 - 1, tableRowNo * 2, 0);
//}
}
else {
$("#pPlanInterBox_Content").html("<small><strong> 暂无生产计划</strong ></small >");
}
}
},
});
};
function mergeCell(table1, startRow, endRow, col) {
var tb = document.getElementById(table1);
if (!tb || !tb.rows || tb.rows.length <= 0) {
return;
}
if (col >= tb.rows[0].cells.length || (startRow >= endRow && endRow != 0)) {
return;
}
if (endRow == 0) {
endRow = tb.rows.length - 1;
}
for (var i = startRow; i < endRow; i++) {
if (tb.rows[startRow].cells[col].innerHTML == tb.rows[i + 1].cells[col].innerHTML) { //如果相等就合并单元格,合并之后跳过下一行
tb.rows[i + 1].removeChild(tb.rows[i + 1].cells[col]);
tb.rows[startRow].cells[col].rowSpan = (tb.rows[startRow].cells[col].rowSpan) + 1;
} else {
mergeCell(table1, i + 1, endRow, col);
break;
}
}
}
var oTable;
function newTable(tbid) {
oTable = $('#' + tbid).DataTable({
"bFilter": false, //过滤功能
"info": false,
"ordering": false,
"lengthChange": false,
"bAutoWidth": false,//自动宽度
"bPaginate": false, //翻页功能
//表头固定
//"fixedHeader": true,
//"scrollX": "500px",
//"scrollY": "400px",
//"scrollCollapse": true,
////固定首列,需要引入相应 dataTables.fixedColumns.min.js
//"fixedColumns": {
// "leftColumns": 2
//},
//"columnDefs": [{
// targets: 0, //第1列
// createdCell: function (td, cellData, rowData, row, col) {
// var rowspan = (row+1)%2;
// if (rowspan == 0) {
// $(td).remove();
// }
// else {
// $(td).attr('rowspan', 2);
// }
// }
//}],
});
//即时编辑
oTable.$('td:not(.Date,.Total,.DataType)').editable(function (value, settings) {
var station = this.dataset.station;//站
var datetime = this.dataset.datetime;//日期
var oiID = $("#oiID").val();//内部单号
var projectID = $("#projectID").val();//机型
SetPPCount(projectID, oiID, station, datetime, value);//修改数量
return (value);
},
{
"indicator": '保存中...',//提交处理过程中显示的提示文字
"tooltip": '单击编辑...',//鼠标悬停时的提示信息
//"cssclass": 'form-control',
"width": "60px",
"height": "100%",
"placeholder": "0",
//"style": 'input:{width:60px;}',
//"onblur": 'ignore',//方便调试样式
});
$.editable.addInputType('birthday', {
element: function (settings, original) {
var input = $('<input type="text" size="8" readonly>').datetimepicker({
language: 'zh-CN',
//locale: moment.locale('zh-CN'),
format: 'yyyy/mm/dd',
autoclose: 1,
startView: 2,
minView: 2,
});
$(this).append(input);
return (input);
}
});
//即时编辑
oTable.$('.Date:not(.Total)').editable(function (value, settings) {
var datetime = this.dataset.datetime;//日期
var oiID = $("#oiID").val();//内部单号
var projectID = $("#projectID").val();//机型
SetPPDate(projectID, oiID, datetime, value);
return (value);
},
{
"cancel": '取消',//取消编辑按钮的文字
"submit": '确定',//确认提交按钮的文字
"indicator": '保存中...',//提交处理过程中显示的提示文字
"tooltip": '单击编辑...',//鼠标悬停时的提示信息
//"cssclass": 'form-control',
"width": "60px",
"height": "100%",
"placeholder": "0",
"type": 'birthday',
//"style": 'input:{width:60px;}',
"onblur": 'ignore',//方便调试样式
});
}
//设置计划信息
function setPPInfo(res) {
$("#customerAbbr").html(res.Data.CustomerAbbr);
$("#projectName").html(res.Data.ProjectName);
$("#orderNo").html(res.Data.OrderNo);
$("#internalNo").html(res.Data.InternalNo);
$("#deliveryTime").html(res.Data.DeliveryTimeStr);
$("#stationText").html(res.Data.StationText);
$("#OrderCount").html(res.Data.OrderCount);
$("#oiID").val(res.Data.ID);
$("#projectID").val(res.Data.ProjectID);
$("#ppInfo").attr("style", "display:block;");
}
//清除计划信息
function removePPInfo() {
$("#customerAbbr").html("");
$("#projectName").html("");
$("#orderNo").html("");
$("#internalNo").html("");
$("#deliveryTime").html("");
$("#stationText").html("");
$("#oiID").val("");
$("#projectID").val("");
$("#ppInfo").attr("style", "display:none;");
};
//新增行
function fnClickAddRow() {
var oiID = $("#oiID").val();//内部单号
var projectID = $("#projectID").val();//机型
$.ajax({
url: "/APP/PPlan/AddPPlanForTB", //"@Url.Action("AddPPlanForTB", "PPlan")",
type: "post",
data: { "projectID": projectID, "oiID": oiID },
dataType: "json",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('提交成功',
{
position: 'top-center',
time: 550,
});
gotoDetailPartialNew(oiID);
}
else {
$.toastr.error('提交失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
};
function SetPPCount(projectID, oiID, station, datetime, value) {
$.ajax({
url: "/APP/PPlan/EditPPlanForTB",//"@Url.Action("EditPPlanForTB", "PPlan")",
type: "post",
data: { "projectID": projectID, "oiID": oiID, "stationName": station, "datetime": datetime, "count": value },
dataType: "json",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('提交成功',
{
position: 'top-center',
time: 550,
});
gotoDetailPartialNew(oiID);
}
else {
$.toastr.error('提交失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
};
function SetPPDate(projectID, oiID, datetime, value) {
$.ajax({
url: "/APP/PPlan/EditPPlanDate",//"@Url.Action("EditPPlanDate", "PPlan")",
type: "post",
data: { "projectID": projectID, "oiID": oiID, "datetime": datetime, "upDate": value },
dataType: "json",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('提交成功',
{
position: 'top-center',
time: 550,
});
gotoDetailPartialNew(oiID);
}
else {
$.toastr.error('提交失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
}
}
});
};

2
AUTS.Web/Plugin/pplan.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

44
AUTS.Web/Plugin/user.js Normal file
View File

@@ -0,0 +1,44 @@

//添加会员
$("#btnaddUser").click(function () {
console.log("123");
var btnText = $('#btnaddUser').html()
$("#btnaddUser").attr("disabled", "true"); //设置禁用按钮
$('#btnaddUser').text('提交中...'); //显示提交中
$("#addUserForm").ajaxSubmit({
url: "/APP/user/AddUser",
type: "post",
success: function (res) {
if (res.Status == 200) {
$.toastr.success('添加成功',
{
position: 'top-center',
time: 2000,
callback: function () {
location.href = "/APP/User/UserList";
}
});
} else {
$.toastr.error('添加失败! <br />' + res.Message, {
time: 3000,
position: 'top-center'
});
$('#btnaddUser').removeAttr('disabled')//重置按钮
$('#btnaddUser').text(btnText); //还原显示
}
},
error: function (error) {
$('#btnaddUser').removeAttr('disabled')//重置按钮
$('#btnaddUser').text(btnText); //还原显示
alert(error);
}
});
});

1
AUTS.Web/Plugin/zh.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(){"use strict";window.jQuery.fn.fileinputLocales.zh={sizeUnits:["B","KB","MB","GB","TB","PB","EB","ZB","YB"],bitRateUnits:["B/s","KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"],fileSingle:"文件",filePlural:"个文件",browseLabel:"选择 &hellip;",removeLabel:"移除",removeTitle:"清除选中文件",cancelLabel:"取消",cancelTitle:"取消进行中的上传",pauseLabel:"暂停",pauseTitle:"暂停上传",uploadLabel:"上传",uploadTitle:"上传选中文件",msgNo:"没有",msgNoFilesSelected:"未选择文件",msgPaused:"已暂停",msgCancelled:"取消",msgPlaceholder:"选择 {files} ...",msgZoomModalHeading:"详细预览",msgFileRequired:"必须选择一个文件上传.",msgSizeTooSmall:'文件 "{name}" (<b>{size} KB</b>) 必须大于限定大小 <b>{minSize} KB</b>.',msgSizeTooLarge:'文件 "{name}" (<b>{size} KB</b>) 超过了允许大小 <b>{maxSize} KB</b>.',msgFilesTooLess:"你必须选择最少 <b>{n}</b> {files} 来上传. ",msgFilesTooMany:"选择的上传文件个数 <b>({n})</b> 超出最大文件的限制个数 <b>{m}</b>.",msgTotalFilesTooMany:"你最多可以上传 <b>{m}</b> 个文件 (当前有<b>{n}</b> 个文件).",msgFileNotFound:'文件 "{name}" 未找到!',msgFileSecured:'安全限制,为了防止读取文件 "{name}".',msgFileNotReadable:'文件 "{name}" 不可读.',msgFilePreviewAborted:'取消 "{name}" 的预览.',msgFilePreviewError:'读取 "{name}" 时出现了一个错误.',msgInvalidFileName:'文件名 "{name}" 包含非法字符.',msgInvalidFileType:'不正确的类型 "{name}". 只支持 "{types}" 类型的文件.',msgInvalidFileExtension:'不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.',msgFileTypes:{image:"image",html:"HTML",text:"text",video:"video",audio:"audio",flash:"flash",pdf:"PDF",object:"object"},msgUploadAborted:"该文件上传被中止",msgUploadThreshold:"处理中 &hellip;",msgUploadBegin:"正在初始化 &hellip;",msgUploadEnd:"完成",msgUploadResume:"继续上传 &hellip;",msgUploadEmpty:"无效的文件上传.",msgUploadError:"上传出错",msgDeleteError:"删除出错",msgProgressError:"上传出错",msgValidationError:"验证错误",msgLoading:"加载第 {index} 文件 共 {files} &hellip;",msgProgress:"加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.",msgSelected:"{n} {files} 选中",msgProcessing:"处理中 ...",msgFoldersNotAllowed:"只支持拖拽文件! 跳过 {n} 拖拽的文件夹.",msgImageWidthSmall:'图像文件的"{name}"的宽度必须是至少{size}像素.',msgImageHeightSmall:'图像文件的"{name}"的高度必须至少为{size}像素.',msgImageWidthLarge:'图像文件"{name}"的宽度不能超过{size}像素.',msgImageHeightLarge:'图像文件"{name}"的高度不能超过{size}像素.',msgImageResizeError:"无法获取的图像尺寸调整。",msgImageResizeException:"调整图像大小时发生错误。<pre>{errors}</pre>",msgAjaxError:"{operation} 发生错误. 请重试!",msgAjaxProgressError:"{operation} 失败",msgDuplicateFile:'文件 "{name}",大小 "{size} KB" 已经被选中.忽略相同的文件.',msgResumableUploadRetriesExceeded:"文件 <b>{file}</b> 上传失败超过 <b>{max}</b> 次重试 ! 错误详情: <pre>{error}</pre>",msgPendingTime:"{time} 剩余",msgCalculatingTime:"计算剩余时间",ajaxOperations:{deleteThumb:"删除文件",uploadThumb:"上传文件",uploadBatch:"批量上传",uploadExtra:"表单数据上传"},dropZoneTitle:"拖拽文件到这里 &hellip;<br>支持多文件同时上传",dropZoneClickTitle:"<br>(或点击{files}按钮选择文件)",fileActionSettings:{removeTitle:"删除文件",uploadTitle:"上传文件",downloadTitle:"下载文件",uploadRetryTitle:"重试",zoomTitle:"查看详情",dragTitle:"移动 / 重置",indicatorNewTitle:"没有上传",indicatorSuccessTitle:"上传",indicatorErrorTitle:"上传错误",indicatorPausedTitle:"上传已暂停",indicatorLoadingTitle:"上传 &hellip;"},previewZoomButtonTitles:{prev:"预览上一个文件",next:"预览下一个文件",toggleheader:"缩放",fullscreen:"全屏",borderless:"无边界模式",close:"关闭当前预览"}}}();