|
|
@@ -66,9 +66,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
Table.api.bindevent(table);
|
|
|
},
|
|
|
add: function () {
|
|
|
- // 进入页面全屏
|
|
|
- // document.documentElement.webkitRequestFullScreen();
|
|
|
- $('#c-bach').focus();
|
|
|
+ // document.documentElement.webkitRequestFullScreen();// 进入页面全屏
|
|
|
+ $('#c-bach').focus();//光标自动跳到(批次号输入框)
|
|
|
var num=0;
|
|
|
$('#c-bach').keydown((e)=>{
|
|
|
let key = e.which;
|
|
|
@@ -76,6 +75,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
$("#wuliao").focus();
|
|
|
if(num === 0){
|
|
|
var bach = $("#c-bach").val();
|
|
|
+ // console.log("输入框的批次号:↓↓↓↓");
|
|
|
+ // console.log(bach);
|
|
|
if (bach == ''){
|
|
|
layer.confirm('批次号不能为空',{
|
|
|
title:'操作提示',
|
|
|
@@ -224,11 +225,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
var str = '';//页面table
|
|
|
var html = '';//打印的table
|
|
|
for(var i=0;i<result.data.length;i++){
|
|
|
- console.log(result.data[i]);
|
|
|
str += "<tr class='tablestr"+i+" tablestr'><td><input class='form-control material' type='text' name='row[material][]' readonly value='"+result.data[i].material+"'></td>";
|
|
|
str += "<td><input class='form-control nweight' type='text' name='row[nweight][]' readonly value='"+result.data[i].nweight+"'></td>";
|
|
|
str += "<td style='display: none'><input class='form-control gy_num' type='hidden' name='row[gy_num][]' value='"+result.data[i].gy_num+"'></td>";
|
|
|
- str += "<td><input class='form-control number' type='number' name='row[weight][]' value='";
|
|
|
+ //投料重量
|
|
|
+ str += "<td><input class='form-control number' type='number' name='row[weight][]' value='";
|
|
|
if (result.data[i].weight) {
|
|
|
//已操作的工序变为只读,附带实加重量
|
|
|
str += result.data[i].weight + "' readonly ";
|
|
|
@@ -260,7 +261,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
<td class="total" id="stotal" style="width: 100px;text-align: center"></td>
|
|
|
<td id="total"></td>
|
|
|
<td></td>
|
|
|
- </tr>`;//${res.data[0].number}
|
|
|
+ </tr>`;
|
|
|
$("#print_gy").append(html);
|
|
|
$("#table").append(str);
|
|
|
$("#c-bach").attr('readonly','readonly');//批次号输入框变为只读
|
|
|
@@ -268,7 +269,152 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
let key = e.which;
|
|
|
var error = 0;
|
|
|
if(key === 13){
|
|
|
- var string = $("#wuliao").val();
|
|
|
+ var string = $("#wuliao").val();//获取扫描物料的值
|
|
|
+ $(document).ready(function() {
|
|
|
+ console.log('开始获取');
|
|
|
+ var intervalId; // 用于存储定时器ID
|
|
|
+ function fetchDataAndUpdateInput() {
|
|
|
+ $.ajax({
|
|
|
+ url: 'Feeding/cheng',
|
|
|
+ method: 'GET',
|
|
|
+ success: function(data) {
|
|
|
+ var val = data.slice(0,-2);
|
|
|
+ console.log(data);
|
|
|
+ console.log(val);
|
|
|
+ var focusedInput = $("#table").find('.number:focus');
|
|
|
+ focusedInput.val(val);
|
|
|
+ // 遍历返回的数据对象,更新对应的输入框
|
|
|
+ // for (var port in data) {
|
|
|
+ // var value = data[port];
|
|
|
+ // // var inputToUpdate = $('#table').find('.' + port); // 假设每个输入框有对应的类名(例如 COM3、COM4)
|
|
|
+ // var focusedInput = $("#table").find('.number:focus');
|
|
|
+ // // 只有当值大于 0 时才更新输入框
|
|
|
+ // if (value > 0 && focusedInput.length > 0) {
|
|
|
+ // focusedInput.val(value);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ error: function(jqXHR, textStatus, errorThrown) {
|
|
|
+ console.log('数据错误:', errorThrown);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function startTimer() {
|
|
|
+ // 如果定时器已经存在,则不重复创建
|
|
|
+ if (intervalId) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 创建定时器,每2秒获取一次数据
|
|
|
+ intervalId = setInterval(fetchDataAndUpdateInput, 2000);
|
|
|
+ }
|
|
|
+ function stopTimer() {
|
|
|
+ if (intervalId) {
|
|
|
+ clearInterval(intervalId); // 停止定时器
|
|
|
+ intervalId = null; // 清除定时器ID
|
|
|
+ }
|
|
|
+ console.log('停止获取电子秤数据。');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 当任何一个class为number的输入框获得焦点时,启动定时器
|
|
|
+ $('.number').focus(startTimer);
|
|
|
+
|
|
|
+ // 当任何一个class为number的输入框失去焦点时,停止定时器
|
|
|
+ $('.number').blur(stopTimer);
|
|
|
+ });
|
|
|
+
|
|
|
+ //选择获取电子秤数据
|
|
|
+ // $(document).ready(function() {
|
|
|
+ // var intervalId; // 用于存储定时器ID
|
|
|
+ // // 当任何一个class为number的输入框获得焦点时,启动定时器
|
|
|
+ // $('.number').focus(function() {
|
|
|
+ // // 如果定时器已经存在,则不重复创建
|
|
|
+ // if (intervalId) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // // 创建定时器,每3秒获取一次数据
|
|
|
+ // intervalId = setInterval(function() {
|
|
|
+ // $.ajax({
|
|
|
+ // url: 'Feeding/cheng',
|
|
|
+ // method: 'GET',
|
|
|
+ // success: function(data) {
|
|
|
+ // console.log(data);
|
|
|
+ // var focusedInput = $("#table").find('.number:focus');
|
|
|
+ // if (focusedInput.length > 0 && data > 0) {
|
|
|
+ // focusedInput.val(data);
|
|
|
+ // } else {
|
|
|
+ // console.log("未获取到电子秤数据或输入框失去焦点");
|
|
|
+ // clearInterval(intervalId); // 停止定时器
|
|
|
+ // intervalId = null; // 清除定时器ID
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function() {
|
|
|
+ // console.log('数据错误');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }, 2000);
|
|
|
+ // });
|
|
|
+ // // 当任何一个class为number的输入框失去焦点时,停止定时器
|
|
|
+ // $('.number').blur(function() {
|
|
|
+ // if (intervalId) {
|
|
|
+ // clearInterval(intervalId); // 停止定时器
|
|
|
+ // intervalId = null; // 清除定时器ID
|
|
|
+ // }
|
|
|
+ // console.log('未选择输入框,停止获取电子秤数据。');
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
+
|
|
|
+ // //获取电子秤数据
|
|
|
+ // $(document).ready(function() {
|
|
|
+ // var intervalId; // 用于存储定时器ID
|
|
|
+ // // 当任何一个class为number的输入框获得焦点时,启动定时器
|
|
|
+ // $('.number').focus(function() {
|
|
|
+ // // 如果定时器已经存在,则不重复创建
|
|
|
+ // if (intervalId) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // // 创建定时器,每3秒获取一次数据
|
|
|
+ // intervalId = setInterval(function() {
|
|
|
+ // // var dzc = $("#dzc").val(); // 获取选择的电子秤值
|
|
|
+ // var dzc = '开始获取'; // 自动获取
|
|
|
+ // // console.log(dzc);
|
|
|
+ // if (!dzc) {
|
|
|
+ // console.log('未获取电子秤');
|
|
|
+ // return; // 如果没有选择电子秤,则不执行后续操作
|
|
|
+ // }
|
|
|
+ // // 发送AJAX请求获取电子秤数据
|
|
|
+ // $.ajax({
|
|
|
+ // url: 'Feeding/cheng',
|
|
|
+ // method: 'GET',
|
|
|
+ // data: { dzc: dzc },
|
|
|
+ // success: function(data) {
|
|
|
+ // // console.log('开始获取电子秤数据↓↓↓↓↓↓');
|
|
|
+ // // console.log("电子秤:" + '(' + dzc + ')' + "--数据:" + '(' + data + ')');
|
|
|
+ // var focusedInput = $("#table").find('.number:focus');
|
|
|
+ // if (focusedInput.length > 0 && data > 0) {
|
|
|
+ // focusedInput.val(data);
|
|
|
+ // } else {
|
|
|
+ // console.log("未获取到电子秤数据或输入框失去焦点");
|
|
|
+ // clearInterval(intervalId); // 停止定时器
|
|
|
+ // intervalId = null; // 清除定时器ID
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function() {
|
|
|
+ // console.log('数据错误');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }, 2000);
|
|
|
+ // });
|
|
|
+ // // 当任何一个class为number的输入框失去焦点时,停止定时器
|
|
|
+ // $('.number').blur(function() {
|
|
|
+ // if (intervalId) {
|
|
|
+ // clearInterval(intervalId); // 停止定时器
|
|
|
+ // intervalId = null; // 清除定时器ID
|
|
|
+ // }
|
|
|
+ // console.log('未选择输入框,停止获取电子秤数据。');
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
if(string.substr(0,string.indexOf('_'))){
|
|
|
var wuliao = string.substr(0,string.indexOf('_')); //原材料
|
|
|
var bach = string.substr(string.indexOf('_')+1); //原材料批次号
|
|
|
@@ -276,6 +422,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
var wuliao = string;
|
|
|
var bach = '';
|
|
|
}
|
|
|
+
|
|
|
$('#input').html();
|
|
|
$.ajax({
|
|
|
method: "POST",
|
|
|
@@ -294,13 +441,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
if(result.data[i].material===data.data[j].m_name){
|
|
|
if (result.data[i].gy_num <= result.process){
|
|
|
//投料重量为空时 扫描物料文字为红
|
|
|
-
|
|
|
-
|
|
|
if (result.data[i].weight == 0) {
|
|
|
$(".material")[i].setAttribute('style','color:red');
|
|
|
$(".nweight")[i].setAttribute('style','color:red');
|
|
|
}
|
|
|
var the_bach = document.getElementsByClassName('bach')[i];
|
|
|
+
|
|
|
if(the_bach.readOnly == false){
|
|
|
the_bach.value = bach;
|
|
|
$(".number")[i].focus();
|
|
|
@@ -317,14 +463,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
window.speechSynthesis.speak(msg);
|
|
|
error++;
|
|
|
- // }else{
|
|
|
- // Layer.confirm("此物料已经投料,请确认此工序是否有此物料!",{
|
|
|
- // area: ['60%', '60%'],
|
|
|
- // });
|
|
|
- // //语音播报
|
|
|
- // var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
- // window.speechSynthesis.speak(msg);
|
|
|
- // error++;
|
|
|
+ // }else{
|
|
|
+ // Layer.confirm("此物料已经投料,请确认此工序是否有此物料!",{
|
|
|
+ // area: ['60%', '60%'],
|
|
|
+ // });
|
|
|
+ // //语音播报
|
|
|
+ // var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
+ // window.speechSynthesis.speak(msg);
|
|
|
+ // error++;
|
|
|
}
|
|
|
}
|
|
|
//替代料变扫描的物料
|
|
|
@@ -460,6 +606,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
$(document).on('click','.submit',function () {
|
|
|
if($("#c-operator").val() == "" || $("#c-inspector").val() == ""){
|
|
|
layer.confirm('请选择 操作人员 或 检验人员',{
|
|
|
@@ -533,6 +681,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
$(this).parent().siblings().eq(4).children('input').attr('disabled',true);
|
|
|
$(this).attr('disabled',true);
|
|
|
}
|
|
|
+
|
|
|
+ // console.log(bach);
|
|
|
+ // console.log(date);
|
|
|
+ // console.log(operator);
|
|
|
+ // console.log(inspector);
|
|
|
+ // console.log(material);
|
|
|
+ // console.log(nweight);
|
|
|
+ // console.log(gy_num);
|
|
|
+ // console.log(weight);
|
|
|
+ // console.log(material_bach);
|
|
|
+ // console.log(gy_name);return false;
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
url: "feeding/add",
|