499 lines
13 KiB
JavaScript
499 lines
13 KiB
JavaScript
///////////////////////////////////////////
|
|
////////T O O L B A R /////////////////////
|
|
///////////////////////////////////////////
|
|
|
|
|
|
/////////////////////////////////////////////7
|
|
function checkFields()
|
|
/////////////////////////////////////////////7
|
|
{
|
|
//R per required
|
|
//isNum per numerico
|
|
//isNumKey è una chiave.. uguale a isNum>0 ma cambio il messaggio
|
|
//isNum>x per numerico maggiore di x
|
|
//isNum<x per numerico minore di x
|
|
//isEmail per indirizzo email
|
|
//inRange1:10 per ..
|
|
//3 stringhe
|
|
//1: nome del field
|
|
//2: se '' visualizza il nome del field, altrimenti questo campo
|
|
//3: R/N+''/isNum/isEmail/inRangea:b
|
|
return Ab.validateForm('descrizione', 'Descrizione', 'R', 'id_tipo', 'Tipo', 'RisNumKey', 'id_iva', 'Iva', 'RisNumKey');
|
|
|
|
}
|
|
|
|
/////////////////////////////////////////////7
|
|
function checkSearchFields()
|
|
/////////////////////////////////////////////7
|
|
{
|
|
if (document.main.crNS == 1)
|
|
return false;
|
|
else {
|
|
//return Ab.validateForm('descrizione','Descrizione','R','numero','Numero','RisNum>0','eMail','','NisEmail');
|
|
return true;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function checkBoxes()
|
|
/////////////////////////////////////////////
|
|
{
|
|
//Ab.setChekBoxValue("dettaglio","flgSommaCRL","1","0");
|
|
|
|
}
|
|
|
|
function checkRadio() {
|
|
//Ab.setRadioButtonValue("dettaglio","flgPlaAntPos");
|
|
}
|
|
|
|
function checkBoxesCR()
|
|
/////////////////////////////////////////////
|
|
{
|
|
//Ab.setChekBoxValue("ricerca","flgSommaCRL","1","0");
|
|
}
|
|
|
|
function checkRadioCR() {
|
|
//Ab.setRadioButtonValue("ricerca","flgPlaAntPos");
|
|
|
|
}
|
|
/////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////
|
|
function addRow()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
if (Ab.validateForm('id_componente', 'Componente', 'R')) {
|
|
f.cmd.value = "addComponente";
|
|
f.act.value = "";
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
function delRow(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "delComponente";
|
|
f.act.value = "";
|
|
f.id_articoloFilatoComponente.value = l_id;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
/////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////
|
|
function addColore()
|
|
/////////////////////////////////////////////
|
|
{
|
|
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
if (Ab.validateForm('id_coloreFilato', 'Colore', 'R')) {
|
|
f.cmd.value = "addColore";
|
|
f.act.value = "";
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
function delColore(l_id)
|
|
/////////////////////////////////////////////
|
|
{
|
|
if (Ab.confirmDelete()) {
|
|
var f = document.main;
|
|
f.action = f.actionPage.value;
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "delColore";
|
|
f.act.value = "";
|
|
f.id_articoloFilatoColore.value = l_id;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* DETTAGLIO ARTICOLO VARIANTI da CR */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function dettaglioArticoliFilatiCR(l_id) {
|
|
/*
|
|
var f = document.main;
|
|
theAction=webApp+"/admin/art/Articolo.abl?cmd=viewM&id_articolo="+l_id;
|
|
wArticolo=window.open(theAction, "Lista_Varianti","width=810,height=600,status=yes,resizable=yes,top=100,left=100,scrollbars=yes");
|
|
wArticolo.focus();
|
|
*/
|
|
|
|
$(".mov-body").load("../filato/ArticoloFilatoColore.abl?cmd=dettaglioDisponibilita&id_articoloFilato=" + l_id);
|
|
|
|
$("#modalMov").modal("show");
|
|
|
|
|
|
}
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* DETTAGLIO ARTICOLO VARIANTI da dettaglio filato */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function dettaglioArticoliFilatiColoreCR(l_id) {
|
|
/*
|
|
var f = document.main;
|
|
theAction=webApp+"/admin/art/Articolo.abl?cmd=viewM&id_articolo="+l_id;
|
|
wArticolo=window.open(theAction, "Lista_Varianti","width=810,height=600,status=yes,resizable=yes,top=100,left=100,scrollbars=yes");
|
|
wArticolo.focus();
|
|
*/
|
|
|
|
$(".mov-body").load("../filato/ArticoloFilatoColore.abl?cmd=dettaglioDisponibilita&id_articoloFilatoColore=" + l_id);
|
|
|
|
$("#modalMov").modal("show");
|
|
|
|
|
|
}
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* toggle dettaglio popup articolo filato */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
|
|
function toggleDetail() {
|
|
if ($("#detail").hasClass("out")) {
|
|
$("#detail").addClass("in");
|
|
$("#detail").removeClass("out");
|
|
} else {
|
|
$("#detail").addClass("out");
|
|
$("#detail").removeClass("in");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/************************************/
|
|
/************************************/
|
|
/* popup e comando IMPOSTA TELAIO */
|
|
/************************************/
|
|
/************************************/
|
|
function impostaTelaioPopup(l_id) {
|
|
$("#id_documento").val(l_id);
|
|
$("#impostaTelaio").modal("show");
|
|
setTimeout(function () {
|
|
{
|
|
Ab.setFocus("id_telaioR");
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
function impostaColpiInizialiPopup(l_id) {
|
|
impostaTelaioPopup(l_id);
|
|
}
|
|
|
|
function impostaTelaio() {
|
|
|
|
var f = document.main;
|
|
if (Ab.validateForm('id_telaioR', 'Telaio', 'RisNumKey', 'colpoInizialeR', 'Colpi Iniziali', 'RisNum>0')) {
|
|
|
|
|
|
$("#impostaTelaio").modal("hide");
|
|
setTimeout(function () {
|
|
{
|
|
f.action = f.actionPage.value;
|
|
f.cmd.value = "impostaTelaio";
|
|
//f.act.value="view";
|
|
|
|
Ab.submitAj('main');
|
|
|
|
}
|
|
|
|
}, 500);
|
|
}
|
|
}
|
|
|
|
|
|
/************************************/
|
|
/************************************/
|
|
/* popup e comando IMPOSTA colpi FINALI */
|
|
/************************************/
|
|
/************************************/
|
|
function impostaColpiFinaliPopup(l_id, colpiIniziali) {
|
|
$("#id_documento").val(l_id);
|
|
$("#colpiInizialiShow").html(colpiIniziali);
|
|
$("#impostaColpiFinali").modal("show");
|
|
setTimeout(function () {
|
|
{
|
|
Ab.setFocus("colpiFinaliR");
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
|
|
function impostaColpiFinali() {
|
|
|
|
var f = document.main;
|
|
if (Ab.validateForm('colpoFinaleR', 'Colpi Finali', 'RisNum')) {
|
|
|
|
|
|
$("#impostaColpiFinali").modal("hide");
|
|
setTimeout(function () {
|
|
{
|
|
f.action = f.actionPage.value;
|
|
f.cmd.value = "impostaColpiFinali";
|
|
//f.act.value="view";
|
|
|
|
Ab.submitAj('main');
|
|
|
|
}
|
|
|
|
}, 500);
|
|
}
|
|
}
|
|
|
|
|
|
/************************************/
|
|
/************************************/
|
|
/* popup e comando AGGIUNGI PEZZA */
|
|
/************************************/
|
|
/************************************/
|
|
function aggiungiPezzaPopup(l_id_rigaBolla) {
|
|
$("#id_rigaDocumento").val(l_id_rigaBolla);
|
|
$("#aggiungiPezza").modal("show");
|
|
setTimeout(function () {
|
|
{
|
|
Ab.setFocus("codicePezza");
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
|
|
function aggiungiPezza() {
|
|
|
|
var f = document.main;
|
|
|
|
$("#aggiungiPezza").modal("hide");
|
|
setTimeout(function () {
|
|
{
|
|
f.action = f.actionPage.value;
|
|
f.cmd.value = "aggiungiPezza";
|
|
//f.act.value="view";
|
|
|
|
Ab.submitAj('main');
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
/************************************/
|
|
/************************************/
|
|
/* chiama scanner barcode da webview android */
|
|
/************************************/
|
|
/************************************/
|
|
function scan(field) {
|
|
|
|
Android.scanBarcode(field);
|
|
}
|
|
|
|
|
|
/************************************/
|
|
/************************************/
|
|
/* chiama scanner barcode da webview android */
|
|
/************************************/
|
|
/************************************/
|
|
function mostraDocumento(l_id) {
|
|
|
|
var f = document.main;
|
|
f.action = "../contab/Documento.abl";
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "md";
|
|
f.act.value = "";
|
|
f.id_documento.value = l_id;
|
|
Ab.submitAj('main');
|
|
}
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* MOSTRA DETTAGLIO PEZZE su popup */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function mostraPezze(l_id) {
|
|
|
|
|
|
$(".pezze-body").load("../lav/LavTessitura.abl?cmd=dettaglioPezze&id_documento=" + l_id);
|
|
|
|
|
|
$("#modalPezze").modal("show");
|
|
|
|
/*
|
|
$( "#dettaglioWin" ).dialog("option", "title", "Dettaglio Articolo Varianti");
|
|
$("#dettaglioWin").load("Articolo.abl?cmd=viewM&id_articolo="+l_id);
|
|
$("#dettaglioWin").dialog("open");
|
|
*/
|
|
}
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* TROVA COLPI INIZIALI */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function trovaColpiIniziali() {
|
|
|
|
var id_telaio = $("#id_telaioR").val(),
|
|
actionPage = $("#actionPage").val();
|
|
|
|
|
|
if (id_telaio == 0) {
|
|
//alert('pio');
|
|
} else {
|
|
//alert("cmd=caricaColoreFilato&id_articoloFilato=" + id_articoloFilato);
|
|
Ab.fetch4(actionPage, "cmd=trovaColpiIniziali&id_telaio=" + id_telaio, null, "postTrovaColpiIniziali()");
|
|
}
|
|
}
|
|
|
|
|
|
function postTrovaColpiIniziali(response) {
|
|
//in response ho il risultato di _fetchCombFilatoColore.jsp
|
|
|
|
$("#colpoInizialeR").val(response);
|
|
Ab.setFocus("colpoInizialeR");
|
|
|
|
}
|
|
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* COMANDI SULLE RIGHE PER AGGIRNARE I VARI CAMPI*/
|
|
/* PARAMETRI: nomeCampo, id*/
|
|
/***********************************************/
|
|
/***********************************************/
|
|
|
|
function updateLTSField(campo, id) {
|
|
|
|
var f = document.main;
|
|
var actionPage = f.actionPage.value,
|
|
value = $("#" + campo + "_" + id).val();
|
|
|
|
//alert(campo+" "+id+" "+tab+" "+value);
|
|
//basta la fetch
|
|
|
|
//alert("cmd=updateTdField&act=" + campo+"&id_tableDesc="+id+"&value="+value);
|
|
if (true) {
|
|
f.action = actionPage;
|
|
f.cmd.value = "updateLTSField";
|
|
f.act.value = "refresh";
|
|
f.fieldName.value = campo;
|
|
f.id_rigaDocumento.value = id;
|
|
f.value.value = value;
|
|
Ab.submitAj("main");
|
|
} else {
|
|
|
|
|
|
Ab.fetch4(actionPage, "cmd=updateLTSField&fieldName=" + campo + "&id_rigaDocumento=" + id + "&value=" + value, null, postUpdateLTSField);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function postUpdateLTSField(response) {
|
|
if (response && response.trim() != "") {
|
|
var messaggio = response;
|
|
$('#messaggi').html(messaggio);
|
|
|
|
if ($('#messaggi').length > 0 && $('#messaggi').html().length > 0) {
|
|
Ab.showMessage($('#messaggi').html());
|
|
}
|
|
}
|
|
}
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* riapri riga */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function riapriRiga(id) {
|
|
Swal.fire({
|
|
title: "Riapri Riga",
|
|
text: "Verranno azzerati i colpi finali. Sei Sicuro?",
|
|
icon: "warning",
|
|
showDenyButton: true,
|
|
showCancelButton: false,
|
|
confirmButtonText: `Si`,
|
|
denyButtonText: `No`,
|
|
cancelButtonText: `Annulla`,
|
|
}).then((result) => {
|
|
/* Read more about isConfirmed, isDenied below */
|
|
if (result.isConfirmed) {
|
|
////////////////////////////////////////////////////////////////////
|
|
$("#main").attr("action", $("#actionPage").val());
|
|
$("#flgReport").val("S");
|
|
$("#cmd", "#main").val("updateLTSField");
|
|
$("#act", "#main").val("refresh");
|
|
$("#fieldName").val("colpoFinaleRiga");
|
|
$("#value").val("0");
|
|
$("#id_rigaDocumento").val(id);
|
|
Ab.submitAj('main');
|
|
////////////////////////////////////////////////////////////////////
|
|
} else if (result.isDenied) {
|
|
//Swal.fire('Changes are not saved', '', 'info')
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* imposta i colpi iniziali sulla riga corrente */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function setColpiIniziali(id) {
|
|
$("#colpoInizialeRiga_" + id).val(0);
|
|
|
|
updateLTSField('colpoInizialeRiga', id)
|
|
}
|
|
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* annulla in lavorazione e ritprnda da pianificare */
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function annullaStatoLavorazione(id) {
|
|
Swal.fire({
|
|
title: "Annulla Lavorazione",
|
|
text: "Verra' riportata la riga nello stato da pianificare. Sei Sicuro?",
|
|
icon: "warning",
|
|
showDenyButton: true,
|
|
showCancelButton: false,
|
|
confirmButtonText: `Si`,
|
|
denyButtonText: `No`,
|
|
cancelButtonText: `Annulla`,
|
|
}).then((result) => {
|
|
/* Read more about isConfirmed, isDenied below */
|
|
if (result.isConfirmed) {
|
|
////////////////////////////////////////////////////////////////////
|
|
$("#main").attr("action", $("#actionPage").val());
|
|
$("#flgReport").val("S");
|
|
$("#cmd", "#main").val("annullaStatoLavorazione");
|
|
$("#id_rigaDocumento").val(id);
|
|
Ab.submitAj('main');
|
|
////////////////////////////////////////////////////////////////////
|
|
} else if (result.isDenied) {
|
|
//Swal.fire('Changes are not saved', '', 'info')
|
|
}
|
|
})
|
|
|
|
}
|