720 lines
22 KiB
ObjectPascal
720 lines
22 KiB
ObjectPascal
unit U_KnitPlanList;
|
||
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, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters,
|
||
dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxPC, Vcl.Menus, dxSkinBasic,
|
||
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, dxSkinOffice2016Colorful,
|
||
dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful,
|
||
dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven,
|
||
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
||
dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
||
dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue,
|
||
dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010,
|
||
dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, dxScrollbarAnnotations,
|
||
cxContainer, dxCore, cxDateUtils, cxDropDownEdit, cxButtons, cxMaskEdit,
|
||
FrameDateSel;
|
||
type
|
||
TfrmKnitPlanList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DS_1: TDataSource;
|
||
Label3: TLabel;
|
||
ConNo: TcxTextEdit;
|
||
Label5: TLabel;
|
||
C_Name: TcxTextEdit;
|
||
TBExport: TToolButton;
|
||
CDS_1: TClientDataSet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
TBCopy: TToolButton;
|
||
TBView: TToolButton;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
C_Code: TcxTextEdit;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column31: TcxGridDBColumn;
|
||
CustName: TcxTextEdit;
|
||
Label7: TLabel;
|
||
lbl1: TLabel;
|
||
cxTabControl1: TcxTabControl;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
OrderNo: TcxTextEdit;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
TBEnd: TToolButton;
|
||
TBNoEnd: TToolButton;
|
||
TBSCAP: TToolButton;
|
||
btnChk: TToolButton;
|
||
btnReChk: TToolButton;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Label6: TLabel;
|
||
CardPiece: TcxTextEdit;
|
||
Label8: TLabel;
|
||
PBJYPS: TcxTextEdit;
|
||
Label9: TLabel;
|
||
PBJYQty: TcxTextEdit;
|
||
Label11: TLabel;
|
||
PBCKPS: TcxTextEdit;
|
||
Label12: TLabel;
|
||
PBCKQty: TcxTextEdit;
|
||
Label13: TLabel;
|
||
PBKCPS: TcxTextEdit;
|
||
Label14: TLabel;
|
||
PBKCQty: TcxTextEdit;
|
||
ADO_JD: TADOQuery;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
cxComboBox1: TcxComboBox;
|
||
TfrmFrameDateSel: TfrmFrameDateSel;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure ConNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure conPress(Sender: TObject; var Key: Char);
|
||
procedure TBViewClick(Sender: TObject);
|
||
procedure TBCopyClick(Sender: TObject);
|
||
procedure OrdTypeChange(Sender: TObject);
|
||
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
procedure BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
procedure CustNameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure C_NameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure TBEndClick(Sender: TObject);
|
||
procedure TBNoEndClick(Sender: TObject);
|
||
procedure TBSCAPClick(Sender: TObject);
|
||
procedure btnChkClick(Sender: TObject);
|
||
procedure btnReChkClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure N1Click(Sender: TObject);
|
||
private
|
||
FInt, PFInt: Integer;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData(): Boolean;
|
||
procedure InitButton();
|
||
{ Private declarations }
|
||
public
|
||
canshu1, FCheJian: string;
|
||
{ Public declarations }
|
||
end;
|
||
implementation
|
||
uses
|
||
U_DataLink, U_KnitPlanInPut, U_RTFun, U_ZDYHelp, U_LabelPrint, U_KnitCardInPut,
|
||
U_KnitInspSet;
|
||
{$R *.dfm}
|
||
procedure TfrmKnitPlanList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
procedure TfrmKnitPlanList.InitButton();
|
||
begin
|
||
TBAdd.Enabled := False;
|
||
TBCopy.Enabled := False;
|
||
TBEdit.Enabled := False;
|
||
TBDel.Enabled := False;
|
||
TBEnd.Enabled := False;
|
||
TBNoEnd.Enabled := False;
|
||
TBSCAP.Enabled := False;
|
||
btnChk.Enabled := False;
|
||
btnReChk.Enabled := False;
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
begin
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBAdd.Enabled := true;
|
||
TBCopy.Enabled := true;
|
||
TBDel.Enabled := true;
|
||
TBSCAP.Enabled := true;
|
||
TBEdit.Enabled := true;
|
||
btnChk.Enabled := true;
|
||
end;
|
||
1:
|
||
begin
|
||
TBAdd.Enabled := true;
|
||
TBCopy.Enabled := true;
|
||
TBEnd.Enabled := true;
|
||
TBSCAP.Enabled := true;
|
||
TBEdit.Enabled := true;
|
||
btnReChk.Enabled := true;
|
||
end;
|
||
2:
|
||
begin
|
||
TBNoEnd.Enabled := true;
|
||
end;
|
||
end;
|
||
end;
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
TBAdd.Enabled := true;
|
||
TBCopy.Enabled := true;
|
||
TBDel.Enabled := true;
|
||
TBSCAP.Enabled := true;
|
||
TBEdit.Enabled := true;
|
||
btnChk.Enabled := true;
|
||
end;
|
||
1:
|
||
begin
|
||
TBAdd.Enabled := true;
|
||
TBCopy.Enabled := true;
|
||
TBEnd.Enabled := true;
|
||
TBSCAP.Enabled := true;
|
||
TBEdit.Enabled := true;
|
||
btnReChk.Enabled := true;
|
||
end;
|
||
2:
|
||
begin
|
||
TBNoEnd.Enabled := true;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmKnitPlanList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',APPS=(select count(X.pcid) from knit_Plan_Card X where X.SubId=B.Subid)');
|
||
sql.Add(',Y_NameS= SUBSTRING(CAST((select ''+'' +X.Y_Name from knit_Plan_Yarn X where X.subid=B.subid order by YRId for xml path('''') ) AS VARCHAR(100)) , 2, 100) ');
|
||
sql.Add(' from knit_Plan_Main A inner join knit_Plan_Sub B on A.Mainid=B.MainId');
|
||
sql.Add(' where A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.BegDate.Date)) + '''');
|
||
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.EndDate.Date + 1)) + '''');
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add('and isnull(Status,''0'') =''0'' ');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add('and isnull(Status,''0'') =''9'' ');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add('and isnull(Status,''0'') =''10'' ');
|
||
sql.Add(' and A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.BegDate.Date)) + '''');
|
||
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.EndDate.Date + 1)) + '''');
|
||
end;
|
||
end;
|
||
sql.add('order by A.FILLTIME DESC');
|
||
Open;
|
||
end;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.N1Click(Sender: TObject);
|
||
begin
|
||
CopyTVFocusValue(TV1);
|
||
end;
|
||
procedure TfrmKnitPlanList.InitForm();
|
||
begin
|
||
InitButton();
|
||
ReadCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
TfrmFrameDateSel.BegDate.Date := SGetServerDate(ADOQueryTemp) - 30;
|
||
TfrmFrameDateSel.EndDate.Date := SGetServerDate(ADOQueryTemp);
|
||
InitGrid();
|
||
end;
|
||
procedure TfrmKnitPlanList.TBFindClick(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
procedure TfrmKnitPlanList.TBNoEndClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update knit_Plan_Main SET status=''9'',Comper=null,Comptime=null ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><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 TfrmKnitPlanList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmKnitPlanInPut := TfrmKnitPlanInPut.Create(Application);
|
||
with frmKnitPlanInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.CDS_1.fieldbyname('SubId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
Self.CDS_1.Locate('MainId', frmKnitPlanInPut.FMainId, []);
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitPlanInPut.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBEndClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update knit_Plan_Main SET status=''10'' ,Comper=''' + trim(DName) + ''',Comptime=getdate() ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select A.*');
|
||
sql.Add('from Knit_Plan_Card A');
|
||
sql.Add(' where A.SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
||
sql.Add(' and A.MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><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;
|
||
if DelData() then
|
||
begin
|
||
//TBRafresh.Click;
|
||
//TBFind.Click;
|
||
CDS_1.Delete;
|
||
end;
|
||
end;
|
||
function TfrmKnitPlanList.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete knit_Plan_Sub where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete knit_Plan_Main where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete knit_Plan_Yarn where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete knit_Plan_Arrange where MainId=''' + Trim(CDS_1.fieldbyname('MainId').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 TfrmKnitPlanList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxGrid1);
|
||
end;
|
||
procedure TfrmKnitPlanList.TBPrintClick(Sender: TObject);
|
||
var
|
||
WSql: string;
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
WSql := (Trim(CDS_1.fieldbyname('MainId').AsString));
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'knitPlanPrint';
|
||
FFiltration1 := WSql;
|
||
if ShowModal = 1 then
|
||
begin
|
||
// Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
procedure TfrmKnitPlanList.TBSCAPClick(Sender: TObject);
|
||
var
|
||
FMainId, FSubId: string;
|
||
begin
|
||
try
|
||
frmKnitCardInPut := TfrmKnitCardInPut.Create(Application);
|
||
with frmKnitCardInPut do
|
||
begin
|
||
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.CDS_1.fieldbyname('SubId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
// InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitCardInPut.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmKnitPlanInPut := TfrmKnitPlanInPut.Create(Application);
|
||
with frmKnitPlanInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
FSubId := '';
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitPlanInPut.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.ConNoChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
procedure TfrmKnitPlanList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
canshu1 := DParameters1;
|
||
InitForm();
|
||
end;
|
||
procedure TfrmKnitPlanList.conPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Length(Trim(ConNo.Text)) < 4 then
|
||
Exit;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
//sql.Add('exec knit_Plan_QryList :MainId,:WSql');
|
||
// Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNoM.Text)+'%'+''''
|
||
// +' and ConType=''<27><><EFBFBD><EFBFBD>'' ';
|
||
sql.Add('select * from knit_Plan_Main A inner join knit_Plan_Sub B on A.Mainid=B.MainId');
|
||
sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBViewClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmKnitPlanInPut := TfrmKnitPlanInPut.Create(Application);
|
||
with frmKnitPlanInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(Self.CDS_1.fieldbyname('SubId').AsString);
|
||
FConNo := Trim(Self.CDS_1.fieldbyname('ConNo').AsString);
|
||
TBSave.Visible := False;
|
||
ToolBar3.Visible := False;
|
||
ScrollBox1.Enabled := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitPlanInPut.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
procedure TfrmKnitPlanList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmKnitInspSet := TfrmKnitInspSet.Create(Application);
|
||
with frmKnitInspSet do
|
||
begin
|
||
FDataID := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitInspSet.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
var
|
||
fwhere: string;
|
||
begin
|
||
fwhere := ' and A.MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''';
|
||
with ADO_JD do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' exec P_Knit_Plan_Progress @Begdate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.Begdate.Date))));
|
||
sql.Add(',@enddate=' + quotedstr(trim(FormatDateTime('yyyy-MM-dd', TfrmFrameDateSel.EndDate.Date + 1))));
|
||
sql.Add(',@criteria= ' + quotedstr(fwhere));
|
||
Open;
|
||
end;
|
||
SClearData(Panel2, 0);
|
||
SCSHData(ADO_JD, Panel2, 0);
|
||
end;
|
||
procedure TfrmKnitPlanList.btnChkClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update knit_Plan_Main SET status=''9'',chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><>ʼ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><>ʼʧ<CABC>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.btnReChkClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
begin
|
||
Application.MessageBox('ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>ѿ<EFBFBD>ʼ״̬<D7B4>½<EFBFBD><C2BD>к˲<D0BA><CBB2><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update knit_Plan_Main SET status=''0'',chker=null,Chktime=null ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ')));
|
||
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼʧ<CABC>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.TBCopyClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmKnitPlanInPut := TfrmKnitPlanInPut.Create(Application);
|
||
with frmKnitPlanInPut do
|
||
begin
|
||
PState := 1;
|
||
FCopyInt := 1;
|
||
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
||
FConNo := Trim(Self.CDS_1.fieldbyname('ConNo').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
end;
|
||
end;
|
||
finally
|
||
frmKnitPlanInPut.Free;
|
||
end;
|
||
end;
|
||
procedure TfrmKnitPlanList.OrdTypeChange(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
procedure TfrmKnitPlanList.C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
procedure TfrmKnitPlanList.BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
procedure TfrmKnitPlanList.CustNameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
procedure TfrmKnitPlanList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitButton();
|
||
InitGrid();
|
||
end;
|
||
procedure TfrmKnitPlanList.C_NameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
TBRafresh.Click();
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
end.
|