877 lines
26 KiB
ObjectPascal
877 lines
26 KiB
ObjectPascal
unit U_DJBRKList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
||
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
||
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
||
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
||
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
||
BtnEdit, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter, cxNavigator, dxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmDJBRKList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
CDS_PRT: TClientDataSet;
|
||
TBDel: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label8: TLabel;
|
||
SPName: TEdit;
|
||
FactoryName: TEdit;
|
||
SPID: TEdit;
|
||
SPSpec: TEdit;
|
||
Label6: TLabel;
|
||
SPCF: TEdit;
|
||
Label7: TLabel;
|
||
OrderNo: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
Label9: TLabel;
|
||
ToFactoryName: TEdit;
|
||
Label12: TLabel;
|
||
CRType: TComboBox;
|
||
v1Column18: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
KuWei: TEdit;
|
||
v1Column19: TcxGridDBColumn;
|
||
Label11: TLabel;
|
||
RCGangNo: TEdit;
|
||
Label13: TLabel;
|
||
PRTColor: TEdit;
|
||
Label14: TLabel;
|
||
SOrddefstr1: TEdit;
|
||
Label15: TLabel;
|
||
PRTHX: TEdit;
|
||
v1Column20: TcxGridDBColumn;
|
||
prtkuanNo: TEdit;
|
||
Label16: TLabel;
|
||
v1Column21: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
TBCHK: TToolButton;
|
||
TBNOchk: TToolButton;
|
||
cxTabControl1: TcxTabControl;
|
||
v1Column24: TcxGridDBColumn;
|
||
v1Column25: TcxGridDBColumn;
|
||
Panel5: TPanel;
|
||
Label28: TLabel;
|
||
Label17: TLabel;
|
||
Label18: TLabel;
|
||
Label19: TLabel;
|
||
Label24: TLabel;
|
||
Button5: TButton;
|
||
Button6: TButton;
|
||
factoryName1: TBtnEditA;
|
||
Com_CRype: TComboBox;
|
||
Button1: TButton;
|
||
edit_defstr2: TEdit;
|
||
edit_gangNo: TEdit;
|
||
Button2: TButton;
|
||
Button3: TButton;
|
||
edit_note: TEdit;
|
||
Button4: TButton;
|
||
TBTSedit: TToolButton;
|
||
v1Column26: TcxGridDBColumn;
|
||
defstr2: TEdit;
|
||
Label20: TLabel;
|
||
note: TEdit;
|
||
Label21: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure SPIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure SPIDChange(Sender: TObject);
|
||
procedure SPSpecChange(Sender: TObject);
|
||
procedure FactoryNameChange(Sender: TObject);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure TBCHKClick(Sender: TObject);
|
||
procedure TBNOchkClick(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure factoryName1BtnClick(Sender: TObject);
|
||
procedure TBTSeditClick(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure defstr2KeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button4Click(Sender: TObject);
|
||
private
|
||
canshu1, canshu2: string;
|
||
procedure InitGrid();
|
||
procedure setstatus();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDJBRKList: TfrmDJBRKList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_DJBCKInPut, U_ZdyAttachGYS;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmDJBRKList.setstatus();
|
||
begin
|
||
TBedit.Visible := false;
|
||
TBdel.Visible := false;
|
||
TBchk.Visible := false;
|
||
TBNochk.Visible := false;
|
||
TBTSedit.Visible := false;
|
||
if canshu1 = '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBedit.Visible := true;
|
||
TBdel.Visible := true;
|
||
TBchk.Visible := true;
|
||
TBTSedit.Visible := true;
|
||
end;
|
||
1:
|
||
begin
|
||
TBNochk.Visible := True;
|
||
TBTSedit.Visible := true;
|
||
end;
|
||
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBedit.Visible := true;
|
||
TBdel.Visible := true;
|
||
// TBchk.Visible:=true;
|
||
end;
|
||
1:
|
||
begin
|
||
// TBNochk.Visible:=True;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmDJBRKList := nil;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
canshu1 := Trim(DParameters1);
|
||
canshu2 := Trim(DParameters2);
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ,AvgQty=case when piQty<>0 then cast(Qty/piQty as decimal(18,2)) else 0 end');
|
||
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
||
sql.Add(' ,SOrddefstr1=(select SOrddefstr1 from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTColor=(select PRTColor from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTkuanNo=(select PRTkuanNo from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTHX=(select PRTHX from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where A.CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
||
sql.Add(' and A.CRTime<=''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + '''');
|
||
sql.Add(' and isnull(CKName,'''')=''<27><><EFBFBD>첼''');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
if cxTabControl1.TabIndex < 2 then
|
||
SQL.Add(' and isnull(A.chkstatus,''0'')=''' + inttostr(cxTabControl1.TabIndex) + ''' ');
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
BegDate.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, '<27><><EFBFBD>첼<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.FormShow(Sender: TObject);
|
||
begin
|
||
if Trim(canshu2) = '<27>鿴' then
|
||
begin
|
||
TBAdd.Visible := False;
|
||
TBDel.Visible := False;
|
||
TBEdit.Visible := False;
|
||
end
|
||
else
|
||
begin
|
||
TBAdd.Visible := True;
|
||
TBDel.Visible := True;
|
||
TBEdit.Visible := True;
|
||
end;
|
||
ReadCxGrid('<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, '<27><><EFBFBD>첼<EFBFBD>ֿ<EFBFBD>');
|
||
setstatus();
|
||
// InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel('<27><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, True);
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main, False);
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_Main.fieldbyname('SPID').AsString) <> '' then
|
||
begin
|
||
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_SXPB_CR where FZSPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
sql.Add(' and CRQtyFlag=-1');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete CK_SXPB_CR where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
{sql.Add('Update CK_SXPB_KC Set KCKGQty=(select sum(isnull(KGQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.CRID=CK_SXPB_KC.CRID)');
|
||
sql.Add(',KCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.CRID=CK_SXPB_KC.CRID)');
|
||
sql.Add(' where CRID='+Trim(CDS_Main.fieldbyname('CRID').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><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('SPID').AsString) + ',<2C>ӹ<EFBFBD><D3B9><EFBFBD>' + trim(CDS_Main.FieldByName('factoryName').AsString) + ',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(CDS_Main.FieldByName('QCorderNo').AsString) + ',ƥ<><C6A5>' + trim(CDS_Main.FieldByName('piqty').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
{ with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select KCKGQty=isnull(KCKGQty,0) from CK_SXPB_KC where CRID='+Trim(CDS_Main.fieldbyname('CRID').AsString));
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty=False then
|
||
begin
|
||
if ADOQueryTemp.FieldByName('KCKGQty').Value<0 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><E2B9AB><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><E2B9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end; }
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_Main.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmDJBCKInPut := TfrmDJBCKInPut.Create(Application);
|
||
with frmDJBCKInPut do
|
||
begin
|
||
FBCId := '';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmDJBCKInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_SXPB_CR where FZSPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
sql.Add(' and CRQtyFlag=-1');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
frmDJBCKInPut := TfrmDJBCKInPut.Create(Application);
|
||
with frmDJBCKInPut do
|
||
begin
|
||
FBCId := Trim(CDS_Main.fieldbyname('SPID').AsString);
|
||
TBDel.Visible := False;
|
||
TBAdd.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmDJBCKInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.SPIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
{if Length(Trim(SPID.Text))<4 then Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(',ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId)');
|
||
//sql.Add(' ,ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId )');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where SPID like :SXID');
|
||
Parameters.ParamByName('SXID').Value:='%'+Trim(SXID.Text)+'%';
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end; }
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.SPIDChange(Sender: TObject);
|
||
begin
|
||
if Length(Trim(SPID.Text)) < 4 then
|
||
begin
|
||
if Trim(SPID.Text) <> '' then
|
||
Exit;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.SPSpecChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if trim(OrderNo.Text) = '' then
|
||
exit;
|
||
if Key = #13 then
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
||
sql.Add(' ,SOrddefstr1=(select SOrddefstr1 from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTColor=(select PRTColor from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTkuanNo=(select PRTkuanNo from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTHX=(select PRTHX from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where exists(select MainID from JYOrder_Main X where X.mainID=A.ORDMainIdRK and X.orderNo like ' + quotedstr('%' + trim(OrderNo.text) + '%') + ')');
|
||
sql.Add(' and isnull(CKName,'''')=''<27><><EFBFBD>첼''');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
if cxTabControl1.TabIndex < 2 then
|
||
SQL.Add(' and isnull(A.chkstatus,''0'')=''' + inttostr(cxTabControl1.TabIndex) + ''' ');
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBCHKClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update CK_SXPB_CR SET chkstatus=''1'',chker=''' + trim(DName) + ''',chkTime=getdate() ');
|
||
sql.Add('where SPID=' + quotedstr(trim(CDS_Main.fieldbyname('SPID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBNOchkClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update CK_SXPB_CR SET chkstatus=''0'',chker=''' + trim(DName) + ''',chkTime=getdate() ');
|
||
sql.Add('where SPID=' + quotedstr(trim(CDS_Main.fieldbyname('SPID').AsString)));
|
||
execsql;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
setstatus();
|
||
InitGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.Button5Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if trim(factoryName1.Text) = '' then
|
||
begin
|
||
application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>ļӹ<C4BC><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('SPID').AsString) + ',ԭ<>ӹ<EFBFBD><D3B9><EFBFBD>' + Trim(CDS_Main.fieldbyname('factoryName').AsString) + ',<2C>ĺ<DEB8>' + trim(factoryName1.Text))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
sql.Add('update CK_SXPB_CR SET factoryName=''' + trim(factoryName1.Text) + ''',edittime=getdate() where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
// sql.Add('update WFB_MJJY SET factoryName='''+trim(factoryName1.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
Panel5.Visible := false;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.Button1Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if trim(Com_CRype.Text) = '' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('SPID').AsString) + ',ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(CDS_Main.fieldbyname('CRType').AsString) + ',<2C>ĺ<DEB8>' + trim(Com_CRype.Text))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
sql.Add('update CK_SXPB_CR SET CRType=''' + trim(Com_CRype.Text) + ''' where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
Panel5.Visible := false;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.factoryName1BtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
factoryName1.Text := Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.TBTSeditClick(Sender: TObject);
|
||
begin
|
||
factoryName1.Text := '';
|
||
Com_CRype.Text := '';
|
||
edit_defstr2.Text := '';
|
||
edit_gangNo.Text := '';
|
||
edit_note.Text := '';
|
||
Panel5.Left := (self.Width - Panel5.Width) div 2;
|
||
Panel5.Visible := true;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.Button6Click(Sender: TObject);
|
||
begin
|
||
Panel5.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.Button2Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if trim(edit_defstr2.Text) = '' then
|
||
begin
|
||
application.MessageBox('ͳ<>Ƶ<EFBFBD><C6B5>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><EFBFBD>ͳ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
if fieldbyName('Ssel').AsBoolean then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('SPID').AsString) + ',ԭͳ<D4AD>Ƶ<EFBFBD><C6B5><EFBFBD>' + Trim(CDS_Main.fieldbyname('defstr2').AsString) + ',<2C>ĺ<DEB8>' + trim(edit_defstr2.Text))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
sql.Add('update CK_SXPB_CR SET defstr2=''' + trim(edit_defstr2.Text) + ''' where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
Panel5.Visible := false;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.defstr2KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if trim(defstr2.Text) = '' then
|
||
exit;
|
||
if Key = #13 then
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add(' select A.* ');
|
||
sql.Add(',OrderNO=(select OrderNO from JYOrder_Main JM where JM.MainId=A.ORDMainIdRK)');
|
||
sql.Add(' ,SOrddefstr1=(select SOrddefstr1 from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTColor=(select PRTColor from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTkuanNo=(select PRTkuanNo from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' ,PRTHX=(select PRTHX from JYOrder_Sub JM where JM.SubId=A.OrdSubIdRK )');
|
||
sql.Add(' from CK_SXPB_CR A');
|
||
sql.add(' where A.defstr2 like ' + quotedstr('%' + trim(OrderNo.text) + '%'));
|
||
sql.Add(' and isnull(CKName,'''')=''<27><><EFBFBD>첼''');
|
||
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
if cxTabControl1.TabIndex < 2 then
|
||
SQL.Add(' and isnull(A.chkstatus,''0'')=''' + inttostr(cxTabControl1.TabIndex) + ''' ');
|
||
Open;
|
||
//ShowMessage(SQL.Text);
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDJBRKList.Button4Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if trim(edit_note.Text) = '' then
|
||
begin
|
||
application.MessageBox('<27><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>ı<DEB8>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
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><><EFBFBD>첼<EFBFBD><ECB2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('SPID').AsString) + ',ԭ<><D4AD>ע' + Trim(CDS_Main.fieldbyname('Note').AsString) + ',<2C>ĺ<DEB8>' + trim(edit_note.Text))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
sql.Add('update CK_SXPB_CR SET Note=''' + trim(edit_note.Text) + ''',edittime=getdate() where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
Panel5.Visible := false;
|
||
TBRafresh.Click;
|
||
except
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|