D7szChenfeng/梭织计划单(ShuttleSchedule.dll)/U_ShuttleClothGYList.pas

767 lines
21 KiB
ObjectPascal
Raw Permalink Normal View History

2025-07-22 15:51:47 +08:00
unit U_ShuttleClothGYList;
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, StrUtils, RM_e_Graphic, RM_e_Jpeg,
dxBarBuiltInMenu, cxPC, dxSkinsCore, dxSkinsDefaultPainters,
dxSkinscxPCPainter, cxCheckBox, 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, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue;
type
TfrmShuttleClothGYList = class(TForm)
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;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label5: TLabel;
logs: TEdit;
TBExport: TToolButton;
Order_Main: TClientDataSet;
RM1: TRMGridReport;
RMXLSExport1: TRMXLSExport;
CDS_PM: TClientDataSet;
RMDB_Main: TRMDBDataSet;
TBCopy: TToolButton;
TBView: TToolButton;
Label10: TLabel;
P_Code: TEdit;
RMDB_JS: TRMDBDataSet;
CDS_PJS: TClientDataSet;
RMDB_WS: TRMDBDataSet;
CDS_PWS: TClientDataSet;
ComboBox1: TComboBox;
Label4: TLabel;
RMDB_CZ: TRMDBDataSet;
CDS_CZ: TClientDataSet;
RMDB_QZ: TRMDBDataSet;
CDS_QZ: TClientDataSet;
CDS_QZ2: TClientDataSet;
RMDB_QZ2: TRMDBDataSet;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
RMJPEGExport1: TRMJPEGExport;
cxTabControl1: TcxTabControl;
cxGrid4: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn36: TcxGridDBColumn;
cxGridDBColumn38: TcxGridDBColumn;
cxGridDBColumn40: TcxGridDBColumn;
cxGridDBColumn41: TcxGridDBColumn;
cxGridDBColumn43: TcxGridDBColumn;
cxGridDBColumn44: TcxGridDBColumn;
cxGridDBColumn45: TcxGridDBColumn;
cxGridDBColumn47: TcxGridDBColumn;
cxGridDBColumn49: TcxGridDBColumn;
cxGridDBColumn51: TcxGridDBColumn;
Tv3Column6: TcxGridDBColumn;
Tv3Column7: TcxGridDBColumn;
Tv3Column9: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
ToolButton1: TToolButton;
Tv3Column1: TcxGridDBColumn;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
Tv3Column2: TcxGridDBColumn;
Tv3Column3: TcxGridDBColumn;
Tv3Column4: TcxGridDBColumn;
Tv3Column5: TcxGridDBColumn;
Label3: TLabel;
orderno: TEdit;
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 TBViewClick(Sender: TObject);
procedure TBCopyClick(Sender: TObject);
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure cxGridDBColumn46PropertiesEditValueChanged(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
private
FInt, PFInt: Integer;
procedure InitGrid();
procedure InitForm();
function DelData(): Boolean;
procedure InitButton();
procedure UPGYD(MMainId: string);
procedure SCGYD(MMainId: string);
{ Private declarations }
public
canshu1, FCheJian: string;
{ Public declarations }
end;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_LabelList, U_CompressionFun,
U_ShuttleClothGYInPut, U_FileUp;
{$R *.dfm}
procedure TfrmShuttleClothGYList.UPGYD(MMainId: string);
var
OpenDiaLog: TOpenDialog;
fFileName: string;
fFilePath: string;
maxNo: string;
FJStream: TMemoryStream;
mfileSize: integer;
mCreationTime: TdateTime;
mWriteTime: TdateTime;
begin
try
adoqueryCmd.Connection.BeginTrans;
fFilePath := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg';
fFileName := 'label.jpg';
application.ProcessMessages;
if GetLSNo(ADOQueryTemp, maxNo, 'FJ', 'TP_File', 4, 1) = False then
begin
adoqueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
GetFileInfo(fFilePath, mfileSize, mCreationTime, mWriteTime);
with adoqueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from TP_File ');
sql.Add('where TFType='<><EFBFBD>յ<EFBFBD>'' and WBID=' + quotedstr(Trim(MMainId)));
execsql;
end;
try
FJStream := TMemoryStream.Create;
with adoqueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from TP_File ');
sql.Add('where TFID=' + quotedstr(trim(maxNo)));
open;
append;
fieldbyname('TFID').Value := trim(maxNo);
fieldbyname('WBID').Value := Trim(MMainId);
fieldbyname('TFType').Value := trim(<><EFBFBD>յ<EFBFBD>');
fieldbyname('Filler').Value := trim(DName);
fieldbyname('FileName').Value := trim(fFileName);
fieldbyname('TFDate').Value := mWriteTime;
FJStream.LoadFromFile(fFilePath);
CompressionStream(FJStream);
tblobfield(FieldByName('Filesother')).LoadFromStream(FJStream);
post;
end;
finally
FJStream.Free;
end;
adoqueryCmd.Connection.CommitTrans;
except
adoqueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmShuttleClothGYList.SCGYD(MMainId: string);
var
fPrintFile, fImagePath2: string;
i, j, k: integer;
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
ExportFtErpFile(Trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_Plan_Main A inner join PD_Plan_Sub B on A.Mainid=B.MainId where A.MainId=' + Quotedstr(Trim(MMainId)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PM);
SInitCDSData20(ADOQueryTemp, CDS_PM);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_Plan_Yarn where PYType=''<27><>˿'' and MainId=' + Quotedstr(Trim(MMainId)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PJS);
SInitCDSData20(ADOQueryTemp, CDS_PJS);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_Plan_Yarn where PYType=''γ˿'' and MainId=' + Quotedstr(Trim(MMainId)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PWS);
SInitCDSData20(ADOQueryTemp, CDS_PWS);
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg';
if FileExists(fImagePath2) then
DeleteFile(fImagePath2);
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.jpg';
RM1.PrepareReport;
RM1.ExportTo(RMJPEGExport1, fImagePath2);
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmShuttleClothGYList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmShuttleClothGYList.InitButton();
begin
if Trim(canshu1) = '<27><>ѯ' then
begin
TBAdd.Visible := False;
TBCopy.Visible := False;
TBEdit.Visible := False;
TBDel.Visible := False;
end;
end;
procedure TfrmShuttleClothGYList.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(Trim(self.Caption), Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmShuttleClothGYList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
// Filtered := False;
Close;
sql.Clear;
sql.Add('select A.*,B.* ');
SQL.Add(',IsImg=cast((case when (select COUNT(T.WBID) from TP_File T where T.WBID=A.MAINID)=0 then 0 else 1 end) as bit )');
// SQL.Add(',ISIMG=CAST (( CASE WHEN (SELECT COUNT(*) FROM TP_FILE E WHERE E.WBID=A.MAINID)>0 THEN 1 ELSE 0)) AS BIT)');
sql.Add(' from PD_GY_Main A inner join PD_GY_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)) + '''');
case cxTabControl1.TabIndex of
0:
begin
SQL.Add('AND A.VALID=''Y''');
end;
1:
begin
SQL.Add('AND A.VALID=''N''');
end;
end;
SQL.Add('ORDER BY A.MAINID');
// if Trim(canshu1) = '¼<><C2BC>' then
// sql.Add(' and A.Filler=' + quotedstr(DName));
// ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmShuttleClothGYList.InitForm();
begin
InitButton();
ReadCxGrid(Trim(self.Caption), Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 90;
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
InitGrid();
end;
procedure TfrmShuttleClothGYList.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmShuttleClothGYList.TBEditClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
if Order_Main.FieldByName('ISSD').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
try
frmClothGYInPut := tfrmClothgyInPut.Create(Application);
with frmClothGYInPut do
begin
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
if ShowModal = 1 then
begin
InitGrid();
// Self.Order_Main.Locate('MainId', frmClothgyInPut.FMainId, []);
end;
end;
finally
frmClothgyInPut.Free;
end;
end;
procedure TfrmShuttleClothGYList.TBDelClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
if DelData() then
begin
Order_Main.Delete;
end;
end;
function TfrmShuttleClothGYList.DelData(): Boolean;
begin
try
Result := false;
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPDATE PD_GY_Main SET VALID=''N'' where MainId=''' + Trim(Order_Main.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 TfrmShuttleClothGYList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>', cxGrid4);
end;
procedure TfrmShuttleClothGYList.TBPrintClick(Sender: TObject);
var
fPrintFile, fPrintFileQZ, fPrintFileYWB: string;
i, j, k: integer;
begin
if Order_Main.IsEmpty then
Exit;
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(ComboBox1.Text) + '.rmf';
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from PD_GY_Main A inner join PD_GY_Sub B on A.Mainid=B.MainId where A.MainId=' + Quotedstr(Trim(Order_Main.fieldbyname('MainId').AsString)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PM);
SInitCDSData20(ADOQueryTemp, CDS_PM);
if Trim(ADOQueryTemp.fieldbyname('YWBian').AsString) <> '' then
begin
fPrintFileYWB := ExtractFilePath(Application.ExeName) + 'Report\Ӣ<>ı<EFBFBD>.rmf';
ExportFtErpFile(<>ı<EFBFBD>.rmf', ADOQueryTemp);
end;
if (ComboBox1.Text = <><EFBFBD>յ<EFBFBD>') or ((ComboBox1.Text = <><EFBFBD>յ<EFBFBD>(<28><><EFBFBD>Ӱ<EFBFBD>)')) then
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' EXEC P_PRINT_QZ_GY @MAINID=' + Quotedstr(Trim(Order_Main.fieldbyname('MainId').AsString)));
// ShowMessage(sql.Text);
open;
end;
SCreateCDS20(ADOQuery1, CDS_QZ);
SInitCDSData20(ADOQuery1, CDS_QZ);
if ADOQuery1.IsEmpty = false then
begin
fPrintFileQZ := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD>.rmf';
ExportFtErpFile('<27><><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD>.rmf', ADOQuery1);
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' EXEC P_PRINT_GYYARN_J @MAINID=' + Quotedstr(Trim(Order_Main.fieldbyname('MainId').AsString)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PJS);
SInitCDSData20(ADOQueryTemp, CDS_PJS);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' EXEC P_PRINT_GYYARN_W @MAINID=' + Quotedstr(Trim(Order_Main.fieldbyname('MainId').AsString)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_PWS);
SInitCDSData20(ADOQueryTemp, CDS_PWS);
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
if FileExists(fPrintFileQZ) then
begin
RM1.LoadFromFile(fPrintFileQZ);
RM1.ShowReport;
end;
if FileExists(fPrintFileYWB) then
begin
RM1.LoadFromFile(fPrintFileYWB);
RM1.ShowReport;
end;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmShuttleClothGYList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmShuttleClothGYList.TBAddClick(Sender: TObject);
begin
try
frmClothGYInPut := TfrmClothGYInPut.Create(Application);
with frmClothGYInPut do
begin
PState := 0;
FMainId := '';
FSubId := '';
if ShowModal = 1 then
begin
InitGrid();
end;
end;
finally
frmClothGYInPut.Free;
end;
end;
procedure TfrmShuttleClothGYList.ConNoChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
end;
procedure TfrmShuttleClothGYList.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmShuttleClothGYList.TBViewClick(Sender: TObject);
begin
try
frmClothGYInPut := TfrmClothGYInPut.Create(Application);
with frmClothGYInPut do
begin
PState := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FSubId := Trim(Self.Order_Main.fieldbyname('SubId').AsString);
TBSave.Visible := False;
ScrollBox1.Enabled := False;
if ShowModal = 1 then
begin
end;
end;
finally
frmClothGYInPut.Free;
end;
end;
procedure TfrmShuttleClothGYList.TBCopyClick(Sender: TObject);
begin
if Order_Main.IsEmpty then
Exit;
try
frmClothGYInPut := tfrmClothGYInPut.Create(Application);
with frmClothGYInPut do
begin
PState := 1;
FCopyInt := 1;
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
FConNo := Trim(Self.Order_Main.fieldbyname('ConNo').AsString);
if ShowModal = 1 then
begin
end;
end;
finally
frmClothGYInPut.Free;
end;
end;
procedure TfrmShuttleClothGYList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
FDDZT: string;
begin
// if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('ConNoStatu').Index] = '<27><>ȡ<EFBFBD><C8A1>' then
// begin
// ACanvas.Brush.Color := $0000FF;
// ACanvas.Font.Color := $F0FBFF;
// end;
//
// FDDZT := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('DDZT').Index];
//
// if FDDZT = '<27>ѿ<EFBFBD>ʼ' then
// ACanvas.Font.Color := $FF0000;
// if FDDZT = '<27>ѽ<EFBFBD><D1BD><EFBFBD>' then
// ACanvas.Font.Color := $0000FF;
end;
procedure TfrmShuttleClothGYList.cxGridDBColumn46PropertiesEditValueChanged(Sender: TObject);
var
mvalue, FFieldName: string;
begin
mvalue := TcxTextEdit(Sender).EditingText;
FFieldName := Trim(Tv3.Controller.FocusedColumn.DataBinding.FilterFieldName);
try
ADOQueryCmd.Connection.BeginTrans;
with Order_Main do
begin
Edit;
FieldByName(FFieldName).Value := Trim(mvalue);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate PD_Plan_Sub ');
sql.Add(' Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
sql.Add(' where SubId=' + quotedstr(Order_Main.fieldbyname('SubId').AsString));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
tv3.Controller.EditingController.ShowEdit();
except
tv3.Controller.EditingController.ShowEdit();
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end
end;
procedure TfrmShuttleClothGYList.ToolButton1Click(Sender: TObject);
begin
try
frmFileUp := TfrmFileUp.Create(Application);
with frmFileUp do
begin
Code.Text := Trim(Self.order_Main.fieldbyname('mainid').AsString);
CYID := Trim(Self.order_Main.fieldbyname('mainid').AsString);
if ShowModal = 1 then
begin
Self.InitGrid();
end;
end;
finally
frmFileUp.Free;
end;
end;
procedure TfrmShuttleClothGYList.ToolButton2Click(Sender: TObject);
begin
if Order_Main.IsEmpty then
exit;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update PD_Plan_Main SET sdren=NULL,sdtime=NULL,issd=NULL ');
sql.Add('where mainid=' + quotedstr(trim(Order_Main.fieldbyname('mainid').AsString)));
execsql;
end;
InitGrid();
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmShuttleClothGYList.ToolButton3Click(Sender: TObject);
var
MLBName: string;
begin
if Order_Main.IsEmpty then
Exit;
try
frmLabelList := TfrmLabelList.Create(Application);
with frmLabelList do
begin
if ShowModal = 1 then
begin
// MLBName := leftStr(Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString), );
MLBName := Trim(Copy(Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString), 1, Length(Trim(ADOQueryLabel.fieldbyname('labelCaption').AsString)) - 4));
// ShowMessage(MLBName);
end;
end;
finally
frmLabelList.Free;
end;
if MLBName <> '' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update PD_Plan_Main Set LaBName=''' + MLBName + '''');
sql.Add(' where Mainid=''' + Trim(self.Order_Main.fieldbyname('Mainid').AsString) + '''');
ExecSQL;
end;
with Order_Main do
begin
Edit;
FieldByName('SSel').Value := False;
FieldByName('LaBName').Value := MLBName;
Post;
end;
tv3.Controller.EditingController.ShowEdit();
end;
end;
procedure TfrmShuttleClothGYList.ToolButton4Click(Sender: TObject);
begin
with Order_Main do
begin
First;
while not Eof do
begin
SCGYD(Trim(Order_Main.fieldbyname('MainId').AsString));
Sleep(150);
UPGYD(Trim(Order_Main.fieldbyname('MainId').AsString));
Next;
end;
end;
end;
procedure TfrmShuttleClothGYList.cxTabControl1Change(Sender: TObject);
begin
initgrid();
end;
procedure TfrmShuttleClothGYList.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if Order_Main.IsEmpty then
Exit;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('exec P_Del_CF2 @mainid=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
ExecSQL;
end;
end;
end.