Zacatek uprav Ramcovy plan

This commit is contained in:
2025-06-10 19:43:13 +02:00
parent fedc940ac4
commit 5fcde65f6b
30 changed files with 1863 additions and 334 deletions

View File

@ -6,7 +6,7 @@ uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Data.DB, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls, Vcl.Mask,
IdHTTP, IdSSLOpenSSL, System.JSON, IdBaseComponent, IdComponent, IdRawBase, IdRawClient, IdIcmpClient,
ddPlugin_TLB, JvExDBGrids, JvDBGrid;
ddPlugin_TLB, JvExDBGrids, JvDBGrid, uPing;
{$I iConsts.inc}
@ -111,6 +111,7 @@ uses System.StrUtils, System.Math,
if not(TryStrToFloat(edtNaPalete.Text, napal)) then
napal:= 0;
if (mn>0) or (pal>0) then
begin
mnSum:= mn;
@ -182,6 +183,7 @@ uses System.StrUtils, System.Math,
sarze:= '';
paletovyList:= '';
try
{
icmpCli.Host:= datMod.getDomainName (datMod.phServer);
try
icmpCLi.Ping();
@ -190,20 +192,34 @@ uses System.StrUtils, System.Math,
except
pingOK:= False;
end;
}
{$IFDEF DEBUG}
i:= 0;
resp:= '{"@context":"/api/contexts/Order","@id":"/api/orders/10","@type":"Order","id":10,"heliosId":null,"name":"Lecitin tekutý","skupzbo":"101","regcis":"652801"'
+ ',"paletovyList":"2500082","quantity":"1000.0000","items":[{"@id":"/api/material_order_items/12","@type":"MaterialOrderItem","id":12,"stockItem":{"@id":"/api/stock_items/47"'
+ ',"@type":"StockItem","id":47,"heliosId":250,"heliosPrijemkaId":84},"stockItemFinal":null,"order":"/api/orders/10","name":"Lecitin tekutý","sarze":"066-03-24-0220"'
+ ',"paletovyList":"2500082","quantity":"1000","dateExp":"2026-08-31T00:00:00+02:00","isCompleted":false,"completedAt":null}],"isCompleted":false,"isUserCompleted":false'
+ ',"completedAt":null,"isFinalCompleted":false}';
{$ELSE}
i:= uPing.Ping (datMod.getDomainName (datMod.phServer), resp);
resp:= '';
if (pingOK) then
begin
respStream:= TStringStream.Create('');
lHTTP.Post (datMod.phServer + '/order', lParamList, respStream);
resp:= respStream.DataString.Replace('\/', '/');
end;
{$ENDIF}
pingOK:= (i=0);
if (pingOK)
{$IFDEF DEBUG} and (1=0) {$ENDIF}
then
begin
respStream:= TStringStream.Create('');
lHTTP.Post ('http://rootvin.datazone.cloud/api/helios/order', lParamList, respStream);
// lHTTP.Post (datMod.phServer + '/order', lParamList, respStream);
resp:= respStream.DataString.Replace('\/', '/');
end;
// log
if (helUtils.SQLObjectExists(Helios, tblHDCPHLog)) and (resp<>'') then
Helios.ExecSQL ('INSERT ' + tblHDCPHLog + ' (LogText, LogTextLong) SELECT N''Dotaz na objednávku materiálu (dle mnoz)'', N' + resp.QuotedString);
if (resp.Contains('neexistuje')) then
errText:= 1;
@ -240,6 +256,10 @@ uses System.StrUtils, System.Math,
else
if (sarze='') and (paletovyList='') then
begin
if (ph1='') then
ph1:= '0';
if (ph2='') then
ph2:= '0';
lSQL:= 'INSERT ' + tblObjednavky + ' (SkupZbo, RegCis, IDKmenZbozi, PaletovyList, Sarze, Mnozstvi, IdPHIdent, IdPHIdent2) SELECT N' + sz.QuotedString;
lSQL:= lSQL + ', N' + rc.QuotedString + ', ' + idKmen.ToString + ', N' + paletovyList.QuotedString + ', N' + sarze.QuotedString + ', ' + mnPL.ToString.Replace(',', '.');
lSQL:= lSQL + ', ' + ph1 + ', ' + ph2;