697 lines
19 KiB
ObjectPascal
697 lines
19 KiB
ObjectPascal
![]() |
unit U_SXCKOutList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
|||
|
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
|||
|
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
|||
|
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxSkinscxPCPainter, IdBaseComponent, IdComponent,
|
|||
|
IdTCPConnection, IdTCPClient, IdHTTP, 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
|
|||
|
TfrmSXCKOutList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
TBDel: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
SPName: TEdit;
|
|||
|
FactoryName: TEdit;
|
|||
|
SPID: TEdit;
|
|||
|
SPSpec: TEdit;
|
|||
|
CRType: TComboBox;
|
|||
|
Label13: TLabel;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
SPCode: TEdit;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
FZSPID: TEdit;
|
|||
|
Label15: TLabel;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
v1Column29: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
TvMX: TcxGridDBTableView;
|
|||
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
DS_MX: TDataSource;
|
|||
|
CDS_MX: TClientDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
CDS_JuanPRT: TClientDataSet;
|
|||
|
RMDBMX: TRMDBDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMX2: TRMDBDataSet;
|
|||
|
RMGridReport1: TRMGridReport;
|
|||
|
CDS_JuanPRT2: TClientDataSet;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
IdHTTP1: TIdHTTP;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure SPNameChange(Sender: TObject);
|
|||
|
procedure SPIDChange(Sender: TObject);
|
|||
|
procedure SPIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure SPSpecChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure TvMXDblClick(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
private
|
|||
|
canshu2: string;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitMXGrid(MCRNO: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmSXCKOutList: TfrmSXCKOutList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_SXCKOutPut, U_SXCKTHPut, U_FjList_RZ, U_PBCKMXLR, u_fun;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.InitMXGrid(MCRNO: string);
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_SXPB_CRMX where CRNO=' + quotedstr(Trim(MCRNO)));
|
|||
|
sql.Add(' order by MXID');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_MX);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_MX);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSXCKOutList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(',ISSC=cast((case when isnull((select count(WBID) from TP_File X where X.WBID=A.spid and X.TFType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''),0)>0 then 1 else 0 end) as bit)');
|
|||
|
SQL.Add(',IST=CAST(ISNULL(ISTS,''0'') AS BIT)');
|
|||
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
|
|||
|
sql.Add(' where A.CRTime>=' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime))) + ' and A.CRTime<' + quotedstr(Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1))));
|
|||
|
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add(' and isnull(CKName,'''')=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
Open;
|
|||
|
//
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PMD1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(canshu2) = '<27>鿴' then
|
|||
|
begin
|
|||
|
TBAdd.Visible := False;
|
|||
|
TBDel.Visible := False;
|
|||
|
TBEdit.Visible := False;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBAdd.Visible := True;
|
|||
|
TBDel.Visible := True;
|
|||
|
TBEdit.Visible := True;
|
|||
|
end;
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PMD1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_SXPB_CR set DCFLAG=''<27>ѵ<EFBFBD><D1B5><EFBFBD>'' where spid=''' + Trim(CDS_Main.fieldbyname('spid').AsString) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.SPNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.SPIDChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if Length(Trim(SPID.Text)) < 4 then
|
|||
|
begin
|
|||
|
if Trim(SPID.Text) <> '' then
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.SPIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
{if Length(Trim(SPID.Text))<4 then Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
sql.add(' where SPID like :SXID');
|
|||
|
Parameters.ParamByName('SXID').Value:='%'+Trim(SPID.Text)+'%';
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if (trim(CDS_Main.FieldByName('Filler').AsString) <> Trim(DName)) and (Trim(DName) <> 'ADMIN') then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(CDS_Main.fieldbyname('SPID').AsString) <> '' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<>Ƴ<EFBFBD><C6B3><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_SXPB_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_SXPB_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
sql.Add(' and CRQtyFlag=-1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
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 CK_SXPB_CR where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' Update CK_SXPB_CR Set MXKCQty=(select sum(isnull(Qty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
|||
|
sql.Add(',MXKCPiQty=(select sum(isnull(PiQty,0)*CRQtyFlag) from CK_SXPB_CR A where A.FZSPID=CK_SXPB_CR.SPID)');
|
|||
|
sql.Add(' where SPID=''' + Trim(CDS_Main.fieldbyname('FZSPID').AsString) + '''');
|
|||
|
if Trim(CDS_Main.fieldbyname('CRType').AsString) = 'ƽ<>Ƴ<EFBFBD><C6B3><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' delete CK_SXPB_CR where CRType=''ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
end;
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmSXCKOutPut := TfrmSXCKOutPut.Create(Application);
|
|||
|
with frmSXCKOutPut do
|
|||
|
begin
|
|||
|
FBCId := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSXCKOutPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if (trim(CDS_Main.FieldByName('Filler').AsString) <> Trim(DName)) and (Trim(DName) <> 'ADMIN') then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_SXPB_CR where FZSPID=');
|
|||
|
sql.Add('(select SPID from CK_SXPB_CR where PYID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
sql.Add(' and isnull(CRType,'''')=''ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
sql.Add(' and CRQtyFlag=-1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmSXCKOutPut := TfrmSXCKOutPut.Create(Application);
|
|||
|
with frmSXCKOutPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('SPID').AsString);
|
|||
|
TBDel.Visible := False;
|
|||
|
TBAdd.Visible := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmSXCKOutPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.SPSpecChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmFjList_RZ := TfrmFjList_RZ.Create(Application);
|
|||
|
with frmFjList_RZ do
|
|||
|
begin
|
|||
|
fkeyNO := Trim(Self.CDS_Main.fieldbyname('SPID').AsString);
|
|||
|
fType := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFjList_RZ.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
frmPBCKMXLR := TfrmPBCKMXLR.create(self);
|
|||
|
with frmPBCKMXLR do
|
|||
|
begin
|
|||
|
fkeyNo := self.cds_main.fieldbyname('spid').AsString;
|
|||
|
// FMXGangHao := self.cds_main.fieldbyname('GangHao').AsString;
|
|||
|
fType := 0;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
self.InitGrid();
|
|||
|
self.CDS_Main.Locate('spid', fkeyNo, [])
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitMXGrid(Trim(CDS_Main.fieldbyname('SPID').AsString));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.TvMXDblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_MX.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('delete CK_SXPB_CRMX where MXID=' + quotedstr(Trim(CDS_MX.FieldByName('MXID').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><>ϸɾ<CFB8><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD>:' + CDS_Main.FieldByName('spid').AsString + '<27><><EFBFBD><EFBFBD>' + CDS_MX.FieldByName('MXQty').AsString)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_MX.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
EXIT;
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
if (trim(ComboBox1.Text) = '<27><>Ʒ<EFBFBD>뵥2') or (trim(ComboBox1.Text) = '<27><>Ʒ<EFBFBD>뵥1') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_SXPB_Print_CKMD2 ' + quotedstr(Trim(CDS_Main.fieldbyname('SPID').AsString)));
|
|||
|
|
|||
|
sql.add(', ' + quotedstr(Trim(CDS_Main.fieldbyname('SPCode').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_SXPB_Print_CKMD2_2 ' + quotedstr(Trim(CDS_Main.fieldbyname('SPID').AsString)));
|
|||
|
|
|||
|
sql.add(', ' + quotedstr(Trim(CDS_Main.fieldbyname('SPCode').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_JuanPRT2);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_JuanPRT2);
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_SXPB_CR set DYFLAG=''<27>Ѵ<EFBFBD>ӡ'' where SPID=''' + Trim(CDS_Main.fieldbyname('SPID').AsString) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
FBJNO: string;
|
|||
|
fgdy: string;
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_Main.Locate('ssel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
|
|||
|
SQL.Add('EXEC P_push_check @SHDWNAME=' + QuotedStr(CDS_Main.fieldbyname('ToFactoryName').AsString));
|
|||
|
|
|||
|
OPEN;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.FieldByName('CS').Asfloat = 0 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>ÿͻ<C3BF>û<EFBFBD>а<EFBFBD><D0B0><EFBFBD><EFBFBD><CEA2>', '<27><>ʾ', 0);
|
|||
|
CDS_Main.EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
|
|||
|
sql.Add('exec P_Do_WXInsert_HZMD ');
|
|||
|
sql.Add('@CKORDNO=' + quotedstr(trim(CDS_Main.fieldbyname('SPID').AsString)));
|
|||
|
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
GetHTTP(IdHTTP1, 'http://www.rightsoft.top/chenfeng/api/message/send/OrderDelivery');
|
|||
|
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
InitGrid();
|
|||
|
// if CDS_Main.IsEmpty then
|
|||
|
// exit;
|
|||
|
//
|
|||
|
// try
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add(' SELECT wxid FROM BS_Company_Main WHERE NAME= ' + QuotedStr(CDS_Main.FieldByName('ToFactoryName').AsString));
|
|||
|
// sql.Add('and cotype=''<27>ͻ<EFBFBD>'' and valid=''Y''');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if ADOQueryTemp.FieldByName('wxid').AsString = '' then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27>ÿͻ<C3BF>û<EFBFBD>а<EFBFBD><D0B0><EFBFBD><EFBFBD><CEA2>', '<27><>ʾ', 0);
|
|||
|
// exit;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
//
|
|||
|
// sql.Add('exec P_Do_WXInsert_HZMD ');
|
|||
|
// sql.Add('@CKORDNO=' + quotedstr(trim(CDS_Main.fieldbyname('SPID').AsString)));
|
|||
|
//
|
|||
|
// execsql;
|
|||
|
// end;
|
|||
|
// GetHTTP(IdHTTP1, 'http://www.rightsoft.top/chenfeng/api/message/send/OrderDelivery');
|
|||
|
//
|
|||
|
// finally
|
|||
|
//
|
|||
|
// application.MessageBox('<27><><EFBFBD>ͳɹ<CDB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSXCKOutList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if '<27>Ѵ<EFBFBD>ӡ' = AViewInfo.GridRecord.Values[Tv1Column7.Index] then
|
|||
|
ACanvas.Brush.Color := $0080FF80;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|