633 lines
17 KiB
ObjectPascal
633 lines
17 KiB
ObjectPascal
|
|
unit U_TradeInspSet;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, StrUtils, SysUtils, Variants, Classes, Graphics, Controls,
|
|||
|
|
Forms, Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB,
|
|||
|
|
ADODB, cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
|||
|
|
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
|
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
|||
|
|
cxTextEdit, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
cxNavigator, dxDateRanges,
|
|||
|
|
dxBarBuiltInMenu, U_BaseList, cxContainer, dxCore, cxDateUtils, cxImage,
|
|||
|
|
cxDBEdit, IdExplicitTLSClientServerBase, RM_Preview, cxPC, U_BaseHelp,
|
|||
|
|
System.ImageList, Vcl.ImgList, RM_BarCode, RM_e_Xls, dxScrollbarAnnotations,
|
|||
|
|
dxLayoutcxEditAdapters, RM_DsgGridReport, RM_RichEdit, dxLayoutContainer,
|
|||
|
|
dxLayoutControl;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmTradeInspSet = class(TfrmBaseHelp)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
Tsave: TToolButton;
|
|||
|
|
cxPageControl1: TcxPageControl;
|
|||
|
|
cxTabSheet4: TcxTabSheet;
|
|||
|
|
cxTabSheet3: TcxTabSheet;
|
|||
|
|
RMPreview2: TRMPreview;
|
|||
|
|
RMPreview1: TRMPreview;
|
|||
|
|
RuleLaterTare: TcxTextEdit;
|
|||
|
|
Coefficient: TcxTextEdit;
|
|||
|
|
ADOQueryLabel: TADOQuery;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDB_1: TRMDBDataSet;
|
|||
|
|
ADO_1: TADOQuery;
|
|||
|
|
RM2: TRMGridReport;
|
|||
|
|
RMDB_2: TRMDBDataSet;
|
|||
|
|
cxTabSheet1: TcxTabSheet;
|
|||
|
|
DS_Label: TDataSource;
|
|||
|
|
CDS_Label: TClientDataSet;
|
|||
|
|
RMDB_Label: TRMDBDataSet;
|
|||
|
|
RMLabel: TRMGridReport;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxGridLabel: TcxGrid;
|
|||
|
|
TVLabel: TcxGridDBTableView;
|
|||
|
|
TVLabellabelId: TcxGridDBColumn;
|
|||
|
|
TVLabellabeltype: TcxGridDBColumn;
|
|||
|
|
TVLabellabelCaption: TcxGridDBColumn;
|
|||
|
|
TVLabellabelFile: TcxGridDBColumn;
|
|||
|
|
cxGridLabelLevel1: TcxGridLevel;
|
|||
|
|
RMPreview3: TRMPreview;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
TVolumeset: TToolButton;
|
|||
|
|
Tpackset: TToolButton;
|
|||
|
|
Tadd: TToolButton;
|
|||
|
|
Tupd: TToolButton;
|
|||
|
|
Tdel: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
RMBarCodeObject1: TRMBarCodeObject;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
ADO_Down: TADOQuery;
|
|||
|
|
TVLabelColumn1: TcxGridDBColumn;
|
|||
|
|
TVLabelColumn2: TcxGridDBColumn;
|
|||
|
|
LabVolume: TcxTextEdit;
|
|||
|
|
LabPackage: TcxTextEdit;
|
|||
|
|
RuleAddLen: TcxTextEdit;
|
|||
|
|
LabelType: TcxComboBox;
|
|||
|
|
LabelCaption: TcxTextEdit;
|
|||
|
|
RuleConversion: TcxComboBox;
|
|||
|
|
RulePieceNo: TcxComboBox;
|
|||
|
|
RuleLenUnit: TcxComboBox;
|
|||
|
|
RuleAddwet: TcxTextEdit;
|
|||
|
|
FixedLength: TcxTextEdit;
|
|||
|
|
dxLayoutControl_packsetGroup_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl_packset: TdxLayoutControl;
|
|||
|
|
dxLayoutGroup1: TdxLayoutGroup;
|
|||
|
|
dxLayoutItem1: TdxLayoutItem;
|
|||
|
|
dxLayoutItem2: TdxLayoutItem;
|
|||
|
|
RulePackNo: TcxComboBox;
|
|||
|
|
RuleYardstick: TcxComboBox;
|
|||
|
|
dxLayoutItem3: TdxLayoutItem;
|
|||
|
|
packRolls: TcxTextEdit;
|
|||
|
|
dxLayoutControl_piecesetGroup_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl_pieceset: TdxLayoutControl;
|
|||
|
|
dxLayoutGroup2: TdxLayoutGroup;
|
|||
|
|
dxLayoutGroup3: TdxLayoutGroup;
|
|||
|
|
dxLayoutItem4: TdxLayoutItem;
|
|||
|
|
dxLayoutItem5: TdxLayoutItem;
|
|||
|
|
dxLayoutItem6: TdxLayoutItem;
|
|||
|
|
dxLayoutItem7: TdxLayoutItem;
|
|||
|
|
dxLayoutItem8: TdxLayoutItem;
|
|||
|
|
dxLayoutItem9: TdxLayoutItem;
|
|||
|
|
dxLayoutItem10: TdxLayoutItem;
|
|||
|
|
dxLayoutItem11: TdxLayoutItem;
|
|||
|
|
dxLayoutItem12: TdxLayoutItem;
|
|||
|
|
dxLayoutItem13: TdxLayoutItem;
|
|||
|
|
RMDB_rtfields: TRMDBDataSet;
|
|||
|
|
ADOQueryRtFields: TADOQuery;
|
|||
|
|
ADOConnection1: TADOConnection;
|
|||
|
|
RuleAddwetVirtual: TcxTextEdit;
|
|||
|
|
RuleAddLenVirtual: TcxTextEdit;
|
|||
|
|
dxLayoutItem14: TdxLayoutItem;
|
|||
|
|
dxLayoutItem15: TdxLayoutItem;
|
|||
|
|
DecimalY: TcxTextEdit;
|
|||
|
|
DecimalKg: TcxTextEdit;
|
|||
|
|
dxLayoutItem16: TdxLayoutItem;
|
|||
|
|
dxLayoutItem18: TdxLayoutItem;
|
|||
|
|
dxLayoutGroup4: TdxLayoutGroup;
|
|||
|
|
RMRichObject1: TRMRichObject;
|
|||
|
|
DecimalM: TcxTextEdit;
|
|||
|
|
dxLayoutItem17: TdxLayoutItem;
|
|||
|
|
packlabNumber: TcxComboBox;
|
|||
|
|
packPostAction: TcxComboBox;
|
|||
|
|
dxLayoutItem_packlabNumber: TdxLayoutItem;
|
|||
|
|
dxLayoutItem_packPrintAction: TdxLayoutItem;
|
|||
|
|
RMGridReportDesigner1: TRMGridReportDesigner;
|
|||
|
|
dxLayoutItem_outPage: TdxLayoutItem;
|
|||
|
|
labelOutPage: TcxComboBox;
|
|||
|
|
TlaySave: TToolButton;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure TsaveClick(Sender: TObject);
|
|||
|
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
|
procedure TVolumesetClick(Sender: TObject);
|
|||
|
|
procedure TpacksetClick(Sender: TObject);
|
|||
|
|
procedure TupdClick(Sender: TObject);
|
|||
|
|
procedure TdelClick(Sender: TObject);
|
|||
|
|
procedure TaddClick(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure LabelTypeChange(Sender: TObject);
|
|||
|
|
procedure TVLabelCellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TVLabelDblClick(Sender: TObject);
|
|||
|
|
procedure TlaySaveClick(Sender: TObject);
|
|||
|
|
procedure dxLayoutControl_piecesetDblClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure InitLabel();
|
|||
|
|
function SaveLabel(MLabelID: string): Boolean;
|
|||
|
|
procedure InitLabVolume();
|
|||
|
|
procedure InitLabPackage();
|
|||
|
|
public
|
|||
|
|
FDataID: string;
|
|||
|
|
fSubUseFlag:Boolean;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmTradeInspSet: TfrmTradeInspSet;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_LabelInput,U_FormLayOutDesign, U_LabelList,U_globalVar;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
function TfrmTradeInspSet.SaveLabel(MLabelID: string): Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Label');
|
|||
|
|
sql.Add('where LabelID=' + Quotedstr(MLabelID));
|
|||
|
|
Open;
|
|||
|
|
Edit;
|
|||
|
|
fieldByName('Editer').value := DName;
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
// RMLabel.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 TfrmTradeInspSet.InitLabel();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from Trade_Label');
|
|||
|
|
sql.Add(' order by labeltype,labelCaption');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel4, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Label);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Label);
|
|||
|
|
TVLabel.ApplyBestFit() ;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.InitLabVolume();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with ADOQueryLabel do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select top 1 * from RT_FileUpdate');
|
|||
|
|
sql.Add('where FileName=' + quotedstr(trim(LabVolume.Text) + '.rmf'));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryLabel.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with RM1 do
|
|||
|
|
begin
|
|||
|
|
LoadFromBlobField(tblobfield(ADOQueryLabel.fieldbyname('Files')));
|
|||
|
|
Preview := RMPreview1;
|
|||
|
|
ShowReport;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.InitLabPackage();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with ADOQueryLabel do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select top 1 * from RT_FileUpdate');
|
|||
|
|
sql.Add('where FileName=' + quotedstr(trim(LabPackage.Text) + '.rmf'));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryLabel.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
with RM2 do
|
|||
|
|
begin
|
|||
|
|
LoadFromBlobField(tblobfield(ADOQueryLabel.fieldbyname('Files')));
|
|||
|
|
Preview := RMPreview2;
|
|||
|
|
ShowReport;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.LabelTypeChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel4, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Label);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Label);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.InitGrid();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from Trade_Cloth_Inspect_Rule where RuleID=''' + Trim(FDataID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
LSCSHData(ADOQueryTemp, dxLayoutControl_pieceset, 2);
|
|||
|
|
LSCSHData(ADOQueryTemp, dxLayoutControl_packset, 2);
|
|||
|
|
if trim(ADOQueryTemp.FieldByName('RuleYardstick').AsString)<>'' then
|
|||
|
|
RuleYardstick.Text:=trim(ADOQueryTemp.FieldByName('RuleYardstick').AsString)
|
|||
|
|
else
|
|||
|
|
RuleYardstick.Text:='100';
|
|||
|
|
if dxLayoutItem_outPage.ActuallyVisible then
|
|||
|
|
begin
|
|||
|
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if ADOQueryTemp.FieldByName('labelOutPage').AsBoolean then
|
|||
|
|
labelOutPage.ItemIndex:=1
|
|||
|
|
else
|
|||
|
|
labelOutPage.ItemIndex:=0 ;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmTradeInspSet := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.cxPageControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
case cxPageControl1.ActivePageIndex of
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
InitLabVolume();
|
|||
|
|
end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
InitLabPackage();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.dxLayoutControl_piecesetDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
layoutDesign(dxLayoutControl_pieceset,ADOQueryCmd,PWideChar(dcode));
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
cxPageControl1.Align:=alClient;
|
|||
|
|
fSubUseFlag:=false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TaddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmLabelInput := TfrmLabelInput.create(self);
|
|||
|
|
with frmLabelInput do
|
|||
|
|
begin
|
|||
|
|
FLabelId := '';
|
|||
|
|
if showModal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitLabel();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelInput.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
//ModalResult := 1;
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
tlaysave.Visible:=gIsCanDesign;
|
|||
|
|
readLayOut(dxLayoutControl_pieceset,ADOQueryTemp,PWideChar( fDllFileName+'|'+self.name+'|'+dxLayoutControl_pieceset.Name+'.ini'));
|
|||
|
|
|
|||
|
|
if fSubUseFlag then
|
|||
|
|
begin
|
|||
|
|
ToolBar1.Visible:=false;
|
|||
|
|
dxLayoutControl_packset.Visible:=false;
|
|||
|
|
dxLayoutControl_pieceset.Visible:=False;
|
|||
|
|
Tpackset.Visible:=False;
|
|||
|
|
TVolumeset.Visible:=false;
|
|||
|
|
end;
|
|||
|
|
ExportFtErpFile('ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf', ADOQueryTemp);
|
|||
|
|
with ADO_1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec P_BS_Label_Get_Test');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
Initlabel();
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TdelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>ǰѡ<C7B0><D1A1><EFBFBD>ı<EFBFBD>ǩ<EFBFBD><C7A9>?','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ',1)=2 then exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.clear;
|
|||
|
|
sql.Add('delete Trade_Label');
|
|||
|
|
sql.Add('where labelId=' + quotedstr(CDS_Label.fieldByName('LabelID').asString));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ǩɾ<C7A9><C9BE>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ǩ<EFBFBD><C7A9><EFBFBD>ƣ<EFBFBD>' + trim(CDS_Label.fieldByName('labelCaption').asString))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
execSql;
|
|||
|
|
end;
|
|||
|
|
CDS_Label.Delete;
|
|||
|
|
except
|
|||
|
|
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmTradeInspSet.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
MaxId, MaxSubId, FCoCode, FCCID, MaxCFID: string;
|
|||
|
|
begin
|
|||
|
|
Result := false;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|
|||
|
|
if Trim(FDataID) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, MaxId, 'R', 'Trade_Cloth_Inspect_Rule', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
MaxId := Trim(FDataID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Trade_Cloth_Inspect_Rule where RuleID=''' + Trim(FDataID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FDataID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('Edittime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
FieldByName('RuleID').Value := Trim(MaxId);
|
|||
|
|
LRTSetsavedata(ADOQueryCmd, 'Trade_Cloth_Inspect_Rule', dxLayoutControl_pieceset, 2);
|
|||
|
|
LRTSetsavedata(ADOQueryCmd, 'Trade_Cloth_Inspect_Rule', dxLayoutControl_packset, 2);
|
|||
|
|
if dxLayoutItem_outPage.ActuallyVisible then
|
|||
|
|
begin
|
|||
|
|
if trim(labelOutPage.Text)='<27>ֶ<EFBFBD>' then
|
|||
|
|
FieldByName('labelOutPage').Value :=0
|
|||
|
|
else
|
|||
|
|
FieldByName('labelOutPage').Value :=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
FCCID := Trim(MaxSubId);
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TVolumesetClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Label.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
LabVolume.Text := trim(CDS_Label.fieldbyname('labelCaption').asstring);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TpacksetClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Label.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
LabPackage.Text := trim(CDS_Label.fieldbyname('labelCaption').asstring);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TsaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if RuleLenUnit.text = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
//if trim(RuleConversion.text)='<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
|
|||
|
|
// Coefficient.Text:='';
|
|||
|
|
|
|||
|
|
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
if Tsave.Tag=0 then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0) ;
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TlaySaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if gIsCanDesign then
|
|||
|
|
begin
|
|||
|
|
saveLayOut(application,dxLayoutControl_pieceset, ADOQueryBaseCmd, pwidechar( fDllFileName + '|' + Self.name + '|' + dxLayoutControl_pieceset.name+ '.ini'));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.ToolButton4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fFileName, fPrintFile: string;
|
|||
|
|
MLabelID, MLabelCaption: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_Label.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with ADOQueryRtFields do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from SY_ReportFields10');
|
|||
|
|
sql.Add('where field_group=''label''');
|
|||
|
|
sql.Add('order by order_no');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
MLabelID := TRIM(CDS_Label.fieldByName('LabelID').asString);
|
|||
|
|
MLabelCaption := TRIM(CDS_Label.fieldByName('LabelCaption').asString);
|
|||
|
|
ExportFtErpFile(MLabelCaption + '.rmf', ADOQueryTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'report\' + MLabelCaption + '.rmf';
|
|||
|
|
|
|||
|
|
if not FileExists(fPrintFile) then
|
|||
|
|
CopyFile(PChar(ExtractFilePath(Application.ExeName) + 'Report\ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'), PChar(fPrintFile), False);
|
|||
|
|
|
|||
|
|
|
|||
|
|
with RMLabel do
|
|||
|
|
begin
|
|||
|
|
RMLabel.Clear;
|
|||
|
|
RMDB_Label.DataSet := nil;
|
|||
|
|
Dictionary.FieldAliases.Clear;
|
|||
|
|
Dictionary.FieldAliases['RMDB_Label'] := '<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>';
|
|||
|
|
RMVariables.Add('QRBARCODE','[QRBARCODE]');
|
|||
|
|
RMDB_Label.DataSet := ADO_1;
|
|||
|
|
LoadFromFile(fPrintFile);
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
|
|||
|
|
DesignReport();
|
|||
|
|
// RMLabel.SaveToFile(fPrintFile);
|
|||
|
|
SaveLabel(MLabelID);
|
|||
|
|
ExportToFtErp(fPrintFile, ADOQueryCmd);
|
|||
|
|
end;
|
|||
|
|
with RMLabel do
|
|||
|
|
begin
|
|||
|
|
RMLabel.LoadFromFile(fPrintFile);
|
|||
|
|
Preview := RMPreview3;
|
|||
|
|
ShowReport;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TupdClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Label.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
try
|
|||
|
|
frmLabelInput := TfrmLabelInput.create(self);
|
|||
|
|
with frmLabelInput do
|
|||
|
|
begin
|
|||
|
|
fLabelId := CDS_Label.fieldByName('LabelId').AsString;
|
|||
|
|
if showModal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitLabel();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelInput.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TVLabelCellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_Label.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
ExportFtErpFile(TRIM(CDS_Label.fieldByName('LabelCaption').asString) + '.rmf', ADOQueryTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + CDS_Label.fieldbyname('LabelCaption').AsString + '.rmf';
|
|||
|
|
if not FileExists(fPrintFile) then
|
|||
|
|
CopyFile(PChar(ExtractFilePath(Application.ExeName) + 'Report\ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf'), PChar(fPrintFile), False);
|
|||
|
|
|
|||
|
|
with RMLabel do
|
|||
|
|
begin
|
|||
|
|
RMLabel.ShowErrorMsg:=false;
|
|||
|
|
RMLabel.LoadFromFile(fPrintFile);
|
|||
|
|
Preview := RMPreview3;
|
|||
|
|
ShowReport;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmTradeInspSet.TVLabelDblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if fSubUseFlag then
|
|||
|
|
begin
|
|||
|
|
ModalResult :=1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|