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.
122 lines
3.7 KiB
122 lines
3.7 KiB
var site = $("#current_site").val();
|
|
var defectList=[];
|
|
|
|
//页面初始化
|
|
$(function(){
|
|
// 初始化光标
|
|
$("#seqNo_scan").focus();
|
|
});
|
|
|
|
//为物料号绑定一个失去焦点事件
|
|
$("#seqNo_scan").bind("keydown",function(event) {
|
|
if (event.keyCode == 13) {
|
|
var seqNo = $(this).val().trim();
|
|
if(seqNo == null || seqNo == ""){
|
|
layer.msg("派工单号不能为空!",{
|
|
offset:['20%','30%'],
|
|
});
|
|
$("#seqNo_scan").val("");
|
|
$("#seqNo_scan").focus();
|
|
return false;
|
|
}
|
|
scanSeqNo(seqNo);
|
|
}
|
|
});
|
|
function doScanSeqNo() {
|
|
var seqNo = $("#seqNo_scan").val();
|
|
if(seqNo == null || seqNo == ""){
|
|
layer.msg("派工单号不能为空!",{
|
|
offset:['20%','30%'],
|
|
});
|
|
$("#seqNo_scan").val("");
|
|
$("#seqNo_scan").focus();
|
|
return false;
|
|
}
|
|
scanSeqNo(seqNo);
|
|
}
|
|
|
|
function scanSeqNo(seqNo) {
|
|
var jsonData = {
|
|
site: site,
|
|
seqNo: seqNo,
|
|
}
|
|
$.ajax({
|
|
url: "/schedule/scanSeqNo",
|
|
contentType: 'application/json',
|
|
type: "POST",
|
|
data: JSON.stringify(jsonData),//你的formid
|
|
dataType: "JSON",
|
|
async: false,
|
|
beforeSend: function (request) {
|
|
request.setRequestHeader("token", $.cookie("token"));
|
|
},
|
|
success: function (data) {
|
|
if(data.code===0){
|
|
$("#seqNo").val($("#seqNo_scan").val());
|
|
$("#orderNo").val(data.row.orderNo);
|
|
$("#scheduleDate").val(data.row.sScheduledDate);
|
|
$("#partNo").val(data.row.partNo);
|
|
$("#partDesc").val(data.row.partDesc);
|
|
$("#shiftNo").val(data.row.sShiftNo);
|
|
$("#scheduleQty").val(data.row.qtyRequired);
|
|
$("#unApproveQty").val(0);
|
|
$("#operatorId").val(data.row.operatorId);
|
|
}else{
|
|
layer.msg(data.msg,{
|
|
offset:['20%','30%'],
|
|
});
|
|
$("#seqNo_scan").val("");
|
|
$("#seqNo_scan").focus();
|
|
}
|
|
},
|
|
error: function (data) {
|
|
var responseText = data.responseText;
|
|
var json_str = JSON.parse(responseText);
|
|
var status = json_str.status;
|
|
var message = json_str.message;
|
|
//判断是否是session超时
|
|
if (403 == status) {
|
|
layer.alert(message, function () {
|
|
window.location.href = "/login";
|
|
});
|
|
}
|
|
layer.closeAll('loading');
|
|
}
|
|
})
|
|
}
|
|
function defectModal(){
|
|
|
|
}
|
|
|
|
function defectAdd() {
|
|
let id= Math.floor(Math.random() *1000)
|
|
let str = '<tr id = '+id+'>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;" width="25%">' +
|
|
'<span>'+"不良代码号"+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;" width="25%">' +
|
|
'<span>'+"不良原因啊"+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;" width="25%">' +
|
|
'<span>'+id+'</span></th>' +
|
|
'<th class="" style="text-align:center;background-color: #ffff;" width="25%">' +
|
|
'<button onclick="removeColomn(\''+id+'\')">删除</button></th>' +
|
|
'</tr>';
|
|
defectList.push({
|
|
id:id,
|
|
desc:'不良代码号',
|
|
})
|
|
$("#defect_table").append(str);
|
|
}
|
|
|
|
|
|
//不良原因删除
|
|
function removeColomn(id){
|
|
tableDatailRemo(id);
|
|
defectList = defectList.filter(item => item.id != id );
|
|
layer.msg("移除成功!");
|
|
|
|
}
|
|
// 移除table
|
|
function tableDatailRemo(id){
|
|
$table=$("#defect_table tr");
|
|
$("tr[id='" + id + "']").remove();
|
|
}
|