Commit 6e5be87d authored by kravtsov's avatar kravtsov

[+] Добавлена запись тега 1162

[+] Добавлена проверка кода маркировки для мехов и лекарств
parent df011afe
......@@ -4,6 +4,14 @@
Company : SHTRIH-M, Russia, Moscow, Masterkova 4
(495) 787-60-90, www.shtrih-m.ru
*******************************************************************
OposShtrih_1.13_472.exe
12 февраля 2018 20:40
[+] Добавлена запись тега 1162
[+] Добавлена проверка кода маркировки для мехов и лекарств
*******************************************************************
OposShtrih_1.13_471.exe
......
object fmFptrReceipt: TfmFptrReceipt
Left = 313
Top = 184
Left = 689
Top = 154
Width = 512
Height = 498
Caption = 'Receipt'
......@@ -16,12 +16,12 @@ object fmFptrReceipt: TfmFptrReceipt
object gbParams: TGroupBox
Left = 8
Top = 8
Width = 225
Height = 345
Width = 481
Height = 417
TabOrder = 0
DesignSize = (
225
345)
481
417)
object lblDefaultDepartment: TLabel
Left = 8
Top = 16
......@@ -92,10 +92,17 @@ object fmFptrReceipt: TfmFptrReceipt
Height = 13
Caption = 'Quantity length:'
end
object lblPrintRecMessageMode: TLabel
Left = 8
Top = 256
Width = 116
Height = 13
Caption = 'PrintRecMessage mode:'
end
object cbCutType: TComboBox
Left = 96
Left = 136
Top = 40
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -107,9 +114,9 @@ object fmFptrReceipt: TfmFptrReceipt
'No cut')
end
object cbEncoding: TComboBox
Left = 96
Left = 136
Top = 64
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -120,9 +127,9 @@ object fmFptrReceipt: TfmFptrReceipt
'CP866')
end
object cbStatusCommand: TComboBox
Left = 96
Left = 136
Top = 88
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -134,9 +141,9 @@ object fmFptrReceipt: TfmFptrReceipt
'Long status, 11h')
end
object cbHeaderType: TComboBox
Left = 96
Left = 136
Top = 112
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -148,9 +155,9 @@ object fmFptrReceipt: TfmFptrReceipt
'None')
end
object cbZeroReceipt: TComboBox
Left = 96
Left = 136
Top = 184
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -161,9 +168,9 @@ object fmFptrReceipt: TfmFptrReceipt
'Nonfiscal')
end
object cbCompatLevel: TComboBox
Left = 96
Left = 136
Top = 136
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -175,9 +182,9 @@ object fmFptrReceipt: TfmFptrReceipt
'Level 2')
end
object cbReceiptType: TComboBox
Left = 96
Left = 136
Top = 160
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -191,16 +198,16 @@ object fmFptrReceipt: TfmFptrReceipt
end
object chbCacheReceiptNumber: TCheckBox
Left = 8
Top = 256
Top = 296
Width = 201
Height = 17
Caption = 'Cache receipt number'
TabOrder = 10
end
object seDepartment: TSpinEdit
Left = 96
Left = 136
Top = 16
Width = 121
Width = 337
Height = 22
MaxValue = 0
MinValue = 0
......@@ -208,7 +215,7 @@ object fmFptrReceipt: TfmFptrReceipt
Value = 0
end
object seZeroReceiptNumber: TSpinEdit
Left = 120
Left = 136
Top = 208
Width = 97
Height = 22
......@@ -219,7 +226,7 @@ object fmFptrReceipt: TfmFptrReceipt
end
object chbZReceiptBeforeZReport: TCheckBox
Left = 8
Top = 280
Top = 320
Width = 214
Height = 17
Caption = 'Zero receipt before Z report (day closed)'
......@@ -227,16 +234,16 @@ object fmFptrReceipt: TfmFptrReceipt
end
object chbOpenReceiptEnabled: TCheckBox
Left = 8
Top = 304
Top = 344
Width = 214
Height = 17
Caption = 'Open receipt in beginFiscalReceipt'
TabOrder = 12
end
object cbQuantityDecimalPlaces: TComboBox
Left = 96
Left = 136
Top = 232
Width = 121
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
......@@ -246,12 +253,18 @@ object fmFptrReceipt: TfmFptrReceipt
'3 digits'
'6 digits')
end
end
object gbReceipt: TGroupBox
Left = 240
Top = 8
Width = 249
Height = 345
TabOrder = 1
object cbPrintRecMessageMode: TComboBox
Left = 136
Top = 256
Width = 337
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
ItemHeight = 13
TabOrder = 13
Items.Strings = (
'1. Normal - after receipt ending'
'2. Before receipt ending')
end
end
end
......@@ -37,7 +37,8 @@ type
chbOpenReceiptEnabled: TCheckBox;
cbQuantityDecimalPlaces: TComboBox;
lblQuantityLength: TLabel;
gbReceipt: TGroupBox;
lblPrintRecMessageMode: TLabel;
cbPrintRecMessageMode: TComboBox;
public
procedure UpdatePage; override;
procedure UpdateObject; override;
......@@ -67,6 +68,7 @@ begin
chbZReceiptBeforeZReport.Checked := Parameters.ZReceiptBeforeZReport;
chbOpenReceiptEnabled.Checked := Parameters.OpenReceiptEnabled;
cbQuantityDecimalPlaces.ItemIndex := Parameters.QuantityDecimalPlaces;
cbPrintRecMessageMode.ItemIndex := Parameters.PrintRecMessageMode;
end;
procedure TfmFptrReceipt.UpdateObject;
......@@ -84,6 +86,7 @@ begin
Parameters.ZReceiptBeforeZReport := chbZReceiptBeforeZReport.Checked;
Parameters.OpenReceiptEnabled := chbOpenReceiptEnabled.Checked;
Parameters.QuantityDecimalPlaces := cbQuantityDecimalPlaces.ItemIndex;
Parameters.PrintRecMessageMode := cbPrintRecMessageMode.ItemIndex;
end;
end.
......@@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=13
Release=0
Build=473
Build=477
Debug=0
PreRelease=0
Special=0
......@@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=SHTRIH-M
FileDescription=OPOS setup utility
FileVersion=1.13.0.473
FileVersion=1.13.0.477
InternalName=OPOS setup
LegalCopyright=SHTRIH-M 2013
LegalTrademarks=
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,471
PRODUCTVERSION 1,13,0,471
FILEVERSION 1,13,0,472
PRODUCTVERSION 1,13,0,472
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "OPOS setup utility\0"
VALUE "FileVersion", "1.13.0.471\0"
VALUE "FileVersion", "1.13.0.472\0"
VALUE "InternalName", "OPOS setup \0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "OposConfig.exe\0"
......
[Closed Files]
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\OposConfig\Fmu\fmuMarkChecker.pas',0,1,1,25,2,1,0
File_1=SourceModule,'C:\projects\OPOSShtrih\Source\OposConfig\Units\FiscalPrinterDevice.pas',0,1,43,30,64,0,0
File_2=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParameters.pas',0,1,334,19,353,0,0
File_3=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParametersIni.pas',0,1,311,1,335,0,0
File_4=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParametersReg.pas',0,1,617,2,650,0,0
File_5=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParametersRegIBT.pas',0,1,1,47,10,0,0
File_6=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\TLV.pas',0,1,62,30,77,0,0
File_7=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterDevice.pas',0,1,1,15,9,0,0
File_8=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterImpl.pas',0,1,4489,34,4502,0,0
File_9=SourceModule,'C:\projects\OPOSShtrih\Source\OposTest\Units\PrinterTest.pas',0,1,4436,40,4454,0,0
File_0=SourceModule,'C:\projects\OPOSShtrih\Source\OposTest\Units\PrinterTest.pas',0,1,4496,18,4497,0,0
File_1=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\DirectIOAPI.pas',0,1,294,25,315,0,0
File_2=SourceModule,'C:\projects\OPOSShtrih\Test\SmFiscalPrinterTest\Units\TextFiscalPrinterDevice.pas',0,1,303,2,303,0,0
File_3=SourceModule,'C:\projects\OPOSShtrih\Test\SmFiscalPrinterTest\Units\MockFiscalPrinterDevice.pas',0,1,1733,122,1741,0,0
File_4=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterDevice.pas',0,1,6926,1,6947,0,0
File_5=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterTypes.pas',0,1,1197,2,1199,0,0
File_6=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FiscalPrinterTypes.pas',0,1,442,1,465,0,0
File_7=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\FSSalesReceipt.pas',0,1,997,20,1002,0,0
File_8=SourceModule,'C:\projects\OPOSShtrih\Source\Shared\DIOHandlers.pas',0,1,1938,114,1948,0,0
File_9=SourceModule,'C:\projects\OPOSShtrih\Source\SmFiscalPrinter\Units\PrinterParameters.pas',0,1,499,2,520,0,0
[Modules]
Count=0
EditWindowCount=0
TypeLibWindowCount=3
[C:\projects\OPOSShtrih\Source\OposConfig\OposConfig.dpr]
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Test\SmScaleTest\SmScaleTestLib.dpr]
[C:\projects\OPOSShtrih\Source\OposShtrih.bpg]
FormState=0
FormOnTop=0
[C:\projects\OPOSShtrih\Source\OposShtrih.bpg]
[C:\projects\OPOSShtrih\Source\OposConfig\OposConfig.dpr]
FormState=0
FormOnTop=0
......@@ -188,11 +188,11 @@ State=0
Left=-2
Top=116
Width=650
Height=515
Height=514
MaxLeft=-1
MaxTop=-1
ClientWidth=634
ClientHeight=481
ClientHeight=480
TBDockHeight=681
LRDockWidth=445
Dockable=0
......@@ -418,5 +418,5 @@ CompUnitPane=104
DockHostCount=0
[ActiveProject]
ActiveProject=3
ActiveProject=2
......@@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=13
Release=0
Build=478
Build=482
Debug=0
PreRelease=0
Special=0
......@@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=SHTRIH-M
FileDescription=OPOS test utility
FileVersion=1.13.0.478
FileVersion=1.13.0.482
InternalName=OPOS test
LegalCopyright=SHTRIH-M 2013
LegalTrademarks=
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,471
PRODUCTVERSION 1,13,0,471
FILEVERSION 1,13,0,472
PRODUCTVERSION 1,13,0,472
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "OPOS test utility\0"
VALUE "FileVersion", "1.13.0.471\0"
VALUE "FileVersion", "1.13.0.472\0"
VALUE "InternalName", "OPOS test\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "OposTest.exe\0"
......
......@@ -4462,11 +4462,6 @@ begin
Check(FiscalPrinter.PrintRecItem(Text, 101, 3088, 4, 32.7, ''));
Check(FiscalPrinter.PrintRecTotal(101, 101, '2'));
Check(FiscalPrinter.PrintRecMessage('.: 41895 '));
Check(FiscalPrinter.FSWriteTag(1203, '505303696069'));
Check(FiscalPrinter.FSWriteTag(1203, '505303696069'));
Check(FiscalPrinter.EndFiscalReceipt(True));
end;
......@@ -4513,18 +4508,20 @@ begin
FiscalPrinter.FiscalReceiptType := FPTR_RT_SALES;
Check(FiscalPrinter.BeginFiscalReceipt(True));
pData := 0;
pString := '3';
pData := DriverParameterMarkType;
Check(FiscalPrinter.DirectIO(DIO_SET_DRIVER_PARAMETER, pData, pString));
pData := DriverParameterBarcode;
pString :=
'(01)18901148006025(21)5L1DNSVZD716T(10)DEMO(17)201231' +
'(240)1111(91)1129(92)mUfZBFCQmjupbDczH0kCErEiLNCktMzv' +
'+tWG24jDtHwRbPARdskMHHxuHE3h2fGRFX6wtXeQo11QXzLMGWqNcg==';
Check(FiscalPrinter.DirectIO(DIO_CHECK_MARKING, pData, pString));
Check(FiscalPrinter.DirectIO(DIO_SET_DRIVER_PARAMETER, pData, pString));
Check(FiscalPrinter.PrintRecItem('Item 1', 101, 3088, 4, 32.7, ''));
Check(FiscalPrinter.PrintRecTotal(101, 101, '2'));
Check(FiscalPrinter.PrintRecMessage('.: 41895 '));
Check(FiscalPrinter.FSWriteTag(1203, '505303696069'));
Check(FiscalPrinter.EndFiscalReceipt(True));
end;
......
......@@ -1858,6 +1858,7 @@ begin
DriverParameterParam9: pString := Printer.Parameters.Parameter9;
DriverParameterParam10: pString := Printer.Parameters.Parameter10;
DriverParameterBarcode: pString := Printer.Parameters.Barcode;
DriverParameterMarkType: pString := IntToStr(Printer.Parameters.MarkType);
end;
end;
......@@ -1955,6 +1956,7 @@ begin
DriverParameterParam9: Parameters.Parameter9 := pString;
DriverParameterParam10: Parameters.Parameter10 := pString;
DriverParameterBarcode: Parameters.Barcode := pString;
DriverParameterMarkType: Parameters.MarkType := StrToInt(pString);
end;
end;
......
......@@ -7,7 +7,7 @@ uses
DeviceService;
const
GenericServiceVersion = deviceVersion113 + 471;
GenericServiceVersion = deviceVersion113 + 472;
implementation
......
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,13,0,471
PRODUCTVERSION 1,13,0,471
FILEVERSION 1,13,0,472
PRODUCTVERSION 1,13,0,472
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
......@@ -13,7 +13,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "SHTRIH-M\0"
VALUE "FileDescription", "Fiscal printer service\0"
VALUE "FileVersion", "1.13.0.471\0"
VALUE "FileVersion", "1.13.0.472\0"
VALUE "InternalName", "Fiscal printer driver\0"
VALUE "LegalCopyright", "SHTRIH-M \251 2013 \0"
VALUE "OriginalFilename", "SmFiscalPrinter.dll\0"
......
......@@ -313,6 +313,7 @@ const
DriverParameterParam9 = 78;
DriverParameterParam10 = 79;
DriverParameterBarcode = 80;
DriverParameterMarkType = 81;
/////////////////////////////////////////////////////////////////////////////
......
......@@ -49,7 +49,7 @@ type
function GetAdjustmentAmount(AdjustmentType: Integer;
Amount: Currency): Int64;
function GetLastItem: TFSSaleItem;
procedure AddSale(const P: TFSSale);
procedure AddSale(P: TFSSale);
procedure ClearReceipt;
procedure SetRefundReceipt;
procedure UpdateDiscounts;
......@@ -240,8 +240,15 @@ begin
Printer.Printer.PrintText(Text);
end;
procedure TFSSalesReceipt.AddSale(const P: TFSSale);
procedure TFSSalesReceipt.AddSale(P: TFSSale);
begin
P.ItemBarcode := Parameters.Barcode;
P.MarkType := Parameters.MarkType;
if Parameters.Barcode <> '' then
begin
Device.Check(Device.CheckItemBarcode(Parameters.Barcode));
end;
FLastItem := TFSSaleItem.Create(FReceiptItems);
FLastItem.Data := P;
FLastItem.PreLine := Printer.Printer.PreLine;
......@@ -1008,6 +1015,8 @@ begin
FSSale2.Text := Operation.Text;
FSSale2.PaymentType := StrToInt64Def(FSRegistration.Parameter3, 0);
FSSale2.PaymentItem := StrToInt64Def(FSRegistration.Parameter4, 0);
FSSale2.ItemBarcode := FSRegistration.ItemBarcode;
FSSale2.MarkType := FSRegistration.MarkType;
Device.Check(Device.FSSale2(FSSale2));
end else
begin
......@@ -1143,7 +1152,7 @@ begin
end;
end;
procedure TFSSalesReceipt.EndFiscalReceipt;
procedure TFSSalesReceipt.EndFiscalReceipt2;
begin
Device.Lock;
try
......@@ -1178,7 +1187,7 @@ begin
end;
end;
procedure TFSSalesReceipt.EndFiscalReceipt2;
procedure TFSSalesReceipt.EndFiscalReceipt;
var
CloseParams: TCloseReceiptParams;
CloseParams2: TFSCloseReceiptParams2;
......
......@@ -4,7 +4,7 @@ interface
uses
// VCL
Windows, SysUtils, Classes, Variants, SyncObjs, Graphics, Math,
Windows, SysUtils, Classes, Variants, SyncObjs, Graphics, Math, StrUtils,
// 3'd
// to enable loading this image formats
JvGIF, JvPCX, PngImage, uZintBarcode, uZintInterface,
......@@ -190,6 +190,8 @@ type
procedure EkmCheckBarcode(const Barcode: TGS1Barcode);
function CheckItemBarcode(const Barcode: string): Integer;
function LoadBarcodeData(const Barcode: string): Integer;
function SendItemBarcode(const Barcode: string;
MarkType: Integer): Integer;
protected
function GetMaxGraphicsWidthInBytes: Integer;
public
......@@ -437,6 +439,7 @@ type
function IsCapBarcode2D: Boolean;
function IsCapEnablePrint: Boolean;
function ReadCashReg(ID: Integer; var R: TCashRegisterRec): Integer;
function FSSendTLVOperation(const Data: string): Integer;
property IsOnline: Boolean read GetIsOnline;
property Tables: TPrinterTables read FTables;
......@@ -969,10 +972,11 @@ function TFiscalPrinterDevice.GetText(const Text: string;
MinLength: Integer): string;
begin
Result := Text;
if Length(Text) < MinLength then
Result := Result + StringOfChar(#0, MinLength - Length(Result));
if not FCapFiscalStorage then
Result := Copy(Result, 1, GetPrintWidth);
if Length(Result) < MinLength then
Result := Result + StringOfChar(#0, MinLength - Length(Result));
end;
function TFiscalPrinterDevice.GetPrintWidth: Integer;
......@@ -6955,6 +6959,10 @@ begin
Copy(P.Text, 1, 128);
Result := ExecuteData(Command, Answer);
if Result = 0 then
begin
Result := SendItemBarcode(P.ItemBarcode, P.MarkType);
end;
end;
function TFiscalPrinterDevice.FSStorno(const P: TFSSale): Integer;
......@@ -8667,5 +8675,56 @@ begin
end;
end;
function TFiscalPrinterDevice.SendItemBarcode(const Barcode: string;
MarkType: Integer): Integer;
var
Data: string;
GTIN: string;
Serial: string;
GS1Barcode: TGS1Barcode;
begin
Result := 0;
if Barcode = '' then Exit;
if not MarkType in [2, 3] then Exit;
Data := GS1DecodeBraces(Barcode);
Data := GS1FilterTockens(Data);
GS1Barcode := DecodeGS1(Data);
GTIN := ReverseString(IntToBin(StrToInt64(GS1Barcode.GTIN), 6));
case MarkType of
2:
begin //
Serial := Copy(GS1Barcode.Serial, 1, 20);
Serial := Serial + StringOfChar(' ', 20 - Length(Serial));
Data := #$00#$02 + GTIN + TTLVTag.ASCII2ValueTLV(Serial);
Data := TTLVTag.Int2ValueTLV(1162, 2) + TTLVTag.Int2ValueTLV(Length(Data), 2) + Data;
end;
3:
begin //
Serial := Copy(GS1Barcode.Serial, 1, 13);
Serial := Serial + StringOfChar(' ', 13 - Length(Serial));
Data := #$00#$03 + TTLVTag.ASCII2ValueTLV(Serial) + GTIN;
Data := TTLVTag.Int2ValueTLV(1162, 2) + TTLVTag.Int2ValueTLV(Length(Data), 2) + Data;
end;
else
raise Exception.Create('Invalid MarType value');
end;
Result := FSSendTLVOperation(Data);
end;
function TFiscalPrinterDevice.FSSendTLVOperation(const Data: string): Integer;
var
Command: string;
Answer: string;
begin
if Length(Data) > 249 then
raise Exception.Create('TLV data length too big');