900 lines
25 KiB
ObjectPascal
900 lines
25 KiB
ObjectPascal
unit U_CKProductBCPKCList_other;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils,strUtils, 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, cxPC, BtnEdit, cxTextEdit, cxButtonEdit, cxDropDownEdit, MovePanel,
|
||
cxContainer, cxCurrencyEdit;
|
||
|
||
type
|
||
TfrmCKProductBCPKCList_other = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label3: TLabel;
|
||
C_CodeName: TEdit;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
conNo: TEdit;
|
||
Label6: TLabel;
|
||
MJID: TEdit;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
Label8: TLabel;
|
||
KZ: TEdit;
|
||
Label9: TLabel;
|
||
MF: TEdit;
|
||
Label7: TLabel;
|
||
CPType: TComboBox;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
Label11: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
RichEdit1: TRichEdit;
|
||
MovePanel2: TMovePanel;
|
||
v1gangNO: TcxGridDBColumn;
|
||
v1C_Color: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
C_Color: TEdit;
|
||
Label4: TLabel;
|
||
AOrdDefStr1: TEdit;
|
||
TBKWChg: TToolButton;
|
||
kcKw: TBtnEditA;
|
||
v1Column11: TcxGridDBColumn;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
ToolButton1: TToolButton;
|
||
v1KCROllNum: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
Edit1: TEdit;
|
||
Label12: TLabel;
|
||
Edit2: TEdit;
|
||
AdoPrint: TADOQuery;
|
||
RMDB_MD: TRMDBDataSet;
|
||
RMGridReport1: TRMGridReport;
|
||
RMXLSExport2: TRMXLSExport;
|
||
ToolButton4: TToolButton;
|
||
ADOQueryPrint: TADOQuery;
|
||
RMDB_Main: TRMDBDataSet;
|
||
CheckBox1: TCheckBox;
|
||
Label13: TLabel;
|
||
CKOrdNo: TEdit;
|
||
v1CKOrdNo: TcxGridDBColumn;
|
||
TBKW: TToolButton;
|
||
v1factoryName: TcxGridDBColumn;
|
||
factoryName: TEdit;
|
||
Label14: TLabel;
|
||
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 C_CodeNameChange(Sender: TObject);
|
||
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
|
||
Y: Integer);
|
||
procedure Image2Click(Sender: TObject);
|
||
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBKWChgClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure kcKwExit(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure TBKWClick(Sender: TObject);
|
||
private
|
||
TblCprk :string;
|
||
FLeft,FTop:Integer;
|
||
procedure InitGrid();
|
||
{ Private declarations }
|
||
public
|
||
procedure CreateTable();
|
||
procedure DropTable();
|
||
{ Public declarations }
|
||
end;
|
||
TMakebar = procedure(ucData:pchar;nDataLen:integer;nErrLevel:integer;nMask:integer;nBarEdition:integer;szBmpFileName:pchar;nScale:integer);stdcall;
|
||
TMixtext = procedure( szSrcBmpFileName:PChar;szDstBmpFileName:PChar;sztext:PChar;fontsize,txtheight,hmargin,vmargin,txtcntoneline:integer);stdcall;
|
||
var
|
||
frmCKProductBCPKCList_other: TfrmCKProductBCPKCList_other;
|
||
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun, U_ZDYHelp, U_kcchEdit, U_kw, U_kcchEdit_other;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmCKProductBCPKCList_other.DropTable();
|
||
var
|
||
strSQL:string;
|
||
begin
|
||
// TblCprk := '[##CP_INOut123' + trim(DCode) + IntToStr(Handle)+formatdatetime('hhnnsszzz',time) + ']';
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||
strSQL := 'IF OBJECT_ID(''tempdb..' + TblCprk + ''') IS NOT NULL DROP TABLE ' + TblCprk;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add(strSQL);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
procedure TfrmCKProductBCPKCList_other.CreateTable();
|
||
var
|
||
strSQL:string;
|
||
begin
|
||
TblCprk := '[##CP_PPack' + trim(DCode) + IntToStr(Handle)+formatdatetime('hhnnsszzz',time) + ']';
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||
strSQL := 'IF OBJECT_ID(''tempdb..' + TblCprk + ''') IS NOT NULL DROP TABLE ' + TblCprk + #13
|
||
+ 'CREATE TABLE ' + TblCprk + ' ('
|
||
+ 'MainID VARCHAR(20),'
|
||
+ 'CRID VARCHAR(20),'
|
||
+ 'BCID Varchar(20))'#13;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add(strSQL);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCKProductBCPKCList_other:=nil;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_View_CPKCMX_Other');
|
||
SQl.Add('@ConNo='+quotedstr(trim(conNo.Text)));
|
||
SQl.Add(',@C_CodeName='+quotedstr(trim(C_CodeName.Text)));
|
||
SQl.Add(',@C_Color='+quotedstr(trim(C_Color.Text)));
|
||
// SQl.Add(',@CKOrdNo='+quotedstr(trim(CKOrdNo.Text)));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
// BegDate.SetFocus;
|
||
MovePanel2.Visible:=True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
|
||
MovePanel2.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
v1Column5.Visible:=False;
|
||
v1Column5.Hidden:=True;
|
||
v1Column11.Visible:=False;
|
||
v1Column11.Hidden:=True;
|
||
TBKWChg.Visible:=False;
|
||
kcKw.Visible:=False;
|
||
ToolButton1.Visible:=fALSE;
|
||
ToolButton2.Visible:=false;
|
||
v2Column6.Options.Editing:=false;
|
||
v1Column5.Options.Editing:=fALSE;
|
||
ToolButton3.Visible:=false;
|
||
ToolButton4.Visible:=false;
|
||
TBKW.Visible:=false;
|
||
end else
|
||
begin
|
||
v1Column5.Visible:=True;
|
||
v1Column5.Hidden:=False;
|
||
v1Column11.Visible:=True;
|
||
v1Column11.Hidden:=False;
|
||
TBKWChg.Visible:=True;
|
||
kcKw.Visible:=True;
|
||
ToolButton1.Visible:=TRUE;
|
||
ToolButton2.Visible:=TRUE;
|
||
v2Column6.Options.Editing:=true;
|
||
v1Column5.Options.Editing:=TRUE;
|
||
ToolButton3.Visible:=true;
|
||
ToolButton4.Visible:=true;
|
||
TBKW.Visible:=true;
|
||
end;
|
||
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBFindClick(Sender: TObject);
|
||
var
|
||
strwhere:string;
|
||
begin
|
||
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
strwhere:= SGetFilters(Panel1,1,2);
|
||
|
||
if (trim(strwhere)='') and (trim(Edit1.Text)<>'') then
|
||
begin
|
||
strwhere:=' KCQty>='+floattostr(strtofloatdef(trim(edit1.Text),0));
|
||
end
|
||
else
|
||
if (trim(strwhere)<>'') and (trim(Edit1.Text)<>'') then
|
||
begin
|
||
strwhere:=strwhere+' and KCQty>='+floattostr(strtofloatdef(trim(edit1.Text),0));
|
||
end;
|
||
|
||
if (trim(strwhere)='') and (trim(Edit2.Text)<>'') then
|
||
begin
|
||
strwhere:=' KCQty<='+floattostr(strtofloatdef(trim(Edit2.Text),0));
|
||
end
|
||
else
|
||
if (trim(strwhere)<>'') and (trim(Edit2.Text)<>'') then
|
||
begin
|
||
strwhere:=strwhere+' and KCQty<='+floattostr(strtofloatdef(trim(Edit2.Text),0));
|
||
end;
|
||
|
||
|
||
{ if (trim(strwhere)='') then
|
||
begin
|
||
|
||
IF trim(CPType.Text)='<27><>Ʒ' then
|
||
strwhere:=' CPType=''<27><>Ʒ'' ';
|
||
IF trim(CPType.Text)='<27><>Ʒ' then
|
||
strwhere:=' CPType<>''<27><>Ʒ'' ';
|
||
end;
|
||
|
||
if (trim(strwhere)<>'') then
|
||
begin
|
||
|
||
IF trim(CPType.Text)='<27><>Ʒ' then
|
||
strwhere:=strwhere+' and CPType=''<27><>Ʒ'' ';
|
||
IF trim(CPType.Text)='<27><>Ʒ' then
|
||
strwhere:=strwhere+' and CPType<>''<27><>Ʒ'' ';
|
||
end; }
|
||
|
||
SDofilter(ADOQueryMain,strwhere);
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.C_CodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.Panel10MouseMove(Sender: TObject;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
ReleaseCapture;
|
||
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.Tv1MouseUp(Sender: TObject;
|
||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft:=X;
|
||
FTop:=Y;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.Tv1CellDblClick(
|
||
Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
{if Trim(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName)<>'CDQK' then Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select CDQK=dbo.F_Get_Order_SubStr(:MJID,''MJCDHZSL'')');
|
||
Parameters.ParamByName('MJID').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
|
||
Open;
|
||
end;
|
||
with CDS_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('CDQK').Value:=Trim(ADOQueryTemp.fieldbyname('CDQK').AsString);
|
||
Post;
|
||
end; }
|
||
Panel4.Left:=FLeft;
|
||
Panel4.Top:=FTop+110;
|
||
Panel4.Visible:=True;
|
||
Panel4.Refresh;
|
||
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
|
||
|
||
RichEdit1.Text:=CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,True);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,False);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBKWChgClick(Sender: TObject);
|
||
begin
|
||
if not CDS_Main.Active then exit;
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
{ if Trim(kcKw.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27>Ų<D7BA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
conNo.SetFocus;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
while CDS_Main.Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_BanCP_CR1 Set BCGANGnO='''+Trim(kcKw.Text)+'''');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
sql.Add('Update CK_BanCP_KC1 Set BCGANGnO='''+Trim(kcKw.Text)+'''');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
ExecSQL;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
FieldByName('AOrdDefStr1').Value:=Trim(kcKw.Text);
|
||
Post;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if not CDS_Main.Active then exit;
|
||
if CDS_Main.IsEmpty then exit;
|
||
frmkcchEdit_other:=TfrmkcchEdit_other.create(self);
|
||
with frmkcchEdit_other do
|
||
begin
|
||
fBCID:=trim(CDS_Main.fieldbyname('BCID').AsString);
|
||
FCRID:=trim(CDS_Main.fieldbyname('CRID').AsString);
|
||
edit1.text:=trim(CDS_Main.fieldbyname('KCROllNum').AsString);
|
||
edit2.text:=trim(CDS_Main.fieldbyname('KCqty').AsString);
|
||
if showmodal=1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.ToolButton2Click(Sender: TObject);
|
||
var
|
||
i,FCRID:integer;
|
||
fconNo,FC_CodeName,FC_Color:string;
|
||
|
||
fRollNum,FQty:double;
|
||
begin
|
||
if not CDS_Main.Active then exit;
|
||
if not CDS_Main.Locate('SSel',True,[]) then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
i:=0;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
if i=0 then
|
||
begin
|
||
fconNo:= trim(Fieldbyname('ConNo').AsString);
|
||
FC_CodeName:= trim(Fieldbyname('C_CodeName').AsString);
|
||
FC_Color:= trim(Fieldbyname('C_Color').AsString);
|
||
end
|
||
else
|
||
begin
|
||
if trim(fconNo)<>trim(Fieldbyname('ConNo').AsString) then
|
||
begin
|
||
EnableControls;
|
||
application.MessageBox('<27><><EFBFBD>Ų<F1B5A5BA>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
exit;
|
||
end;
|
||
if trim(FC_CodeName)<>trim(Fieldbyname('C_CodeName').AsString) then
|
||
begin
|
||
EnableControls;
|
||
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
exit;
|
||
end;
|
||
if trim(FC_Color)<>trim(Fieldbyname('C_Color').AsString) then
|
||
begin
|
||
EnableControls;
|
||
application.MessageBox('<27><>ɫ<EFBFBD><C9AB>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
i:=i+1;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
First;
|
||
end;
|
||
|
||
if i<2 then exit;
|
||
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
try
|
||
|
||
fRollNum:=0;
|
||
FQty:=0;
|
||
i:=0;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
IF i=0 then
|
||
fCRID:=Fieldbyname('CRID').AsInteger;
|
||
|
||
fRollNum:=fRollNum + Fieldbyname('KCROllNum').AsFloat;
|
||
FQty:=FQty + Fieldbyname('kcQty').AsFloat;
|
||
|
||
with adoqueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC1 ');
|
||
sql.Add('where CRID='+quotedstr(trim(CDS_Main.Fieldbyname('CRID').AsString)));
|
||
open;
|
||
edit;
|
||
fieldbyname('ZDYstr1').Value:='<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>';
|
||
fieldbyname('ZDYFlote1').Value:=fieldbyname('kcQty').AsFloat;
|
||
FieldByName('oldCRID').Value:=fCRID;
|
||
fieldbyname('KCROllNum').Value:=0;
|
||
fieldbyname('kcQty').Value:=0;
|
||
post;
|
||
end;
|
||
i:=i+1;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
First;
|
||
end;
|
||
|
||
with adoqueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC1 ');
|
||
sql.Add('where CRID='+quotedstr(inttostr(fCRID)));
|
||
open;
|
||
edit;
|
||
fieldbyname('KCROllNum').Value:=1;
|
||
fieldbyname('kcQty').Value:=FQty;
|
||
post;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
application.MessageBox('<27><><EFBFBD>ݺϲ<DDBA><CFB2>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD>ݺϲ<DDBA>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
|
||
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.ToolButton3Click(Sender: TObject);
|
||
var
|
||
oldQty,kcQty:double;
|
||
str1:string;
|
||
begin
|
||
if not CDS_Main.Active then exit;
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
conNo.SetFocus;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
while CDS_Main.Locate('SSel',True,[]) do
|
||
begin
|
||
kcQty:=CDS_Main.fieldbyname('kcQty').AsFloat;
|
||
str1:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+trim(Cds_Main.Fieldbyname('MJID').AsString)+':';
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from CK_BanCP_KC ');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
open;
|
||
end;
|
||
str1:=str1+ADOQueryCmd.fieldbyname('kcQty').AsString+'->';
|
||
str1:=str1+CDS_Main.fieldbyname('kcQty').AsString;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update CK_BanCP_KC1 Set ZDYFlote1=KCqty ');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
sql.Add(' and ZDYFlote1=0 ');
|
||
sql.Add(' Update CK_BanCP_KC1 Set kcqty='''+floattostr(kcQty)+''',ZDYStr1=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' ,kcNote='+quotedstr(trim(CDS_Main.fieldbyname('kcnote').AsString)));
|
||
sql.Add(' ,CPType='+quotedstr(trim(CDS_Main.fieldbyname('CPType').AsString)) );
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
|
||
sql.Add(' Update CK_BanCP_KC1 Set kcRollNum=0 ');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
sql.Add(' and kcqty=0 and kcRollNum<>0 ');
|
||
|
||
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(','+quotedstr(trim(str1)));
|
||
sql.Add(','+quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
post;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBPrintClick(Sender: TObject);
|
||
var
|
||
filepath:string;
|
||
begin
|
||
if CDS_Main.IsEmpty then exit;
|
||
CreateTable();
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
with adoqueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add(' insert into '+TblCprk+'(BCID,CRID) values( ');
|
||
SQL.Add(' '+quotedstr(trim(CDS_Main.fieldbyname('BCID').AsString)));
|
||
SQL.Add(','+quotedstr(trim(CDS_Main.fieldbyname('CRID').AsString)));
|
||
sql.add(')');
|
||
execsql;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
with AdoPrint do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Get_CpkcList ');
|
||
sql.Add('@mainID='+quotedstr(trim('')));
|
||
sql.Add(',@TblCprk='+quotedstr(trim(TblCprk)));
|
||
sql.Add(',@flag='+quotedstr(trim('1')));
|
||
open;
|
||
end;
|
||
try
|
||
filepath:=ExtractFilePath(Application.ExeName) + 'report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>.rmf';
|
||
if not FileExists(Pchar(filepath)) then
|
||
begin
|
||
application.MessageBox(pchar('<27>ļ<EFBFBD>['+filepath+']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_IConError);
|
||
exit;
|
||
end;
|
||
RMVariables['begdate'] :=FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+' - '+FormatDateTime('yyyy-MM-dd',enddate.DateTime);
|
||
RMVariables['dtxz'] :=FormatDateTime('yyyy-mm-dd',date());
|
||
RMVariables['zdr'] :=trim(DName);
|
||
// RMVariables['Filler'] :=trim(CDS_Main.fieldbyname('Filler').AsString);
|
||
RMGridReport1.LoadFromFile(filepath);
|
||
RMGridReport1.ShowReport;
|
||
finally
|
||
|
||
end;
|
||
DropTable();
|
||
end;
|
||
procedure TfrmCKProductBCPKCList_other.kcKwExit(Sender: TObject);
|
||
var
|
||
mvalue:string;
|
||
begin
|
||
mvalue:=kcKw.Text;
|
||
|
||
IF trim(mvalue)='' then exit;
|
||
|
||
IF rightBstr(trim(mvalue),1)<>'W' THEN
|
||
BEGIn
|
||
mvalue:=trim(mvalue)+'W';
|
||
END;
|
||
|
||
kcKw.Text:=trim(mvalue);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.ToolButton4Click(Sender: TObject);
|
||
var
|
||
fPrintFile:string;
|
||
Txt,fImagePath:string;
|
||
Moudle: THandle;
|
||
Makebar:TMakebar;
|
||
Mixtext:TMixtext;
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
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
|
||
try
|
||
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar:=GetProcAddress(Moudle,'Make');
|
||
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
||
Txt:=Trim(CDS_Main.fieldbyname('MJID').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);
|
||
CDS_Main.EnableControls;
|
||
exit;
|
||
end;
|
||
with ADOQueryPrint do //Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>Ҫ<EFBFBD>ڿͻ<DABF><CDBB>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><C8A1>note<74>ֶΡ<D6B6>
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,kcQty as mjlen,kcQtyUnit as MJTypeother ');
|
||
sql.Add(' from CK_BanCP_KC1 A') ;
|
||
SQL.Add(' where A.MJID='''+Trim(CDS_Main.fieldbyname('MJID').AsString)+'''');
|
||
SQL.Add(' and KCQty>0 ');
|
||
Open;
|
||
end;
|
||
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ͨ<>ñ<EFBFBD>ǩ.rmf' ;
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE']:=fImagePath;
|
||
RMGridReport1.LoadFromFile(fPrintFile);
|
||
// RMGridReport1.ShowReport;
|
||
RMGridReport1.PrintReport;
|
||
end else
|
||
begin
|
||
CDS_Main.EnableControls;
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
IF CDS_Main.IsEmpty then exit;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('ssel').Value:=checkbox1.Checked;
|
||
post;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCList_other.TBKWClick(Sender: TObject);
|
||
var
|
||
isGx:boolean;
|
||
fkw:string;
|
||
begin
|
||
if not CDS_Main.Active then exit;
|
||
if CDS_Main.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
isGx:=false;
|
||
frmkw:=Tfrmkw.create(self);
|
||
with frmkw do
|
||
begin
|
||
fc_CodeName:=CDS_Main.fieldbyname('C_CodeName').AsString;
|
||
if showmodal=1 then
|
||
begin
|
||
fkw:=kw.text;
|
||
isGx:=true;
|
||
end;
|
||
free;
|
||
end;
|
||
|
||
IF isGx=false then exit;
|
||
|
||
// if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
// conNo.SetFocus;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
while CDS_Main.Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_BanCP_CR1 Set kckw='''+Trim(fkw)+'''');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
sql.Add('Update CK_BanCP_KC1 Set kckw='''+Trim(fkw)+'''');
|
||
sql.Add(' where CRID='+Cds_Main.Fieldbyname('CRID').AsString);
|
||
ExecSQL;
|
||
end;
|
||
Edit;
|
||
FieldByName('SSel').Value:=False;
|
||
FieldByName('kckw').Value:=Trim(fkw);
|
||
Post;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
end.
|