RTFormwork/项目代码/RTBasicsV1/D01针织生产计划/U_MachPlanSet.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

250 lines
7.4 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_MachPlanSet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
cxTextEdit, cxPC, cxCheckComboBox, cxDropDownEdit, Menus, RM_e_Xls,
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList,
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
TfrmMachPlanSet = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
ToolButton2: TToolButton;
ADO_2: TADOQuery;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
GPM_2: TcxGridPopupMenu;
DS_2: TDataSource;
CDS_2: TClientDataSet;
v2Column12: TcxGridDBColumn;
Tv2Column1: TcxGridDBColumn;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
v1Column31: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
v1Column21: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
Tv1Column3: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column22: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1PRTOrderQty: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
GPM_1: TcxGridPopupMenu;
CDS_1: TClientDataSet;
DS_1: TDataSource;
ADO_1: TADOQuery;
ToolButton1: TToolButton;
Tv2Column2: TcxGridDBColumn;
ToolButton3: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Tv1DblClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
procedure InitGrid();
public
fFlag: integer;
{ Public declarations }
RKFlag, FCYID, fmanage: string;
end;
var
frmMachPlanSet: TfrmMachPlanSet;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp;
{$R *.dfm}
procedure TfrmMachPlanSet.InitGrid();
begin
ToolBar1.SetFocus;
with ADO_1 do
begin
Close;
SQL.Clear;
sql.Add('select A.*,B.* ');
sql.Add(' from knit_Plan_Main A inner join knit_Plan_Sub B on A.Mainid=B.MainId');
sql.Add(' where isnull(Status,''0'') =''9'' ');
Open;
end;
SCreateCDS(ADO_1, CDS_1);
SInitCDSData(ADO_1, CDS_1);
with ADO_2 do
begin
Close;
SQL.Clear;
sql.Add(' select A.* from BS_Machine A order by MCNO '); //where MCType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''
Open;
end;
SCreateCDS(ADO_2, CDS_2);
SInitCDSData(ADO_2, CDS_2);
end;
procedure TfrmMachPlanSet.FormDestroy(Sender: TObject);
begin
inherited;
frmMachPlanSet := nil;
end;
procedure TfrmMachPlanSet.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmMachPlanSet.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmMachPlanSet.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(Trim(Self.Caption) + 'Tv1', Tv1, '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>');
ReadCxGrid(Trim(Self.Caption) + 'Tv2', Tv2, '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>');
// Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
// begdate.DateTime:=Enddate.DateTime-30;
InitGrid();
end;
procedure TfrmMachPlanSet.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmMachPlanSet.ToolButton1Click(Sender: TObject);
begin
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_2 do
begin
Edit;
FieldByName('OrderNo').Value := '';
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate BS_Machine Set OrderNo='''' ');
sql.Add(' , Editer=''' + Trim(DName) + '''');
sql.Add(' , Edittime=getdate()');
sql.Add(' where MCID=' + quotedstr(CDS_2.fieldbyname('MCID').AsString));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
tv2.Controller.EditingController.ShowEdit();
except
tv2.Controller.EditingController.ShowEdit();
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end
end;
procedure TfrmMachPlanSet.ToolButton3Click(Sender: TObject);
begin
WriteCxGrid(Trim(Self.Caption) + 'Tv1', Tv1, '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>');
WriteCxGrid(Trim(Self.Caption) + 'Tv2', Tv2, '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>');
end;
procedure TfrmMachPlanSet.Tv1DblClick(Sender: TObject);
begin
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_2 do
begin
Edit;
FieldByName('OrderNo').Value := CDS_1.FieldByName('OrderNo').Value;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate BS_Machine ');
sql.Add(' Set OrderNo=''' + Trim(CDS_1.FieldByName('OrderNo').AsString) + '''');
sql.Add(' , Editer=''' + Trim(DName) + '''');
sql.Add(' , Edittime=getdate()');
sql.Add(' where MCID=' + quotedstr(CDS_2.fieldbyname('MCID').AsString));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
tv2.Controller.EditingController.ShowEdit();
except
tv2.Controller.EditingController.ShowEdit();
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end
end;
procedure TfrmMachPlanSet.cxTabControl1Change(Sender: TObject);
begin
InitGrid;
end;
procedure TfrmMachPlanSet.FormCreate(Sender: TObject);
begin
inherited;
fmanage := Trim(DParameters1);
end;
end.