1230 lines
33 KiB
ObjectPascal
1230 lines
33 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, cxCheckBox, 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;
|
|||
|
|
|||
|
type
|
|||
|
TfrmKnitPlanList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
Label3: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
C_Name: TEdit;
|
|||
|
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: TEdit;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column31: TcxGridDBColumn;
|
|||
|
CustName: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
TBEnd: TToolButton;
|
|||
|
TBNoEnd: TToolButton;
|
|||
|
TBSCAP: TToolButton;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
FtyCoName: TEdit;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
Tv2Column2: TcxGridDBColumn;
|
|||
|
CDS_2: TClientDataSet;
|
|||
|
DS_2: TDataSource;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
Tv3Column1: TcxGridDBColumn;
|
|||
|
Tv3Column2: TcxGridDBColumn;
|
|||
|
Tv3Column3: TcxGridDBColumn;
|
|||
|
Tv3Column4: TcxGridDBColumn;
|
|||
|
Tv3Column5: TcxGridDBColumn;
|
|||
|
Tv3Column6: TcxGridDBColumn;
|
|||
|
Tv3Column7: TcxGridDBColumn;
|
|||
|
GPM_3: TcxGridPopupMenu;
|
|||
|
CDS_3: TClientDataSet;
|
|||
|
DS_3: TDataSource;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
ADOQuerySub: TADOQuery;
|
|||
|
cxgrdbclmnTv3Column8: TcxGridDBColumn;
|
|||
|
PM_1: TPopupMenu;
|
|||
|
MenuItem1: TMenuItem;
|
|||
|
MenuItem2: TMenuItem;
|
|||
|
btn1: TToolButton;
|
|||
|
cxgrdbclmnTv1Column15: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv3Column9: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column16: TcxGridDBColumn;
|
|||
|
lbl1: TLabel;
|
|||
|
CarHZ: TEdit;
|
|||
|
cxgrdbclmnTv1Column17: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column18: TcxGridDBColumn;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
ToolButton9: TToolButton;
|
|||
|
Tv1Column18: TcxGridDBColumn;
|
|||
|
ToolButton10: TToolButton;
|
|||
|
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 ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure MenuItem1Click(Sender: TObject);
|
|||
|
procedure MenuItem2Click(Sender: TObject);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
procedure ToolButton10Click(Sender: TObject);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitSubGrid();
|
|||
|
procedure InitForm();
|
|||
|
function DelData(): Boolean;
|
|||
|
procedure InitButton();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, FCheJian: string;
|
|||
|
WSql: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
//frmClothSCList: TfrmClothSCList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_KnitPlanInPut, U_RTFun, U_ZDYHelp, U_LabelPrint, U_KnitCardInPut,
|
|||
|
U_TradeInspSet, U_LCKInput;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.InitButton();
|
|||
|
begin
|
|||
|
|
|||
|
TBAdd.Visible := False;
|
|||
|
TBCopy.Visible := False;
|
|||
|
TBEdit.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
TBEnd.Visible := False;
|
|||
|
TBNoEnd.Visible := False;
|
|||
|
TBSCAP.Visible := False;
|
|||
|
|
|||
|
btn1.Visible := False;
|
|||
|
ToolButton5.Visible := False;
|
|||
|
ToolButton9.Visible := False;
|
|||
|
ToolButton10.Visible := False;
|
|||
|
ToolButton6.Visible := False;
|
|||
|
ToolButton7.Visible := False;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
begin
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBCopy.Visible := true;
|
|||
|
TBDel.Visible := true;
|
|||
|
TBSCAP.Visible := true;
|
|||
|
TBEdit.Visible := true;
|
|||
|
end
|
|||
|
else if cxTabControl1.TabIndex = 1 then
|
|||
|
begin
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBCopy.Visible := true;
|
|||
|
TBEnd.Visible := true;
|
|||
|
TBSCAP.Visible := true;
|
|||
|
TBEdit.Visible := true;
|
|||
|
|
|||
|
btn1.Visible := true;
|
|||
|
ToolButton5.Visible := true;
|
|||
|
ToolButton6.Visible := true;
|
|||
|
ToolButton7.Visible := true;
|
|||
|
ToolButton9.Visible := true;
|
|||
|
ToolButton10.Visible := true;
|
|||
|
end
|
|||
|
else if cxTabControl1.TabIndex = 2 then
|
|||
|
begin
|
|||
|
TBNoEnd.Visible := true;
|
|||
|
|
|||
|
btn1.Visible := true;
|
|||
|
ToolButton5.Visible := true;
|
|||
|
ToolButton6.Visible := true;
|
|||
|
ToolButton7.Visible := true;
|
|||
|
ToolButton9.Visible := true;
|
|||
|
ToolButton10.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(isred,'''') AS isred,IfJQ = DATEDIFF(day, CONVERT(date, GETDATE()), A.DlyDate),A.*,B.* ');
|
|||
|
sql.Add(',CarHZ=cast((SELECT DISTINCT CarNO +'';'' from Knit_Plan_Card X where X.status <>''-1'' and X.MainID=A.MainID FOR XML PATH(''''))as VARCHAR(6000) ) ');
|
|||
|
sql.Add(',APPS=(select count (PCID) from Knit_Plan_Card X where X.MainID =A.MainID and X.Status <> ''-1'') ');
|
|||
|
sql.Add(',JYPS=(select count (PCID) from Knit_Cloth_Inspect X where X.MainID =A.MainID ) ');
|
|||
|
sql.Add(',XJPS=(select count (PCID) from Knit_Plan_Card X where X.MainID =A.MainID and X.IsOffMachine = ''<27><>'') ');
|
|||
|
sql.Add(',WXJPS=(select count (PCID) from Knit_Plan_Card X where X.MainID =A.MainID and ISNULL(X.IsOffMachine,'''') = '''') ');
|
|||
|
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', BegDate.DateTime)) + '''');
|
|||
|
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
|
|||
|
|
|||
|
if DParameters1 = 'ҵ<><D2B5>Ա' then
|
|||
|
begin
|
|||
|
|
|||
|
sql.Add(' and Saleser=''' + trim(DName) + '''');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''0'' ');
|
|||
|
sql.Add('and not EXISTS (select PCID from Knit_Plan_Card X where A.MainId =X.MainId and X.Status <> ''-1'') ');
|
|||
|
end
|
|||
|
else if cxTabControl1.TabIndex = 1 then
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''0'' ');
|
|||
|
sql.Add('and EXISTS (select PCID from Knit_Plan_Card X where A.MainId =X.MainId and X.Status <> ''-1'') ');
|
|||
|
end
|
|||
|
else if cxTabControl1.TabIndex = 2 then
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''1'' ');
|
|||
|
// sql.Add('and EXISTS (select PCID from Knit_Plan_Card X where A.MainId =X.MainId and X.Status <> ''-1'') ');
|
|||
|
end;
|
|||
|
sql.add('order by A.FILLTIME DESC');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
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
|
|||
|
SelOKNo(cds_3, true)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(cds_3, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.InitForm();
|
|||
|
begin
|
|||
|
InitButton();
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 30;
|
|||
|
EndDate.DateTime := 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=''0'' ');
|
|||
|
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;
|
|||
|
|
|||
|
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) + '''');
|
|||
|
sql.Add(' and Status <> ''-1'' ');
|
|||
|
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><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
|
|||
|
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=''1'' ');
|
|||
|
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) + '''');
|
|||
|
sql.Add(' and Status <> ''-1'' ');
|
|||
|
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><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 SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from knit_Plan_Sub where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete knit_Plan_Main where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(CDS_1.fieldbyname('SubId').AsString) = '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete knit_Plan_Main where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
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);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
WSql := Trim(CDS_1.fieldbyname('MainId').AsString);
|
|||
|
Panel2.Visible := True;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select DISTINCT CarNO from Knit_Plan_Card where Status <> ''-1'' and MainID =''' + Trim(WSql) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_2);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_2);
|
|||
|
|
|||
|
SelOKNo(cds_2, true);
|
|||
|
|
|||
|
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.btn1Click(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_3.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_3.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
WSql := '';
|
|||
|
CDS_3.DisableControls;
|
|||
|
|
|||
|
with CDS_3 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_3.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if WSql <> '' then
|
|||
|
begin
|
|||
|
WSql := WSql + ',' + QuotedStr(Trim(CDS_3.fieldbyname('LCKID').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
WSql := QuotedStr(Trim(CDS_3.fieldbyname('LCKID').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_3.Locate('SSel', True, []);
|
|||
|
CDS_3.EnableControls;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FPreviewPrint := False;
|
|||
|
FLMType := 'KnitPlanLCK';
|
|||
|
FFiltration1 := WSql;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete TbForBatch where DName=' + quotedstr(Trim(DName)));
|
|||
|
SQL.Add('and MainType=' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ'));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
if CDS_2.Locate('SSel', True, []) = true then
|
|||
|
begin
|
|||
|
with CDS_2 do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_2.FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with Self.ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into TbForBatch(DName,MainType,Value1,Value2) ');
|
|||
|
sql.Add(' values( ' + quotedstr(Trim(DName)) + ',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ') + ',' + quotedstr(Trim(WSql)) + ',' + quotedstr(Trim(Self.CDS_2.FieldByName('carNo').AsString)) + ')');
|
|||
|
//showmessage(sql.text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with Self.ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into TbForBatch(DName,MainType,Value1,Value2) ');
|
|||
|
sql.Add(' values( ' + quotedstr(Trim(DName)) + ',' + quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ') + ',' + quotedstr(Trim(WSql)) + ',' + quotedstr(Trim('')) + ')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FLMType := 'knitPlanPrint';
|
|||
|
FFiltration1 := trim(DName);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
panel2.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
panel2.Visible := false;
|
|||
|
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('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.ToolButton10Click(Sender: TObject);
|
|||
|
var
|
|||
|
sInput: string;
|
|||
|
i, iLoopCount: Integer;
|
|||
|
begin
|
|||
|
if CDS_3.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>̿<EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿؼ<D8BF><D8BC><EFBFBD>ֹ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ToolButton10.Enabled := False;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('EXEC P_Dye_Card_HX @PCID=' + quotedstr(trim(CDS_3.fieldbyname('LCKID').AsString)));
|
|||
|
sql.Add(',@dname=' + quotedstr(trim(DNAME)));
|
|||
|
sql.Add(',@dcode=' + quotedstr(trim(DCODE)));
|
|||
|
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
ToolButton10.Enabled := true;
|
|||
|
InitsubGrid();
|
|||
|
// TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTradeInspSet := TfrmTradeInspSet.Create(Application);
|
|||
|
with frmTradeInspSet do
|
|||
|
begin
|
|||
|
|
|||
|
FDataID := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTradeInspSet.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update knit_Plan_Main SET isred=''<27><>'' ');
|
|||
|
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.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update knit_Plan_Main SET isred=''<27><>'' ');
|
|||
|
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><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmLCKInput := TfrmLCKInput.Create(Application);
|
|||
|
with frmLCKInput do
|
|||
|
begin
|
|||
|
PState := 0;
|
|||
|
FLCKID := '';
|
|||
|
FFSubId := Trim(self.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitsubGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLCKInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_3.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmLCKInput := TfrmLCKInput.Create(Application);
|
|||
|
with frmLCKInput do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FLCKID := Trim(self.CDS_3.fieldbyname('LCKID').AsString);
|
|||
|
FFSubId := Trim(self.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLCKInput.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton7Click(Sender: TObject);
|
|||
|
var
|
|||
|
MLCKIDS: string;
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_3.IsEmpty then
|
|||
|
exit;
|
|||
|
if not CDS_3.Locate('SSel', True, []) then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
// if CDS_3.IsEmpty then
|
|||
|
// Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
with CDS_3 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add(' DELETE from PB_LCK');
|
|||
|
sql.Add(' where LCKID=''' + Trim(CDS_3.fieldbyname('LCKID').AsString) + '''');
|
|||
|
|
|||
|
SQL.Add(' DELETE from Dye_Plan_Glide');
|
|||
|
sql.Add(' where PCID=''' + Trim(CDS_3.fieldbyname('LCKID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
InitsubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
|
|||
|
FLMType := 'ZZJHD';
|
|||
|
FFiltration1 := CDS_1.FieldByName('MAINID').AsString;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.ToolButton9Click(Sender: TObject);
|
|||
|
var
|
|||
|
sInput: string;
|
|||
|
i, iLoopCount: Integer;
|
|||
|
begin
|
|||
|
if CDS_3.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>̿<EFBFBD>', '<27><>ʾ');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
// <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>
|
|||
|
if not InputQuery('ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>1-999<39><39><EFBFBD><EFBFBD>', sInput) then
|
|||
|
Exit; // <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
|
|||
|
if not TryStrToInt(sInput, iLoopCount) or (iLoopCount < 1) then
|
|||
|
begin
|
|||
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؿؼ<D8BF><D8BC><EFBFBD>ֹ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ToolButton9.Enabled := False;
|
|||
|
// Application.ProcessMessages;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>3<EFBFBD><33>ִ<EFBFBD><D6B4>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for i := 1 to iLoopCount do
|
|||
|
begin
|
|||
|
// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
// Application.ProcessMessages; // <20><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('EXEC P_Dye_Card_CF @PCID=' + quotedstr(trim(CDS_3.fieldbyname('LCKID').AsString)));
|
|||
|
sql.Add(',@dname=' + quotedstr(trim(DNAME)));
|
|||
|
sql.Add(',@dcode=' + quotedstr(trim(DCODE)));
|
|||
|
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
ToolButton9.Enabled := true;
|
|||
|
InitsubGrid();
|
|||
|
// TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if cxTabControl1.TabIndex = 1 then
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('IFJQ').Index] <= 3 then
|
|||
|
ACanvas.Brush.Color := clMenuHighlight;
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('OrdPiece').Index] > AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('APPS').Index] then
|
|||
|
begin
|
|||
|
if AViewInfo.Item.Index = 1 then
|
|||
|
begin
|
|||
|
// <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|||
|
ACanvas.Brush.Color := clYellow;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if AViewInfo.GridRecord.Values[Tv1Column8.Index] = '<27><>' then
|
|||
|
ACanvas.Font.Color := $1C6BFF;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitsubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.InitsubGrid();
|
|||
|
var
|
|||
|
FLCKID: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQuerySub.DisableControls;
|
|||
|
with ADOQuerySub do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select OutNumber=(select count(A.LCKID) OutNumber from PB_LCK A inner join PB_CK_LCK B on A.LCKID=B.LCKID where B.LCKID = X.LCKID),X.* from PB_LCK X');
|
|||
|
sql.Add('where X.SubID =''' + Trim(self.CDS_1.fieldbyname('SubId').AsString) + '''');
|
|||
|
// showmessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQuerySub, CDS_3);
|
|||
|
SInitCDSData(ADOQuerySub, CDS_3);
|
|||
|
finally
|
|||
|
ADOQuerySub.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.MenuItem1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(cds_2, true)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmKnitPlanList.MenuItem2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(cds_2, false)
|
|||
|
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.
|
|||
|
|