|
|
@@ -43,12 +43,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
});
|
|
|
|
|
|
document.documentElement.webkitRequestFullScreen();
|
|
|
-
|
|
|
+
|
|
|
// 为表格绑定事件
|
|
|
Table.api.bindevent(table);
|
|
|
},
|
|
|
add: function () {
|
|
|
- // document.documentElement.webkitRequestFullScreen();
|
|
|
$('#c-bach').focus();
|
|
|
var num=0;
|
|
|
$('#c-bach').keydown((e)=>{
|
|
|
@@ -58,132 +57,129 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
if(num === 0){
|
|
|
var bach = $("#c-bach").val();
|
|
|
if (bach == ''){
|
|
|
- layer.confirm('批次号不能为空,请输入批次号');return false;
|
|
|
+ layer.confirm('批次号不能为空',{
|
|
|
+ title:'操作提示',
|
|
|
+ btn:[],
|
|
|
+ // icon:2,
|
|
|
+ closeBtn:0,
|
|
|
+ time:2000
|
|
|
+ });
|
|
|
+ return false;
|
|
|
}
|
|
|
$.ajax({
|
|
|
method:"POST",
|
|
|
data:{bach:bach},//批次号
|
|
|
url:"feeding/get_task",
|
|
|
success(res){
|
|
|
- if(res.code == 0){
|
|
|
- layer.confirm(res.msg,{
|
|
|
- title:['信息'],
|
|
|
- area:['80%','60%'],
|
|
|
- });
|
|
|
- var msg = new SpeechSynthesisUtterance(res.msg);
|
|
|
- window.speechSynthesis.speak(msg);
|
|
|
- return false;
|
|
|
- // layer.confirm(res.msg);return false;
|
|
|
- }
|
|
|
$("#table").append("<input id='name' type='hidden' value='"+res.data[0].name+"'>");
|
|
|
//批次号重复/做下拉选择
|
|
|
if(res.data.length>1){
|
|
|
- let str = '';
|
|
|
- str+='<select class="selectpicker form-control" id="bach"><option>请选择对应的生产量</option>';
|
|
|
- for(var i=0;i<res.data.length;i++){
|
|
|
- str+='<option value="'+i+'">'+res.data[i].create+' 生产量:'+res.data[i].number+'</option>';
|
|
|
- }
|
|
|
- str+='</select><a href="javascript:;" id="btn" class="btn btn-success">确认</a>';
|
|
|
- $('#c-bach').parent('#c_bach').append(str);
|
|
|
- $("#bach").change(()=>{
|
|
|
- $("#c-name").val(res.data[$("#bach").val()].name);
|
|
|
- $("#c-specifications").val(res.data[$("#bach").val()].drawer_name);
|
|
|
- $("#c-unit").val(res.data[$("#bach").val()].examine_name);
|
|
|
- });
|
|
|
- $("#btn").click(()=>{
|
|
|
- //只读->已扫描过批次号
|
|
|
- if($("#c-bach").attr('readonly')==='readonly'){
|
|
|
- return false;
|
|
|
- }
|
|
|
- $("#bach").css('cssText','display:none! important');//隐藏按钮,下拉菜单
|
|
|
- $("#btn").css('display','none');
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- method:"POST",
|
|
|
- url:"feeding/get_formula",
|
|
|
- data:{
|
|
|
- bach:$("#c-bach").val(),
|
|
|
- num:res.data[$("#bach").val()].number// 选定批次号的生产量,精确查找
|
|
|
- },
|
|
|
- success(result){
|
|
|
- var str = '';//页面table
|
|
|
- var html = '';// html:需打印的表格
|
|
|
- for(var i=0;i<result.data.length;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' type='text' name='row[nweight][]' readonly value='"+result.data[i].nweight+"'></td>";
|
|
|
- str += "<td><input class='form-control' type='number' name='row[weight][]' value='";
|
|
|
- if (result.data[i].weight) {
|
|
|
- //已操作的工序变为只读,附带实加重量
|
|
|
- str += parseFloat(result.data[i].weight) + "' readonly ";
|
|
|
- }
|
|
|
- str += "'></td>";
|
|
|
- str += "<input class='form-control' type='hidden' name='row[gy_num][]' value='"+result.data[i].gy_num+"'>";
|
|
|
- str += "<td><input class='form-control' type='text' name='row[gy_name][]' readonly value='"+result.data[i].gy_name+"'></td>";
|
|
|
- str += "</tr>";
|
|
|
- html += `<tr class="print${i} print"><td>${result.data[i].material}</td>
|
|
|
- <td>${result.data[i].nweight}</td><td>`;
|
|
|
- if (result.data[i].weight) {
|
|
|
- html += parseFloat(result.data[i].weight);
|
|
|
- }
|
|
|
- html += `</td><td style="text-align: left">${result.data[i].gy_name}</td></tr>`;
|
|
|
-
|
|
|
- }
|
|
|
- html+= `<tr>
|
|
|
- <td style="width: 100px;text-align: center">总计</td>
|
|
|
- <td class="total" style="width: 100px;text-align: center"></td>
|
|
|
- <td id="total"></td>
|
|
|
- <td></td>
|
|
|
- </tr>`;//${res.data.number}
|
|
|
- $("#print_gy").append(html);
|
|
|
- $("#table").append(str);
|
|
|
- $("#c-bach").attr('readonly','readonly');//批次号输入框变为只读
|
|
|
-
|
|
|
- $("#wuliao").keydown((e)=>{
|
|
|
- let key = e.which;
|
|
|
- var error = 0;
|
|
|
- if(key === 13){
|
|
|
- var wuliao = $("#wuliao").val();
|
|
|
- for(var i=0;i<result.data.length;i++) {
|
|
|
- //扫描的物料=table中的物料,,,变红,否则语音提示
|
|
|
- if(result.data[i].material===wuliao && result.data[i].gy_num == result.process){
|
|
|
- $(".material")[i].setAttribute('style','color:red');
|
|
|
- error++;
|
|
|
- }else if(result.data[i].material===wuliao){
|
|
|
- Layer.confirm("此物料不在当前工序,请确认!");
|
|
|
- //语音播报
|
|
|
- var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
- window.speechSynthesis.speak(msg);
|
|
|
- error++;
|
|
|
- }
|
|
|
- //替代料变扫描的物料
|
|
|
- if(result.data[i].material.indexOf('/')!==-1){
|
|
|
- var arr = result.data[i].material.split('/');
|
|
|
- if(arr.indexOf($("#wuliao").val()) !== -1 && result.data[i].gy_num == result.process){
|
|
|
- $(".material")[i].value = wuliao;
|
|
|
- $(".material")[i].setAttribute('style','color:red');
|
|
|
- error++;
|
|
|
- }else if(arr.indexOf($("#wuliao").val()) !== -1 ){
|
|
|
- Layer.confirm("此物料不在当前工序,请确认!");
|
|
|
- //语音播报
|
|
|
- var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
- window.speechSynthesis.speak(msg);
|
|
|
- error++;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(error===0){
|
|
|
- Layer.confirm("此物料不在配方中,请确认!");
|
|
|
- //语音播报
|
|
|
- var msg = new SpeechSynthesisUtterance("此物料不在配方中,请确认!");
|
|
|
- window.speechSynthesis.speak(msg);
|
|
|
- }
|
|
|
- //清空物料扫描后的值,下次直接重新扫描即可
|
|
|
- $("#wuliao").val('');
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ // let str = '';
|
|
|
+ // str+='<select class="selectpicker form-control" id="bach"><option>请选择对应的生产量</option>';
|
|
|
+ // for(var i=0;i<res.data.length;i++){
|
|
|
+ // str+='<option value="'+i+'">'+res.data[i].create+' 生产量:'+res.data[i].number+'</option>';
|
|
|
+ // }
|
|
|
+ // str+='</select><a href="javascript:;" id="btn" class="btn btn-success">确认</a>';
|
|
|
+ // $('#c-bach').parent('#c_bach').append(str);
|
|
|
+ // $("#bach").change(()=>{
|
|
|
+ // $("#c-name").val(res.data[$("#bach").val()].name);
|
|
|
+ // $("#c-specifications").val(res.data[$("#bach").val()].drawer_name);
|
|
|
+ // $("#c-unit").val(res.data[$("#bach").val()].examine_name);
|
|
|
+ // });
|
|
|
+ // $("#btn").click(()=>{
|
|
|
+ // //只读->已扫描过批次号
|
|
|
+ // if($("#c-bach").attr('readonly')==='readonly'){
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // $("#bach").css('cssText','display:none! important');//隐藏按钮,下拉菜单
|
|
|
+ // $("#btn").css('display','none');
|
|
|
+ //
|
|
|
+ // $.ajax({
|
|
|
+ // method:"POST",
|
|
|
+ // url:"feeding/get_formula",
|
|
|
+ // data:{
|
|
|
+ // bach:$("#c-bach").val(),
|
|
|
+ // num:res.data[$("#bach").val()].number// 选定批次号的生产量,精确查找
|
|
|
+ // },
|
|
|
+ // success(result){
|
|
|
+ // var str = '';//页面table
|
|
|
+ // var html = '';// html:需打印的表格
|
|
|
+ // for(var i=0;i<result.data.length;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' type='text' name='row[nweight][]' readonly value='"+result.data[i].nweight+"'></td>";
|
|
|
+ // str += "<td><input class='form-control' type='number' name='row[weight][]' value='";
|
|
|
+ // if (result.data[i].weight) {
|
|
|
+ // //已操作的工序变为只读,附带实加重量
|
|
|
+ // str += parseFloat(result.data[i].weight) + "' readonly ";
|
|
|
+ // }
|
|
|
+ // str += "'></td>";
|
|
|
+ // str += "<input class='form-control' type='hidden' name='row[gy_num][]' value='"+result.data[i].gy_num+"'>";
|
|
|
+ // str += "<td><input class='form-control' type='text' name='row[gy_name][]' readonly value='"+result.data[i].gy_name+"'></td>";
|
|
|
+ // str += "</tr>";
|
|
|
+ // html += `<tr class="print${i} print"><td>${result.data[i].material}</td>
|
|
|
+ // <td>${result.data[i].nweight}</td><td>`;
|
|
|
+ // if (result.data[i].weight) {
|
|
|
+ // html += parseFloat(result.data[i].weight);
|
|
|
+ // }
|
|
|
+ // html += `</td><td style="text-align: left">${result.data[i].gy_name}</td></tr>`;
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // html+= `<tr>
|
|
|
+ // <td style="width: 100px;text-align: center">总计</td>
|
|
|
+ // <td class="total" style="width: 100px;text-align: center"></td>
|
|
|
+ // <td id="total"></td>
|
|
|
+ // <td></td>
|
|
|
+ // </tr>`;//${res.data.number}
|
|
|
+ // $("#print_gy").append(html);
|
|
|
+ // $("#table").append(str);
|
|
|
+ // $("#c-bach").attr('readonly','readonly');//批次号输入框变为只读
|
|
|
+ //
|
|
|
+ // $("#wuliao").keydown((e)=>{
|
|
|
+ // let key = e.which;
|
|
|
+ // var error = 0;
|
|
|
+ // if(key === 13){
|
|
|
+ // var wuliao = $("#wuliao").val();
|
|
|
+ // for(var i=0;i<result.data.length;i++) {
|
|
|
+ // //扫描的物料=table中的物料,,,变红,否则语音提示
|
|
|
+ // if(result.data[i].material===wuliao && result.data[i].gy_num == result.process){
|
|
|
+ // $(".material")[i].setAttribute('style','color:red');
|
|
|
+ // error++;
|
|
|
+ // }else if(result.data[i].material===wuliao){
|
|
|
+ // Layer.confirm("此物料不在当前工序,请确认!");
|
|
|
+ // //语音播报
|
|
|
+ // var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
+ // window.speechSynthesis.speak(msg);
|
|
|
+ // error++;
|
|
|
+ // }
|
|
|
+ // //替代料变扫描的物料
|
|
|
+ // if(result.data[i].material.indexOf('/')!==-1){
|
|
|
+ // var arr = result.data[i].material.split('/');
|
|
|
+ // if(arr.indexOf($("#wuliao").val()) !== -1 && result.data[i].gy_num == result.process){
|
|
|
+ // $(".material")[i].value = wuliao;
|
|
|
+ // $(".material")[i].setAttribute('style','color:red');
|
|
|
+ // error++;
|
|
|
+ // }else if(arr.indexOf($("#wuliao").val()) !== -1 ){
|
|
|
+ // Layer.confirm("此物料不在当前工序,请确认!");
|
|
|
+ // //语音播报
|
|
|
+ // var msg = new SpeechSynthesisUtterance("此物料不在当前工序,请确认!");
|
|
|
+ // window.speechSynthesis.speak(msg);
|
|
|
+ // error++;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if(error===0){
|
|
|
+ // Layer.confirm("此物料不在配方中,请确认!");
|
|
|
+ // //语音播报
|
|
|
+ // var msg = new SpeechSynthesisUtterance("此物料不在配方中,请确认!");
|
|
|
+ // window.speechSynthesis.speak(msg);
|
|
|
+ // }
|
|
|
+ // //清空物料扫描后的值,下次直接重新扫描即可
|
|
|
+ // $("#wuliao").val('');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
}else{//批次号不重复直接赋值
|
|
|
// console.log(2222);
|
|
|
$("#btn").css('display','none');
|
|
|
@@ -200,7 +196,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
url: "feeding/get_formula",
|
|
|
data: {
|
|
|
bach: $("#c-bach").val(),
|
|
|
- num:''
|
|
|
},
|
|
|
success(result) {
|
|
|
console.log(result)
|
|
|
@@ -211,13 +206,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
// str += "<td><input class='form-control' type='text' name='row[nweight][]' readonly value='"+result.data[i].nweight+"'></td>";
|
|
|
str += "<td><input class='form-control nweight' type='text' name='row[nweight][]' readonly value='"+result.data[i].nweight+"'></td>";
|
|
|
str += "<input class='form-control' type='hidden' name='row[gy_num][]' value='"+result.data[i].gy_num+"'>";
|
|
|
- str += "<td><input class='form-control' 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 ";
|
|
|
}
|
|
|
str += "'></td>";
|
|
|
- str += "<td><input class='form-control' type='text' name='row[gy_name][]' readonly value='"+result.data[i].gy_name+"'></td>";
|
|
|
+ str += "<td><button type=\"button\" class=\"btn btn-primary btn-embossed submit \">保存</button></td>";
|
|
|
+ str += "<td><input class='form-control bach' type='text' name='row[bach][]' value=''></td>";
|
|
|
+ str += "<td><input class='form-control' type='text' name='row[gy_name][]' value='"+result.data[i].gy_name+"'></td>";
|
|
|
str += "</tr>";
|
|
|
html += `<tr class="print${i} print"><td>${result.data[i].material}</td>
|
|
|
<td>${result.data[i].nweight}</td><td>`;
|
|
|
@@ -239,9 +236,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
let key = e.which;
|
|
|
var error = 0;
|
|
|
if(key === 13){
|
|
|
- var wuliao = $("#wuliao").val();
|
|
|
+ var string = $("#wuliao").val();
|
|
|
+ var wuliao = string.substr(0,string.indexOf('_')); //原材料
|
|
|
+ var bach = string.substr(string.indexOf('_')+1); //原材料批次号
|
|
|
+ console.log(string.indexOf('_'))
|
|
|
+ console.log(wuliao)
|
|
|
+ console.log(bach)
|
|
|
+ // return false;
|
|
|
$('#input').html();
|
|
|
- $('#input').html(wuliao);
|
|
|
$.ajax({
|
|
|
method: "POST",
|
|
|
url: "feeding/get_material",
|
|
|
@@ -322,9 +324,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
for (var i=0;i<result.data.length;i++){
|
|
|
//扫描的物料=table中的物料,,,变红,否则语音提示
|
|
|
if(result.data[i].material===wuliao){
|
|
|
- if (result.data[i].gy_num == result.process){
|
|
|
+ if (result.data[i].gy_num <= result.process){
|
|
|
$(".material")[i].setAttribute('style','color:red');
|
|
|
$(".nweight")[i].setAttribute('style','color:red');
|
|
|
+ var the_bach = document.getElementsByClassName('bach')[i];
|
|
|
+ console.log(the_bach)
|
|
|
+ the_bach.value = bach;
|
|
|
+ $(".number")[i].focus();
|
|
|
//语音播报
|
|
|
var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
|
|
|
window.speechSynthesis.speak(msg);
|
|
|
@@ -337,15 +343,16 @@ 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++;
|
|
|
+ // }
|
|
|
}
|
|
|
//替代料变扫描的物料
|
|
|
if(result.data[i].material.indexOf('/')!==-1) {
|
|
|
@@ -355,6 +362,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
$(".material")[i].value = wuliao;
|
|
|
$(".material")[i].setAttribute('style', 'color:red');
|
|
|
$(".nweight")[i].setAttribute('style', 'color:red');
|
|
|
+ var the_bach = document.getElementsByClassName('bach')[i];
|
|
|
+ the_bach.value = bach;
|
|
|
+ $(".number")[i].focus();
|
|
|
var msg = new SpeechSynthesisUtterance("应投入物料"+result.data[i].material+"应投入重量"+result.data[i].nweight+"千克");
|
|
|
window.speechSynthesis.speak(msg);
|
|
|
error++;
|
|
|
@@ -398,6 +408,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','jQuery.print','jquery
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ $(document).on('click','.submit',function () {
|
|
|
+ if ($(this).parent().siblings().eq(2).children('input').attr('readonly') == true){
|
|
|
+ layer.confirm('此原材料已经保存',{
|
|
|
+ title:'操作提示',
|
|
|
+ btn:[],
|
|
|
+ closeBtn:0,
|
|
|
+ time:2000
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var material = $(this).parent().siblings().eq(0).children('input').val();
|
|
|
+ var weight = $(this).parent().siblings().eq(2).children('input').val();
|
|
|
+ var bach = $(this).parent().siblings().eq(4).children('input').val();
|
|
|
+ console.log(material)
|
|
|
+ console.log(weight)
|
|
|
+ console.log(bach)
|
|
|
+ })
|
|
|
$('input').keydown( function (e) {
|
|
|
let key = e.which;
|
|
|
if (key == 13) {
|