1436 lines
43 KiB
ObjectPascal
1436 lines
43 KiB
ObjectPascal
![]() |
unit U_CKProductBCPKCList;
|
|||
|
|
|||
|
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,
|
|||
|
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
|
|||
|
TfrmCKProductBCPKCList = 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;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ADOQueryTmp: TADOQuery;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
CheckBox2: TCheckBox;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
TBNoBH: TToolButton;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
Label18: TLabel;
|
|||
|
Label24: TLabel;
|
|||
|
Button3: TButton;
|
|||
|
Button4: TButton;
|
|||
|
Button5: TButton;
|
|||
|
Edit_C_CodeName: TEdit;
|
|||
|
Edit_C_Color: TEdit;
|
|||
|
CheckBox3: TCheckBox;
|
|||
|
CheckBox4: TCheckBox;
|
|||
|
Button9: TButton;
|
|||
|
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 kcKwBtnClick(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 ToolButton5Click(Sender: TObject);
|
|||
|
procedure v1Column5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
procedure TBNoBHClick(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure Button4Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure Button9Click(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: TfrmCKProductBCPKCList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_kcchEdit, U_KCEdit;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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.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.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCKProductBCPKCList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('exec P_View_CPKCMX');
|
|||
|
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)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
// BegDate.SetFocus;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
InitGrid();
|
|||
|
|
|||
|
MovePanel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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
|
|||
|
TBKWChg.Visible := False;
|
|||
|
kcKw.Visible := False;
|
|||
|
ToolButton1.Visible := fALSE;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
v2Column6.Options.Editing := false;
|
|||
|
v1Column5.Options.Editing := TRUE;
|
|||
|
ToolButton3.Visible := false;
|
|||
|
ToolButton5.Visible := false;
|
|||
|
TBNoBH.Visible := false;
|
|||
|
ToolButton6.Visible := false;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBKWChg.Visible := True;
|
|||
|
kcKw.Visible := True;
|
|||
|
ToolButton1.Visible := fALSE;
|
|||
|
ToolButton2.Visible := fALSE;
|
|||
|
v2Column6.Options.Editing := true;
|
|||
|
v1Column5.Options.Editing := TRUE;
|
|||
|
ToolButton3.Visible := true;
|
|||
|
ToolButton5.Visible := true;
|
|||
|
TBNoBH.Visible := true;
|
|||
|
ToolButton6.Visible := true;
|
|||
|
end;
|
|||
|
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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.C_CodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
ReleaseCapture;
|
|||
|
TWinControl(Panel4).Perform(WM_SYSCOMMAND, $F012, 0);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft := X;
|
|||
|
FTop := Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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_CR Set BCGANGnO=''' + Trim(kcKw.Text) + '''');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
sql.Add('Update CK_BanCP_KC 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.kcKwBtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'CPKWFlag';
|
|||
|
flagname := '<27><>λ<EFBFBD><CEBB>Ϣ';
|
|||
|
V1Name.Caption := '<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>';
|
|||
|
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
// MainType:=Trim(DName);
|
|||
|
fnote := FALSE;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
kcKw.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
CRID: integer;
|
|||
|
i, J: integer;
|
|||
|
fAPTM: string;
|
|||
|
Isedit: boolean;
|
|||
|
RollNum1: integer;
|
|||
|
num1: double;
|
|||
|
fBCID, FCRID: string;
|
|||
|
begin
|
|||
|
if not CDS_Main.Active then
|
|||
|
exit;
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
Isedit := false;
|
|||
|
frmkcchEdit := TfrmkcchEdit.create(self);
|
|||
|
with frmkcchEdit 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
|
|||
|
RollNum1 := strtointdef(cxCurrencyEdit1.Text, 0);
|
|||
|
num1 := strtofloatdef(cxCurrencyEdit2.Text, 0);
|
|||
|
// i:=RadioGroup1.ItemIndex;
|
|||
|
Isedit := true;
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
if RollNum1 < 1 then
|
|||
|
exit;
|
|||
|
if Isedit = false then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CK_BanCP_KC ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
// sql.Add(' and KCQty=0.0 ');
|
|||
|
open;
|
|||
|
if ADOQueryTemp.fieldbyname('KCQty').AsFloat = 0.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>¼<EFBFBD><C2BC><EFBFBD>г<EFBFBD><D0B3>⣬<EFBFBD><E2A3AC><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
fBCID := trim(CDS_Main.fieldbyname('BCID').AsString);
|
|||
|
FCRID := trim(CDS_Main.fieldbyname('CRID').AsString);
|
|||
|
for J := 1 to RollNum1 do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, fAPTM, 'C', 'APTM', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_KC A');
|
|||
|
sql.Add('where BCID=' + quotedstr(trim(fBCID)));
|
|||
|
sql.Add('and CRID=' + quotedstr(trim(FCRID)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
|
|||
|
sql.Add('select * from CK_BanCP_CRID');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsInteger;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_KC A');
|
|||
|
sql.Add('where 1=2 ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for i := 0 to ADOQueryCmd.FieldCount - 1 do
|
|||
|
begin
|
|||
|
ADOQueryCmd.fields[i].value := ADOQueryTmp.Fields[i].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('CRID').Value := CRID;
|
|||
|
ADOQueryCmd.FieldByName('KCROllNum').Value := 1;
|
|||
|
ADOQueryCmd.FieldByName('KCQty').Value := num1;
|
|||
|
ADOQueryCmd.FieldByName('oldCRID').Value := FCRID;
|
|||
|
ADOQueryCmd.FieldByName('MJID').Value := trim(fAPTM);
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_KC A');
|
|||
|
sql.Add('where CRID=''' + trim(FCRID) + '''');
|
|||
|
open;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Edit;
|
|||
|
ADOQueryCmd.FieldByName('KCROllNum').Value := 1;
|
|||
|
ADOQueryCmd.FieldByName('KCQty').Value := ADOQueryCmd.FieldByName('KCQty').AsFloat - num1;
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update CK_BanCP_KC SET KCROllNum=0 ');
|
|||
|
sql.Add('where CRID=''' + trim(FCRID) + ''' and KCQty<=0 ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
{ with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCp_KC SET KCRollNum =1 ');
|
|||
|
sql.Add('WHERE (KCQty<>0 or KCKgQty<>0)and KcRollNum=0 ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
}
|
|||
|
|
|||
|
Edit;
|
|||
|
// FieldByName('kcqty').Value:=kcQty;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
TBRafresh.Click;
|
|||
|
CDS_Main.Locate('CRID', FCRID, []);
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
i := 0;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CK_BanCP_KC ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
sql.Add(' and KCQty=0.0 ');
|
|||
|
open;
|
|||
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>¼<EFBFBD><C2BC><EFBFBD>г<EFBFBD><D0B3>⣬<EFBFBD><E2A3AC><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
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;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
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_KC ');
|
|||
|
sql.Add('where CRID=' + quotedstr(trim(CDS_Main.Fieldbyname('CRID').AsString)));
|
|||
|
open;
|
|||
|
edit;
|
|||
|
fieldbyname('KCROllNum').Value := 0;
|
|||
|
fieldbyname('kcQty').Value := 0;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
First;
|
|||
|
end;
|
|||
|
|
|||
|
with adoqueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_KC ');
|
|||
|
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.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
oldQty, kcQty: double;
|
|||
|
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
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CK_BanCP_KC ');
|
|||
|
sql.Add(' where CRID=' + quotedstr(trim(Cds_Main.Fieldbyname('CRID').AsString)));
|
|||
|
open;
|
|||
|
if Fieldbyname('KCQty').AsFloat = 0.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>¼<EFBFBD><C2BC><EFBFBD>г<EFBFBD><D0B3>⣬<EFBFBD><E2A3AC><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
oldQty := ADOQueryTemp.fieldbyname('KCQty').AsFloat;
|
|||
|
kcQty := CDS_Main.fieldbyname('kcQty').AsFloat;
|
|||
|
if oldQty < 100 then
|
|||
|
begin
|
|||
|
if abs(oldQty - kcQty) > 5.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5M', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if strtofloat(format('%.1f', [abs(oldQty - kcQty) / oldQty * 100])) > 3.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%3', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update CK_BanCP_KC Set ZDYFlote1=KCqty ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
sql.Add(' and ZDYFlote1=0 ');
|
|||
|
sql.Add(' Update CK_BanCP_KC Set kcqty=''' + floattostr(kcQty) + ''',ZDYStr1=''<27><><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_KC 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>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('kcqty').Value := kcQty;
|
|||
|
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.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.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.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,A.CPType as MJType,C_CodeNameZW=(select Top 1 defnote3 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and Type=''CP'') ');
|
|||
|
sql.Add(',C_colorName=(select Top 1 DEFstr6 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and X.DEFstr3=A.C_Color and Type=''CP'') ');
|
|||
|
sql.Add(' from CK_BanCP_KC 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>' + trim(fPrintFile)), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.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.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
oldQty, kcQty, num1: Extended;
|
|||
|
i: integer;
|
|||
|
isEdit: boolean;
|
|||
|
str1: string;
|
|||
|
begin
|
|||
|
//showmessage(format('%.1f',[117.50 * 0.98]));
|
|||
|
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;
|
|||
|
isEdit := false;
|
|||
|
|
|||
|
frmKCEdit := TfrmKCEdit.create(self);
|
|||
|
with frmKCEdit do
|
|||
|
begin
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
num1 := strtofloatdef(cxCurrencyEdit2.Text, 0);
|
|||
|
i := RadioGroup1.ItemIndex;
|
|||
|
isEdit := true;
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
if isEdit = false then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CK_BanCP_KC ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
// sql.Add(' and KCQty=0.0 ');
|
|||
|
open;
|
|||
|
if ADOQueryTemp.fieldbyname('KCQty').AsFloat = 0.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>¼<EFBFBD><C2BC><EFBFBD>г<EFBFBD><D0B3>⣬<EFBFBD><E2A3AC><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
oldQty := ADOQueryTemp.fieldbyname('KCQty').AsFloat;
|
|||
|
if i = 0 then
|
|||
|
kcQty := CDS_Main.fieldbyname('kcQty').AsFloat + num1;
|
|||
|
if i = 1 then
|
|||
|
kcQty := CDS_Main.fieldbyname('kcQty').AsFloat - num1;
|
|||
|
if i = 2 then
|
|||
|
begin
|
|||
|
// str1:=format('%.1f',[CDS_Main.fieldbyname('kcQty').AsFloat*1.00 * num1]);
|
|||
|
kcQty := strtofloat(format('%.1f', [CDS_Main.fieldbyname('kcQty').AsFloat * 1.00 * num1]));
|
|||
|
end;
|
|||
|
if i = 3 then
|
|||
|
kcQty := strtofloat(format('%.1f', [CDS_Main.fieldbyname('kcQty').AsFloat * 1.00 / num1]));
|
|||
|
// kcQty:=CDS_Main.fieldbyname('kcQty').AsFloat;
|
|||
|
if oldQty < 100 then
|
|||
|
begin
|
|||
|
if abs(oldQty - kcQty) > 5.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>5M', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if strtofloat(format('%.1f', [abs(oldQty - kcQty) / oldQty * 100])) > 3.0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%3', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update CK_BanCP_KC Set ZDYFlote1=KCqty ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
sql.Add(' and ZDYFlote1=0 ');
|
|||
|
sql.Add(' Update CK_BanCP_KC Set kcqty=''' + floattostr(kcQty) + ''',ZDYStr1=''<27><><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_KC 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>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('kcqty').Value := kcQty;
|
|||
|
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.v1Column5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
Fieldname: string;
|
|||
|
begin
|
|||
|
Fieldname := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname(Fieldname).Value := TcxTextEdit(Sender).EditingText;
|
|||
|
// FieldByName('PrtMoney').Value:=strtofloat(format('%.2f',[Fieldbyname('PRTOrderQty').AsFloat*Fieldbyname('PrtPrice').AsFloat ]));
|
|||
|
post;
|
|||
|
end;
|
|||
|
Tv1.Controller.EditingController.ShowEdit();
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update CK_BanCP_KC Set kcNote=' + quotedstr(trim(CDS_Main.fieldbyname('kcnote').AsString)));
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
except
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CheckBox2.Checked then
|
|||
|
begin
|
|||
|
MJID.Tag := 1;
|
|||
|
C_CodeName.Tag := 1;
|
|||
|
C_Color.Tag := 1;
|
|||
|
AOrdDefStr1.Tag := 1;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
MJID.Tag := 2;
|
|||
|
C_CodeName.Tag := 2;
|
|||
|
C_Color.Tag := 2;
|
|||
|
AOrdDefStr1.Tag := 2;
|
|||
|
end;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.TBNoBHClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.fieldbyName('BHFlag').AsInteger = 1 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' Update CK_BanCP_KC Set BHFlag=0 ');
|
|||
|
sql.Add(' where CRID=' + Cds_Main.Fieldbyname('CRID').AsString);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Edit;
|
|||
|
CDS_Main.FieldByName('BHFlag').Value := 0;
|
|||
|
CDS_Main.Post;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel2.Left := (self.Width - Panel2.Width) div 2;
|
|||
|
Panel2.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Button4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
panel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Button3Click(Sender: TObject);
|
|||
|
var
|
|||
|
FCodeName: string;
|
|||
|
begin
|
|||
|
if trim(Edit_C_CodeName.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FCodeName := trim(CDS_Main.fieldbyname('C_CodeName').AsString);
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
// sql.Add('update CK_BanCP_CR SET C_CodeName=''' + trim(Edit_C_CodeName.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add('update CK_BanCP_KC SET C_CodeName=''' + trim(Edit_C_CodeName.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>:' + trim(FCodeName) + ',<2C><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
FieldByName('C_CodeName').Value := Trim(Edit_C_CodeName.Text);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Panel2.Visible := false;
|
|||
|
Edit_C_CodeName.Text := '';
|
|||
|
Exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Button5Click(Sender: TObject);
|
|||
|
var
|
|||
|
FColor: string;
|
|||
|
begin
|
|||
|
if trim(Edit_C_Color.Text) = '' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FColor := trim(CDS_Main.fieldbyname('C_Color').AsString);
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
// sql.Add('update CK_BanCP_CR SET C_Color=''' + trim(Edit_C_Color.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add('update CK_BanCP_KC SET C_color=''' + trim(Edit_C_Color.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ɫ:' + trim(FColor) + ',<2C><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
FieldByName('C_Color').Value := Trim(Edit_C_Color.Text);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Panel2.Visible := false;
|
|||
|
Edit_C_Color.Text := '';
|
|||
|
Exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCList.Button9Click(Sender: TObject);
|
|||
|
var
|
|||
|
FColor, FCodeName: string;
|
|||
|
begin
|
|||
|
if (trim(Edit_C_CodeName.Text) = '') and checkbox3.Checked then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if (trim(Edit_C_Color.Text) = '') and checkbox4.Checked then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
FCodeName := trim(CDS_Main.fieldbyname('C_CodeName').AsString);
|
|||
|
FColor := trim(CDS_Main.fieldbyname('C_Color').AsString);
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
if checkbox3.Checked then
|
|||
|
begin
|
|||
|
// sql.Add('update CK_BanCP_CR SET C_CodeName=''' + trim(Edit_C_CodeName.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add('update CK_BanCP_KC SET C_CodeName=''' + trim(Edit_C_CodeName.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
end;
|
|||
|
if CheckBox4.Checked then
|
|||
|
begin
|
|||
|
// sql.Add('update CK_BanCP_CR SET C_Color=''' + trim(Edit_C_Color.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add('update CK_BanCP_KC SET C_color=''' + trim(Edit_C_Color.Text) + ''' where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
end;
|
|||
|
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><C6B7>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ɫ:' + trim(FCodeName) + ',' + trim(FColor) + ',<2C><><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('MJID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
if CheckBox2.Checked then
|
|||
|
begin
|
|||
|
FieldByName('C_CodeName').Value := Trim(Edit_C_CodeName.Text);
|
|||
|
end;
|
|||
|
if CheckBox3.Checked then
|
|||
|
begin
|
|||
|
FieldByName('C_Color').Value := Trim(Edit_C_Color.Text);
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Panel2.Visible := false;
|
|||
|
Edit_C_CodeName.Text := '';
|
|||
|
Edit_C_Color.Text := '';
|
|||
|
Exit;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|