([])
- /* const [Inicio, setInicio] = useState(currentDate(0))
- const [Fin, setFin] = useState(currentDate(0))
- const [filtro, setFiltro] = useState('')
- */
const [Accion, setAccion] = useState(0)
const [Estatus, setEstatus] = useState(0)
const [IDInvoice, setIDInvoice] = useState(0)
@@ -62,17 +46,10 @@ export default function RptAmazonFinishedClasificationInvoices(
const [header, setHeader] = useState('')
const [show, setShowMsg] = useState(false)
const [msg, setMsg] = useState('')
+ const [WaitingDialog, setWaitingDialog] = useState(false)
+ const [WaitingMessage, setWaitingMessage] = useState('Plantilla de Partes')
const msgColor = 'primary'
-/* function currentDate(days: number): string {
- var today = new Date()
- today.setDate(today.getDate() + days)
- var dd = String(today.getDate()).padStart(2, '0')
- var mm = String(today.getMonth() + 1).padStart(2, '0')
- var yyyy = today.getFullYear()
- return yyyy + '-' + mm + '-' + dd
- } */
-
const loadReport = () => {
DSAmazon.AmazonFinishedClasificationInvoiceGET()
.then((response) => {
@@ -85,9 +62,7 @@ export default function RptAmazonFinishedClasificationInvoices(
}
const downloadExcel = (id: number) => {
- DSAmazon.SePuedeTerminardeClasificarFactura(id)
- .then((response) => {})
- .catch((e: Error) => {})
+ setWaitingDialog(true)
DSAmazon.NoPartesAmazon2SIRGET(id)
.then((response: any) => {
if (response.status === 200) {
@@ -97,11 +72,7 @@ export default function RptAmazonFinishedClasificationInvoices(
link.setAttribute('download', 'Plantilla de partes.xlsx')
document.body.appendChild(link)
link.click()
- DSAmazon.TerminaClasificarFactura(id)
- .then((response) => {})
- .catch((e: Error) => {
- alert('Ocurrio un error' + e.message.toString())
- })
+ setWaitingDialog(false)
}
})
.catch((e: Error) => {
@@ -112,8 +83,7 @@ export default function RptAmazonFinishedClasificationInvoices(
})
}
- useEffect(() => {
- loadReport()
+ const loadProfiles = () => {
DSAmazon.PerfilesParecidosGet('Clasificador')
.then((response) => {
setData(response.data)
@@ -121,10 +91,15 @@ export default function RptAmazonFinishedClasificationInvoices(
.catch((e: Error) => {
alert('Ocurrio un error' + e.message.toString())
})
+ }
+
+ useEffect(() => {
+ loadReport()
+ loadProfiles()
}, [])
const getUser = (Id: number) => {
- const NoAsignado = ' - NO ASIGNADO -'
+ const NoAsignado = 'NO ASIGNADO'
if (Id === 0) return NoAsignado
else if (Data.length) {
const Usuario = Data.filter((item) => item.idUsuario === Id)
@@ -134,9 +109,9 @@ export default function RptAmazonFinishedClasificationInvoices(
}
useEffect(() => {
- if (ShowModal) {
+ if (ShowModal) {
setClasificador(getUser(IDClasificador))
- }
+ }
}, [ShowModal])
const changeToggle = (row: I2096Headers) => {
@@ -148,17 +123,13 @@ export default function RptAmazonFinishedClasificationInvoices(
const returnTO = () => {
DSAmazon.InvoiceReturnState(IDInvoice, 0)
- .then((response) => {
- loadReport()
- setShowModal(false)
- })
- .catch((e: Error) => {
- alert('Ocurrio un error' + e.message.toString())
- })
- }
-
- const openLink = (item: string) => {
- window.open('https://www.amazon.com/dp/' + item)
+ .then((response) => {
+ loadReport()
+ setShowModal(false)
+ })
+ .catch((e: Error) => {
+ alert('Ocurrio un error' + e.message.toString())
+ })
}
return (
@@ -204,6 +175,7 @@ export default function RptAmazonFinishedClasificationInvoices(
Tot currency ISO code |
Tot Monetary amount |
Tot partidas |
+ Clasificador |
|
@@ -305,6 +277,7 @@ export default function RptAmazonFinishedClasificationInvoices(
return row.detail.length
})}
+ {getUser(MasterData.clasificador)} |
+ {
+ setWaitingDialog(false)
+ }}
+ backdrop="static"
+ keyboard={false}
+ size="sm"
+ dialogClassName={'modal-50w'}
+ centered
+ >
+
+
+
+
+
+ Generando {WaitingMessage}...
+
+
+
|
{
- DSAmazon.TerminaClasificarFactura(id)
- .then((response) => {
- DSAmazon.NoPartesAmazon2SIRGET(id)
- .then((response: any) => {
- if (response.status === 200) {
- const url = window.URL.createObjectURL(new Blob([response.data]))
- const link = document.createElement('a')
- link.href = url
- link.setAttribute('download', 'Plantilla de partes.xlsx')
- document.body.appendChild(link)
- link.click()
- setShowModal(false)
- loadReport()
- }
- })
- .catch((e: Error) => {
- setHeader('Error')
- setMsg('Ocurrio un error')
- setShowMsg(true)
- return
- })
- })
- .catch((e: Error) => {})
- }
-
useEffect(() => {
loadReport()
}, [])
@@ -109,67 +86,104 @@ export default function RtpAmazonPendingInvoices(
(child) =>
child.idHeader === IDMaster &&
child.destinationHTSCode.replaceAll('.', '').trim() !==
- child.fraccionGEMCO
+ child.fraccionGEMCO &&
+ child.validaFraccionOriginal !== 3
)
})
return Exceptions && Exceptions.length ? Exceptions[0].length : 0
}
- const facturaTerminada = (row: I2096Headers) => {
- if (!existsExeptions(row.id)) {
- DSAmazon.SePuedeTerminardeClasificarFactura(row.id)
- .then((response) => {
- if (response.data.respuesta.includes('lista')) {
- setIDFactura(row.id)
- setShowModal(true)
- return
- } else {
- setIDFactura(0)
+ const descargaArchivoExcepciones = () => {
+ setShowModalW(false)
+ setWaitingMessage('Archivo de excepciones')
+ setWaitingDialog(true)
+ DSAmazon.ExceptionsFileAmazonGET(IDFactura)
+ .then((response: any) => {
+ if (response.status === 200) {
+ const url = window.URL.createObjectURL(new Blob([response.data]))
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', 'Archivo de excepciones.xlsx')
+ document.body.appendChild(link)
+ link.click()
+ DSAmazon.EnviaEsperaRespuestaAmazon(IDFactura)
+ .then((response) => {
+ loadReport()
+ setWaitingDialog(false)
+ })
+ .catch((e: Error) => {
+ setHeader('Error')
+ setMsg(
+ 'Ocurrio un error, no se pudo actualizar informacion' +
+ e.message.toString()
+ )
+ setShowMsg(true)
+ return
+ })
+
+ }
+ })
+ .catch((e: Error) => {
setHeader('Error')
- setMsg(response.data.respuesta)
+ setMsg('Ocurrio un error')
setShowMsg(true)
return
- }
- })
- .catch((e: Error) => {
- setIDFactura(0)
- setHeader('Error')
- setMsg('Ocurrio un error')
- setShowMsg(true)
- return
- })
- } else {
- DSAmazon.SePuedeTerminardeClasificarFacturaEsperandoRespuesta(row.id)
- .then((response) => {
- if (response.data.respuesta.includes('lista')) {
- setIDFactura(row.id)
- setShowModalW(true)
- return
- } else {
- setIDFactura(0)
+ })
+ }
+
+ const descargaPantillaPartes = () => {
+ setShowModal(false)
+ setWaitingMessage('Plantilla de partes')
+ setWaitingDialog(true)
+ DSAmazon.NoPartesAmazon2SIRGET(IDFactura)
+ .then((response: any) => {
+ if (response.status === 200) {
+ const url = window.URL.createObjectURL(new Blob([response.data]))
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', 'Plantilla de partes.xlsx')
+ document.body.appendChild(link)
+ link.click()
+ DSAmazon.TerminaClasificarFactura(IDFactura)
+ .then((response) => {
+ loadReport()
+ setWaitingDialog(false)
+ })
+ .catch((e: Error) => {
+ setHeader('Error')
+ setMsg(
+ 'Ocurrio un error, no se pudo actualizar informacion' +
+ e.message.toString()
+ )
+ setShowMsg(true)
+ return
+ })
+ }
+ })
+ .catch((e: Error) => {
setHeader('Error')
- setMsg(response.data.respuesta)
+ setMsg('Ocurrio un error')
setShowMsg(true)
return
- }
- })
- .catch((e: Error) => {
- setIDFactura(0)
- setHeader('Error')
- setMsg('Ocurrio un error')
- setShowMsg(true)
- return
- })
- }
+ })
}
-
- const send2WaitingProcess = (id: number) => {
- DSAmazon.EnviaEsperaRespuestaAmazon(id)
- .then((response) => {
- setShowModalW(false)
- loadReport()
- })
- .catch((e: Error) => {})
+
+ const facturaTerminada = (row: I2096Headers) => {
+ DSAmazon.SePuedeTerminardeClasificarFactura(row.id).then((response) => {
+ if (response.data.estatus === 0) {
+ setIDFactura(0)
+ setHeader('Error')
+ setMsg(response.data.respuesta)
+ setShowMsg(true)
+ return
+ } else if (response.data.estatus === 1) {
+ setIDFactura(row.id)
+ setShowModalW(true)
+ } else if (response.data.estatus === 2) {
+ setIDFactura(row.id)
+ setShowModal(true)
+ }
+ })
}
return (
@@ -228,7 +242,13 @@ export default function RtpAmazonPendingInvoices(
Perfil !== 'Clasificador lider'
) {
return a
- } else if ( ["Clasificador lider", "Administrador"].includes(Perfil)) {return a}
+ } else if (
+ ['Clasificador lider', 'Administrador'].includes(
+ Perfil
+ )
+ ) {
+ return a
+ }
})
.map((MasterData) => {
return (
@@ -332,9 +352,6 @@ export default function RtpAmazonPendingInvoices(
})}
|
- {' '}
- {/* Componente: Asigna clasificador */}
- {/* {Perfil==='Clasificador lider' ? 'Modifica' : 'NO MODIFICA'} */}
- Confirme fraccion
+ Confirme
+ fraccion
- La factura esta lista para terminarse y pasarse al siguiente proceso?
+ ¿La factura esta lista para terminarse y pasarse al siguiente
+ proceso?
@@ -646,7 +665,7 @@ export default function RtpAmazonPendingInvoices(
| |