418 lines
11 KiB
ObjectPascal
418 lines
11 KiB
ObjectPascal
|
|
unit U_ProductFYSS;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
cxStyles, dxSkinsCore, 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,
|
|||
|
|
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
|
dxSkinXmas2008Blue, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData,
|
|||
|
|
cxDataStorage, cxEdit, cxNavigator, DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxGridCustomView, cxGrid, DBClient, Menus, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, ADODB, StdCtrls, ComCtrls, ExtCtrls, ToolWin;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TFRMProductFYSS = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBEdit: TToolButton;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
TBCK: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
TRZ: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
OrderNo: TEdit;
|
|||
|
|
SScolor: TEdit;
|
|||
|
|
SSCodeName: TEdit;
|
|||
|
|
SSGH: TEdit;
|
|||
|
|
SSCodeNo: TEdit;
|
|||
|
|
MPRTKZ: TEdit;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
|
v1OrderNo: TcxGridDBColumn;
|
|||
|
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
|
v1ConNo: TcxGridDBColumn;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
v1MPRTCodeName: TcxGridDBColumn;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
v1MPRTSpec: TcxGridDBColumn;
|
|||
|
|
v1MPRTMF: TcxGridDBColumn;
|
|||
|
|
v1MPRTKZ: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column11: TcxGridDBColumn;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
RCFactoryName: TEdit;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
ssType: TComboBox;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBEditClick(Sender: TObject);
|
|||
|
|
procedure TBCKClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
|
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure ssTypeChange(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
DQdate: TDateTime;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure SetStatus();
|
|||
|
|
function DelData(): Boolean;
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FFInt, FCloth: Integer;
|
|||
|
|
canshu1, canshu2: string;
|
|||
|
|
fFlileFlag: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
FRMProductFYSS: TFRMProductFYSS;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_SysLogHelp, U_Fun, U_ZDYHelp, U_ProductFYSSedit;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TFRMProductFYSS.InitGrid();
|
|||
|
|
var
|
|||
|
|
strwhere: string;
|
|||
|
|
begin
|
|||
|
|
Panel4.Visible := True;
|
|||
|
|
Panel4.Refresh;
|
|||
|
|
strwhere := '';
|
|||
|
|
// if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
|
// strwhere := strwhere + ' and Filler=''' + Trim(DName) + '''';
|
|||
|
|
// if cxTabControl1.TabIndex < 4 then
|
|||
|
|
// begin
|
|||
|
|
// strwhere := strwhere + ' and isnull(A.status,''0'')=''' + inttostr(cxTabControl1.TabIndex) + '''';
|
|||
|
|
// end;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from JYOrder_SS ');
|
|||
|
|
Sql.add('where filltime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
|
Sql.add('and filltime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
|
sql.Add('and DDTYpe=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
|
begin
|
|||
|
|
SQL.Add(' and Filler=''' + Trim(DName) + '''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' order by filltime ');
|
|||
|
|
// ShowMessage(SQL.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
Panel4.Visible := false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.TBAddClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
maxno: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
FRMProductFYSSedit := TFRMProductFYSSedit.Create(Application);
|
|||
|
|
with FRMProductFYSSedit do
|
|||
|
|
begin
|
|||
|
|
PState := 0;
|
|||
|
|
FSSId := '';
|
|||
|
|
canshu1 := self.canshu1;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
FRMProductFYSSedit.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxgrid1.Align := alClient;
|
|||
|
|
DQdate := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 30;
|
|||
|
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.SetStatus();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
TBAdd.Visible := false;
|
|||
|
|
TBEdit.Visible := false;
|
|||
|
|
TBDel.Visible := false;
|
|||
|
|
|
|||
|
|
ToolButton2.Visible := false; //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
if Trim(canshu1) = '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
TBAdd.Visible := true;
|
|||
|
|
TBEdit.Visible := true;
|
|||
|
|
TBDel.Visible := true;
|
|||
|
|
ToolButton2.Visible := true;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
|
begin
|
|||
|
|
TBAdd.Visible := true;
|
|||
|
|
TBEdit.Visible := true;
|
|||
|
|
TBDel.Visible := true;
|
|||
|
|
ToolButton2.Visible := true;
|
|||
|
|
end;
|
|||
|
|
if Trim(canshu1) = '<27><>ѯ' then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.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 TFRMProductFYSS.TBEditClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
// if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
FRMProductFYSSedit := TFRMProductFYSSedit.Create(Application);
|
|||
|
|
with FRMProductFYSSedit do
|
|||
|
|
begin
|
|||
|
|
PState := 1;
|
|||
|
|
FSSId := Trim(Self.Order_Main.fieldbyname('SSId').AsString);
|
|||
|
|
// FOrderNo := Trim(Self.Order_Main.fieldbyname('OrderNoM').AsString);
|
|||
|
|
canshu1 := self.canshu1;
|
|||
|
|
// conNo.Enabled := false;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
FRMProductFYSSedit.Free;
|
|||
|
|
end;
|
|||
|
|
self.TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.TBCKClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
FRMProductFYSSedit := TFRMProductFYSSedit.Create(Application);
|
|||
|
|
with FRMProductFYSSedit do
|
|||
|
|
begin
|
|||
|
|
PState := 1;
|
|||
|
|
FSSId := Trim(Self.Order_Main.fieldbyname('SSId').AsString);
|
|||
|
|
// ToolBar2.Visible := False;
|
|||
|
|
TBSave.Visible := False;
|
|||
|
|
// ScrollBox1.Enabled := False;
|
|||
|
|
Tv1.OptionsSelection.CellSelect := False;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
FRMProductFYSSedit.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
// if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><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;
|
|||
|
|
if DelData() then
|
|||
|
|
begin
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TFRMProductFYSS.DelData(): Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result := false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete JYOrder_SS where SSId=''' + Trim(Order_Main.fieldbyname('SSId').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><>ˮɾ<CBAE><C9BE>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('ָʾ<D6B8><CABE><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('OrderNO').AsString))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
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 TFRMProductFYSS.OrderNoChange(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 TFRMProductFYSS.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
if Length(OrderNo.Text) < 3 then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from JYOrder_SS ');
|
|||
|
|
Sql.add('where filltime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
|
|||
|
|
Sql.add('and filltime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
|
|||
|
|
sql.Add(' order by filltime ');
|
|||
|
|
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and Filler=''' + Trim(DName) + '''');
|
|||
|
|
// Parameters.ParamByName('WSql').Value := ' and Filler=''' + Trim(DName) + '''';
|
|||
|
|
end;
|
|||
|
|
begin
|
|||
|
|
sql.Add('and orderno like ''' + '%' + Trim(OrderNo.Text) + '%' + '''');
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
//WriteCxGrid('ָʾ<D6B8><CABE><EFBFBD>б<EFBFBD>FF', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
if Trim(DName) = 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
WriteCxGridAll(trim(self.Caption), Tv1, ADOQueryCmd, ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFRMProductFYSS.ssTypeChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|