1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| unit InfoNomen;
interface
uses
querywoservice, bomwoservice, StrUtils, SysUtils;
const
STATUS_FALSE : integer = 1;
STATUS_ERROR_UNKNOWNFUNCTION : integer = 2;
STATUS_ERROR_INVALIDARGUMENT : integer = 3;
STATUS_ERROR_UNKNOWN : integer = 4;
function ElementNR(dXfo : String): Integer;
function ElementMAX(dXfo : String): Integer;
function _ElementNR(): Integer;
function _ElementMAX() : Integer;
implementation
function _ElementNR(): Integer;
var
sIdXfo : String;
nResult : Integer;
begin
sIdXfo := ParamStr(2);
nResult := ElementNR(sIdXfo);
end;
function _ElementMAX(): Integer;
var
sIdXfo : String;
nResult : Integer;
begin
sIdXfo := ParamStr(2);
nResult := ElementMAX(sIdXfo);
end;
function ElementMAX(dXfo : String): Integer;
var
Service1 : iquerywoservice;
Service2 : ibomwoservice;
V_P_FER_MAX : String;
V_P_FER : ArrayOfBomWoDto;
Num: WoDto;
begin
Service1 := querywoservice.GetIQueryWoService(TRUE);
Num := Service1.GetWoCore('DG', StrToInt(Copy(dXfo, 1, (Pos('-', dXfo)-1))));
Service2 := bomwoservice.GetIbomwoservice(TRUE);
V_P_FER := Service2.GetListByVariableWoNo('DG', Num.WoNo, 'V_P_FER');
if (Length(V_P_FER)=2)then begin
if (Pos('N/R',V_P_FER[0].Component)>0)then begin
V_P_FER_MAX := RightStr(V_P_FER[1].Component, 4);
end else
if (Pos('N/R',V_P_FER[1].Component)>0)then begin
V_P_FER_MAX := RightStr(V_P_FER[0].Component, 4);
end;
end;
result := StrToInt(V_P_FER_MAX);
end;
function ElementNR(dXfo : String): Integer;
var
V_P_FER_NR : String;
V_P_FER : ArrayOfBomWoDto;
Service1 : iquerywoservice;
Service2 : ibomwoservice;
Num: WoDto;
begin
Service1 := querywoservice.GetIQueryWoService(TRUE);
Num := Service1.GetWoCore('DG', StrToInt(Copy(dXfo, 1, (Pos('-', dXfo)-1))));
Service2 := bomwoservice.GetIbomwoservice(TRUE);
V_P_FER := Service2.GetListByVariableWoNo('DG', Num.WoNo, 'V_P_FER');
if (Length(V_P_FER)=2)then begin
if (Pos('N/R',V_P_FER[0].Component)>0)then begin
V_P_FER_NR := RightStr(V_P_FER[0].Component, 4);
end else
if (Pos('N/R',V_P_FER[1].Component)>0)then begin
V_P_FER_NR := RightStr(V_P_FER[1].Component, 4);
end;
end;
result := StrToInt(V_P_FER_NR);
end;
end. |
Partager