509 lines
15 KiB
ObjectPascal
509 lines
15 KiB
ObjectPascal
|
|
unit U_MLSC;
|
|||
|
|
|
|||
|
|
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, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
|||
|
|
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxButtonEdit,
|
|||
|
|
cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmMLSC = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
KHConNo: TEdit;
|
|||
|
|
v1KHNo: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
ConNo: TEdit;
|
|||
|
|
v1KHLXR: TcxGridDBColumn;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
CheckBox1: TCheckBox;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
DS_Sub: TDataSource;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
RMGridReport1: TRMGridReport;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Tv2Column2: TcxGridDBColumn;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
Tv2Column8: TcxGridDBColumn;
|
|||
|
|
Tv2Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
KHNo: TEdit;
|
|||
|
|
KHName: TEdit;
|
|||
|
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
GYNoteZ: TEdit;
|
|||
|
|
Note: TEdit;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv2Column3: TcxGridDBColumn;
|
|||
|
|
Tv2Column4: TcxGridDBColumn;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBEditClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure CustomerNoNameChange(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure Tv2DblClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
DQdate: TDateTime;
|
|||
|
|
XZKHTYpe, canshu1: string;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelData(): Boolean;
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FFInt, FCloth: Integer;
|
|||
|
|
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmMLSC: TfrmMLSC;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_SCPerson, U_PBGYSInPutMain, U_MLLR,U_SCDMX;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmMLSC := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxgrid1.Align := alClient;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
// writeCxGrid(self.Caption + '11', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
// writeCxGrid(self.Caption + '<27>ӱ<EFBFBD>11', Tv2, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
writeCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>11', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
writeCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>11', Tv2, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * ');
|
|||
|
|
sql.Add(' from MLSC A ');
|
|||
|
|
sql.Add(' where A.CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
|
sql.Add(' and A.CRTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.InitForm();
|
|||
|
|
begin
|
|||
|
|
BegDate.Date := SGetServerDateMBeg(ADOQueryTemp);
|
|||
|
|
EndDate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
|
// ReadCxGrid(self.Caption + '11', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
// ReadCxGrid(self.Caption + '<27>ӱ<EFBFBD>11', Tv2, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>11', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>11', Tv2, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1');
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.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 TfrmMLSC.TBEditClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(canshu1) = '' then
|
|||
|
|
begin
|
|||
|
|
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;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.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 TfrmMLSC.DelData(): Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result := false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update ZH_KH_Info Set Valid=''N'' where ZKId=''' + Trim(Order_Main.fieldbyname('ZKId').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 TfrmMLSC.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.N1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Porderno: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf';
|
|||
|
|
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>10.rmf'), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
SDofilter(ADOQueryMain, '');
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
Order_Main.Locate('ordernoM', Porderno, []);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.N2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Porderno: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf';
|
|||
|
|
SDofilter(ADOQueryMain, ' OrderNoM=''' + Trim(Order_Main.fieldbyname('OrderNoM').AsString) + '''');
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
Porderno := Trim(Order_Main.fieldbyname('OrderNoM').AsString);
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>.rmf'), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
SDofilter(ADOQueryMain, '');
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
Order_Main.Locate('ordernoM', Porderno, []);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmMLLR := TfrmMLLR.create(self);
|
|||
|
|
with frmMLLR do
|
|||
|
|
begin
|
|||
|
|
PState := 0;
|
|||
|
|
FMainId := '';
|
|||
|
|
if showmodal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.CustomerNoNameChange(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 TfrmMLSC.ToolButton1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Txt, fImagePath: string;
|
|||
|
|
Moudle: THandle;
|
|||
|
|
Makebar: TMakebar;
|
|||
|
|
Mixtext: TMixtext;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
Sql.Add(' select A.*,B.*');
|
|||
|
|
sql.Add(' from MLSC A inner join MLSC_Sub B on A.MainID=B.MainID ');
|
|||
|
|
sql.Add(' where A.MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
|
Txt := Trim(Order_Main.fieldbyname('MainID').AsString);
|
|||
|
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
|
if FileExists(fImagePath) then
|
|||
|
|
DeleteFile(fImagePath);
|
|||
|
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQuery1.DisableControls;
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * ');
|
|||
|
|
// sql.Add(',sl=(select sum(MQty) from CK_MYSC_CR_MX B where B.MYID=(select mainid from CK_MYSC_CR C where C.scdsubid=A.subid)) ');
|
|||
|
|
// sql.Add(',zl=(select sum(KgQty) from CK_MYSC_CR_MX B where B.MYID=(select mainid from CK_MYSC_CR C where C.scdsubid=A.subid)) ');
|
|||
|
|
sql.Add(',sl=(select sum(B.MQty) from CK_MYSC_CR C INNER JOIN CK_MYSC_CR_MX B on B.MYID=C.MYID where B.Fsubid=A.subid AND ToGYSName=''<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>'') ');
|
|||
|
|
sql.Add(',zl=(select sum(B.KgQty) from CK_MYSC_CR C INNER JOIN CK_MYSC_CR_MX B on B.MYID=C.MYID where B.Fsubid=A.subid AND ToGYSName=''<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>'') ');
|
|||
|
|
sql.Add(' from MLSC_Sub A ');
|
|||
|
|
sql.Add(' where A.MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
|
|||
|
|
// ShowMessage(sql.Text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQuery1, CDS_Sub);
|
|||
|
|
SInitCDSData20(ADOQuery1, CDS_Sub);
|
|||
|
|
finally
|
|||
|
|
ADOQuery1.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.ToolButton2Click(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;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete MLSC where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete MLSC_Sub where MainID=''' + Trim(Order_Main.fieldbyname('MainID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ݳɹ<DDB3><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.ToolButton4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmMLLR := TfrmMLLR.create(self);
|
|||
|
|
with frmMLLR do
|
|||
|
|
begin
|
|||
|
|
PState := 1;
|
|||
|
|
FMainId := Trim(Order_Main.fieldbyname('MainID').AsString);
|
|||
|
|
if showmodal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLSC.Tv2DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmSCDMX := TfrmSCDMX.Create(Application);
|
|||
|
|
with frmSCDMX do
|
|||
|
|
begin
|
|||
|
|
// PState := 0;
|
|||
|
|
Fsubid := Trim(CDS_Sub.fieldbyname('subid').AsString);
|
|||
|
|
// FMYType := FGXName;
|
|||
|
|
// FMYTypeFlag := FGXName;
|
|||
|
|
// labMYType.Caption := Trim(FGXName) + '<27>ӹ<EFBFBD><D3B9>뵥';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSCDMX.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|