RTFormwork/项目代码/RTBasicsV1/T03贸易布匹检验/U_TradeClothInspList.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

1038 lines
28 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_TradeClothInspList;
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, 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, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges, U_BaseList, dxDateTimeWheelPicker;
type
TfrmTradeClothInspList = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
GPM_1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADO_1: TADOQuery;
ADOQueryTemp: TADOQuery;
DS_1: TDataSource;
TBExport: TToolButton;
CDS_1: TClientDataSet;
btnEdit: TToolButton;
btnDel: TToolButton;
btnJBQ: TToolButton;
btnJYBG: TToolButton;
ToolButton1: TToolButton;
PM_1: TPopupMenu;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
btnEditGH: TToolButton;
ToolButton3: TToolButton;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
Pnl_F2: TPanel;
Label2: TLabel;
Label11: TLabel;
Label15: TLabel;
DateTimePicker3: TDateTimePicker;
DateTimePicker4: TDateTimePicker;
Edit1: TEdit;
PacketId: TEdit;
Edit4: TEdit;
BegDate2: TDateTimePicker;
EndDate2: TDateTimePicker;
chk_F2: TCheckBox;
cxTabSheet2: TcxTabSheet;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column22: TcxGridDBColumn;
v1Column32: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column21: TcxGridDBColumn;
Tv1Column4: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column23: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column27: TcxGridDBColumn;
v1Column28: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
Tv1Column10: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column12: 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;
Tv1Column1: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
Tv1Column9: TcxGridDBColumn;
Tv1Column11: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
Panel6: TPanel;
Label31: TLabel;
LBCPAP: TLabel;
BTLP: TButton;
BTNP: TButton;
TCBNOR: TComboBox;
Pnl_F1: TPanel;
Label3: TLabel;
Label7: TLabel;
Label8: TLabel;
Label10: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
lbl1: TLabel;
Label20: TLabel;
Label23: TLabel;
Label1: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
OrderNo: TEdit;
conNO: TEdit;
CIID: TEdit;
Grade: TComboBox;
C_Name: TEdit;
CIIOFlag: TComboBox;
Filler: TComboBox;
C_Color: TEdit;
chk_F1: TCheckBox;
BCIOID: TEdit;
C_Pattern: TEdit;
C_Code: TEdit;
FtyPCId: TEdit;
PM_2: TPopupMenu;
MenuItem1: TMenuItem;
GPM_2: TcxGridPopupMenu;
CDS_2: TClientDataSet;
DS_2: TDataSource;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn19: TcxGridDBColumn;
cxGridDBColumn20: TcxGridDBColumn;
cxGridDBColumn21: TcxGridDBColumn;
cxGridDBColumn22: TcxGridDBColumn;
cxGridDBColumn23: TcxGridDBColumn;
cxGridDBColumn24: TcxGridDBColumn;
cxGridDBColumn25: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
TV2Column1: TcxGridDBColumn;
TV2Column2: TcxGridDBColumn;
TV2Column3: TcxGridDBColumn;
N1: TMenuItem;
N5: TMenuItem;
ADO_2: TADOQuery;
cxTabSheet3: TcxTabSheet;
Pnl_F3: TPanel;
Label9: TLabel;
Label12: TLabel;
Label13: TLabel;
DateTimePicker1: TDateTimePicker;
DateTimePicker2: TDateTimePicker;
Edit2: TEdit;
Edit5: TEdit;
BegDate3: TDateTimePicker;
EndDate3: TDateTimePicker;
chk_F3: TCheckBox;
cxGrid3: TcxGrid;
TV3: TcxGridDBTableView;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
PM_3: TPopupMenu;
DS_3: TDataSource;
CDS_3: TClientDataSet;
ADO_3: TADOQuery;
GPM_3: TcxGridPopupMenu;
N6: TMenuItem;
TV3Column1: TcxGridDBColumn;
Edit3: TEdit;
ToolButton2: 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 btnEditClick(Sender: TObject);
procedure btnDelClick(Sender: TObject);
procedure btnJBQClick(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure BTLPClick(Sender: TObject);
procedure BTNPClick(Sender: TObject);
procedure TCBNORChange(Sender: TObject);
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 btnJYBGClick(Sender: TObject);
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 N4Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure btnEditGHClick(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure TV2DblClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure TV3DblClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
FLeft, FTop: Integer;
CurrentPage, RecordsNumber: Integer;
procedure InitGrid(WSql: string);
procedure InitPage();
function Savedata(): Boolean;
procedure SetStatus();
procedure PrintCKMDG(MRKOrdID: string);
{ Private declarations }
public
FFInt: Integer;
canshu1: string;
{ Public declarations }
end;
implementation
uses
U_DataLink, U_RTFun, U_TradeInspEdit, U_ZDYHelp, U_LabelPrint, U_LabelPrintSql,
U_InputBoxCoefficient;
{$R *.dfm}
procedure TfrmTradeClothInspList.InitPage();
begin
CurrentPage := 1;
case cxPageControl1.ActivePageIndex of
0:
begin
InitGrid(SGetHintFilters(Pnl_F2, 1, 2));
end;
1:
begin
InitGrid(SGetHintFilters(Pnl_F1, 1, 2));
end;
2:
begin
InitGrid(SGetHintFilters(Pnl_F3, 1, 2));
end;
end;
end;
procedure TfrmTradeClothInspList.SetStatus();
begin
btnEdit.Enabled := False;
btnEditGH.Enabled := False;
btnDel.Enabled := False;
btnJBQ.Enabled := False;
btnJYBG.Enabled := False;
case cxPageControl1.ActivePageIndex of
0:
begin
end;
1:
begin
btnEdit.Enabled := true;
btnEditGH.Enabled := true;
btnDel.Enabled := true;
btnJBQ.Enabled := true;
btnJYBG.Enabled := true;
end;
3:
begin
end;
end;
end;
procedure TfrmTradeClothInspList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmTradeClothInspList.FormCreate(Sender: TObject);
begin
inherited;
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
BegDate.DateTime := EndDate.DateTime - 20;
BegDate2.DateTime := BegDate.DateTime;
EndDate2.DateTime := EndDate.DateTime;
BegDate3.DateTime := EndDate.DateTime - 1;
EndDate3.DateTime := EndDate.DateTime;
end;
procedure TfrmTradeClothInspList.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmTradeClothInspList.TBExportClick(Sender: TObject);
begin
case cxPageControl1.ActivePageIndex of
0:
begin
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', cxgrid2);
end;
1:
begin
TcxGridToExcel(self.Caption, cxgrid1);
end;
2:
begin
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxgrid1);
end;
end;
end;
procedure TfrmTradeClothInspList.PrintCKMDG(MRKOrdID: string);
begin
end;
procedure TfrmTradeClothInspList.InitGrid(WSql: string);
begin
if trim(WSql) <> '' then
begin
WSql := ' and ' + trim(WSql);
end
else
begin
chk_F1.Checked := True;
chk_F2.Checked := True;
end;
case cxPageControl1.ActivePageIndex of
0:
begin
if chk_F2.Checked then
begin
WSql := WSql + ' and PacketTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate2.DateTime));
WSql := WSql + ' and PacketTime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate2.DateTime + 1));
end;
with ADO_2 do
begin
Close;
sql.Clear;
sql.Add(' select PacketTime=CONVERT(VARCHAR(10),PacketTime,120),PacketId,PacketNo,OrderNo,C_Name ');
sql.Add(' ,COUNT(PieceNo) SumPieceNo,sum(GrossWeight) GrossWeight,sum(NetWeight) NetWeight ,Sum(Meter) Meter,Sum(Yardage) Yardage');
sql.Add(' from Trade_Cloth_Inspect A where isnull(PacketId,'''')<>'''' ');
sql.Add(WSql);
sql.Add(' GROUP BY CONVERT(VARCHAR(10),PacketTime,120),PacketId,PacketNo,OrderNo,C_Name ');
Open;
end;
SCreateCDS(ADO_2, CDS_2);
SInitCDSData(ADO_2, CDS_2);
TV2.DataController.Filter.Clear;
end;
1:
begin
if chk_F1.Checked then
begin
WSql := WSql + ' and Filltime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
WSql := WSql + ' and Filltime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
end;
with ADO_1 do
begin
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(ADO_1, CDS_1);
SInitCDSData(ADO_1, CDS_1);
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_1.FieldByName('TotalCount').AsInteger / RecordsNumber));
TV1.DataController.Filter.Clear;
end;
2:
begin
if chk_F3.Checked then
begin
WSql := WSql + ' and Filltime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate3.DateTime));
WSql := WSql + ' and Filltime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate3.DateTime + 1));
end;
with ADO_3 do
begin
Close;
sql.Clear;
sql.Add(' select Filltime=CONVERT(VARCHAR(10),Filltime,120),Filler,OrderNo,C_Name ');
sql.Add(' ,COUNT(PieceNo) SumPieceNo,sum(GrossWeight) GrossWeight,sum(NetWeight) NetWeight ,Sum(Meter) Meter,Sum(Yardage) Yardage');
sql.Add(' from Trade_Cloth_Inspect A where isnull(PacketId,'''')<>'''' ');
sql.Add(WSql);
sql.Add(' GROUP BY CONVERT(VARCHAR(10),Filltime,120),Filler,OrderNo,C_Name ');
Open;
end;
SCreateCDS(ADO_3, CDS_3);
SInitCDSData(ADO_3, CDS_3);
TV3.DataController.Filter.Clear;
end;
end;
end;
procedure TfrmTradeClothInspList.TBRafreshClick(Sender: TObject);
begin
InitPage();
end;
procedure TfrmTradeClothInspList.FormShow(Sender: TObject);
begin
inherited;
canshu1 := self.fParameters1;
CurrentPage := 1;
RecordsNumber := 500;
ReadCxGrid(Trim(self.Caption) + 'Tv1', Tv1, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(Trim(self.Caption) + 'Tv2', Tv2, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// fsj := 'select distinct(Filler) name from Trade_Cloth_Inspect ';
// SInitComBoxBySql(ADOQueryCmd, Filler, False, fsj);
// Filler.ItemIndex := Filler.Items.IndexOf(trim(DName));
SetStatus();
InitPage();
end;
procedure TfrmTradeClothInspList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLeft := X;
FTop := Y;
end;
procedure TfrmTradeClothInspList.TV2DblClick(Sender: TObject);
begin
// BegDate.DateTime := BegDate2.DateTime;
// EndDate.DateTime := EndDate2.DateTime;
chk_F1.Checked := False;
cxPageControl1.ActivePageIndex := 1;
SetStatus();
InitGrid(SGetCDSFilters(Tv2, CDS_2));
end;
procedure TfrmTradeClothInspList.TV3DblClick(Sender: TObject);
begin
chk_F1.Checked := True;
BegDate.DateTime := BegDate3.DateTime;
EndDate.DateTime := EndDate3.DateTime;
cxPageControl1.ActivePageIndex := 1;
SetStatus();
InitGrid(SGetCDSFilters(Tv3, CDS_3));
end;
procedure TfrmTradeClothInspList.btnEditClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from Trade_Cloth_IO where IOFlag=''<27><><EFBFBD><EFBFBD>'' and stkid=''' + Trim(CDS_1.fieldbyname('CIID').AsString) + '''');
Open;
end;
if ADOQueryTemp.IsEmpty = False then
begin
CDS_1.EnableControls;
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܱ༭!', '<27><>ʾ', 0);
Exit;
end;
try
frmTradeInspEdit := TfrmTradeInspEdit.Create(Application);
with frmTradeInspEdit do
begin
CIID.Text := Trim(Self.CDS_1.fieldbyname('CIID').AsString);
if ShowModal = 1 then
begin
end;
end;
finally
frmTradeInspEdit.Free;
end;
end;
procedure TfrmTradeClothInspList.btnDelClick(Sender: TObject);
var
RTValues: TArray<string>;
begin
if CDS_1.Locate('ssel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<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><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
RTValues := SelCDSKey(CDS_1, ['CIID', 'BCIOID']);
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Trade_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(RTValues[1]));
sql.Add(',''<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(RTValues[0]));
sql.Add(') ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Trade_Insp_Del ');
Sql.Add('@CIIDS=' + quotedstr(Trim(RTValues[0])));
Sql.Add(',@DCode=' + Quotedstr(DCode));
Sql.Add(',@DName=' + Quotedstr(DName));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
CurrentPage := 1;
InitPage();
application.MessageBox(<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmTradeClothInspList.btnJBQClick(Sender: TObject);
var
MSQLS1: TStringList;
WSql: string;
begin
if CDS_1.IsEmpty then
Exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
WSql := '';
MSQLS1 := TStringList.Create;
CDS_1.DisableControls;
with CDS_1 do
begin
First;
while not Eof do
begin
if CDS_1.FieldByName('SSel').AsBoolean = True then
begin
MSQLS1.Add(' EXEC P_Trade_Insp_Prt_Lab @CIID=' + QuotedStr(Trim(CDS_1.fieldbyname('CIID').AsString)));
if WSql <> '' then
begin
WSql := WSql + ',' + Trim(CDS_1.fieldbyname('CIID').AsString);
end
else
begin
WSql := Trim(CDS_1.fieldbyname('CIID').AsString);
end;
end;
Next;
end;
end;
CDS_1.EnableControls;
try
frmLabelPrintSql := TfrmLabelPrintSql.Create(Application);
with frmLabelPrintSql do
begin
MSQLS := MSQLS1;
if ShowModal = 1 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 EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + QuotedStr(WSql) + ','','') X where Trade_Cloth_Inspect.CIID=X.RTValue ) ');
ExecSQL;
end;
end;
end;
finally
frmLabelPrintSql.Free;
MSQLS1.Free;
end;
end;
function TfrmTradeClothInspList.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(CDS_1.fieldbyname('SubId').AsString) + '''');
sql.Add(' and FirstName=''' + Trim(CDS_1.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 CDS_1 do
begin
First;
while not Eof do
begin
if CDS_1.FieldByName('SSel').AsBoolean = True then
begin
HXPS := HXPS + 1;
HXQty := HXQty + CDS_1.FieldByName('MJLen').Value;
end;
Next;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('');
Open;
end;
except
end;
end;
procedure TfrmTradeClothInspList.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
InitPage();
end;
end;
procedure TfrmTradeClothInspList.BTLPClick(Sender: TObject);
begin
if CurrentPage > 1 then
CurrentPage := CurrentPage - 1;
InitGrid(SGetHintFilters(Pnl_F1, 1, 2));
end;
procedure TfrmTradeClothInspList.BTNPClick(Sender: TObject);
begin
if CurrentPage < CDS_1.FieldByName('TotalCount').AsInteger / RecordsNumber then
CurrentPage := CurrentPage + 1;
InitGrid(SGetHintFilters(Pnl_F1, 1, 2));
end;
procedure TfrmTradeClothInspList.TCBNORChange(Sender: TObject);
begin
RecordsNumber := StrToInt(TCBNOR.Text);
CurrentPage := 1;
InitGrid(SGetHintFilters(Pnl_F1, 1, 2));
end;
procedure TfrmTradeClothInspList.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(Trim(self.Caption) + 'Tv1', Tv1, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(Trim(self.Caption) + 'Tv2', Tv2, <>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmTradeClothInspList.ToolButton2Click(Sender: TObject);
var
RTValues: TArray<string>;
begin
if CDS_1.IsEmpty then
Exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
RTValues := SelCDSKey(CDS_1, ['CIID', 'BCIOID']);
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
frmInputBoxCoefficient := TfrmInputBoxCoefficient.Create(Application);
with frmInputBoxCoefficient do
begin
if ShowModal = 1 then
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Trade_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(RTValues[1]));
sql.Add(',''<27><><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>޸<EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(RTValues[0]));
sql.Add(') ');
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Trade_Insp_Up_Coefficient ');
Sql.Add(' @CIIDS=' + quotedstr(Trim(RTValues[0])));
Sql.Add(',@Coefficient=' + frmInputBoxCoefficient.Conversion.Text);
Sql.Add(',@RuleConversion=' + quotedstr(Trim(frmInputBoxCoefficient.RuleConversion.Text)));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27>޸ijɹ<C4B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end;
finally
frmInputBoxCoefficient.Free;
end;
CurrentPage := 1;
InitPage();
end;
procedure TfrmTradeClothInspList.btnEditGHClick(Sender: TObject);
var
MStrsql, MStrIn: string;
begin
if CDS_1.IsEmpty then
Exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
CDS_1.DisableControls;
with CDS_1 do
begin
MStrsql := '';
First;
while not Eof do
begin
if CDS_1.FieldByName('SSel').AsBoolean then
begin
if MStrsql = '' then
MStrsql := Quotedstr(trim(CDS_1.FieldByName('CIID').AsString))
else
MStrsql := MStrsql + ',' + Quotedstr(trim(CDS_1.FieldByName('CIID').AsString));
end;
Next;
end;
end;
CDS_1.EnableControls;
except
CDS_1.EnableControls;
end;
if InputQuery('<27><><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', MStrIn) then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update Trade_Cloth_Inspect Set BatchNO=' + QuotedStr(MStrIn));
sql.Add(' where CIID in (' + MStrsql + ')');
sql.Add('Update Trade_Cloth_Stock Set BatchNO=' + QuotedStr(MStrIn));
sql.Add(' where CIID in (' + MStrsql + ')');
ExecSQL;
end;
end;
InitPage();
end;
procedure TfrmTradeClothInspList.ToolButton3Click(Sender: TObject);
var
MSQLS1: TStringList;
begin
if CDS_2.IsEmpty then
Exit;
if CDS_2.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
MSQLS1 := TStringList.Create;
CDS_2.DisableControls;
with CDS_2 do
begin
First;
while not Eof do
begin
if CDS_2.FieldByName('SSel').AsBoolean = True then
begin
MSQLS1.Add(' EXEC P_Trade_Insp_Prt_PackLab @CIID=' + QuotedStr(Trim(CDS_2.fieldbyname('PacketId').AsString)));
end;
Next;
end;
end;
CDS_2.EnableControls;
try
frmLabelPrintSql := TfrmLabelPrintSql.Create(Application);
with frmLabelPrintSql do
begin
MSQLS := MSQLS1;
if ShowModal = 1 then
begin
end;
end;
finally
frmLabelPrintSql.Free;
MSQLS1.Free;
end;
end;
procedure TfrmTradeClothInspList.chkZFClick(Sender: TObject);
begin
inherited;
InitPage();
SetStatus();
InitPage();
end;
procedure TfrmTradeClothInspList.conNOKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
InitPage();
end;
end;
procedure TfrmTradeClothInspList.cxPageControl1Change(Sender: TObject);
begin
SetStatus();
end;
procedure TfrmTradeClothInspList.CIIOFlagChange(Sender: TObject);
begin
InitPage();
end;
procedure TfrmTradeClothInspList.GradeChange(Sender: TObject);
begin
InitPage();
end;
procedure TfrmTradeClothInspList.KHConNOKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
CurrentPage := 1;
InitPage();
end;
end;
procedure TfrmTradeClothInspList.MenuItem1Click(Sender: TObject);
begin
Clipboard.SetTextBuf(PChar(Trim(CDS_2.fieldbyname(TV2.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;
procedure TfrmTradeClothInspList.N1Click(Sender: TObject);
begin
SelOKNo(CDS_2, True);
end;
procedure TfrmTradeClothInspList.N2Click(Sender: TObject);
begin
SelOKNo(CDS_1, True); //ȫѡ
end;
procedure TfrmTradeClothInspList.N3Click(Sender: TObject);
begin
SelOKNo(CDS_1, False); //ȫ<><C8AB>
end;
procedure TfrmTradeClothInspList.N4Click(Sender: TObject);
begin
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;
procedure TfrmTradeClothInspList.N5Click(Sender: TObject);
begin
SelOKNo(CDS_2, True);
end;
procedure TfrmTradeClothInspList.N6Click(Sender: TObject);
begin
Clipboard.SetTextBuf(PChar(Trim(CDS_3.fieldbyname(TV3.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
end;
procedure TfrmTradeClothInspList.RKOrdIDKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Initpage();
end;
end;
procedure TfrmTradeClothInspList.btnJYBGClick(Sender: TObject);
var
WSql: string;
begin
if CDS_1.IsEmpty then
Exit;
WSql := '';
CDS_1.DisableControls;
with CDS_1 do
begin
First;
while not Eof do
begin
if CDS_1.fieldbyname('SSel').AsBoolean then
begin
if WSql <> '' then
begin
WSql := WSql + ',' + Trim(CDS_1.fieldbyname('CIID').AsString);
end
else
begin
WSql := Trim(CDS_1.fieldbyname('CIID').AsString);
end;
end;
Next;
end;
end;
CDS_1.Locate('SSel', True, []);
CDS_1.EnableControls;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := 'TradeInsp';
FFiltration1 := WSql;
if ShowModal = 1 then
begin
// Self.InitGrid();
end;
end;
finally
frmLabelPrint.Free;
end;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end;
procedure TfrmTradeClothInspList.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;
end.