git-svn-id: https://192.168.0.254/svn/Proyectos.Varela_PuntosVenta/trunk@68 1c943782-d109-9647-9548-93b3ac332352
This commit is contained in:
parent
2506a3ba09
commit
4c1303a7f9
@ -45,6 +45,27 @@
|
||||
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Language><Language Name="RootDir">C:\Archivos de programa\Borland\Delphi7\Bin\</Language></Language><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">2</VersionInfo><VersionInfo Name="Release">5</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">3082</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Rodax Software S.L.</VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.2.5.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName">AdminPV_Server</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.2.5.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys><VersionInfoKeys Name="CompileDate">miércoles, 12 de septiembre de 2007 18:52</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">AdminPV_Server.dpr</Source></Source><Excluded_Packages>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Excluded_Packages Name="C:\Varela_D2007\Lib\DevExpressVCL\dxPSCoreD10.bpl">ExpressPrinting System by Developer Express Inc.</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDS)\bin\dclwebsnap100.bpl">CodeGear WebSnap Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDS)\bin\dclsoap100.bpl">CodeGear SOAP Components</Excluded_Packages>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,7 +1,9 @@
|
||||
inherited EDI_Inventary: TEDI_Inventary
|
||||
object EDI_Inventary: TEDI_Inventary
|
||||
OldCreateOrder = True
|
||||
Left = 200
|
||||
Top = 200
|
||||
OnAfterProcessTransactionAction = pptaNone
|
||||
ExportedDataTables = <>
|
||||
CacheElements = <>
|
||||
Options = [rsoProcessDeltasWithoutUpdateRules]
|
||||
Height = 300
|
||||
Width = 300
|
||||
end
|
||||
|
||||
@ -23,6 +23,7 @@ type
|
||||
{ TEDI_Inventary }
|
||||
TEDI_Inventary = class(TDARemoteService, IEDI_Inventary)
|
||||
private
|
||||
procedure InsertarLog(OK : Boolean; Error_msg : String = '');
|
||||
protected
|
||||
{ IEDI_Inventary methods }
|
||||
function CargarFicheroEDI(const FicheroCAB: String; const FicheroLIN: String; const FicheroCANT: String; out MsgError: String): Boolean;
|
||||
@ -32,7 +33,8 @@ implementation
|
||||
|
||||
{$R *.dfm}
|
||||
uses
|
||||
{Generated:} VARELA_Invk;
|
||||
{Generated:} VARELA_Invk, uDataModuleServer,
|
||||
JclFileUtils, DateUtils, EDI_Log_Impl, uDataModuleEDI_Inventary;
|
||||
|
||||
procedure Create_EDI_Inventary(out anInstance : IUnknown);
|
||||
begin
|
||||
@ -41,7 +43,91 @@ end;
|
||||
|
||||
{ EDI_Inventary }
|
||||
function TEDI_Inventary.CargarFicheroEDI(const FicheroCAB: String; const FicheroLIN: String; const FicheroCANT: String; out MsgError: String): Boolean;
|
||||
var
|
||||
ADirEntrada : String;
|
||||
ADirTemp : String;
|
||||
NumRegNuevos : Integer;
|
||||
|
||||
procedure GuardarFicheros;
|
||||
var
|
||||
AAlmacen : String;
|
||||
ADate : String;
|
||||
begin
|
||||
DateTimeToString(ADate, 'yyyymmddhhnn', Now);
|
||||
AAlmacen := PathAddSeparator(dmServer.FDirAlmacen);
|
||||
AAlmacen := PathAddSeparator(AAlmacen + ADate);
|
||||
if not DirectoryExists(AAlmacen) then
|
||||
ForceDirectories(AAlmacen);
|
||||
FileMove(ADirTemp + FicheroCAB, AAlmacen + FicheroCAB);
|
||||
FileMove(ADirTemp + FicheroLIN, AAlmacen + FicheroLIN);
|
||||
FileMove(ADirTemp + FicheroCANT, AAlmacen + FicheroCANT);
|
||||
DeleteDirectory(ADirTemp, False);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
// Hay que comprobar que existen los ficheros.
|
||||
ADirEntrada := PathAddSeparator(dmServer.FDirEntrada);
|
||||
|
||||
if not FileExists(ADirEntrada + FicheroCAB) or
|
||||
not FileExists(ADirEntrada + FicheroLIN) or
|
||||
not FileExists(ADirEntrada + FicheroCANT) then
|
||||
begin
|
||||
MsgError := 'No hay ficheros de datos';
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI1 INV)');
|
||||
end
|
||||
else begin
|
||||
|
||||
// Muevo los ficheros de carga a un directorio temporal
|
||||
ADirTemp := PathAddSeparator(ADirEntrada + GetTempDirectory(ADirEntrada));
|
||||
try
|
||||
if not DirectoryExists(ADirTemp) then
|
||||
ForceDirectories(ADirTemp);
|
||||
FileMove(ADirEntrada + FicheroCAB, ADirTemp + FicheroCAB);
|
||||
FileMove(ADirEntrada + FicheroLIN, ADirTemp + FicheroLIN);
|
||||
FileMove(ADirEntrada + FicheroCANT, ADirTemp + FicheroCANT);
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
MsgError := E.Message;
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI2 INV)');
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
try
|
||||
try
|
||||
dmEDIInventary.CargarFicheros (ADirTemp + FicheroCAB, ADirTemp + FicheroLIN, ADirTemp + FicheroCANT, NumRegNuevos);
|
||||
if NumRegNuevos > 0 then
|
||||
InsertarLog(True, Format('Se han cargado %d registros de inventario nuevos', [NumRegNuevos]))
|
||||
else
|
||||
InsertarLog(True, 'El fichero se ha cargado pero no hay registros de inventario nuevos');
|
||||
Result := True;
|
||||
finally
|
||||
GuardarFicheros;
|
||||
dmServer.BorrarFicherosDeCargaAntiguos;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
MsgError := E.Message;
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI3 INV)');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEDI_Inventary.InsertarLog(OK: Boolean; Error_msg: String);
|
||||
var
|
||||
LogService : IEDI_Log;
|
||||
begin
|
||||
LogService := EDI_Log_Impl.TEDI_Log.Create(Self);
|
||||
try
|
||||
LogService.InsertarLog(Now, 'INVRPT', OK, Error_msg);
|
||||
finally
|
||||
LogService := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
inherited EDI_Sales: TEDI_Sales
|
||||
object EDI_Sales: TEDI_Sales
|
||||
OldCreateOrder = True
|
||||
Left = 200
|
||||
Top = 200
|
||||
OnAfterProcessTransactionAction = pptaNone
|
||||
ExportedDataTables = <>
|
||||
CacheElements = <>
|
||||
Options = [rsoProcessDeltasWithoutUpdateRules]
|
||||
Height = 300
|
||||
Width = 300
|
||||
end
|
||||
|
||||
@ -23,6 +23,7 @@ type
|
||||
{ TEDI_Sales }
|
||||
TEDI_Sales = class(TDARemoteService, IEDI_Sales)
|
||||
private
|
||||
procedure InsertarLog(OK : Boolean; Error_msg : String = '');
|
||||
protected
|
||||
{ IEDI_Sales methods }
|
||||
function CargarFicheroEDI(const FicheroCAB: String; const FicheroLUG: String; const FicheroART: String; out MsgError: String): Boolean;
|
||||
@ -32,7 +33,8 @@ implementation
|
||||
|
||||
{$R *.dfm}
|
||||
uses
|
||||
{Generated:} VARELA_Invk;
|
||||
{Generated:} VARELA_Invk, uDataModuleServer, uDataModuleEDI_Sales,
|
||||
EDI_Log_Impl, JclFileUtils, DateUtils;
|
||||
|
||||
procedure Create_EDI_Sales(out anInstance : IUnknown);
|
||||
begin
|
||||
@ -41,7 +43,94 @@ end;
|
||||
|
||||
{ EDI_Sales }
|
||||
function TEDI_Sales.CargarFicheroEDI(const FicheroCAB: String; const FicheroLUG: String; const FicheroART: String; out MsgError: String): Boolean;
|
||||
var
|
||||
ADirEntrada : String;
|
||||
ADirTemp : String;
|
||||
NumRegNuevos : Integer;
|
||||
|
||||
procedure GuardarFicheros;
|
||||
var
|
||||
AAlmacen : String;
|
||||
ADate : String;
|
||||
begin
|
||||
DateTimeToString(ADate, 'yyyymmddhhnn', Now);
|
||||
AAlmacen := PathAddSeparator(dmServer.FDirAlmacen);
|
||||
AAlmacen := PathAddSeparator(AAlmacen + ADate);
|
||||
if not DirectoryExists(AAlmacen) then
|
||||
ForceDirectories(AAlmacen);
|
||||
FileMove(ADirTemp + FicheroCAB, AAlmacen + FicheroCAB);
|
||||
FileMove(ADirTemp + FicheroLUG, AAlmacen + FicheroLUG);
|
||||
FileMove(ADirTemp + FicheroART, AAlmacen + FicheroART);
|
||||
FileMove(ADirTemp + FicheroART, AAlmacen + 'CONVEN.TXT');
|
||||
DeleteDirectory(ADirTemp, False);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
NumRegNuevos := 0;
|
||||
|
||||
// Hay que comprobar que existen los ficheros.
|
||||
ADirEntrada := PathAddSeparator(dmServer.FDirEntrada);
|
||||
|
||||
if not FileExists(ADirEntrada + FicheroCAB) or
|
||||
not FileExists(ADirEntrada + FicheroLUG) or
|
||||
not FileExists(ADirEntrada + FicheroART) then
|
||||
begin
|
||||
MsgError := 'No hay ficheros de datos';
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI1 SLS)');
|
||||
end
|
||||
else begin
|
||||
|
||||
// Muevo los ficheros de carga a un directorio temporal
|
||||
ADirTemp := PathAddSeparator(ADirEntrada + GetTempDirectory(ADirEntrada));
|
||||
try
|
||||
if not DirectoryExists(ADirTemp) then
|
||||
ForceDirectories(ADirTemp);
|
||||
FileMove(ADirEntrada + FicheroCAB, ADirTemp + FicheroCAB);
|
||||
FileMove(ADirEntrada + FicheroLUG, ADirTemp + FicheroLUG);
|
||||
FileMove(ADirEntrada + FicheroART, ADirTemp + FicheroART);
|
||||
FileMove(ADirEntrada + FicheroART, ADirTemp + 'CONVEN.TXT');
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
MsgError := E.Message;
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI2 SLS)');
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
try
|
||||
try
|
||||
dmEDISales.CargarFicheros (ADirTemp + FicheroCAB, ADirTemp + FicheroLUG, ADirTemp + FicheroART, NumRegNuevos);
|
||||
if NumRegNuevos > 0 then
|
||||
InsertarLog(True, Format('Se han cargado %d registros de ventas nuevos', [NumRegNuevos]))
|
||||
else
|
||||
InsertarLog(True, 'El fichero se ha cargado pero no hay registros de ventas nuevos');
|
||||
Result := True;
|
||||
finally
|
||||
GuardarFicheros;
|
||||
dmServer.BorrarFicherosDeCargaAntiguos;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
MsgError := E.Message;
|
||||
InsertarLog(False, MsgError + ' (CargarFicheroEDI3 SLS)');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEDI_Sales.InsertarLog(OK: Boolean; Error_msg: String);
|
||||
var
|
||||
LogService : IEDI_Log;
|
||||
begin
|
||||
LogService := EDI_Log_Impl.TEDI_Log.Create(Self);
|
||||
try
|
||||
LogService.InsertarLog(Now, 'SLSRPT', OK, Error_msg);
|
||||
finally
|
||||
LogService := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
Loading…
Reference in New Issue
Block a user