D10DJzhuocan/项目代码/djdPack/G03贸易布匹检验/U_TradeClothInspList_Auto.pas
DESKTOP-E401PHE\Administrator a7ad636323 卓灿~
2026-02-06 14:28:14 +08:00

1191 lines
33 KiB
ObjectPascal
Raw 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_TradeClothInspList_Auto;
interface
uses
Windows, MMSystem, 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, Menus, MovePanel, cxTextEdit,
cxContainer, cxCurrencyEdit, BtnEdit, RM_e_main, RM_e_htm, RM_e_Graphic,
RM_e_Jpeg, RM_e_txt, RM_e_csv, Math, Clipbrd, cxPC, cxLookAndFeels,
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxDateRanges, U_BaseList,
dxDateTimeWheelPicker, dxSkinWXI, dxScrollbarAnnotations, cxMaskEdit,
cxDropDownEdit, dxCore, cxDateUtils, dxLayoutcxEditAdapters, dxLayoutContainer,
dxLayoutControl, System.Diagnostics, cxGroupBox, RM_BarCode, RM_RichEdit,
RM_E_llPDF, dxX509Certificate, dxPDFCore, dxPDFBase, dxPDFText,
dxPDFRecognizedObject, dxPDFForm, dxPDFFormData, dxPDFDocument, dxPrintUtils,
dxCustomPreview, dxPDFDocumentViewer, dxPDFViewer, cxProgressBar,
dxSkinsDefaultPainters;
type
TfrmTradeClothInspList_Auto = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
GPM_1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DS_1: TDataSource;
OrderNo: TcxTextEdit;
TBExport: TToolButton;
Order_Main: TClientDataSet;
conNO: TcxTextEdit;
C_Name: TcxTextEdit;
btnJBQ: TToolButton;
RM1: TRMGridReport;
RMDB_1: TRMDBDataSet;
ADOQueryPrint: TADOQuery;
MovePanel2: TMovePanel;
C_Color: TcxTextEdit;
BCIOID: TcxTextEdit;
CIMachNo: TcxTextEdit;
C_Pattern: TcxTextEdit;
C_Code: TcxTextEdit;
C_EColor: TcxTextEdit;
ToolButton1: TToolButton;
PM_1: TPopupMenu;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1ssel: TcxGridDBColumn;
v1Column21: TcxGridDBColumn;
v1Column32: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
Tv1Column4: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column23: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column27: TcxGridDBColumn;
v1Column28: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column42: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
Tv1Column7: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1MKXS: TcxGridDBColumn;
v1Column34: TcxGridDBColumn;
v1Column40: TcxGridDBColumn;
v1Column46: TcxGridDBColumn;
Tv1Column5: TcxGridDBColumn;
Tv1Column8: TcxGridDBColumn;
Tv1Column3: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
Panel6: TPanel;
Label31: TLabel;
LBCPAP: TLabel;
BTLP: TButton;
BTNP: TButton;
Tv1Column10: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
BatchNO: TcxTextEdit;
Tv1Column11: TcxGridDBColumn;
Tv1Column12: TcxGridDBColumn;
ToolButton3: TToolButton;
grade: TcxComboBox;
CIIOFlag: TcxComboBox;
TCBNOR: TcxComboBox;
Tv1AddwetPresent: TcxGridDBColumn;
Tv1AddLenPresent: TcxGridDBColumn;
ToolButton5: TToolButton;
Tout: TToolButton;
Tunout: TToolButton;
BegDate: TcxDateEdit;
EndDate: TcxDateEdit;
dxLayoutControl_queryGroup_Root: TdxLayoutGroup;
dxLayoutControl_query: TdxLayoutControl;
dxLayoutGroup1: TdxLayoutGroup;
dxLayoutGroup2: TdxLayoutGroup;
dxLayoutItem1: TdxLayoutItem;
dxLayoutItem2: TdxLayoutItem;
dxLayoutItem3: TdxLayoutItem;
dxLayoutItem4: TdxLayoutItem;
dxLayoutItem5: TdxLayoutItem;
dxLayoutItem6: TdxLayoutItem;
dxLayoutItem7: TdxLayoutItem;
dxLayoutItem8: TdxLayoutItem;
dxLayoutItem9: TdxLayoutItem;
dxLayoutItem10: TdxLayoutItem;
dxLayoutItem11: TdxLayoutItem;
dxLayoutItem12: TdxLayoutItem;
dxLayoutItem13: TdxLayoutItem;
dxLayoutItem14: TdxLayoutItem;
dxLayoutItem15: TdxLayoutItem;
dxLayoutItem16: TdxLayoutItem;
IsJYTime: TcxCheckBox;
dxLayoutEmptySpaceItem1: TdxLayoutEmptySpaceItem;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
Tv1custName: TcxGridDBColumn;
custName: TcxTextEdit;
dxLayoutItem17: TdxLayoutItem;
Tv1lenUnit: TcxGridDBColumn;
RMRichObject1: TRMRichObject;
RMBarCodeObject1: TRMBarCodeObject;
RMXLSExport1: TRMXLSExport;
RMCSVExport1: TRMCSVExport;
RMllPDFExport1: TRMllPDFExport;
RMXLSExport2: TRMXLSExport;
Tv1unitPieces: TcxGridDBColumn;
Tv1operators: TcxGridDBColumn;
PopupMenu3: TPopupMenu;
MenuItem1: TMenuItem;
cxCheckBox1: TcxCheckBox;
Tv1Column9: TcxGridDBColumn;
Tv1Column13: TcxGridDBColumn;
Tv1Column14: TcxGridDBColumn;
ToolButton2: TToolButton;
ToolButton4: TToolButton;
Label2: TLabel;
dxLayoutItem18: TdxLayoutItem;
Label3: TLabel;
dxLayoutItem19: TdxLayoutItem;
dxLayoutAutoCreatedGroup1: TdxLayoutAutoCreatedGroup;
dxLayoutAutoCreatedGroup2: TdxLayoutAutoCreatedGroup;
cxTabControl1: TcxTabControl;
Timer1: TTimer;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure btnJBQClick(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORChange(Sender: TObject);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure conNOKeyPress(Sender: TObject; var Key: Char);
procedure CIIOFlagChange(Sender: TObject);
procedure GradeChange(Sender: TObject);
procedure KHConNOKeyPress(Sender: TObject; var Key: Char);
procedure RKOrdIDKeyPress(Sender: TObject; var Key: Char);
procedure Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
procedure cxPageControl1Change(Sender: TObject);
procedure chkZFClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure ToutClick(Sender: TObject);
procedure TunoutClick(Sender: TObject);
procedure CIIOFlagPropertiesChange(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure v1sselPropertiesEditValueChanged(Sender: TObject);
procedure cxCheckBox1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
private
fstopwatch: TStopwatch;
DQdate: TDateTime;
FLeft, FTop: Integer;
CurrentPage, RecordsNumber: Integer;
procedure InitGrid();
function Savedata(): Boolean;
procedure SetStatus();
procedure PrintCKMDG(MRKOrdID: string);
procedure threadLoadform();
function autoOut(mccids: string): boolean;
procedure selDisp();
{ Private declarations }
public
FFInt, mCopys: Integer;
canshu1: string;
{ Public declarations }
end;
implementation
uses
U_DataLink, U_TradePack, U_RTFun, U_globalVar, U_TradeInspEdit, U_ZDYHelp,
U_LabelPrint, U_SysLogList, U_ControlData, U_FormLayOutDesign, U_MdPrint,
U_BatchMdyData, U_iniparam;
{$R *.dfm}
procedure TfrmTradeClothInspList_Auto.SetStatus();
begin
// btnEdit.Enabled := False;
// TBZF.Enabled := False;
// btnHY.Enabled := False;
// btnJBQ.Enabled := False;
// btnJYBG.Enabled := False;
//
// btnEdit.Enabled := True;
// TBZF.Enabled := True;
// btnJBQ.Enabled := True;
// btnJYBG.Enabled := True;
end;
procedure TfrmTradeClothInspList_Auto.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmTradeClothInspList_Auto.FormCreate(Sender: TObject);
begin
// fstopwatch := TStopwatch.StartNew;
inherited;
cxgrid1.Align := alClient;
DQdate := SGetServerDate(ADOQueryTemp);
end;
procedure TfrmTradeClothInspList_Auto.TBCloseClick(Sender: TObject);
begin
inherited;
Close;
end;
procedure TfrmTradeClothInspList_Auto.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel(self.Caption, cxgrid1);
end;
procedure TfrmTradeClothInspList_Auto.PrintCKMDG(MRKOrdID: string);
begin
end;
procedure TfrmTradeClothInspList_Auto.InitGrid();
var
WSql: string;
begin
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
MovePanel2.Visible := True;
MovePanel2.Refresh;
WSql := SLGetFilters(dxLayoutControl_query, 1, 2);
if trim(WSql) <> '' then
begin
WSql := ' and ' + trim(WSql);
end;
if IsJYTime.Checked then
begin
WSql := WSql + ' and A.Filltime>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.Date));
WSql := WSql + ' and A.Filltime<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.Date + 1));
end
else
begin
if trim(WSql) <> '' then
WSql := ' and 1=1' + trim(WSql)
else
WSql := WSql + ' and 1=2 ';
end;
if trim(WSql) = 'and 1=2' then
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
if cxTabControl1.TabIndex = 0 then
begin
WSql := WSql + ' and isnull(A.ZDFlag,'''')=''0'' ';
end;
if cxTabControl1.TabIndex = 1 then
begin
WSql := WSql + ' and isnull(A.ZDFlag,'''')=''1'' ';
end;
try
tv1.BeginUpdate();
Order_Main.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add('exec P_Trade_Insp_Get_Page ');
sql.Add('@pageIndex=' + inttostr(CurrentPage));
sql.Add(',@pageSize=' + inttostr(RecordsNumber));
sql.Add(',@criteria= ' + quotedstr(WSql));
Open;
end;
SCreateCDS(ADOQueryMain, Order_Main);
SInitCDSData(ADOQueryMain, Order_Main);
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
MovePanel2.Visible := false;
finally
Order_Main.EnableControls;
MovePanel2.Visible := false;
TV1.DataController.Filter.Clear;
tv1.EndUpdate;
end;
end;
procedure TfrmTradeClothInspList_Auto.TBRafreshClick(Sender: TObject);
begin
// OrderNo.SetFocus;
CurrentPage := 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.FormShow(Sender: TObject);
begin
inherited;
canshu1 := self.fParameters1;
CurrentPage := 1;
RecordsNumber := 500;
InitDevCombobox(ADOQueryTemp, grade, 'CPGRADE', false);
EndDate.Date := SGetServerDate(ADOQueryTemp);
BegDate.Date := EndDate.Date;
mCopys := 1;
//ReadCxGrid(Trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
// InitGrid();
// SetStatus();
threadLoadform();
application.ProcessMessages;
//fstopwatch.Stop;
// showMessage(IntToStr(fstopwatch.ElapsedMilliseconds) + ' ms');
end;
procedure TfrmTradeClothInspList_Auto.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLeft := X;
FTop := Y;
end;
procedure TfrmTradeClothInspList_Auto.v1sselPropertiesEditValueChanged(Sender: TObject);
begin
inherited;
selDisp();
end;
procedure TfrmTradeClothInspList_Auto.btnJBQClick(Sender: TObject);
var
fPrintFile, FLabVolume, MStrIn: string;
// mCopys: Integer;
begin
if Order_Main.IsEmpty then
Exit;
// if Order_Main.Locate('SSel', True, []) = False then
// begin
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
// Exit;
// end;
// MStrIn := '2';
// if not InputQuery('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', MStrIn) then
// begin
// Exit;
// end;
// mCopys := strToIntdef(trim(MStrIn), 1);
Order_Main.DisableControls;
// with Order_Main do
// begin
// First;
// while not Eof do
// begin
// if Order_Main.FieldByName('SSel').AsBoolean = True then
// begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update Trade_Cloth_Inspect Set ZDFlag=1,PrtCount=PrtCount+1,PrtDate=getdate(),Prter=''' + Trim(DName) + '''');
sql.Add(' where CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
ExecSQL;
end;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Trade_Print_djd_Lab ');
SQL.Add(' @CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
Open;
end;
if ADOQueryPrint.IsEmpty then
begin
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
if Trim(ADOQueryPrint.fieldbyname('SLabVolume').AsString) <> '' then
FLabVolume := Trim(ADOQueryPrint.fieldbyname('SLabVolume').AsString)
else
FLabVolume := Trim(ADOQueryPrint.fieldbyname('LabVolume').AsString);
//Ĭ<>ϱ<EFBFBD>ǩ
if FLabVolume = '' then
FLabVolume := trim(gDefaultLableFile);
ExportFtErpFile(FLabVolume + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLabVolume + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
Rm1.DefaultCopies := mCopys;
// RM1.PrepareReport ;
RM1.PrintReport;
// RM1.ExportTo(RMllPDFExport1,'C:\test.pdf');
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
// end;
// Next;
// end;
// end;
Order_Main.EnableControls;
end;
function TfrmTradeClothInspList_Auto.Savedata(): Boolean;
var
maxno, LLID: string;
HXPS: Integer;
HXQty, HXMQty: Double;
begin
HXPS := 0;
HXQty := 0;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select Top 1 * from Contract_Cloth_LL where OrdSubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
sql.Add(' and FirstName=''' + Trim(Order_Main.fieldbyname('AOrddefstr4').AsString) + '''');
Open;
end;
LLID := Trim(ADOQueryTemp.fieldbyname('LLID').AsString);
if Trim(LLID) = '' then
begin
Result := False;
Application.MessageBox(<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
if GetLSNo(ADOQueryCmd, maxno, 'HX', 'Contract_Cloth_BefChkHX', 2, 1) = False then
begin
Result := False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean = True then
begin
HXPS := HXPS + 1;
HXQty := HXQty + Order_Main.FieldByName('MJLen').Value;
end;
Next;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('');
Open;
end;
except
end;
end;
procedure TfrmTradeClothInspList_Auto.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
CurrentPage := 1;
InitGrid();
end;
end;
procedure TfrmTradeClothInspList_Auto.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.BTNPClick(Sender: TObject);
begin
if CurrentPage < Order_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.TCBNORChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.Timer1Timer(Sender: TObject);
begin
cxTabControl1.TabIndex := 0;
sleep(100);
TBRafresh.Click;
sleep(500);
if not Order_Main.IsEmpty then
begin
if Order_Main.FieldByName('ZDFlag').AsInteger = 0 then
begin
btnJBQ.Click;
// ShowMessage('<27><>ӡ');
end
else
begin
end;
end;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(Trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
if gIsCanDesign then
begin
saveLayOut(application, dxLayoutControl_query, ADOQueryBaseCmd, PWideChar(fDllFileName + '|' + Self.Name + '|' + dxLayoutControl_query.Name + '.ini'));
end;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton2Click(Sender: TObject);
begin
Timer1.Enabled := False;
Label2.Visible := True;
Label3.Visible := False;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton3Click(Sender: TObject);
var
FPrintFile, MPacketId, MLabPackage: string;
begin
if Order_Main.IsEmpty then
Exit;
if Order_Main.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
Order_Main.DisableControls;
with Order_Main do
begin
filter := 'SSel=1 ';
filtered := true;
end;
with Order_Main do
begin
while not Order_Main.eof do
begin
MPacketId := Trim(Order_Main.fieldbyname('PacketId').AsString);
if MPacketId = '' then
begin
Order_Main.Next;
Continue;
end;
if trim(MPacketId) <> '' then
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
SQL.Add('exec P_Trade_Insp_Prt_djd_PackLab ' + quotedstr(MPacketId));
Open;
end;
//
if Trim(ADOQueryPrint.fieldbyname('SLabPackage').AsString) <> '' then
MLabPackage := trim(ADOQueryPrint.FieldByName('SLabPackage').AsString)
else
MLabPackage := trim(ADOQueryPrint.FieldByName('LabPackage').AsString);
if MLabPackage = '' then
MLabPackage := trim(gDefaultPackLableFile);
ExportFtErpFile(Trim(MLabPackage) + '.rmf', ADOQueryTemp);
FPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(MLabPackage) + '.rmf';
if not FileExists(FPrintFile) then
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + FPrintFile), '<27><>ʾ', 0);
Exit;
end;
if FileExists(FPrintFile) then
begin
RM1.LoadFromFile(FPrintFile);
Rm1.DefaultCopies := 1;
RM1.PrintReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + FPrintFile), '<27><>ʾ', 0);
end;
while Order_Main.Locate('SSel;PacketId', VarArrayOf([True, MPacketId]), []) do
begin
with Order_Main do
begin
Edit;
Order_Main.FieldByName('SSel').Value := False;
Post;
end;
end;
end;
Order_Main.Next;
end;
end;
Order_Main.filtered := false;
Order_Main.EnableControls;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton4Click(Sender: TObject);
begin
Timer1.Enabled := true;
Label2.Visible := True;
Label3.Visible := False;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton5Click(Sender: TObject);
begin
inherited;
frmSysLogList := TfrmSysLogList.create(self);
with frmSysLogList do
begin
fModel := self.caption;
FMainId := ''; // Trim(Self.Order_Main.FieldByName('mainId').AsString);
showmodal;
free;
end;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton6Click(Sender: TObject);
begin
// with ADOQueryTemp do
// begin
// close;
// sql.Clear;
// sql.Add('SELECT * FROM [dbo].[Bs_Report_Cloud_File]');
// sql.Add('where BLCLID=''D22E6757-43C2-45B9-AE14-921BD2293E50''');
// open;
// end;
// if ADOQueryTemp.RecordCount>0 then
// begin
// rm1.LoadPreparedReportFromBlobField(TBlobField(ADOQueryTemp.fieldByName('GenerateFiles')));
// rm1.ShowPreparedReport;
// // rm1.PrintPreparedReport('',1,true,rmppAll) ;
// end;
end;
procedure TfrmTradeClothInspList_Auto.ToolButton7Click(Sender: TObject);
var
MStrIn: string;
begin
MStrIn := '1';
if not InputQuery('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', MStrIn) then
begin
Exit;
end;
mCopys := strToIntdef(trim(MStrIn), 1);
end;
procedure TfrmTradeClothInspList_Auto.ToolButton8Click(Sender: TObject);
begin
if Order_Main.Locate('ssel', True, []) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD>Ҫ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean = True then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update Trade_Cloth_Inspect set ZDFlag=1 where CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
ExecSQL;
end;
Order_Main.Edit;
FieldByName('SSel').Value := false;
Order_Main.Post;
end
else
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmTradeClothInspList_Auto.ToutClick(Sender: TObject);
begin
if Order_Main.Locate('ssel', True, []) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean = True then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update Trade_Cloth_Inspect set CIIOFlag=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',IOTime=getdate() where CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
ExecSQL;
end;
Order_Main.Edit;
FieldByName('CIIOFlag').Value := '<27>ѳ<EFBFBD><D1B3><EFBFBD>';
FieldByName('SSel').Value := false;
Order_Main.Post;
end
else
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmTradeClothInspList_Auto.TunoutClick(Sender: TObject);
begin
if Order_Main.Locate('ssel', True, []) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean = True then
begin
//begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update Trade_Cloth_Inspect set CIIOFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',IOTime=null where CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
ExecSQL;
end;
Edit;
FieldByName('CIIOFlag').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('SSel').Value := false;
Post;
Next;
end
else
Next;
end;
end;
finally
Order_Main.EnableControls;
TBRafresh.Click;
end;
end;
procedure TfrmTradeClothInspList_Auto.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
Clipboard.SetTextBuf(PChar(Trim(Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;
procedure TfrmTradeClothInspList_Auto.chkZFClick(Sender: TObject);
begin
inherited;
CurrentPage := 1;
SetStatus();
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.conNOKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
CurrentPage := 1;
InitGrid();
end;
end;
procedure TfrmTradeClothInspList_Auto.cxCheckBox1Click(Sender: TObject);
begin
if not cxCheckBox1.Checked then
cxCheckBox1.Caption := 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>ʾ'
else
selDisp();
end;
procedure TfrmTradeClothInspList_Auto.cxPageControl1Change(Sender: TObject);
begin
CurrentPage := 1;
SetStatus();
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.CIIOFlagChange(Sender: TObject);
begin
CurrentPage := 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.CIIOFlagPropertiesChange(Sender: TObject);
begin
inherited;
CurrentPage := 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.GradeChange(Sender: TObject);
begin
CurrentPage := 1;
InitGrid();
end;
procedure TfrmTradeClothInspList_Auto.KHConNOKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
CurrentPage := 1;
InitGrid();
end;
end;
procedure TfrmTradeClothInspList_Auto.MenuItem1Click(Sender: TObject);
var
fPrintFile, FLabVolume, MStrIn: string;
mCopys: Integer;
begin
if Order_Main.IsEmpty then
Exit;
if Order_Main.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
MStrIn := '2';
if not InputQuery('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', MStrIn) then
begin
Exit;
end;
mCopys := strToIntdef(trim(MStrIn), 2);
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not Eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean = True then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update Trade_Cloth_Inspect Set PrtCount=PrtCount+1,PrtDate=getdate(),Prter=''' + Trim(DName) + '''');
sql.Add(' where CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
ExecSQL;
end;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Trade_Print_djd_Lab ');
SQL.Add(' @CIID=''' + Trim(Order_Main.fieldbyname('CIID').AsString) + '''');
Open;
end;
if ADOQueryPrint.IsEmpty then
begin
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
if Trim(ADOQueryPrint.fieldbyname('SLabVolume').AsString) <> '' then
FLabVolume := Trim(ADOQueryPrint.fieldbyname('SLabVolume').AsString)
else
FLabVolume := Trim(ADOQueryPrint.fieldbyname('LabVolume').AsString);
//Ĭ<>ϱ<EFBFBD>ǩ
if FLabVolume = '' then
FLabVolume := trim(gDefaultLableFile);
ExportFtErpFile(FLabVolume + '.rmf', ADOQueryTemp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLabVolume + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
// if Trim(ADOQueryPrint.fieldbyname('LabVolume').AsString) <> '<27><>Ʒ<EFBFBD><C6B7>ǩ' then
// Rm1.DefaultCopies := 2
// else
Rm1.DefaultCopies := mCopys;
// RM1.PrepareReport ;
RM1.ShowReport;
// RM1.ExportTo(RMllPDFExport1,'C:\test.pdf');
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmTradeClothInspList_Auto.N2Click(Sender: TObject);
begin
// SelOKNoFiler(Tv1, True); //ȫѡ
try
Order_Main.DisableControls;
Order_Main.First;
while not Order_Main.eof do
begin
Order_Main.Edit;
Order_Main.FieldByName('ssel').Value := true;
Order_Main.Post;
Order_Main.Next;
end;
finally
Order_Main.EnableControls;
selDisp();
end;
end;
procedure TfrmTradeClothInspList_Auto.N3Click(Sender: TObject);
begin
//SelOKNoFiler(Tv1, False); //ȫ<><C8AB>
try
Order_Main.DisableControls;
Order_Main.First;
while not Order_Main.eof do
begin
Order_Main.Edit;
Order_Main.FieldByName('ssel').Value := false;
Order_Main.Post;
Order_Main.Next;
end;
finally
Order_Main.EnableControls;
selDisp();
end;
end;
procedure TfrmTradeClothInspList_Auto.RKOrdIDKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
CurrentPage := 1;
InitGrid();
end;
end;
procedure TfrmTradeClothInspList_Auto.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
if pos('<27>ѳ<EFBFBD><D1B3><EFBFBD>', trim(AViewInfo.Text)) > 0 then
begin
ACanvas.Canvas.Brush.Color := RGB(237, 164, 146);
// ACanvas.Canvas.Font.Color := clred;
end
else if pos('<27><>Ʒ', trim(AViewInfo.Text)) > 0 then
begin
ACanvas.Canvas.Brush.Color := RGB(0, 191, 96);
end;
// else if pos('<27><> ', trim(AViewInfo.Text)) > 0 then
// begin
// ACanvas.Canvas.Brush.Color := $000C000;
// if (glideType.Text<>'') and (trim(GlideName.Text)=trim(AViewInfo.Text)) then
// begin
// ACanvas.Canvas.Font.Color := clRed;
// end;
// end
end;
procedure TfrmTradeClothInspList_Auto.Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
FValue: string;
FBounds: TRect;
begin
FBounds := AViewInfo.Bounds;
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
begin
ACanvas.FillRect(FBounds);
ACanvas.DrawComplexFrame(FBounds, clBlack, clBlack, [bBottom, bLeft, bRight], 1);
FValue := IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index + 1);
InflateRect(FBounds, -3, -2); //Platform specific. May not work on Linux.
ACanvas.Font.Color := clBlack;
ACanvas.Brush.Style := bsClear;
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
ADone := True;
end;
end;
/////////////////////////////////////////////////
function TfrmTradeClothInspList_Auto.autoOut(mCcids: string): boolean;
begin
try
result := false;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update Trade_Cloth_Inspect set CIIOFlag=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',IOTime=getdate()');
sql.Add(' where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](''' + mCcids + ''','','') X where X.RTValue=CIID) ');
execsql;
end;
result := true;
except
application.MessageBox(<><D6B4><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', 0)
end;
end;
////////////////////////////////////////////////
procedure TfrmTradeClothInspList_Auto.threadLoadform();
var
thread: TThread;
begin
thread := TThread.CreateAnonymousThread(
procedure
begin
TThread.Synchronize(nil,
procedure
begin
ReadCxGrid(Trim(self.Caption) + 'Tv1', Tv1, gDllFileCaption);
InitGrid();
end)
end);
thread.FreeOnTerminate := True;
thread.Start;
end;
/////////////////////////////////////////////////////
procedure TfrmTradeClothInspList_Auto.selDisp();
var
msumRoll: integer;
msumMeter, msumWeight, msumNetWeight, mSumYard: double;
mrecNo: integer;
begin
if not cxCheckBox1.Checked then
exit;
mrecNo := Order_Main.RecNo;
try
tv1.BeginUpdate();
Order_Main.DisableControls;
msumRoll := 0;
msumMeter := 0;
mSumYard := 0;
msumWeight := 0;
msumNetWeight := 0;
with Order_Main do
begin
Order_Main.first;
while not eof do
begin
if Order_Main.FieldByName('ssel').AsBoolean then
begin
msumRoll := msumRoll + 1;
msumMeter := msumMeter + fieldByName('Meter').AsFloat;
mSumYard := mSumYard + fieldByName('Yardage').AsFloat;
msumWeight := msumWeight + fieldByName('GrossWeight').AsFloat;
msumNetWeight := msumNetWeight + fieldByName('NetWeight').AsFloat;
end;
next;
end;
cxCheckBox1.Caption := '<27><>ѡ ' + inttoStr(msumRoll) + ' <20><> ';
if msumNetWeight > 0 then
begin
cxCheckBox1.Caption := cxCheckBox1.Caption + '<27><><EFBFBD><EFBFBD>:' + floattoStr(msumNetWeight) + 'kg ';
end;
if msumWeight > 0 then
begin
cxCheckBox1.Caption := cxCheckBox1.Caption + <><C3AB>:' + floattoStr(msumWeight) + 'kg ';
end;
if msumMeter > 0 then
begin
cxCheckBox1.Caption := cxCheckBox1.Caption + '<27><><EFBFBD><EFBFBD>:' + floattoStr(msumMeter) + ' ';
cxCheckBox1.Caption := cxCheckBox1.Caption + '<27><><EFBFBD><EFBFBD>:' + floattoStr(mSumYard) + ' ';
end;
end;
finally
Order_Main.RecNo := mrecNo;
Order_Main.EnableControls;
tv1.EndUpdate;
end;
end;
end.