603 lines
16 KiB
ObjectPascal
603 lines
16 KiB
ObjectPascal
![]() |
unit U_CaiGouSQList;
|
|||
|
|
|||
|
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, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
|||
|
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC,
|
|||
|
cxDropDownEdit, cxCheckBox;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCaiGouSQList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
TBFind: TToolButton;
|
|||
|
SPName: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
SQPerson: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
TBSS: TToolButton;
|
|||
|
TBSSCX: TToolButton;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Label3: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
PinPai: TEdit;
|
|||
|
FactoryName: TEdit;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
RMDBPRT: TRMDBDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1SSel: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBSSClick(Sender: TObject);
|
|||
|
procedure TBSSCXClick(Sender: TObject);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure DataTypeChange(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure SPNameChange(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure SetStatus();
|
|||
|
function DelData(): Boolean;
|
|||
|
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, canshu2, ChildFlag: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
// frmCaiGouSQList: TfrmCaiGouSQList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_CaiGouSQInPut, U_ModuleNote;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmCaiGouSQList.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
TBAdd.Visible := False;
|
|||
|
TBEdit.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
TBSS.Visible := False;
|
|||
|
TBSSCX.Visible := False;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><>ѯ' then
|
|||
|
begin
|
|||
|
v1SSel.Visible := False;
|
|||
|
v1SSel.Hidden := True;
|
|||
|
end;
|
|||
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBEdit.Visible := true;
|
|||
|
TBDel.Visible := true;
|
|||
|
TBSS.Visible := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
TBSSCX.Visible := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(canshu1) = '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBEdit.Visible := true;
|
|||
|
TBDel.Visible := true;
|
|||
|
TBSS.Visible := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
TBSSCX.Visible := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
application := mainapplication;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid(Self.Caption, Tv1, '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.InitGrid();
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
SQL.Add(' from SQ_CG A where SQType=''ɴ<><C9B4>'' ');
|
|||
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
sql.Add(' and Filler=''' + Trim(DName) + '''');
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(SChkStatus,'''')='''' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(SChkStatus,'''')<>'''' ');
|
|||
|
sql.Add(' and A.SQDate>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
sql.Add(' and A.SQDate<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.InitForm();
|
|||
|
begin
|
|||
|
|
|||
|
EndDate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.Date := EndDate.Date - 7;
|
|||
|
ReadCxGrid(Self.Caption, Tv1, '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
SetStatus();
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmCaiGouSQInPut := TfrmCaiGouSQInPut.Create(Application);
|
|||
|
with frmCaiGouSQInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FMainId := Trim(Self.Order_Main.fieldbyname('SQID').AsString);
|
|||
|
FSQType := Trim(Self.canshu2);
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCaiGouSQInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
if DelData() then
|
|||
|
begin
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmCaiGouSQList.DelData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete SQ_CG where SQId=''' + Trim(Order_Main.fieldbyname('SQId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result := False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('ɴ<>߲ɹ<DFB2><C9B9>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCaiGouSQInPut := TfrmCaiGouSQInPut.Create(Application);
|
|||
|
with frmCaiGouSQInPut do
|
|||
|
begin
|
|||
|
PState := 0;
|
|||
|
FMainId := '';
|
|||
|
FSQType := Trim(Self.canshu2);
|
|||
|
frmCaiGouSQInPut.Canshu1 := Trim(Self.canshu1);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCaiGouSQInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmModuleNote := TfrmModuleNote.Create(Application);
|
|||
|
with frmModuleNote do
|
|||
|
begin
|
|||
|
flag := '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmModuleNote.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBSSClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
Exit;
|
|||
|
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;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate SQ_CG Set SChkStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SChktime=getdate(),SChker=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' where SQID=''' + Trim(Order_Main.fieldbyname('SQID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.TBSSCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex <> 1 then
|
|||
|
Exit;
|
|||
|
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;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
Order_Main.DisableControls;
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from SQ_CG ');
|
|||
|
sql.Add(' where SQID=''' + Trim(Order_Main.fieldbyname('SQID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('ChkStatus').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
InitGrid();
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate SQ_CG Set SChkStatus=Null,SChktime=getdate(),SChker=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' where SQID=''' + Trim(Order_Main.fieldbyname('SQID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Order_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
//frmCaiGouSQList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, FPBName, maxno: string;
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if cxTabControl1.TabIndex <> 2 then
|
|||
|
Exit;
|
|||
|
if Order_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
if GetLSNoHZ(ADOQueryCmd, maxno, 'PL', 'PRT_Log', 4, 1, 3) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1>ӡ<EFBFBD><D3A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
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 SQ_CG Set PrtCS=isnull(PrtCS,0)+1,PrtTime=Getdate(),PrtPerson=''' + Trim(DName) + '''');
|
|||
|
sql.Add(',PrtHBNO=''' + Trim(maxno) + '''');
|
|||
|
sql.Add(' where SQID=''' + Trim(Order_Main.fieldbyname('SQID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into PRT_Log(WBId,WBType,PrtPerson,PrtTime,PrtCS,PrtHBNO)');
|
|||
|
sql.Add('select SQID,''ɴ<>߲ɹ<DFB2><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CaiGou_SQ'',PrtPerson,PrtTime, PrtCS,''' + Trim(maxno) + '''');
|
|||
|
sql.Add(' from SQ_CG');
|
|||
|
sql.Add(' where SQID=''' + Trim(Order_Main.fieldbyname('SQID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Main.EnableControls;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select FactoryName from SQ_CG where PrtHBNO=''' + Trim(maxno) + '''');
|
|||
|
sql.Add('group by FactoryName');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.RecordCount > 1 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><>ͬ<EFBFBD><CDAC>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>ͬʱ<CDAC><CAB1>ӡ!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select FactoryName from SQ_CG where PrtHBNO=''' + Trim(maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.RecordCount > 6 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('һ<>Ŵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><>ӡ<EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ԭ<>ϲɹ<CFB2><C9B9><EFBFBD>.rmf';
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(',Case when isnull(A.DataType,'''')<>'''' then ''(''+A.DataType+'')'' else '''' end as DataTypePrt ');
|
|||
|
sql.Add(',KHConNo=(select KHConNo from JYOrderCon_Main C where C.MainId=isnull(B.ConMainId,''''))');
|
|||
|
SQL.Add(' from SQ_CG A ');
|
|||
|
sql.Add(' left join Cloth_Main B on A.ConNo=B.ConNo');
|
|||
|
sql.add(' where isnull(A.chker,'''')<>'''' and A.SQType=''ɴ<><C9B4>''');
|
|||
|
SQL.Add(' and A.PrtHBNO=''' + Trim(maxno) + '''');
|
|||
|
//SQL.Add(' and A.SQID='''+Trim(Order_Main.fieldbyname('SQID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
//RM1.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\ԭ<>ϲɹ<CFB2><C9B9><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.DataTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('SQQty').Index]) > 0 then
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('DHBL').Index]) < 0.95 then
|
|||
|
ACanvas.Brush.Color := $ADDEFF;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCaiGouSQList.SPNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|