D7myzhenyong/染整计划(DyeingFinishingPlan.dll)/U_ProductOrderLBNameSet.pas
DESKTOP-E401PHE\Administrator 237de1c308 0
2025-08-26 15:25:51 +08:00

1121 lines
32 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_ProductOrderLBNameSet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, StrUtils, Menus, cxTextEdit,
cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter, cxContainer, cxImage;
type
TZintSymbol = packed record
symbology: Integer;
height: Integer;
whitespace_width: Integer;
border_width: Integer;
output_options: Integer;
fgcolour: array[0..9] of AnsiChar;
bgcolour: array[0..9] of AnsiChar;
outfile: array[0..255] of AnsiChar;
scale: Single;
option_1: Integer;
option_2: Integer;
option_3: Integer;
show_hrt: Integer;
input_mode: Integer;
eci: Integer;
text: array[0..127] of AnsiChar;
rows: Integer;
width: Integer;
primary: array[0..127] of AnsiChar;
encoded_data: array[0..199, 0..142] of AnsiChar;
row_height: array[0..199] of Integer; // Largest symbol is 189 x 189
errtxt: array[0..99] of AnsiChar;
bitmap: PAnsiChar;
bitmap_width: Integer;
bitmap_height: Integer;
bitmap_byte_length: Cardinal;
dot_size: Single;
rendered: Pointer;
debug: Integer;
end;
PZintSymbol = ^TZintSymbol;
const
// Tbarcode 7 codes
BARCODE_QRCODE = 71;
type
TfrmProductOrderLBNameSet = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
OrderNoM: TEdit;
v1OrderNo: TcxGridDBColumn;
v1OrdDate: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
v1ConNo: TcxGridDBColumn;
v1MPRTSpec: TcxGridDBColumn;
Order_Main: TClientDataSet;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
Label4: TLabel;
CustomerNoName: TEdit;
v1MPRTCodeName: TcxGridDBColumn;
v1MPRTMF: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N2: TMenuItem;
ToolButton1: TToolButton;
Label8: TLabel;
MPRTCodeName: TEdit;
Label9: TLabel;
ConNo: TEdit;
v1MPRTKZ: TcxGridDBColumn;
v1OrdDefStr1: TcxGridDBColumn;
Label10: TLabel;
MPRTSpec: TEdit;
Label11: TLabel;
MPRTCode: TEdit;
Label12: TLabel;
MPRTKZ: TEdit;
Label13: TLabel;
MPRTMF: TEdit;
ADOQueryPrint: TADOQuery;
CDS_Print: TClientDataSet;
v1Column4: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
PiZhong: TEdit;
ToolButton4: TToolButton;
v1Column3: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
ToolButton5: TToolButton;
v1Column6: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
v1Column8: TcxGridDBColumn;
ToolButton8: TToolButton;
v1Column9: TcxGridDBColumn;
ADOQueryCmdSC: TADOQuery;
ADOQueryCmdFileContent: TBlobField;
ADOQueryCmdFtFileName: TStringField;
ADOQueryCmdFileEditDate: TDateTimeField;
ADOQueryCmdFileSize: TFloatField;
ADOQueryCmdFiller: TStringField;
ADOQueryCmdLastEditTime: TDateTimeField;
ADOQueryCmdLastEditer: TStringField;
ADOQueryCmdFileCreateDate: TDateTimeField;
ADOQueryCmdchildPath: TStringField;
ADOQueryCmdFileType: TStringField;
Tv1Column1: TcxGridDBColumn;
ToolButton9: TToolButton;
Tv1Column2: TcxGridDBColumn;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolButton12: TToolButton;
cxImage1: TcxImage;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure OrderNoMChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
procedure ToolButton1Click(Sender: TObject);
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure v1Column3PropertiesEditValueChanged(Sender: TObject);
procedure v1Column1PropertiesEditValueChanged(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure v1Column6PropertiesEditValueChanged(Sender: TObject);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure v1Column8PropertiesChange(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure ToolButton10Click(Sender: TObject);
procedure OrderNoMKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton11Click(Sender: TObject);
procedure ToolButton12Click(Sender: TObject);
private
DQdate: TDateTime;
procedure InitGrid();
procedure InitForm();
function UPLabel(LabelName, LabelPath: string): Boolean;
function PostFileToData(LabelName, LabelPath: string): boolean;
{ Private declarations }
public
FFInt, FCloth: Integer;
canshu1: string;
FKHEWM: string;
fkhname: string;
{ Public declarations }
end;
const
LibName = 'zint.dll';
//struct zint_symbol *ZBarcode_Create(void);
function ZBarcode_Create(): PZintSymbol; cdecl; external LibName;
//void ZBarcode_Delete(struct zint_symbol *symbol);
procedure ZBarcode_Delete(symbol: PZintSymbol); cdecl; external LibName;
//int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle);
function ZBarcode_Encode_and_Buffer(symbol: PZintSymbol; input: PAnsiChar; length, rotate_angle: Integer): Integer; cdecl; external LibName;
// create bitmap <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bitmap<61>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>zint<6E><74><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>zint.hͷ<68>ļ<EFBFBD><C4BC>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>zint.hͷ<68>ļ<EFBFBD><C4BC>С<EFBFBD>
procedure ZBarcode_To_Bitmap(symbol: PZintSymbol; const ABitmap: TBitmap);
var
newh: hwnd;
implementation
uses
U_DataLink, U_OrderInPut, U_Fun, U_LabelList;
{$R *.dfm}
function TfrmProductOrderLBNameSet.PostFileToData(LabelName, LabelPath: string): boolean;
var
mFileName, fFileName, fpathFileName: string;
Stream: TMemoryStream;
mfileSize: integer;
mCreationTime: TdateTime;
mWriteTime: TdateTime;
// ADOQueryCmdFileContent: TBlobField;
begin
result := false;
fFileName := Trim(LabelName) + '.rmf';
fpathFileName := Trim(LabelPath);
try
ADOQueryCmdSC.Connection.BeginTrans;
try
with ADOQueryCmdSC do
begin
close;
sql.Clear;
sql.Add('delete from RT_FileUpdate');
sql.Add('where FileName=' + quotedStr(trim(fFileName)));
execsql;
end;
with ADOQueryCmdSC do
begin
close;
sql.Clear;
sql.Add('select * from RT_FileUpdate');
sql.Add('where FileName=' + quotedStr(trim(fFileName)));
Open;
//////////////////////////
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
GetFileInfo(Trim(fpathFileName), mfileSize, mCreationTime, mWriteTime);
if RecordCount <= 0 then
begin
Append;
fieldByName('FileName').AsString := trim(fFileName);
end
else
begin
edit;
end;
fieldByName('FileEditDate').Value := mWriteTime;
fieldByName('FileCreateDate').Value := mCreationTime;
fieldByName('FileSize').Value := mfileSize;
fieldByName('Filler').Value := Dname;
fieldByName('LastEditer').Value := Dname;
fieldByName('LastEditTime').Value := Now();
// if pos('.rmf',fFileName)>0 then
begin
fieldByName('FilePath').Value := 'report';
fieldByName('FileType').Value := '<27><><EFBFBD><EFBFBD>';
end;
//<2F><>OLE<4C><45><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
RM1.SaveToBlobField(TBlobField(FieldByName('Files')));
// ADOQueryCmdFileContent.LoadFromFile(fpathFileName);
//ADOQueryCmdFileContent.LoadFromStream(Stream);
post;
end;
finally
end;
result := true;
ADOQueryCmdSC.Connection.CommitTrans;
except
ADOQueryCmdSC.Connection.RollbackTrans;
Result := False;
application.MessageBox(pchar('<27><EFBFBD>ļ<EFBFBD>[' + trim(fFileName) + ']ʧ<><CAA7>!'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
end;
end;
procedure ZBarcode_To_Bitmap(symbol: PZintSymbol; const ABitmap: TBitmap);
var
SrcRGB: PRGBTriple;
Row, RowWidth: Integer;
begin
ABitmap.PixelFormat := pf24bit;
ABitmap.Height := symbol.bitmap_height;
ABitmap.Width := symbol.bitmap_width;
// ABitmap.Height := 80;
// ABitmap.Width := 80;
SrcRGB := Pointer(symbol.bitmap);
RowWidth := symbol.bitmap_width * 3;
for Row := 0 to symbol.bitmap_height - 1 do
begin
CopyMemory(ABitmap.ScanLine[Row], SrcRGB, RowWidth);
Inc(SrcRGB, symbol.bitmap_width);
end;
SetBitmapBits(ABitmap.Handle, symbol.bitmap_width * symbol.bitmap_height * 3, symbol.bitmap);
end;
function TfrmProductOrderLBNameSet.UPLabel(LabelName, LabelPath: string): Boolean;
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from P_Label');
sql.Add('where LabelCaption=' + quotedstr(LabelName));
Open;
if ADOQueryCmd.IsEmpty then
begin
Append;
fieldByName('filler').value := DName;
fieldByName('filltime').value := DServerDate;
fieldByName('beizhu').value := '';
fieldByName('LabelCaption').value := trim(LabelPath);
fieldByName('LabelType').value := '<27><><EFBFBD>ı<EFBFBD>ǩ';
fieldByName('LabelFileName').value := trim(LabelName);
RM1.SaveToBlobField(TBlobField(FieldByName('LabelFile')));
end
else
begin
Edit;
fieldByName('Editer').value := DName;
fieldByName('EditTime').value := DServerDate;
end;
RM1.SaveToBlobField(TBlobField(FieldByName('LabelFile')));
Post;
end;
ADOQueryCmd.Connection.CommitTrans;
result := true;
except
ADOQueryCmd.Connection.RollbackTrans;
Result := false;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩģ<C7A9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
end;
end;
procedure TfrmProductOrderLBNameSet.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmProductOrderLBNameSet.FormCreate(Sender: TObject);
begin
cxgrid1.Align := alClient;
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
DQdate := SGetServerDate(ADOQueryTemp);
end;
procedure TfrmProductOrderLBNameSet.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmProductOrderLBNameSet.InitGrid();
var
fwhere, Pwhere: string;
begin
Pwhere := SGetFilters(Panel1, 1, 2);
begin
if trim(Pwhere) <> '' then
fwhere := fwhere + ' and ' + trim(Pwhere);
end;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.add('exec P_View_Order :begdate,:enddate,:WSql');
if Trim(canshu1) = '<27><>Ȩ<EFBFBD><C8A8>' then
begin
// Parameters.ParamByName('WSql').Value := ' and Filler=''' + Trim(DName) + '''';
Parameters.ParamByName('WSql').Value := ' and filler in ( select username from SY_User where UType=(select UType from SY_User where UserName=' + quotedstr(Trim(dname)) + ') )';
// ShowMessage(Parameters.ParamByName('WSql').Value);
end
else
begin
Parameters.ParamByName('WSql').Value := '';
end;
if OrderNoM.Text <> '' then
begin
Parameters.ParamByName('WSql').Value := Parameters.ParamByName('WSql').Value + 'AND ORDERNO LIKE' + QUOTEDSTR('%' + Trim(ORDERNOM.TEXT) + '%');
Parameters.ParamByName('begdate').Value := '2021-12-01';
Parameters.ParamByName('enddate').Value := '2099-01-01';
end
else
begin
Parameters.ParamByName('begdate').Value := FormatDateTime('yyyy-MM-dd', BegDate.DateTime);
Parameters.ParamByName('enddate').Value := FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1);
end;
if fwhere <> '' then
begin
Parameters.ParamByName('WSql').Value := Parameters.ParamByName('WSql').Value + fwhere;
end;
// ShowMessage(sql.Text);
ExecSQL;
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmProductOrderLBNameSet.InitForm();
begin
ReadCxGrid('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
end;
procedure TfrmProductOrderLBNameSet.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmProductOrderLBNameSet.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmProductOrderLBNameSet.OrderNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmProductOrderLBNameSet.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmProductOrderLBNameSet.CheckBox1Click(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmProductOrderLBNameSet.CheckBox2Click(Sender: TObject);
begin
TBRafresh.Click;
end;
procedure TfrmProductOrderLBNameSet.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
id, id10: Integer;
begin
{try
if Tv1.GroupedItemCount=0 then
begin
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
if Id<0 then Exit;
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
if (ARecord.Values[id]-DQdate)>=4 then Exit;
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
AStyle:=DataLink_.QHuangSe
else
if ARecord.Values[id]-DQdate<0 then
begin
AStyle:=DataLink_OrderManage.FenHongS;
end;
end else
begin
end;
except
end; }
end;
procedure TfrmProductOrderLBNameSet.ToolButton1Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
try
frmOrderInPut := TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
ToolBar2.Visible := False;
TBSave.Visible := False;
ScrollBox1.Enabled := False;
Tv1.OptionsSelection.CellSelect := False;
if ShowModal = 1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmProductOrderLBNameSet.ConNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
if Length(conno.Text) < 3 then
Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.add('exec P_View_Order :begdate,:enddate,:WSql');
begin
Parameters.ParamByName('WSql').Value := ' and conno like ''' + '%' + Trim(conno.Text) + '%' + '''';
end;
Parameters.ParamByName('begdate').Value := '1899-01-01';
Parameters.ParamByName('enddate').Value := '2050-01-01';
ExecSQL;
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmProductOrderLBNameSet.ToolButton2Click(Sender: TObject);
var
maxno: string;
begin
try
frmLabelList := TfrmLabelList.Create(Application);
with frmLabelList do
begin
if ShowModal = 1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set LBName=''' + Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString) + '''');
sql.Add(' where Mainid=''' + Trim(self.Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Self.Order_Main do
begin
Edit;
FieldByName('LBName').Value := Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString);
Post;
end;
end;
end;
finally
frmLabelList.Free;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.ToolButton3Click(Sender: TObject);
var
FPiZhong: string;
FReal: Double;
begin
if Trim(PiZhong.Text) = '' then
begin
Application.MessageBox(<>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(PiZhong.Text, FReal) = False then
begin
Application.MessageBox(<>طǷ<D8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set PiZhong=' + (PiZhong.Text));
sql.Add(' where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('PiZhong').Value := PiZhong.Text;
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.ToolButton4Click(Sender: TObject);
var
maxno: string;
begin
try
frmLabelList := TfrmLabelList.Create(Application);
with frmLabelList do
begin
if ShowModal = 1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set NLBName=''' + Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString) + '''');
sql.Add(' where Mainid=''' + Trim(self.Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
TBRafresh.Click;
end;
end;
finally
frmLabelList.Free;
end;
end;
procedure TfrmProductOrderLBNameSet.v1Column3PropertiesEditValueChanged(Sender: TObject);
var
mvalues: string;
begin
mvalues := TCXTextEdit(Sender).Text;
with Order_Main do
begin
edit;
fieldbyname('NLBName').Value := mvalues;
post;
end;
tv1.Controller.EditingController.ShowEdit();
if trim(mvalues) = '' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set NLBName='''' ');
sql.Add('where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
end
end;
procedure TfrmProductOrderLBNameSet.v1Column1PropertiesEditValueChanged(Sender: TObject);
var
mvalues, FFieldName: string;
begin
mvalues := TCXTextEdit(Sender).Text;
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
with Order_Main do
begin
edit;
fieldbyname(FFieldName).Value := mvalues;
post;
end;
tv1.Controller.EditingController.ShowEdit();
if trim(mvalues) = '' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set' + Trim(FFieldName) + '='''' ');
sql.Add('where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
end
end;
procedure TfrmProductOrderLBNameSet.ToolButton5Click(Sender: TObject);
var
FReal: Double;
begin
if Trim(PiZhong.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(PiZhong.Text, FReal) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set XS=' + (PiZhong.Text));
sql.Add(' where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('XS').Value := PiZhong.Text;
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.v1Column6PropertiesEditValueChanged(Sender: TObject);
var
mvalues: string;
begin
mvalues := TCXTextEdit(Sender).Text;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set XSType=''' + trim(mvalues) + ''' ');
sql.Add('where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
edit;
fieldbyname('XSType').Value := mvalues;
post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if Order_Main.IsEmpty then
exit;
ToolButton1.Click;
end;
procedure TfrmProductOrderLBNameSet.ToolButton6Click(Sender: TObject);
var
fPrintFile: string;
Txt, Txt2, fImagePath, fImagePath2, Txt3, fImagePath3, Txt4, fImagePath4: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
if Order_Main.IsEmpty then
exit;
if trim(Order_Main.fieldbyname('LBName').AsString) = '' then
exit;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add('exec P_Print_Cs_Roll ');
sql.Add('@mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' ');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt2 := Trim(ADOQueryPrint.fieldbyname('KHEWM').AsString);
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\temp2.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath2) then
DeleteFile(fImagePath2);
Makebar(pchar(Txt2), Length(Txt2), 3, 3, 0, PChar(fImagePath2), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt3 := Trim(ADOQueryPrint.fieldbyname('mjid2').AsString);
fImagePath3 := ExtractFilePath(Application.ExeName) + 'image\temp3.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath3) then
DeleteFile(fImagePath3);
Makebar(pchar(Txt3), Length(Txt3), 3, 3, 0, PChar(fImagePath3), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
fImagePath4 := ExtractFilePath(Application.ExeName) + 'image\temp4.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath4) then
DeleteFile(fImagePath4);
FKHEWM := ADOQueryPrint.fieldbyname('khewm2').AsString;
ToolButton12.Click();
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
ExportFtErpFile(Trim(Order_Main.fieldbyname('LBName').AsString) + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(Order_Main.fieldbyname('LBName').AsString) + '.rmf';
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RMVariables['QRBARCODE2'] := fImagePath2;
RMVariables['QRBARCODE3'] := fImagePath3;
RMVariables['QRBARCODE4'] := fImagePath4;
RM1.LoadFromFile(fPrintFile);
PostFileToData(trim(Order_Main.fieldbyname('LBName').AsString), fPrintFile);
UPLabel(trim(Order_Main.fieldbyname('LBName').AsString), fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmProductOrderLBNameSet.ToolButton7Click(Sender: TObject);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
if Order_Main.IsEmpty then
exit;
if trim(Order_Main.fieldbyname('NLBName').AsString) = '' then
exit;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add('exec P_Print_Cs_Bao ');
sql.Add('@mainID=''' + trim(Order_Main.fieldbyname('mainID').AsString) + ''' ');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
ExportFtErpFile(Trim(Order_Main.fieldbyname('NLBName').AsString) + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(Order_Main.fieldbyname('NLBName').AsString) + '.rmf';
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM1.LoadFromFile(fPrintFile);
PostFileToData(trim(Order_Main.fieldbyname('NLBName').AsString), fPrintFile);
UPLabel(trim(Order_Main.fieldbyname('NLBName').AsString), fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmProductOrderLBNameSet.v1Column8PropertiesChange(Sender: TObject);
var
mvalues: string;
begin
mvalues := TCXTextEdit(Sender).Text;
with Order_Main do
begin
edit;
fieldbyname('Orddefstr15').Value := mvalues;
post;
end;
tv1.Controller.EditingController.ShowEdit();
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set Orddefstr15=''' + trim(mvalues) + ''' ');
sql.Add('where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
end;
procedure TfrmProductOrderLBNameSet.ToolButton8Click(Sender: TObject);
var
FReal: Double;
begin
if Trim(PiZhong.Text) = '' then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(PiZhong.Text, FReal) = False then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set LabQty=' + (PiZhong.Text));
sql.Add(' where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('LabQty').Value := PiZhong.Text;
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.ToolButton9Click(Sender: TObject);
var
FReal: Double;
begin
if Trim(PiZhong.Text) = '' then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(PiZhong.Text, FReal) = False then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set MBJS=' + (PiZhong.Text));
sql.Add(' where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('MBJS').Value := PiZhong.Text;
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.ToolButton10Click(Sender: TObject);
var
FReal: Double;
begin
if Trim(PiZhong.Text) = '' then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(PiZhong.Text, FReal) = False then
begin
Application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set BBQFS=' + (PiZhong.Text));
sql.Add(' where Mainid=''' + Trim(Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('BBQFS').Value := PiZhong.Text;
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.OrderNoMKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
InitGrid();
// TBFind.CLICK();
end;
end;
procedure TfrmProductOrderLBNameSet.ToolButton11Click(Sender: TObject);
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Main Set LBName=NULL');
sql.Add(' where Mainid=''' + Trim(self.Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Self.Order_Main do
begin
Edit;
FieldByName('LBName').Value := '';
Post;
end;
tv1.Controller.EditingController.ShowEdit();
end;
procedure TfrmProductOrderLBNameSet.ToolButton12Click(Sender: TObject);
var
lvData: UTF8String; // ʹ<><CAB9>UTF8<46><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
lvBitMap: TBitmap;
lvSymbol: PZintSymbol;
lvErrorNumber: Integer;
lvErrorText: string;
bitmap: TBitmap;
begin
lvSymbol := ZBarcode_Create();
if lvSymbol = nil then
Exit;
lvBitMap := TBitmap.Create;
try //'010872020901234590RS9999-100R1011234567893112005160'
lvData := UTF8String(FKHEWM);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪQRCODE
lvSymbol.symbology := BARCODE_QRCODE;
// lvSymbol.option_2 := 1;
//Data Matrix <20><>ISO 16022<32><32>(and HIBC)
// <20><><EFBFBD><EFBFBD>
lvErrorNumber := ZBarcode_Encode_and_Buffer(lvSymbol, PAnsiChar(lvData), Length(lvData), 0);
// <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
if lvErrorNumber = 0 then
begin
// <20><><EFBFBD><EFBFBD>Bitmapͼ<70><CDBC>
ZBarcode_To_Bitmap(lvSymbol, lvBitMap);
// <20><>ʾ<EFBFBD><CABE>Image<67><65>
cxImage1.Picture.Bitmap.Width := 80;
cxImage1.Picture.Bitmap.Height := 80;
cxImage1.Picture.Bitmap.Canvas.Brush.Color := clWhite;
cxImage1.Picture.Bitmap.Canvas.FillRect(Rect(0, 0, cxImage1.Width, cxImage1.Height));
cxImage1.Picture.Bitmap.Canvas.StretchDraw(Rect(10, 10, cxImage1.Width - 10, cxImage1.Height - 10), lvBitMap);
end
else
begin
cxImage1.Picture.Bitmap.Width := cxImage1.Width;
cxImage1.Picture.Bitmap.Height := cxImage1.Height;
cxImage1.Picture.Bitmap.Canvas.Brush.Color := clWhite;
cxImage1.Picture.Bitmap.Canvas.FillRect(Rect(0, 0, cxImage1.Width, cxImage1.Height));
lvErrorText := string(AnsiString(lvSymbol.errtxt));
ShowMessage('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + lvErrorText);
end;
finally
lvBitMap.Free;
lvBitMap := nil;
ZBarcode_Delete(lvSymbol);
end;
bitmap := TBitmap.Create;
try
bitmap.Assign(cxImage1.Picture.Bitmap);
bitmap.SaveToFile(ExtractFilePath(Application.ExeName) + 'image\temp4.bmp');
finally
bitmap.Free;
end;
end;
end.