Last stable version working for several weeks

AmazonRelease1.1
unknown 1 year ago
parent f1cd71200d
commit 3451df926a
  1. 43
      src/Components/Clientes/Amazon/Reportes/Payed/RptAmazonPayedOperations.tsx
  2. 7
      src/Components/Clientes/Amazon/Services/Amazon.Services.ts
  3. 10
      src/Components/Utils/MFileManager/MFileManager.tsx
  4. 2
      src/Services/common/http-common.ts

@ -28,6 +28,7 @@ import { FaAmazon } from 'react-icons/fa'
import loadingImg from '../../../../../images/ajaxloader.gif' import loadingImg from '../../../../../images/ajaxloader.gif'
import { MFileManager } from '../../../../Utils/MFileManager/MFileManager' import { MFileManager } from '../../../../Utils/MFileManager/MFileManager'
import DTO2096RptPayedOperations from '../../DTO/DTO2096RptPayedOperations' import DTO2096RptPayedOperations from '../../DTO/DTO2096RptPayedOperations'
import { GoGear } from "react-icons/go";
export interface IRptAmazonPayedOpereationsProps {} export interface IRptAmazonPayedOpereationsProps {}
@ -191,6 +192,33 @@ export default function RptAmazonPayedOpereations(
}) })
} }
const createACKFile = (referencia: string) => {
DSAmazon.CreateACKFile(referencia)
.then((response: any) => {
DSAmazon.UploadACKFile2Amazon(referencia)
.then((response: any) => {
setHeader('Informativo')
setMsg('Se envio el archivo ACK a Amazon')
setShowMsg(true)
loadReport()
return
})
.catch((e: Error) => {
console.log(JSON.stringify(e))
setHeader('Error')
setMsg('Ocurrio un error '+e)
setShowMsg(true)
return
})
})
.catch((e: Error) => {
setHeader('Error')
setMsg('Ocurrio un error')
setShowMsg(true)
return
})
}
useEffect(() => { useEffect(() => {
loadReport() loadReport()
}, []) }, [])
@ -448,6 +476,19 @@ export default function RptAmazonPayedOpereations(
<td style={{ textAlign: 'center', width: '100px' }}> <td style={{ textAlign: 'center', width: '100px' }}>
{MasterData.pedimento} {MasterData.pedimento}
</td> </td>
{MasterData.archivoACK==='' ?
<td style={{textAlign:'center'}}>
<div
onClick={() => { createACKFile(MasterData.referencia) }}
>
<IconContext.Provider
value={{ color: 'orange', size: '22px' }}
>
<GoGear />
</IconContext.Provider>
</div>
</td>
:
<td <td
style={{ textAlign: 'center', width: '100px' }} style={{ textAlign: 'center', width: '100px' }}
onClick={() => { onClick={() => {
@ -456,6 +497,8 @@ export default function RptAmazonPayedOpereations(
> >
{getOnlyDate(MasterData.fhArchivoACK)} {getOnlyDate(MasterData.fhArchivoACK)}
</td> </td>
}
</tr> </tr>
</> </>
) )

@ -163,8 +163,15 @@ class AmazonDataService {
}) })
.catch(function (error) { .catch(function (error) {
console.log(error) console.log(error)
return error
}) })
} }
CreateACKFile(referencia: string) {
return http.get<Boolean>(`/AmazonInvoice/createACKFile?Referencia=`+referencia)
}
UploadACKFile2Amazon(referencia: string) {
return http.get<Boolean>(`/AmazonInvoice/UploadACKFile2Amazon?Referencia=`+referencia)
}
AsignaFacturasReferencia(data: DTO2096LinkInvoice2Reference) { AsignaFacturasReferencia(data: DTO2096LinkInvoice2Reference) {
return http.post<Boolean>(`/AmazonInvoice/AsignaFacturasReferencia`, data) return http.post<Boolean>(`/AmazonInvoice/AsignaFacturasReferencia`, data)
} }

@ -106,13 +106,15 @@ export const MFileManager: FC<IProps> = (props) => {
const blob = new Blob([response.data], { type: 'image/png' }) const blob = new Blob([response.data], { type: 'image/png' })
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
window.open(url) window.open(url)
} else if ( } else if (row.nombreArchivo.toLowerCase().endsWith('.xlsx')) {
row.nombreArchivo.toLowerCase().endsWith('.xls') ||
row.nombreArchivo.toLowerCase().endsWith('.xlsx')
) {
const blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) const blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
window.open(url) window.open(url)
} else if (
row.nombreArchivo.toLowerCase().endsWith('.xls')) {
const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' })
const url = window.URL.createObjectURL(blob)
window.open(url)
} else { } else {
const url = window.URL.createObjectURL(new Blob([response.data])) const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a') const link = document.createElement('a')

@ -30,7 +30,7 @@ instance.interceptors.response.use(
409 === error.response.status && 409 === error.response.status &&
error.response.data.respuesta.indexOf('factura') error.response.data.respuesta.indexOf('factura')
) { ) {
console.log(JSON.stringify(error.response)) //console.log(JSON.stringify(error.response))
if (error.response.data.registro.factura) { if (error.response.data.registro.factura) {
error.response.data.registro.id === -1 error.response.data.registro.id === -1
? alert( ? alert(

Loading…
Cancel
Save