1173 lines
36 KiB
ObjectPascal
1173 lines
36 KiB
ObjectPascal
unit U_CKProductCK;
|
||
|
||
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, MovePanel, cxCheckBox, BtnEdit, strutils, cxSplitter,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
||
|
||
type
|
||
TfrmCKProductCK = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
CDS_Main: TClientDataSet;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
cxGrid2: TcxGrid;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2SSEL: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
Label11: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
RichEdit1: TRichEdit;
|
||
MovePanel2: TMovePanel;
|
||
ToolButton1: TToolButton;
|
||
v1KCRollNum: TcxGridDBColumn;
|
||
v1gangNO: TcxGridDBColumn;
|
||
v1C_Color: TcxGridDBColumn;
|
||
CDS_SubSel: TClientDataSet;
|
||
DSSubSel: TDataSource;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
v1KCKW: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
Panel1: TPanel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
Label7: TLabel;
|
||
Label10: TLabel;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
C_CodeName: TEdit;
|
||
C_Color: TEdit;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
conNo: TEdit;
|
||
MJID: TEdit;
|
||
KZ: TEdit;
|
||
MF: TEdit;
|
||
CPType: TComboBox;
|
||
KCQtyStr: TEdit;
|
||
AOrdDefStr1: TEdit;
|
||
KCKW: TEdit;
|
||
GroupBox1: TGroupBox;
|
||
Label14: TLabel;
|
||
Label15: TLabel;
|
||
CRTIME: TDateTimePicker;
|
||
defstr1: TBtnEditA;
|
||
CRType: TComboBox;
|
||
Label16: TLabel;
|
||
Label17: TLabel;
|
||
NOTE: TEdit;
|
||
Label18: TLabel;
|
||
Label19: TLabel;
|
||
CheckBox1: TCheckBox;
|
||
cxSplitter1: TcxSplitter;
|
||
cxGrid1: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Button1: TButton;
|
||
v1KCnote: TcxGridDBColumn;
|
||
Label20: TLabel;
|
||
Edit1: TEdit;
|
||
Edit2: TEdit;
|
||
Label21: TLabel;
|
||
Label22: TLabel;
|
||
P_CodeName: TBtnEditA;
|
||
P_Color: TBtnEditA;
|
||
Label23: TLabel;
|
||
Edit_MJID: TEdit;
|
||
MovePanel1: TMovePanel;
|
||
Labelts: TLabel;
|
||
editts: TEdit;
|
||
Button4: TButton;
|
||
v1Column5: TcxGridDBColumn;
|
||
v2Column2: 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 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 ToolButton1Click(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure defstr1BtnClick(Sender: TObject);
|
||
procedure v2SSELPropertiesChange(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure P_CodeNameBtnClick(Sender: TObject);
|
||
procedure P_ColorBtnClick(Sender: TObject);
|
||
procedure P_CodeNameExit(Sender: TObject);
|
||
procedure P_ColorExit(Sender: TObject);
|
||
procedure CRTIMEKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Edit_MJIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button4Click(Sender: TObject);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
IsCreateSel: boolean;
|
||
procedure InitGrid();
|
||
procedure InitGridNull();
|
||
function savedate(): boolean;
|
||
function SaveJG(fCkNO: string): boolean;
|
||
function SaveJG10(fCkNO: string): boolean;
|
||
function SaveEjK(FNO, FID, fBCID, fCkNO: string): boolean;
|
||
{ Private declarations }
|
||
public
|
||
fkeyNo: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmCKProductCK: TfrmCKProductCK;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun10, U_ZDYHelp, U_ZdyAttachGYS, U_ZdyAttachCP;
|
||
|
||
{$R *.dfm}
|
||
function TfrmCKProductCK.SaveJG10(fCkNO: string): boolean;
|
||
var
|
||
FmainID, fsubID, fconNo: string;
|
||
fRollNum: double;
|
||
fQty: double;
|
||
begin
|
||
result := false;
|
||
fQty := 0;
|
||
fRollNum := 0;
|
||
|
||
{ with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select C_Code,C_CodeName,C_Spec,C_Color,BCGangNO,QtyUnit,sum(RollNum) as RollNum,suM(Qty) as Qty ');
|
||
sql.Add('from CK_BanCP_CR A');
|
||
sql.Add('where ckOrdNo='+quotedstr(trim(fCkNO)));
|
||
sql.Add('Group by C_Code,C_CodeName,C_Spec,C_Color,BCGangNO,QtyUnit');
|
||
open;
|
||
end; }
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select BCGangNO='''',QtyUnit=''M'',sum(RollNum) as RollNum,suM(Qty) as Qty ');
|
||
sql.Add('from CK_BanCP_CR A');
|
||
sql.Add('where ckOrdNo=' + quotedstr(trim(fCkNO)));
|
||
// sql.Add('Group by C_Code,C_CodeName,C_Spec,C_Color,BCGangNO,QtyUnit');
|
||
open;
|
||
end;
|
||
|
||
try
|
||
|
||
if GetLSNo(ADOQueryCmd, FmainID, 'CM', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
if GetLSNo(ADOQueryCmd, fconNo, 'H', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Main where 1<>2 ');
|
||
Open;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
append;
|
||
Fieldbyname('MainID').Value := FmainID;
|
||
Fieldbyname('ConNO').Value := fconNo;
|
||
Fieldbyname('QDTime').Value := formatDateTime('yyyy-MM-dd', CRTIME.Date);
|
||
Fieldbyname('deliverydate').Value := formatDateTime('yyyy-MM-dd', CRTIME.Date);
|
||
Fieldbyname('factoryNO').Value := trim(defstr1.TxtCode);
|
||
Fieldbyname('factoryNoName').Value := trim(defstr1.Text);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := date();
|
||
FieldByName('ConType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>';
|
||
if trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
||
FieldByName('conTk1').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD>';
|
||
if trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
||
FieldByName('conTk1').Value := '<27><><EFBFBD>ӹ<DEBC>';
|
||
FieldByName('conTk2').Value := trim(fCkNO);
|
||
FieldByName('status').Value := '0';
|
||
post;
|
||
end;
|
||
|
||
while not ADOQueryTemp.Eof do
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, fsubID, 'CS', 'Contract_Sub', 3, 1) = False then
|
||
begin
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_sub where 1<>2 ');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
append;
|
||
Fieldbyname('MainID').Value := FmainID;
|
||
Fieldbyname('subID').Value := fsubID;
|
||
Fieldbyname('ConNO').Value := fconNo;
|
||
Fieldbyname('C_Code').Value := '';
|
||
Fieldbyname('C_CodeName').Value := trim(P_CodeName.text);
|
||
Fieldbyname('C_Spec').Value := '';
|
||
Fieldbyname('C_Color').Value := trim(P_color.text);
|
||
Fieldbyname('BCGangNo').Value := trim(ADOQueryTemp.fieldbyname('BCGangNo').AsString);
|
||
Fieldbyname('C_UNit').Value := trim(ADOQueryTemp.fieldbyname('QtyUnit').AsString);
|
||
Fieldbyname('Qty1').Value := ADOQueryTemp.fieldbyname('RollNum').AsFloat;
|
||
Fieldbyname('C_Qty').Value := ADOQueryTemp.fieldbyname('Qty').AsFloat;
|
||
Fieldbyname('C_Status').Value := '0';
|
||
post;
|
||
end;
|
||
ADOQueryTemp.Next;
|
||
end;
|
||
result := true;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
function TfrmCKProductCK.SaveEjK(FNO, FID, fBCID, fCkNO: string): boolean;
|
||
var
|
||
fkcID: integer;
|
||
Filler: string;
|
||
FillTime: TdateTime;
|
||
begin
|
||
result := false;
|
||
try
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.add('Update BP_Kcid Set kcid=kcid+1');
|
||
sql.Add('select kcid from BP_Kcid');
|
||
Open;
|
||
end;
|
||
fkcID := ADOQueryCmd.fieldbyname('kcid').AsInteger;
|
||
|
||
with CDS_SubSel do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from BP_InOut');
|
||
sql.Add('where 1=2 ');
|
||
open;
|
||
end;
|
||
// fkcID:=strtoint(RightBStr(trim(FNO),length(FNO)-3)+trim(FID));
|
||
ADOQueryCmd.Append;
|
||
ADOQueryCmd.FieldByName('CRNO').Value := trim(FNO);
|
||
ADOQueryCmd.FieldByName('CRID').Value := FID;
|
||
ADOQueryCmd.FieldByName('CRTime').Value := formatdateTime('yyyy-MM-dd', CRTIme.Date);
|
||
if trim(CRType.Text) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ADOQueryCmd.FieldByName('CKName').Value := '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>';
|
||
ADOQueryCmd.FieldByName('CRType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
if trim(CRType.Text) = '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ADOQueryCmd.FieldByName('CKName').Value := '<27>㶫<EFBFBD>ֿ<EFBFBD>';
|
||
ADOQueryCmd.FieldByName('CRType').Value := '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
ADOQueryCmd.FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
||
ADOQueryCmd.FieldByName('mainID').Value := trim(fieldbyname('mainID').AsString);
|
||
ADOQueryCmd.FieldByName('subID').Value := trim(fieldbyname('subID').AsString);
|
||
ADOQueryCmd.FieldByName('MJID').Value := trim(fieldbyname('MJID').AsString);
|
||
ADOQueryCmd.FieldByName('MJXH').Value := trim(fieldbyname('MJXH').AsString);
|
||
ADOQueryCmd.FieldByName('CPTYPE').Value := trim(fieldbyname('CPTYPE').AsString);
|
||
ADOQueryCmd.FieldByName('P_Code').Value := trim(fieldbyname('C_Code').AsString);
|
||
ADOQueryCmd.FieldByName('P_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
|
||
ADOQueryCmd.FieldByName('P_spec').Value := trim(fieldbyname('C_spec').AsString);
|
||
ADOQueryCmd.FieldByName('P_Color').Value := trim(fieldbyname('C_Color').AsString);
|
||
// ADOQueryCmd.FieldByName('P_MF').Value:=fieldbyname('P_MF').AsFloat;
|
||
// ADOQueryCmd.FieldByName('P_KZ').Value:=fieldbyname('P_KZ').AsFloat;
|
||
ADOQueryCmd.FieldByName('RollNum').Value := fieldbyname('KCRollNum').AsFloat;
|
||
ADOQueryCmd.FieldByName('Qty').Value := fieldbyname('KCQty').AsFloat;
|
||
ADOQueryCmd.FieldByName('QtyUnit').Value := trim(fieldbyname('kcQtyUnit').AsString);
|
||
ADOQueryCmd.FieldByName('note').Value := '';
|
||
ADOQueryCmd.FieldByName('Filler').Value := trim(Filler);
|
||
ADOQueryCmd.FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
ADOQueryCmd.FieldByName('fromMainID').Value := trim(fCkNO);
|
||
ADOQueryCmd.FieldByName('FromSubID').Value := trim(fBCID);
|
||
ADOQueryCmd.FieldByName('gangNO').Value := trim(fieldbyname('AOrdDefStr1').AsString);
|
||
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
|
||
ADOQueryCmd.Post;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from BP_KC');
|
||
sql.Add('where 1=2 ');
|
||
open;
|
||
end;
|
||
ADOQueryCmd.Append;
|
||
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
|
||
if trim(CRType.Text) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ADOQueryCmd.FieldByName('CKName').Value := '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>';
|
||
ADOQueryCmd.FieldByName('CRType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
if trim(CRType.Text) = '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ADOQueryCmd.FieldByName('CKName').Value := '<27>㶫<EFBFBD>ֿ<EFBFBD>';
|
||
ADOQueryCmd.FieldByName('CRType').Value := '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
ADOQueryCmd.FieldByName('CRNO').Value := trim(FNO);
|
||
ADOQueryCmd.FieldByName('CRID').Value := FID;
|
||
ADOQueryCmd.FieldByName('CRTime').Value := formatdateTime('yyyy-MM-dd', CRTIme.Date);
|
||
ADOQueryCmd.FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
||
ADOQueryCmd.FieldByName('mainID').Value := trim(fieldbyname('mainID').AsString);
|
||
ADOQueryCmd.FieldByName('subID').Value := trim(fieldbyname('subID').AsString);
|
||
ADOQueryCmd.FieldByName('MJXH').Value := trim(fieldbyname('MJXH').AsString);
|
||
ADOQueryCmd.FieldByName('MJID').Value := trim(fieldbyname('MJID').AsString);
|
||
ADOQueryCmd.FieldByName('CPType').Value := trim(fieldbyname('CPType').AsString);
|
||
ADOQueryCmd.FieldByName('P_Code').Value := trim(fieldbyname('C_Code').AsString);
|
||
ADOQueryCmd.FieldByName('P_CodeName').Value := trim(fieldbyname('C_CodeName').AsString);
|
||
ADOQueryCmd.FieldByName('P_spec').Value := trim(fieldbyname('C_spec').AsString);
|
||
ADOQueryCmd.FieldByName('P_Color').Value := trim(fieldbyname('C_Color').AsString);
|
||
// ADOQueryCmd.FieldByName('P_MF').Value:=fieldbyname('P_MF').AsFloat;
|
||
// ADOQueryCmd.FieldByName('P_KZ').Value:=fieldbyname('P_KZ').AsFloat;
|
||
ADOQueryCmd.FieldByName('RollNum').Value := fieldbyname('KCRollNum').AsFloat;
|
||
ADOQueryCmd.FieldByName('Qty').Value := fieldbyname('kCQty').AsFloat;
|
||
ADOQueryCmd.FieldByName('QtyUnit').Value := trim(fieldbyname('KCQtyUnit').AsString);
|
||
ADOQueryCmd.FieldByName('kcID').Value := fkcID;
|
||
ADOQueryCmd.Post;
|
||
end;
|
||
result := true;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
function TfrmCKProductCK.SaveJG(fCkNO: string): boolean;
|
||
var
|
||
maxno, LLIdx, dhID, FDW: string;
|
||
fRollNum: double;
|
||
fQty: double;
|
||
begin
|
||
result := false;
|
||
fQty := 0;
|
||
fRollNum := 0;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select MainID,subID,BCGangNO,C_Color,QtyUnit,sum(RollNum) as RollNum,suM(Qty) as Qty ');
|
||
sql.Add('from CK_BanCP_CR A');
|
||
sql.Add('where ckOrdNo=' + quotedstr(trim(fCkNO)));
|
||
sql.Add('Group by MainID,subID,BCGangNO,C_Color,QtyUnit');
|
||
open;
|
||
end;
|
||
|
||
try
|
||
while not ADOQueryTemp.Eof do
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxno, 'MX', 'Contract_Cloth_LLMx', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡȥ<C8A1><C8A5><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LLMx where 1<>2 ');
|
||
Open;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('MainId').Value := Trim(ADOQueryTemp.fieldbyname('MainId').AsString);
|
||
FieldByName('SubId').Value := Trim(ADOQueryTemp.fieldbyname('SubId').AsString);
|
||
FieldByName('DHId').Value := Trim(ADOQueryTemp.fieldbyname('SubId').AsString);
|
||
FieldByName('MXId').Value := Trim(maxno);
|
||
FieldByName('OrdSubId').Value := Trim(ADOQueryTemp.fieldbyname('SubId').AsString);
|
||
FieldByName('TPDate').Value := CRTIME.Date;
|
||
FieldByName('TPPerson').Value := '';
|
||
if trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
||
FieldByName('TPNote').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>';
|
||
|
||
if trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
||
FieldByName('TPNote').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
|
||
FieldByName('ToNo').Value := trim(defstr1.TxtCode);
|
||
FieldByName('ToName').Value := trim(defstr1.Text);
|
||
FieldByName('gangNO').Value := '';
|
||
FieldByName('BCgangNO').Value := ADOQueryTemp.fieldbyname('BCGangNO').Value;
|
||
FieldByName('C_Color').Value := ADOQueryTemp.fieldbyname('C_Color').Value;
|
||
FieldByName('TPUnit').Value := ADOQueryTemp.fieldbyname('QtyUnit').Value;
|
||
FieldByName('TPPS').Value := ADOQueryTemp.fieldbyname('RollNum').Value;
|
||
FieldByName('TPQty').Value := ADOQueryTemp.fieldbyname('Qty').Value;
|
||
FieldByName('TPMQty').Value := ADOQueryTemp.fieldbyname('Qty').Value;
|
||
FieldByName('Qty1').Value := 0;
|
||
FieldByName('Qty2').Value := 0;
|
||
FieldByName('Qty3').Value := 0;
|
||
FieldByName('JGPrice').Value := 0;
|
||
FieldByName('GangFee').Value := 0;
|
||
if trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
||
FieldByName('JGType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>';
|
||
|
||
if trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
||
FieldByName('JGType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Cloth_LL where 1<>1');
|
||
Open;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('LLID').Value := trim(maxno);
|
||
FieldByName('DHID').Value := Trim(ADOQueryTemp.fieldbyname('subID').AsString);
|
||
FieldByName('FirstNo').Value := trim(defstr1.TxtCode);
|
||
FieldByName('FirstName').Value := trim(defstr1.Text);
|
||
FieldByName('OrdSubId').Value := Trim(ADOQueryTemp.fieldbyname('subID').AsString);
|
||
FieldByName('TPUnit').Value := Trim(ADOQueryTemp.fieldbyname('QtyUnit').AsString);
|
||
FieldByName('LLIdx').Value := 1;
|
||
if trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
||
FieldByName('JGType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ӹ<EFBFBD>';
|
||
if trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>' then
|
||
FieldByName('JGType').Value := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate Contract_Cloth_LL Set TPPS=(select isnull(sum(TPPS),0) from Contract_Cloth_LLMX A where A.MXID=Contract_Cloth_LL.LLID');
|
||
SQL.Add(' and A.OrdSubId=Contract_Cloth_LL.OrdSubId)');
|
||
sql.Add(',TPQty=(select Sum(TPQty) from Contract_Cloth_LLMx A where A.MXID=Contract_Cloth_LL.LLID');
|
||
SQL.Add(' and A.OrdSubId=Contract_Cloth_LL.OrdSubId)');
|
||
sql.Add(',BCPQty=(select Sum(Qty2) from Contract_Cloth_LLMx A where A.MXID=Contract_Cloth_LL.LLID');
|
||
SQL.Add(' and A.OrdSubId=Contract_Cloth_LL.OrdSubId)');
|
||
sql.Add(', TPMQty=(select isnull(sum(TPMQty),0) from Contract_Cloth_LLMX A where A.MXID=Contract_Cloth_LL.LLID');
|
||
SQL.Add(' and A.OrdSubId=Contract_Cloth_LL.OrdSubId)');
|
||
sql.Add(', BCPMQty=(select isnull(sum(MQty2),0) from Contract_Cloth_LLMX A where A.MXID=Contract_Cloth_LL.LLID');
|
||
SQL.Add(' and A.OrdSubId=Contract_Cloth_LL.OrdSubId)');
|
||
sql.Add('where LLID=''' + Trim(maxno) + '''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryTemp.Next;
|
||
end;
|
||
result := true;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
function TfrmCKProductCK.savedate(): boolean;
|
||
var
|
||
maxno: string;
|
||
CRID: Integer;
|
||
MaxCkNo: string;
|
||
i: integer;
|
||
rkNo: string;
|
||
begin
|
||
result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_SubSel.DisableControls;
|
||
try
|
||
if GetLSNo(ADOQueryCmd, fkeyNo, 'CK', 'CK_BanCP_CR', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if (trim(CRType.Text) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>') or (trim(CRType.Text) = '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD>') then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, rkNo, 'RK', 'BP_InOut', 3, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
i := 1;
|
||
with CDS_SubSel do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
// if fieldbyname('ssel').AsBoolean then
|
||
// begin
|
||
// if Trim(CDS_SubSel.fieldbyname('C_CodeName').AsString) <> Trim(P_CodeName.text) then
|
||
// begin
|
||
// application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>⣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
// CDS_SubSel.EnableControls;
|
||
// exit;
|
||
// end;
|
||
if GetLSNo(ADOQueryCmd, MaxCkNo, 'CC', 'CK_BanCP_CR', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR ');
|
||
sql.Add('where 1=2 ');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if IsEmpty then
|
||
Append
|
||
else
|
||
edit;
|
||
FieldByName('MainId').Value := Trim(CDS_SubSel.fieldbyname('MainId').AsString);
|
||
FieldByName('SubId').Value := Trim(CDS_SubSel.fieldbyname('SubId').AsString);
|
||
FieldByName('C_Code').Value := Trim(CDS_SubSel.fieldbyname('C_Code').AsString);
|
||
FieldByName('C_CodeName').Value := Trim(CDS_SubSel.fieldbyname('C_CodeName').AsString);
|
||
FieldByName('C_SPec').Value := Trim(CDS_SubSel.fieldbyname('C_SPec').AsString);
|
||
FieldByName('C_Color').Value := Trim(CDS_SubSel.fieldbyname('C_Color').AsString);
|
||
FieldByName('APID').Value := Trim(CDS_SubSel.fieldbyname('APID').AsString);
|
||
FieldByName('MJID').Value := Trim(CDS_SubSel.fieldbyname('MJId').AsString);
|
||
FieldByName('MJxh').Value := Trim(CDS_SubSel.fieldbyname('MJxh').AsString);
|
||
FieldByName('kcKw').Value := Trim(CDS_SubSel.fieldbyname('kcKw').AsString);
|
||
FieldByName('RCGangNo').Value := Trim(CDS_SubSel.fieldbyname('RCGangNo').AsString);
|
||
FieldByName('BCGangNo').Value := Trim(CDS_SubSel.fieldbyname('BCGangNo').AsString);
|
||
FieldByName('BCID').Value := Trim(MaxCkNo);
|
||
FieldByName('ckordNo').Value := Trim(fkeyNo);
|
||
FieldByName('CRTime').Value := FormatDateTime('yyyy-MM-dd', CRTime.DateTime);
|
||
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('CRType').Value := trim(CRType.Text);
|
||
//FieldByName('JTType').Value:=Trim(XJFlag);
|
||
FieldByName('CRID').Value := Trim(CDS_SubSel.fieldbyname('CRID').AsString);
|
||
FieldByName('KGQty').Value := CDS_SubSel.fieldbyname('KCKGQty').AsFloat;
|
||
FieldByName('Qty').Value := CDS_SubSel.fieldbyname('KCQty').AsFloat;
|
||
FieldByName('RollNum').Value := CDS_SubSel.fieldbyname('KCRollNum').AsFloat;
|
||
FieldByName('QtyUnit').Value := CDS_SubSel.fieldbyname('KCQtyUnit').Value;
|
||
FieldByName('CPType').Value := Trim(CDS_SubSel.fieldbyname('CPType').AsString);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
FieldByName('defstr1').Value := trim(defstr1.Text);
|
||
FieldByName('note').Value := trim(note.Text);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC ');
|
||
sql.Add('where CRID=' + quotedstr(trim(CDS_SubSel.fieldbyname('CRID').AsString)));
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if IsEmpty then
|
||
Append
|
||
else
|
||
edit;
|
||
FieldByName('KCQty').Value := FieldByName('KCQty').AsFloat - CDS_SubSel.fieldbyname('KCQty').AsFloat;
|
||
FieldByName('KCRollNum').Value := FieldByName('KCRollNum').AsFloat - CDS_SubSel.fieldbyname('KCRollNum').AsFloat;
|
||
Post;
|
||
end;
|
||
|
||
if (trim(CRType.Text) = '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>') or (trim(CRType.Text) = '<27>㶫<EFBFBD><E3B6AB><EFBFBD><EFBFBD>') then
|
||
begin
|
||
if not SaveEjK(rkNo, inttostr(i), MaxCkNo, fkeyNo) then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
i := i + 1;
|
||
// end;
|
||
CDS_SubSel.Next;
|
||
end;
|
||
end;
|
||
CDS_SubSel.EnableControls;
|
||
if (trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>') then
|
||
begin
|
||
if not saveJG10(fkeyNo) then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
result := true;
|
||
except
|
||
CDS_SubSel.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCKProductCK := nil;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.FormCreate(Sender: TObject);
|
||
begin
|
||
cxGrid2.Align := alClient;
|
||
|
||
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
EndDate.DateTime := BegDate.DateTime;
|
||
CRTIME.DateTime := BegDate.DateTime;
|
||
IsCreateSel := false;
|
||
// TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.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);
|
||
if not IsCreateSel then
|
||
begin
|
||
SCreateCDS20(ADOQueryMain, CDS_SubSel);
|
||
IsCreateSel := true;
|
||
end;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
TBFind.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.InitGridNull();
|
||
begin
|
||
try
|
||
ADOQueryTemp.DisableControls;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_View_CPKCMXNull');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_SubSel);
|
||
SInitCDSData20(ADOQueryTemp, CDS_SubSel);
|
||
finally
|
||
ADOQueryTemp.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
// BegDate.SetFocus;
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
InitGrid();
|
||
MovePanel2.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
// WriteCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.FormShow(Sender: TObject);
|
||
begin
|
||
|
||
ReadCxGrid(self.Caption, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
//ReadCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
// InitGridNull();
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.TBFindClick(Sender: TObject);
|
||
var
|
||
strsql: string;
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
strsql := SGetFilters(Panel1, 1, 2);
|
||
if trim(C_Color.Text) <> '' then
|
||
begin
|
||
if strsql = '' then
|
||
strsql := ' C_Color=' + quotedstr(trim(C_Color.Text))
|
||
else
|
||
strsql := strsql + ' and C_Color=' + quotedstr(trim(C_Color.Text));
|
||
end;
|
||
|
||
if trim(edit1.Text) <> '' then
|
||
begin
|
||
if strsql = '' then
|
||
strsql := ' KCQty>=' + inttostr(strtointdef(trim(edit1.Text), 0))
|
||
else
|
||
strsql := strsql + ' and KCQty>=' + inttostr(strtointdef(trim(edit1.Text), 0));
|
||
end;
|
||
if trim(edit2.Text) <> '' then
|
||
begin
|
||
if strsql = '' then
|
||
strsql := ' KCQty<=' + inttostr(strtointdef(trim(edit2.Text), 0))
|
||
else
|
||
strsql := strsql + ' and KCQty<=' + inttostr(strtointdef(trim(edit2.Text), 0));
|
||
end;
|
||
SDofilter(ADOQueryMain, strsql);
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.C_CodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
ReleaseCapture;
|
||
TWinControl(Panel4).Perform(WM_SYSCOMMAND, $F012, 0);
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft := X;
|
||
FTop := Y;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if not CDS_SubSel.Active then
|
||
exit;
|
||
if CDS_SubSel.IsEmpty then
|
||
exit;
|
||
CRTIME.SetFocus;
|
||
{ if not CDS_SubSel.Locate('SSel',True,[]) then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if trim(CRType.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if (trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>') then
|
||
begin
|
||
if trim(defstr1.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if (trim(CRType.Text) = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>') or (trim(CRType.Text) = '<27><><EFBFBD><EFBFBD><DEB3><EFBFBD>') then
|
||
begin
|
||
if trim(defstr1.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if trim(P_CodeName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if trim(P_Color.Text) = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ɫ!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
{ with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
if trim(Fieldbyname('MainId').AsString)='' then
|
||
begin
|
||
EnableControls;
|
||
application.MessageBox('<27>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD>ⲻ<EFBFBD>ܼӹ<DCBC><D3B9><EFBFBD><EFBFBD>⣡','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
exit;
|
||
end;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
end; }
|
||
end;
|
||
|
||
if savedate() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
ModalResult := 1;
|
||
end
|
||
else
|
||
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_SubSel.IsEmpty then
|
||
exit;
|
||
if not CDS_Main.Locate('CRID', trim(CDS_SubSel.fieldbyname('CRID').AsString), []) then
|
||
begin
|
||
InitCDSToCDS(CDS_SubSel, CDS_Main);
|
||
end;
|
||
CDS_SubSel.Delete;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.defstr1BtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
defstr1.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
defstr1.TxtCode := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
// LXTel.Text:=Trim(CDS_HZ.fieldbyname('DEFstr2').AsString);
|
||
// LXPerson.Text:=Trim(CDS_HZ.fieldbyname('DEFstr4').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.v2SSELPropertiesChange(Sender: TObject);
|
||
var
|
||
fNum: double;
|
||
begin
|
||
fNum := strtofloatdef(Label19.Caption, 0);
|
||
if CDS_Main.FieldByName('ssel').AsBoolean then
|
||
begin
|
||
fNum := fNum + CDS_Main.fieldbyname('KCQty').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
fNum := fNum - CDS_Main.fieldbyname('KCQty').AsFloat;
|
||
end;
|
||
|
||
Label19.Caption := floattostr(fNum);
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.CheckBox1Click(Sender: TObject);
|
||
var
|
||
fNum: double;
|
||
begin
|
||
fNum := 0;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('Ssel').Value := CheckBox1.Checked;
|
||
if CheckBox1.Checked then
|
||
fNum := fNum + CDS_Main.fieldbyname('KCQty').AsFloat;
|
||
post;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
end;
|
||
Label19.Caption := floattostr(fNum);
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
|
||
if not CDS_SubSel.Locate('CRID', trim(CDS_Main.fieldbyname('CRID').AsString), []) then
|
||
begin
|
||
InitCDSToCDS(CDS_Main, CDS_SubSel);
|
||
end;
|
||
CDS_Main.Delete;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Button1Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
CDS_SubSel.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while CDS_Main.Locate('ssel', true, []) do
|
||
begin
|
||
if not CDS_SubSel.Locate('CRID', trim(CDS_Main.fieldbyname('CRID').AsString), []) then
|
||
begin
|
||
InitCDSToCDS(CDS_Main, CDS_SubSel);
|
||
end;
|
||
CDS_Main.Delete;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
CDS_SubSel.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.P_CodeNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
|
||
with frmZdyAttachCP do
|
||
begin
|
||
fType := '<27><>Ʒ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
P_CodeName.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
P_Color.Text := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachCP.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.P_ColorBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
|
||
with frmZdyAttachCP do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
// P_CodeName.Text:==Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
P_Color.Text := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachCP.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.P_CodeNameExit(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := trim(P_CodeName.Text);
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
P_CodeName.Text := trim(mvalue);
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment A ');
|
||
sql.Add('where zdyName=' + quotedstr(trim(P_CodeName.Text)));
|
||
open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty then
|
||
begin
|
||
P_CodeName.Text := '';
|
||
application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.P_ColorExit(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := trim(P_Color.Text);
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
P_Color.Text := trim(mvalue);
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment A ');
|
||
sql.Add('where zdyName=' + quotedstr(trim(P_CodeName.Text)));
|
||
sql.Add('and DEFstr3=' + quotedstr(trim(P_Color.Text)));
|
||
open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty then
|
||
begin
|
||
P_Color.Text := '';
|
||
application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.CRTIMEKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Edit_MJIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
MovePanel1.Visible := false;
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if trim(Edit_MJID.Text) = '' then
|
||
exit;
|
||
|
||
if Key = #13 then
|
||
begin
|
||
if CDS_SubSel.Locate('MJID', trim(edit_MJID.Text), []) then
|
||
begin
|
||
editts.Text := Edit_MJID.Text;
|
||
Labelts.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD>裡';
|
||
MovePanel1.Visible := true;
|
||
end
|
||
else if CDS_Main.Locate('MJID', trim(edit_MJID.Text), []) then
|
||
begin
|
||
if not CDS_SubSel.Locate('CRID', trim(CDS_Main.fieldbyname('CRID').AsString), []) then
|
||
begin
|
||
InitCDSToCDS(CDS_Main, CDS_SubSel);
|
||
end;
|
||
CDS_Main.Delete;
|
||
end
|
||
else
|
||
begin
|
||
editts.Text := Edit_MJID.Text;
|
||
Labelts.Caption := '<27><><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD>ڣ<EFBFBD>';
|
||
MovePanel1.Visible := true;
|
||
end;
|
||
Edit_MJID.Text := '';
|
||
Edit_MJID.SetFocus;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCK.Button4Click(Sender: TObject);
|
||
begin
|
||
MovePanel1.Visible := false;
|
||
end;
|
||
|
||
end.
|
||
|