1141 lines
34 KiB
ObjectPascal
1141 lines
34 KiB
ObjectPascal
![]() |
unit U_CPDCK;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
|||
|
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxCheckBox,
|
|||
|
BtnEdit, RM_BarCode, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
Menus, Buttons, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter,
|
|||
|
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
|||
|
dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
|||
|
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
|
|||
|
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
|
|||
|
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
|
|||
|
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
|||
|
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
|||
|
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCPDCK = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
Label3: TLabel;
|
|||
|
CustomerNoName: TEdit;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
RM3: TRMGridReport;
|
|||
|
RMDBPRT: TRMDBDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
DSAnPai: TDataSource;
|
|||
|
CDS_AnPai: TClientDataSet;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
ZhuanQty: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
Panel2: TPanel;
|
|||
|
Label2: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
ckordno: TEdit;
|
|||
|
Button2: TButton;
|
|||
|
DataSource3: TDataSource;
|
|||
|
ClientDataSet3: TClientDataSet;
|
|||
|
Label4: TLabel;
|
|||
|
C_Code: TEdit;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxgrdCustomerNoName: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
cxgrdMPRTCodeName: TcxGridDBColumn;
|
|||
|
cxgrdPRTColor: TcxGridDBColumn;
|
|||
|
cxgrdMPRTSpec: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
cxgrdKGQty: TcxGridDBColumn;
|
|||
|
cxgrdNETKGQty: TcxGridDBColumn;
|
|||
|
cxgrdQty: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
Label1: TLabel;
|
|||
|
jyxh: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
carno: TEdit;
|
|||
|
Button5: TButton;
|
|||
|
Button6: TButton;
|
|||
|
Label5: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
CRTime: TDateTimePicker;
|
|||
|
CRType: TComboBox;
|
|||
|
BaoID: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
Button1: TButton;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
PopupMenu2: TPopupMenu;
|
|||
|
MenuItem1: TMenuItem;
|
|||
|
MenuItem2: TMenuItem;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
cxGrid2: 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;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
Label8: TLabel;
|
|||
|
price: TEdit;
|
|||
|
Button3: TButton;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure CustomerNoNameChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
|
|||
|
procedure ckordnoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
|||
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure MPRTCodeNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure Button6Click(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure N4Click(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure MenuItem1Click(Sender: TObject);
|
|||
|
procedure MenuItem2Click(Sender: TObject);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure v1Column12PropertiesEditValueChanged(Sender: TObject);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
FFMainID, BPFlag: string;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure SaveCKDataJTM();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
{ Public declarations }
|
|||
|
fkhname2: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCPDCK: TfrmCPDCK;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmCPDCK.SaveCKDataJTM();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CR Set ');
|
|||
|
sql.add(' CRTime= getdate(),CRType=' + QuotedStr(Trim(CRType.Text)));
|
|||
|
sql.Add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.add(',CKOrdNo=' + Quotedstr(ckordno.Text));
|
|||
|
sql.Add(' where CK_BanCP_CR.MJID=' + Quotedstr(Trim(ClientDataSet3.fieldbyname('mjid').AsString)));
|
|||
|
sql.Add('and CK_BanCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'' ');
|
|||
|
sql.Add(' where CK_BanCP_KC.MJID=' + Quotedstr(Trim(ClientDataSet3.fieldbyname('mjid').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' ');
|
|||
|
sql.Add(' where WFB_MJJY.MJID=' + Quotedstr(Trim(ClientDataSet3.fieldbyname('mjid').AsString)));
|
|||
|
SQL.Add(' and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
WriteCxGrid('DCG13', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV2', Tv2, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV2');
|
|||
|
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV1', Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV1');
|
|||
|
|
|||
|
Close;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' where ' + trim(Pwhere);
|
|||
|
FFMainID := '';
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT jyxh,CustomerNoName,orderNo,APID ');
|
|||
|
sql.Add(',MPRTCodeName,PRTColor,CPType,sum(KGQty)KGQty,sum(NETKGQty)NETKGQty,sum(Qty)Qty,count(*)js');
|
|||
|
sql.Add(' FROM V_VIEW_CPKC a ');
|
|||
|
sql.Add('where isnull(yckordno,'''')=''''');
|
|||
|
// sql.Add(' WHERE EXISTS(SELECT * FROM CK_BanCP_CR B WHERE B.CRFLAG=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and b.mjid=a.mjid and isnull(b.ckordno,'''')='''')');
|
|||
|
SQL.Add('GROUP BY jyxh,CustomerNoName,orderNo,APID,MPRTCodeName,PRTColor,CPType ');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQueryMain, ClientDataSet3);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryTemp.DisableControls;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT jyxh,CustomerNoName,orderNo,APID,YCKOrdNo ');
|
|||
|
sql.Add(',MPRTCodeName,PRTColor,CPType,sum(KGQty)KGQty,sum(NETKGQty)NETKGQty,sum(Qty)Qty,count(*)js');
|
|||
|
sql.Add(' FROM V_VIEW_CPKC a ');
|
|||
|
sql.Add('where isnull(yckordno,'''')<>''''');
|
|||
|
// sql.Add(' FROM V_VIEW_CPKC a WHERE EXISTS(SELECT * FROM CK_BanCP_CR B WHERE B.CRFLAG=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
// sql.Add('and b.mjid=a.mjid and isnull(b.ckordno,'''')<>'''')');
|
|||
|
SQL.Add('GROUP BY jyxh,CustomerNoName,orderNo,APID,MPRTCodeName,PRTColor,CPType,YCKOrdNo ');
|
|||
|
SQL.Add('ORDER BY YCKOrdNo,jyxh');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_AnPai);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_AnPai);
|
|||
|
finally
|
|||
|
ADOQueryTemp.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.InitForm();
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
|
|||
|
BPFlag := Trim(DParameters1);
|
|||
|
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV2', Tv2, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV2');
|
|||
|
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV1', Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TV1');
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.CustomerNoNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQueryMain, ClientDataSet3);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
ZXFlag: Boolean;
|
|||
|
CRID: Integer;
|
|||
|
MaxCkNo, MaxCkSubNo, sqlstr: string;
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
CKOrdNo.SetFocus;
|
|||
|
|
|||
|
if CDS_AnPai.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CRType.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_AnPai.DisableControls;
|
|||
|
|
|||
|
with CDS_AnPai do
|
|||
|
begin
|
|||
|
while CDS_AnPai.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CR Set ');
|
|||
|
sql.add(' CRTime=getdate(),CRType=' + QuotedStr(Trim(CRType.Text)));
|
|||
|
sql.Add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
// sql.Add('where APID=' + QuotedStr(CDS_AnPai.fieldbyname('APID').AsString));
|
|||
|
// sql.Add('AND JYXH=' + QuotedStr(CDS_AnPai.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('where CKORDNO=' + QuotedStr(CDS_AnPai.fieldbyname('YCKOrdNo').AsString));
|
|||
|
sql.Add('and CK_BanCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'' ');
|
|||
|
sql.Add(' where CK_BanCP_KC.MJID IN ');
|
|||
|
SQL.Add('(SELECT MJID FROM CK_BanCP_CR B WHERE B.MJID=CK_BanCP_KC.MJID ');
|
|||
|
// sql.Add('and APID=' + QuotedStr(CDS_AnPai.fieldbyname('APID').AsString));
|
|||
|
// sql.Add('AND JYXH=' + QuotedStr(CDS_AnPai.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('AND CKORDNO=' + QuotedStr(CDS_AnPai.fieldbyname('YCKOrdNo').AsString));
|
|||
|
// SQL.Add('and CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
SQL.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' WHERE ');
|
|||
|
|
|||
|
// sql.Add(' APID=' + QuotedStr(CDS_AnPai.fieldbyname('APID').AsString));
|
|||
|
// sql.Add('AND JYXH=' + QuotedStr(CDS_AnPai.fieldbyname('JYXH').AsString));
|
|||
|
SQL.Add(' EXISTS(SELECT * FROM CK_BanCP_CR C WHERE C.MJID=WFB_MJJY.MJID AND CKORDNO=' + QuotedStr(CDS_AnPai.fieldbyname('YCKOrdNo').AsString));
|
|||
|
SQL.Add(' )and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_AnPai.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_AnPai.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
Exit;
|
|||
|
except
|
|||
|
|
|||
|
CDS_AnPai.EnableControls;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.Button3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
fckorderno: string;
|
|||
|
// kj,kjw:DOUBLE;
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_AnPai.IsEmpty = True then
|
|||
|
Exit;
|
|||
|
|
|||
|
ExportFtErpFile(ComboBox1.Text + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
with CDS_AnPai do
|
|||
|
begin
|
|||
|
|
|||
|
if (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><D7BA><CDB9><EFBFBD>') then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_Print_CKMDWSQ2F_5 ');
|
|||
|
SQL.Add(' @CKOrdNO=''' + Trim(Trim(CDS_AnPai.fieldbyname('yCKOrdNO').AsString)) + '''');
|
|||
|
SQL.Add(' ,@kj=' + FloatToStr(StrToFloatDef('0', 0)));
|
|||
|
SQL.Add(' ,@kjw=' + FloatToStr(StrToFloatDef('0', 0)));
|
|||
|
// ShowMessage(SQL.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>') or (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>') then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_Print_CKMDWSQ2F_10 ');
|
|||
|
SQL.Add(' @CKOrdNO=''' + Trim(Trim(CDS_AnPai.fieldbyname('yCKOrdNO').AsString)) + '''');
|
|||
|
SQL.Add(' ,@kj=' + FloatToStr(StrToFloatDef('0', 0)));
|
|||
|
SQL.Add(' ,@kjw=' + FloatToStr(StrToFloatDef('0', 0)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>(16<31><36>)') or (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>(16<31><36>)') then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_Print_CKMD16 ');
|
|||
|
SQL.Add(' @CKOrdNO=''' + Trim(Trim(CDS_AnPai.fieldbyname('yCKOrdNO').AsString)) + '''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if (ComboBox1.Text = '<27>ֿ<EFBFBD><D6BF>뵥<EFBFBD><D7BA><CDB9><EFBFBD>(16<31><36>)') then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_Print_CKMD16_5 ');
|
|||
|
SQL.Add(' @CKOrdNO=''' + Trim(Trim(CDS_AnPai.fieldbyname('yCKOrdNO').AsString)) + '''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if (ComboBox1.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥') or (ComboBox1.Text = '<27><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥') or (ComboBox1.Text = '<27><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥') then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' exec P_PRINT_CKMD_H ');
|
|||
|
SQL.Add(' @Filtration=''' + Trim(Trim(CDS_AnPai.fieldbyname('yCKOrdNO').AsString)) + '''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('CKOrdNO').AsString);
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
RM3.PreviewButtons := [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS, pbExport, pbNavigator];
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + ComboBox1.Text + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RMVariables['DMR'] := Trim(DName);
|
|||
|
|
|||
|
// RMVariables['RKOrdID'] := Trim(CDS_Main.fieldbyname('CKOrdNO').AsString);
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
|
|||
|
RM3.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.ckordnoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
Button2.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQueryMain, ClientDataSet3);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.MPRTCodeNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, ClientDataSet3);
|
|||
|
SInitCDSData20(ADOQueryMain, ClientDataSet3);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.BaoIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
// if Key = #13 then
|
|||
|
// begin
|
|||
|
// if baoid.Text = '' then
|
|||
|
// begin
|
|||
|
// exit;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// if ClientDataSet3.IsEmpty then
|
|||
|
// begin
|
|||
|
// BaoID.Text := '';
|
|||
|
// //Application.MessageBox('û<>в<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>','<27><>ʾ',0);
|
|||
|
// if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
// PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
//
|
|||
|
// if Trim(CKOrdNo.Text) = '' then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// if CDS_MainSel.Locate('MJId', Trim(BaoID.Text), []) then
|
|||
|
// begin
|
|||
|
// MovePanel1.Visible := True;
|
|||
|
// Edit2.Text := Trim(BaoID.Text);
|
|||
|
// Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3>˾<EFBFBD><CBBE>ظ<EFBFBD>ɨ<EFBFBD>裡';
|
|||
|
// BaoID.Text := '';
|
|||
|
// if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav')) then
|
|||
|
// PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav'), 0, SND_ASYNC);
|
|||
|
// // Application.MessageBox('<27>˾<EFBFBD><CBBE>ظ<EFBFBD>ɨ<EFBFBD>裡','<27><>ʾ',0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// if CDS_Main.Locate('MJId', Trim(BaoID.Text), []) = False then
|
|||
|
// begin
|
|||
|
// MovePanel1.Visible := True;
|
|||
|
// Edit2.Text := Trim(BaoID.Text);
|
|||
|
// Label12.Caption := '<27><><EFBFBD>ѣ<EFBFBD><D1A3>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>';
|
|||
|
// BaoID.Text := '';
|
|||
|
// if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
// PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// CDS_Main.Locate('MJId', Trim(BaoID.Text), []);
|
|||
|
// try
|
|||
|
// ADOQueryCmd.Connection.BeginTrans;
|
|||
|
// with CDS_Main do
|
|||
|
// begin
|
|||
|
// if GetLSNo(ADOQueryCmd, maxno, 'CC', 'CK_BanCp_CR', 4, 1) = False then
|
|||
|
// begin
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('select * from CK_BanCp_CR where 1<>1');
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Append;
|
|||
|
// FieldByName('BCID').Value := Trim(maxno);
|
|||
|
// FieldByName('CRID').Value := CDS_Main.fieldbyname('CRID').Value;
|
|||
|
// FieldByName('CRTime').Value := FormatDateTime('yyyy-MM-dd', CRTime.Date);
|
|||
|
// FieldByName('KGQty').Value := CDS_Main.fieldbyname('KGQty').Value;
|
|||
|
// FieldByName('Qty').Value := CDS_Main.fieldbyname('Qty').Value;
|
|||
|
// FieldByName('QtyUnit').Value := CDS_Main.fieldbyname('QtyUnit').Value;
|
|||
|
// FieldByName('MJID').Value := CDS_Main.fieldbyname('MJID').Value;
|
|||
|
// FieldByName('MainID').Value := CDS_Main.fieldbyname('MainID').Value;
|
|||
|
// FieldByName('SubID').Value := CDS_Main.fieldbyname('SubID').Value;
|
|||
|
// FieldByName('APID').Value := CDS_Main.fieldbyname('APID').Value;
|
|||
|
// FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
|
|||
|
// FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
|
|||
|
// FieldByName('BaoID').Value := CDS_Main.fieldbyname('BaoID').Value;
|
|||
|
// FieldByName('RKPlace').Value := CDS_Main.fieldbyname('RKPlace').AsString;
|
|||
|
// FieldByName('Filler').Value := Trim(DName);
|
|||
|
// FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
// FieldByName('CRType').Value := trim(CRType.Text);
|
|||
|
// FieldByName('CKOrdNo').Value := Trim(CKOrdNo.Text);
|
|||
|
// FieldByName('CRNote').Value := Trim(CRNote.Text);
|
|||
|
// Post;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('Update CK_BanCp_KC set KCKgQty=0,KCQty=0 where CRID=' + CDS_Main.fieldbyname('CRID').AsString);
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('Update WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// ADOQueryCmd.Connection.CommitTrans;
|
|||
|
// with CDS_MainSel do
|
|||
|
// begin
|
|||
|
// Append;
|
|||
|
// FieldByName('MainId').Value := CDS_Main.fieldbyname('MainId').Value;
|
|||
|
// FieldByName('SubId').Value := Self.CDS_Main.fieldbyname('SubId').Value;
|
|||
|
// FieldByName('OrderNo').Value := Self.CDS_Main.fieldbyname('OrderNo').Value;
|
|||
|
// FieldByName('KGQty').Value := Self.CDS_Main.fieldbyname('KGQty').Value;
|
|||
|
// FieldByName('Qty').Value := Self.CDS_Main.fieldbyname('Qty').Value;
|
|||
|
// FieldByName('QtyUnit').Value := Self.CDS_Main.fieldbyname('QtyUnit').Value;
|
|||
|
// FieldByName('MJId').Value := Self.CDS_Main.fieldbyname('MJId').Value;
|
|||
|
// FieldByName('CRId').Value := Self.CDS_Main.fieldbyname('CRId').Value;
|
|||
|
// FieldByName('APID').Value := Self.CDS_Main.fieldbyname('APID').Value;
|
|||
|
// FieldByName('CPType').Value := CDS_Main.fieldbyname('CPType').Value;
|
|||
|
// FieldByName('BCID').Value := Trim(maxno);
|
|||
|
// FieldByName('PRTColor').Value := Self.CDS_Main.fieldbyname('PRTColor').Value;
|
|||
|
// FieldByName('MJXH').Value := Self.CDS_Main.fieldbyname('MJXH').Value;
|
|||
|
// FieldByName('AOrdDefstr1').Value := CDS_Main.fieldbyname('AOrdDefstr1').Value;
|
|||
|
// FieldByName('KHName').Value := CDS_Main.fieldbyname('KHName').Value;
|
|||
|
// FieldByName('RKOrdId').Value := CDS_Main.fieldbyname('RKOrdId').Value;
|
|||
|
// FieldByName('BaoNo').Value := CDS_Main.fieldbyname('BaoNo').Value;
|
|||
|
// //FieldByName('JZXNo').Value:=Trim(JZXNo.Text);
|
|||
|
// Post;
|
|||
|
// end;
|
|||
|
// CDS_Main.Delete;
|
|||
|
//
|
|||
|
// BaoID.Text := '';
|
|||
|
// if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
|
|||
|
// PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
|
|||
|
// Exit;
|
|||
|
// except
|
|||
|
// BaoID.Text := '';
|
|||
|
// ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
// if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
// PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.Button2Click(Sender: TObject);
|
|||
|
var
|
|||
|
maxNo: string;
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, maxNo, 'CK', 'CK_BanCP_CR', 3, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>ⵥ<EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
CKOrdNo.Text := Trim(maxNo);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.Button5Click(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
ZXFlag: Boolean;
|
|||
|
CRID: Integer;
|
|||
|
MaxCkNo, MaxCkSubNo, sqlstr, fkhname: string;
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
CKOrdNo.SetFocus;
|
|||
|
|
|||
|
if ClientDataSet3.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
fkhname := '';
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM CK_BanCP_CR a inner join jyorder_main b on a.mainid=b.mainid WHERE CKORDNO=' + QuotedStr(ckordno.Text));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = false then
|
|||
|
begin
|
|||
|
if Application.MessageBox('<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ţ<EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
begin
|
|||
|
button2.Click();
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
fkhname := ADOQueryTemp.FIELDBYNAME('CustomerNoName').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while ClientDataSet3.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
if fkhname <> '' then
|
|||
|
begin
|
|||
|
if ClientDataSet3.FieldByName('CustomerNoName').AsString <> fkhname then
|
|||
|
begin
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27>õ<EFBFBD><C3B5>ſͻ<C5BF><CDBB><EFBFBD>һ<EFBFBD>£<EFBFBD><C2A3><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>⣡', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_BanCp_cr set ckordno=' + QuotedStr(Trim(ckordno.Text)));
|
|||
|
if price.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(', PRICE=' + (price.Text));
|
|||
|
end;
|
|||
|
sql.Add('where APID=' + QuotedStr(ClientDataSet3.fieldbyname('APID').AsString));
|
|||
|
sql.Add('AND isnull(JYXH,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('AND isnull(jycolor,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('PRTColor').AsString));
|
|||
|
|
|||
|
sql.Add('and crflag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
sql.Add('and isnull(ckordno,'''')=''''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
ClientDataSet3.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
price.Text := '';
|
|||
|
InitGrid();
|
|||
|
Exit;
|
|||
|
except
|
|||
|
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.Button6Click(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
ZXFlag: Boolean;
|
|||
|
CRID: Integer;
|
|||
|
MaxCkNo, MaxCkSubNo, sqlstr: string;
|
|||
|
i: integer;
|
|||
|
fkhname: string;
|
|||
|
begin
|
|||
|
CKOrdNo.SetFocus;
|
|||
|
|
|||
|
if ClientDataSet3.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CKOrdNo.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(CRType.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
fkhname := '';
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM CK_BanCP_CR a inner join jyorder_main b on a.mainid=b.mainid WHERE CKORDNO=' + QuotedStr(ckordno.Text));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = false then
|
|||
|
begin
|
|||
|
if Application.MessageBox('<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ţ<EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
|
|||
|
begin
|
|||
|
button2.Click();
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
fkhname := ADOQueryTemp.FIELDBYNAME('CustomerNoName').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
ClientDataSet3.DisableControls;
|
|||
|
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
while ClientDataSet3.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
if fkhname <> '' then
|
|||
|
begin
|
|||
|
if ClientDataSet3.FieldByName('CustomerNoName').AsString <> fkhname then
|
|||
|
begin
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27>õ<EFBFBD><C3B5>ſͻ<C5BF><CDBB><EFBFBD>һ<EFBFBD>£<EFBFBD><C2A3><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>⣡', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CR Set ');
|
|||
|
sql.add(' CRTime=getdate(),CRType=' + QuotedStr(Trim(CRType.Text)));
|
|||
|
sql.Add(',CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
if price.Text <> '' then
|
|||
|
begin
|
|||
|
SQL.Add(', PRICE=' + (price.Text));
|
|||
|
end;
|
|||
|
sql.add(',CKOrdNo=' + Quotedstr(ckordno.Text));
|
|||
|
sql.Add('where APID=' + QuotedStr(ClientDataSet3.fieldbyname('APID').AsString));
|
|||
|
sql.Add('AND isnull(JYXH,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('AND isnull(jycolor,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('PRTColor').AsString));
|
|||
|
|
|||
|
sql.Add('and CK_BanCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add('and isnull(ckordno,'''')=''''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_KC Set ');
|
|||
|
sql.add(' KCValid=''N'' ');
|
|||
|
sql.Add(' where CK_BanCP_KC.MJID IN ');
|
|||
|
SQL.Add('(SELECT MJID FROM CK_BanCP_CR B WHERE B.MJID=CK_BanCP_KC.MJID ');
|
|||
|
sql.Add('and APID=' + QuotedStr(ClientDataSet3.fieldbyname('APID').AsString));
|
|||
|
sql.Add('AND isnull(JYXH,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('AND isnull(jycolor,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('PRTColor').AsString));
|
|||
|
|
|||
|
// SQL.Add('and CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
SQL.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE WFB_MJJY Set MJStr2=''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' WHERE ');
|
|||
|
|
|||
|
sql.Add(' APID=' + QuotedStr(ClientDataSet3.fieldbyname('APID').AsString));
|
|||
|
sql.Add('AND isnull(JYXH,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('AND isnull(jycolor,'''')=' + QuotedStr(ClientDataSet3.fieldbyname('PRTColor').AsString));
|
|||
|
|
|||
|
SQL.Add(' and WFB_MJJY.MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add('and mjid in (select mjid from CK_BanCP_CR b where b.ckordno= ' + Quotedstr(ckordno.Text));
|
|||
|
SQL.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ClientDataSet3.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('ֱ<>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
InitGrid();
|
|||
|
price.Text := '';
|
|||
|
Exit;
|
|||
|
except
|
|||
|
|
|||
|
ClientDataSet3.EnableControls;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_AnPai, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_AnPai, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.N3Click(Sender: TObject);
|
|||
|
var
|
|||
|
Fconno: string;
|
|||
|
Fmainid: string;
|
|||
|
begin
|
|||
|
|
|||
|
Fconno := Trim(CDS_AnPai.FieldByName('YCKOrdNo').AsString);
|
|||
|
with CDS_AnPai do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while Locate('SSel;YCKOrdNo', VarArrayOf([False, Fconno]), []) do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Ssel').Value := True;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.N4Click(Sender: TObject);
|
|||
|
var
|
|||
|
Fconno: string;
|
|||
|
Fmainid: string;
|
|||
|
begin
|
|||
|
|
|||
|
Fconno := Trim(CDS_AnPai.FieldByName('YCKOrdNo').AsString);
|
|||
|
with CDS_AnPai do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
while Locate('SSel;YCKOrdNo', VarArrayOf([true, Fconno]), []) do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Ssel').Value := False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.SpeedButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
ZXFlag: Boolean;
|
|||
|
CRID: Integer;
|
|||
|
MaxCkNo, MaxCkSubNo, sqlstr: string;
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
CKOrdNo.SetFocus;
|
|||
|
|
|||
|
if CDS_AnPai.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CRType.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_AnPai.DisableControls;
|
|||
|
|
|||
|
with CDS_AnPai do
|
|||
|
begin
|
|||
|
while CDS_AnPai.Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_BanCp_cr set ckordno=NULL,PRICE=0');
|
|||
|
sql.Add('where CKORDNO=' + QuotedStr(CDS_AnPai.fieldbyname('YCKOrdNo').AsString));
|
|||
|
sql.Add('AND APID=' + QuotedStr(CDS_AnPai.fieldbyname('APID').AsString));
|
|||
|
sql.Add('AND JYXH=' + QuotedStr(CDS_AnPai.fieldbyname('JYXH').AsString));
|
|||
|
sql.Add('and crflag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_AnPai.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_AnPai.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
InitGrid();
|
|||
|
Exit;
|
|||
|
except
|
|||
|
|
|||
|
CDS_AnPai.EnableControls;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.MenuItem1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(ClientDataSet3, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.MenuItem2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(ClientDataSet3, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCPDCK := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPDCK.v1Column12PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvale: Boolean;
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
mvale := TcxCheckBox(Sender).EditingValue;
|
|||
|
if mvale = True then
|
|||
|
begin
|
|||
|
|
|||
|
if Trim(fkhname2) = '' then
|
|||
|
begin
|
|||
|
fkhname2 := Trim(ClientDataSet3.fieldbyname('CustomerNoName').AsString)
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(fkhname2) <> Trim(ClientDataSet3.fieldbyname('CustomerNoName').AsString) then
|
|||
|
begin
|
|||
|
with ClientDataSet3 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
end;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD>Ŀͻ<C4BF>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ClientDataSet3.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
|
|||
|
fkhname2 := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|