340 lines
8.6 KiB
ObjectPascal
340 lines
8.6 KiB
ObjectPascal
|
|
unit U_frameJGQXList;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|||
|
|
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics,
|
|||
|
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
|
|||
|
|
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxNavigator,
|
|||
|
|
dxDateRanges, dxScrollbarAnnotations, Data.DB, cxDBData, cxCheckBox,
|
|||
|
|
cxTextEdit, dxBarBuiltInMenu, Vcl.Menus, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, Datasnap.DBClient, Data.Win.ADODB, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxGridCustomView, cxGrid, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ToolWin,
|
|||
|
|
Vcl.ExtCtrls, dxSkinsCore, dxSkinsDefaultPainters, cxMemo, cxLabel, cxMaskEdit,
|
|||
|
|
cxDropDownEdit, cxButtonEdit, cxButtons;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TframeJGQXList = class(TFrame)
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Panel_jgqx: TPanel;
|
|||
|
|
LabelJGQX: TLabel;
|
|||
|
|
cxLabel340: TcxLabel;
|
|||
|
|
jgqx_keepTemper: TcxTextEdit;
|
|||
|
|
jgqx_keepTime: TcxTextEdit;
|
|||
|
|
cxLabel347: TcxLabel;
|
|||
|
|
cxLabel173: TcxLabel;
|
|||
|
|
cxLabel334: TcxLabel;
|
|||
|
|
jgqx_upperSpeed: TcxTextEdit;
|
|||
|
|
jgqx_downSpeed: TcxTextEdit;
|
|||
|
|
cxGrid5: TcxGrid;
|
|||
|
|
TvJGQX: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
|
TvJGQXserialno: TcxGridDBColumn;
|
|||
|
|
cxGridLevel3: TcxGridLevel;
|
|||
|
|
cxLabel3: TcxLabel;
|
|||
|
|
TbJGQXAdd: TcxButton;
|
|||
|
|
TbJGQXDel: TcxButton;
|
|||
|
|
jgqx_note: TcxMemo;
|
|||
|
|
CDS_JGQX: TClientDataSet;
|
|||
|
|
DS_jgqx: TDataSource;
|
|||
|
|
TvJGQXBPIID: TcxGridDBColumn;
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure TbJGQXAddClick(Sender: TObject);
|
|||
|
|
procedure TbJGQXDelClick(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn9PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure cxGridDBColumn12PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData(mPSID: string): Boolean;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_LabelPrint,U_ProductInfoSel;
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.cxGridDBColumn12PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
s: string;
|
|||
|
|
fValue: Double;
|
|||
|
|
begin
|
|||
|
|
s := TcxTextEdit(Sender).EditingText;
|
|||
|
|
|
|||
|
|
if (s <> '') and (s[Length(s)] <> '%') then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
// <20><><EFBFBD>Խ<EFBFBD><D4BD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
fValue := StrToFloat(s);
|
|||
|
|
// <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD><CEAA>λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
|
|||
|
|
TvJGQX.Controller.FocusedColumn.EditValue := FormatFloat('0.00', fValue) + '%';
|
|||
|
|
except
|
|||
|
|
on E: EConvertError do
|
|||
|
|
begin
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
|
|||
|
|
TvJGQX.Controller.FocusedColumn.EditValue := s + '%';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.cxGridDBColumn9PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmProductInfoSel := TfrmProductInfoSel.Create(Application);
|
|||
|
|
with frmProductInfoSel do
|
|||
|
|
begin
|
|||
|
|
FSTKName := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_JGQX do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('jgqx_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
|
|||
|
|
FieldByName('jgqx_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Type').value;
|
|||
|
|
FieldByName('jgqx_unit').Value := frmProductInfoSel.CDS_1.fieldbyname('QtyUnit').value;
|
|||
|
|
FieldByName('BPIID').Value := frmProductInfoSel.CDS_1.fieldbyname('BPIID').value;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmProductInfoSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.InitGrid();
|
|||
|
|
begin
|
|||
|
|
// POSNO.SetFocus;
|
|||
|
|
// try
|
|||
|
|
// ADOQueryMain.DisableControls;
|
|||
|
|
// with ADOQueryMain do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// SQL.Clear;
|
|||
|
|
// sql.Add(' select A.* from BS_Position A order by POSNO ');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(ADOQueryMain, CDS_HZ);
|
|||
|
|
// SInitCDSData(ADOQueryMain, CDS_HZ);
|
|||
|
|
// finally
|
|||
|
|
// ADOQueryMain.EnableControls;
|
|||
|
|
// ToolButton2.Click;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.TbJGQXAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with CDS_JGQX do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
CDS_JGQX.FieldByName('serialno').Value := CDS_JGQX.RecordCount + 1;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.TbJGQXDelClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
if not CDS_JGQX.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_JGQX.fieldbyname('BCPID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete BS_Cloth_GY_Sub where BCPID=' + quotedStr(Trim(CDS_JGQX.fieldbyname('BCPID').AsString)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_JGQX.Delete;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
i := 0;
|
|||
|
|
CDS_JGQX.First;
|
|||
|
|
while not CDS_JGQX.Eof do
|
|||
|
|
begin
|
|||
|
|
i := i + 1;
|
|||
|
|
CDS_JGQX.Edit;
|
|||
|
|
CDS_JGQX.fieldByName('serialno').value := i;
|
|||
|
|
CDS_JGQX.Post;
|
|||
|
|
CDS_JGQX.Next;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TframeJGQXList.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.Locate('SSel', True, []) = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete BS_Position where POSID=' + QuotedStr(CDS_HZ.FieldByName('POSID').AsString));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CDS_HZ.Edit;
|
|||
|
|
CDS_HZ.FieldByName('SSel').Value := False;
|
|||
|
|
CDS_HZ.Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TframeJGQXList.SaveData(mPSID: string): Boolean;
|
|||
|
|
var
|
|||
|
|
MaxProcessID, MaxBCPID, MaxPSID, MaxDTMID, mDTMID, DTMPSlist: string;
|
|||
|
|
maxsubid1, maxsubid2, maxsubid3, maxsubid4, maxsubid5, maxsubid6, mmaxgx: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Bs_Cloth_GY_Main where PSID=''' + Trim(mPSID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(mPSID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('PSID').Value := Trim(mPSID);
|
|||
|
|
|
|||
|
|
RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel_jgqx, 2);
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
|
|||
|
|
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ӱ<EFBFBD> //////////////////////
|
|||
|
|
with CDS_JGQX do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Trim(CDS_JGQX.fieldbyname('BCPID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryTemp, maxsubid3, 'JGQX', 'Bs_Cloth_GY_Sub', 5, 1) = False then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxsubid3 := Trim(CDS_JGQX.fieldbyname('BCPID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Bs_Cloth_GY_Sub where ');
|
|||
|
|
sql.Add(' BCPID=''' + Trim(maxsubid3) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_JGQX.fieldbyname('BCPID').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
FieldByName('GYType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ';
|
|||
|
|
FieldByName('PSID').Value := Trim(mPSID);
|
|||
|
|
FieldByName('BCPID').Value := Trim(maxsubid3);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, TvJGQX, CDS_JGQX, 'Bs_Cloth_GY_Sub', 0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// FPSID := maxId;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|