714 lines
20 KiB
ObjectPascal
714 lines
20 KiB
ObjectPascal
|
unit U_YarnElasticityOrderList;
|
|||
|
|
|||
|
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, cxPC, cxCheckBox,
|
|||
|
Menus, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
U_BaseList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmYarnElasticityOrderList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_Main: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
TBCopy: TToolButton;
|
|||
|
TBView: TToolButton;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
Panel3: TPanel;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
YE_Name: TEdit;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
Label2: TLabel;
|
|||
|
Y_Name: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
TV2Column3: TcxGridDBColumn;
|
|||
|
TV2Column4: TcxGridDBColumn;
|
|||
|
TV2Column5: TcxGridDBColumn;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
VC_NeedOrdQty: TcxGridDBColumn;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
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 TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure LSNOChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBViewClick(Sender: TObject);
|
|||
|
procedure TBCopyClick(Sender: TObject);
|
|||
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
procedure machnoChange(Sender: TObject);
|
|||
|
procedure v1Column4PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v1Column11PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v1Column17PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Y_TypeChange(Sender: TObject);
|
|||
|
procedure machstatusChange(Sender: TObject);
|
|||
|
procedure v1Column18PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure YE_NameChange(Sender: TObject);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitGrid2();
|
|||
|
procedure SetStatus();
|
|||
|
function DelData(): Boolean;
|
|||
|
procedure InitButton();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, FCheJian: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_YarnElasticityOrderInPut;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmYarnElasticityOrderList.SetStatus();
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.InitButton();
|
|||
|
begin
|
|||
|
TBAdd.Visible := True;
|
|||
|
TBCopy.Visible := True;
|
|||
|
TBEdit.Visible := True;
|
|||
|
TBDel.Visible := True;
|
|||
|
TBView.Visible := True;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><>ѯ' then
|
|||
|
begin
|
|||
|
TBAdd.Visible := False;
|
|||
|
TBCopy.Visible := False;
|
|||
|
TBEdit.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
Sql.Add(' ,ZGYSHZ=CAST((select distinct(RName) + '' '' from YE_Plan_Rule X where X.MainID=A.MainID and RType=''<27><>ɫ'' and isnull(RName,'''')<>'''' for xml path('''') ) AS VARCHAR(100))');
|
|||
|
Sql.Add(' ,SCJTHZ=CAST((select distinct(RName) + '' '' from YE_Plan_Rule X where X.MainID=A.MainID and RType=''<27><>̨'' and isnull(RName,'''')<>'''' for xml path('''') ) AS VARCHAR(100))');
|
|||
|
sql.Add(' from YE_Plan_Main A');
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' where isnull(Status,''0'')=''0'' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' where isnull(Status,''0'')=''1'' ');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' where isnull(Status,''0'')=''10'' ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.InitGrid2();
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_YE_Plan_Need');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_1);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_1);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmShuttleLSSCInPut := TfrmShuttleLSSCInPut.Create(Application);
|
|||
|
with frmShuttleLSSCInPut 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', frmShuttleLSSCInPut.FMainId, []);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmShuttleLSSCInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.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;
|
|||
|
initgrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmYarnElasticityOrderList.DelData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
// SQL.Add('update YN_Plan set ZDStatus=null,ZDDate=null where yid in (select yid from pd_plan_ls where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + ''')');
|
|||
|
// sql.Add('delete pd_plan_ls where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
sql.Add('delete YE_Plan_Main 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 TfrmYarnElasticityOrderList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('<27><>˿<EFBFBD><CBBF>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid2();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmShuttleLSSCInPut := TfrmShuttleLSSCInPut.Create(Application);
|
|||
|
with frmShuttleLSSCInPut do
|
|||
|
begin
|
|||
|
PState := 0;
|
|||
|
FMainId := '';
|
|||
|
FSubId := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmShuttleLSSCInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.LSNOChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(Trim(self.Caption) + 'Tv1', Tv1, '<27>ӵ<EFBFBD>˿');
|
|||
|
ReadCxGrid(Trim(self.Caption) + 'Tv2', Tv2, '<27>ӵ<EFBFBD>˿');
|
|||
|
InitButton();
|
|||
|
|
|||
|
InitGrid2();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBViewClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmShuttleLSSCInPut := TfrmShuttleLSSCInPut.Create(Application);
|
|||
|
with frmShuttleLSSCInPut 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
|
|||
|
frmShuttleLSSCInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TBCopyClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmShuttleLSSCInPut := TfrmShuttleLSSCInPut.Create(Application);
|
|||
|
with frmShuttleLSSCInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FCopyInt := 1;
|
|||
|
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmShuttleLSSCInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.cxPageControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitButton();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.machnoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.v1Column4PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalues, yjdate: string;
|
|||
|
begin
|
|||
|
mvalues := TCXTextEdit(Sender).Text;
|
|||
|
|
|||
|
with order_main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('MachSpeed').Value := mvalues;
|
|||
|
post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
if (order_main.FieldByName('SCQty').AsString <> '') and (order_main.FieldByName('machspeed').AsString <> '') then
|
|||
|
begin
|
|||
|
yjdate := format('%.1f', [(order_main.FieldByName('SCQty').AsFloat * 10000) / order_main.FieldByName('machspeed').AsFloat / 60 / 24]);
|
|||
|
with order_main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('YJDate').Value := yjdate;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YN_Plan_Mach Set MachSpeed=''' + trim(mvalues) + ''', YJDate=''' + trim(yjdate) + ''' ');
|
|||
|
sql.Add('where PMID=''' + Trim(order_main.fieldbyname('pmid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.v1Column11PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalues: string;
|
|||
|
begin
|
|||
|
mvalues := TCXTextEdit(Sender).Text;
|
|||
|
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('Machstatus').Value := mvalues;
|
|||
|
post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YN_Plan_Mach Set Machstatus=''' + trim(mvalues) + ''' ');
|
|||
|
sql.Add('where PMID=''' + Trim(Order_Main.fieldbyname('pmid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.v1Column17PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalues, YJDate: string;
|
|||
|
begin
|
|||
|
mvalues := TCXTextEdit(Sender).Text;
|
|||
|
|
|||
|
with order_main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('SCQty').Value := mvalues;
|
|||
|
post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
if (order_main.FieldByName('SCQty').AsString <> '') and (order_main.FieldByName('machspeed').AsString <> '') then
|
|||
|
begin
|
|||
|
YJDate := format('%.1f', [(order_main.FieldByName('SCQty').AsFloat * 10000) / order_main.FieldByName('machspeed').AsFloat / 60 / 24]);
|
|||
|
with order_main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('YJDate').Value := YJDate;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YN_Plan_Mach Set SCQty=''' + trim(mvalues) + ''' , YJDate=''' + trim(YJDate) + ''' ');
|
|||
|
sql.Add('where PMID=''' + Trim(order_main.fieldbyname('pmid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.YE_NameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.Y_TypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.machstatusChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.v1Column18PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalues: string;
|
|||
|
begin
|
|||
|
mvalues := TCXTextEdit(Sender).Text;
|
|||
|
|
|||
|
with order_main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('Y_PC').Value := mvalues;
|
|||
|
post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YN_Plan_Mach Set Y_PC=''' + trim(mvalues) + ''' ');
|
|||
|
sql.Add('where PMID=''' + Trim(order_main.fieldbyname('pmid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YE_Plan_Main set Status=''1'' where MainId=' + quotedstr(Trim(Order_Main.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><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('BatchNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
Order_Main.Delete
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YE_Plan_Main set Status=''0'' where MainId=' + quotedstr(Trim(Order_Main.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><D3B5><EFBFBD>ֹͣ<CDA3><D6B9>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('BatchNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
Order_Main.Delete
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'Grade';
|
|||
|
flagname := '<27>ӵ<EFBFBD>˿<EFBFBD>ȼ<EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'YarnTubeType';
|
|||
|
flagname := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
V1Name.Caption := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
V1Note.Caption := 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
fnote := True;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YE_Plan_Main set Status=''10'' where MainId=' + quotedstr(Trim(Order_Main.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><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('BatchNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
Order_Main.Delete
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YE_Plan_Main set Status=''1'' where MainId=' + quotedstr(Trim(Order_Main.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><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('BatchNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
|||
|
Order_Main.Delete
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.ToolButton7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(Trim(self.Caption) + 'Tv1', Tv1, '<27>ӵ<EFBFBD>˿');
|
|||
|
WriteCxGrid(Trim(self.Caption) + 'Tv2', Tv2, '<27>ӵ<EFBFBD>˿');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmYarnElasticityOrderList.TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if StrToFloatDef(AViewInfo.GridRecord.Values[VC_NeedOrdQty.Index], 0) > 0 then
|
|||
|
begin
|
|||
|
ACanvas.Canvas.Brush.Color := $7AA0FF;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|